[Kryonet] How to build a Mulitplayerserver?

Hello,

at the moment i try to build a mulitplayer server for a roundbased Multigame for two players. First i describe how the game should be work. First the client press a button and connect to the server. Now, is there a second client (anywhere in the internet) and press the button too, the server put him in one “session/thread” with the first player. Is there now two other player who want to play, the server starts a new “Thread”. for this two players and so on.

But now i didn’t know how to handel thies connection and if a play, for example, moves a stone the right play get this update from the server.

Can anybody tell me how it works or have some codesnippets?

For your information, i want to use kryonet.

What do you have set up so far? Do you have anything? I’m doing something very similar right now so I could be of some help here. I have it working pretty well.

At the moment I have a wrote a Server that creating “GameSession”. In this sessions i store the connections of the two players.

Hi, I am also facing the same problem as cronosDev, I have no idea on even how to create the sessions can also anybody tell me how it works or have some codesnippets?

You mean you have a two player game with matchmaking?

Okay:

Server recieves connection from client.
If the waiting list is empty, Server adds client to a waiting list.
Otherwise, Server takes first client from waiting list and makes a new instance of the game.
The game contains the logic thread, and a client listener thread for each client.
Only the actual game interacts with the client input/output.
If at some point a player disconnects, end the game and add the remaining player to the waiting list.

Thanks HeroesGraveDev, that has shed some light, how do implement the client listener thread for the client on android with Kryronet