Implementing network part for multiplayer turn-based game may be much trickier than it looks at first glance (on UE4).
First of all, the main goal is to guarantee the same state of the game will be present at the beginning of each turn on each client. It means all the crucial actors (which directly influence and/or represents the gameplay) must be “fully” synchronized across all the clients (and the server ofc). “Fully” here means that all properties and RPCs have finished replication till the moment player can start planning its turn.
To achieve this I see two ways:
-
Make all crucial actors replicated. Calculate hash for the whole “game” state (all crucial actors) on the server. To finish turn execution locally, client periodically recalculates hash and sends it to the server via RPC. When the server detects that all clients have the same game state hash as the server - it starts new turn.
-
Simply not rely on actor’s replication. Replicate only players decisions made before turn execution (client->server->multicast). In fact each client (and server) has its own instance of the “game”, all changes are local, except players decisions.
In both cases only server controls when the match should start/pause/end (judging from its local game state). All decisions can also be validated by the server so there is no chance for cheating.
I am hesitating which strategy to choose. Does anybody know any other approaches for this issue?
Please share you thoughts about it.