I want to create turn based card game. Im currently writing server part in Java and I designed one little mechanism how it could work. On one server I want to be able to have lots of desks. So the basic principse is to have one thread which would be accpeting and checking new connection. This class upon connecting new Player would create new thread for communication with every player. The player could send request. Every PlayerConnection thread would be creating new entry in List named Requests for every request sended by player.. From this List new class called ProccesingUnit would be processing every request one by one, and responses would be add to another List called Responses depending from which connection the request was added. Every PlayerConnection would be having its own Responses list, which would be sended trought TCP to player.

So the general scheme would be something like this

ServerAccepter ->creating PlayerConnection<---Responses | A | | V Processing add entry to Requests -> Unit

My question if there is any better way to handle such a situation?

Another question is what to do about rooms.. Should I make a processing unit for every room or should I handle it globally?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.