Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
vomitmachine767179dI'd do one server with a key mapping a game instance and put hosting the game instance on a player in that room, like the party leader. Make the server agnostic so you can drop it out for a different style if you want to experiment.
The best advice I could give is to do some experimentation with something simpler like a tic tac toe client and server.
That way you can focus on thing that are required for playing a game online
- game lobby
- Eli system
- communication protocol
In the past I've had an assignment to make Othello/reverse Client + server and our code was easily extendable for other turn bases games like chess, checkers, tic tac toe.
At the end of the semester we even hosted a AI tournament with a server hosting the matches and all teams joining with their own client which had the option to use the ai
Point is start simple and extend on it
As for your your question, you have a socket for every client that is connected to the server
The client is usually takes the initiative for the connection therefore your server needs to be live.
It's smart to have a single server with sockets for communication between server and a client
The client needs to maintain a state specific to that client, while the server needs to keep a state of basically everything.
I probably still have the diagrams and repository of this old project. Let me know if you want them
Wow thanks for the awesome reply! I think it might help me to check out the diagrams and repo, so if it's not too much to send over i'd love to take a look. I definitely want to make it highly extensible cause i have a few board games i've been wanting to make web versions of to play in quarantine.