tenio icon indicating copy to clipboard operation
tenio copied to clipboard

TenIO is an open-source project for making online games that includes a java NIO (Non-blocking I/O) based server specifically designed for multiplayer games and simple existing game clients for rapid...

TenIO Tweet

TenIO is an open-source project to create multiplayer online games that includes a java NIO (Non-blocking I/O) based server specifically designed for multiplayer games, which supports UDP, TCP, Websocket, HTTP transports, and available simple client projects for quick development.

Features

  • Scalable, distributed design
  • Easy-to-use, OOP design
  • Based on standard Java development, ensuring cross-platform support
  • Simple event handlers implementation
  • Simple physic simulator and debugger
  • Have simple existing game clients for rapid development

Showcases


Gold Miner Online


Retro Brick Game Online

MMOG System Architecture

Game Server

Game System

First Glimpse

  • Simple Movement Simulation
    Simple Movement Simulation

Simple Implementation

@Bootstrap
public final class TestServerLogin {

    public static void main(String[] params) {
        ApplicationLauncher.run(TestServerLogin.class, params);
    }

}

@Component
final class ConnectionEstablishedHandler extends AbstractExtension implements EventConnectionEstablishedResult {

    @Override
    public void handle(Session session, ServerMessage message, ConnectionEstablishedResult result) {
        if (result == ConnectionEstablishedResult.SUCCESS) {
            var data = (ZeroObject) message.getData();

            api().login(data.getString(SharedEventKey.KEY_PLAYER_LOGIN), session);
        }
    }

}

@Component
final class PlayerLoggedinHandler extends AbstractExtension implements EventPlayerLoggedinResult {

    @Override
    public void handle(Player player, PlayerLoggedinResult result) {
        if (result == PlayerLoggedinResult.SUCCESS) {
            var data = object().putString(SharedEventKey.KEY_PLAYER_LOGIN,
                    String.format("Welcome to server: %s", player.getName()));

            response().setContent(data.toBinary()).setRecipient(player).write();
        }
    }

}

@Component
final class ReceivedMessageFromPlayerHandler extends AbstractExtension
        implements EventReceivedMessageFromPlayer {

    @Override
    public void handle(Player player, ServerMessage message) {
        var data = object().putString(SharedEventKey.KEY_CLIENT_SERVER_ECHO, String.format("Echo(%s): %s",
                player.getName(), ((ZeroObject) message.getData()).getString(SharedEventKey.KEY_CLIENT_SERVER_ECHO)));

        response().setContent(data.toBinary()).setRecipient(player).write();
    }

}

Wiki

The wiki provides implementation level details and answers to general questions that a developer starting to use TenIO might have about it.

Clients


TenIO Cocos2dx


TenIO Libgdx


TenIO Unity


TenIO Phaserjs

Framework

The project is strongly based on the same name framework as you can be referenced by the following repositories.

Requirements

- Java 11
- Java 8
- Docker

License

The TenIO project is currently available under the MIT License.

Contributing

Please check out the contributing guideline for more details.

Documentations

Please check out the documentations directory for more details.

Installation

$ git clone https://github.com/congcoi123/tenio.git

Examples

Collection

Please check out this repository for references.

Wanna try Kotlin?

Then you should check out this showcase for more details.

Happy coding !