Reputation: 309
I am in the process of developing a game for an assignment, and would love some pointers on how to design the server-client interaction. Ideally, I'd love to be able to have multiple instances of clients up, that communicate with the some main server.
More specifically, I was thinking of setting up this main server as the backend of my game, which would be played through a web browser, and it would serve the game logic to clients. Each of the clients would be an instance of some Game class that would make the necessary initializations and continue to be the entry point through which that particular client accesses the game logic available on the logic server.
Does this design make sense, and seem viable as a way of implementing a game like this?
Also, does using threads make sense for this (as in, each Game instance would be a new thread on the server)?
Upvotes: 1
Views: 677
Reputation: 84
Yes, having a separate thread for each client does make sense.
have a look at Similar Question MultiClient server - Java
and following answer https://stackoverflow.com/a/23042582/5828425 ... this will give you idea on how to implement multiclient chat application. now you can send and receive the data using similar api to send chat and receive chat messages. instead of chat messages you can send and receive the game data updates and state transfers.
Upvotes: 1