So I am making a poker game as a mobile app. Naturally, the project is turned based and designed around a client/server architecture.
To summarize, I have created a game server that receives inputs from the player to act, validates the input, processes the new game state, and sends out the current state of the game to all clients. The clients are currently just a graphical representation of the state of the game.
My problem is that I have to design and run animations "in between these game states". So for example, after a betting round completes I have to play the animation of dealing a card and moving the chips to the center.
So all though these animations are just a transition and really have nothing to do with the state of the game, how do I implement them in the client/server system in a way that helps keep clients synced? Also, when it's a players turn to act, is it worth it to implement some kind of ready check from the client to start his turn?
So again my main questions are:
- Should the server tell the clients to initiate the animations and wait for a response from all the clients that they have finished their animation?
- Similarly, should the server wait for a response from the client that they are ready to start their turn?
- How do I account for minor disconnections during those periods? (i.e. client fails to signal the server that he is ready to start his turn, so the server never receives that signal and the player is on the clock so his turn must expire eventually)
My gut tells me that the server should be decoupled from details of animating the game state, but maybe a bit of syncing is required, either way I am not sure how to go about it.