I'm working on learning network programming. I'm working on a simple card game. The basic idea is:
Players enter the lobby Players see tables Players sit at an empty seat
Once they sit, they do not need any information from the lobby, they see the card table and the data about the other players and so forth.
I've programmed the server portion for the game itself. The clients connect to my server object and the server then receives and sends messages; quite simple.
The tricky concepts for me are:
What's a good way to run many tables at the same time? What's a good way to keep the lobby consistently updated for each person in the lobby (eg: MSG_TABLE_FILLED, 22)
Ideally I'd like to have 1 server exe for all of this and to have to deal with multithreading as little as possible.
I'm going to use the enet library.
I was thinking that each time a game session starts, I push a new Game and I map the client IPs to that table, then I just route messages from those clients to that Game.
Since enet supports channels I was thinking of using 2 channels per table, one for the game messages and one for in game chat.
Would something like this work?
Does anyone have any advice / design ideas for a game with a lobby and many tables? Is there a usual way this is done that I'm overlooking?
Any conceptual ideas or even c/c++ code examples would be very helpful.