Skip to content

Basic game server for testing

Vrekt edited this page Apr 8, 2024 · 1 revision

Here is basic example of a testing server to get up and running quick.

        final GdxProtocol protocol = new GdxProtocol(1, "GameProtocol", true);
        final GameServer gameServer = new GameServer(protocol, "1.0");

        final NettyServer server = new NettyServer("localhost", 6969, protocol, gameServer);
        server.bind();
        
        gameServer.getWorldManager().addWorld("TutorialWorld", new WorldAdapter(new ServerWorldConfiguration(), "TutorialWorld"));
        gameServer.start();

        System.err.println("Server running.");

As such, you would join this TutorialWorld in the client with player.getConnection().joinWorld("TutorialWorld", player.getName());