Serializing players’ turns
In Chapter 2, Sending and Receiving Data, we explored an essential technique to recreate the game state across multiple players in a network. By serializing the relevant data and transmitting it in small portions, we ensure efficient utilization of network bandwidth while maintaining synchronization among peers.
Developing an understanding of what information is crucial to replicate the game state among players involves mastering the concept of abstraction in game development. In our case, this primarily revolves around meta_board
, which is an abstraction of the relevant metadata of our game, such as the positional data and king state of the Pieces and the empty cells in the board.
Additionally, we need to consider the availability of Pieces, depending on the players’ turn. Fortunately, most other elements of the game can be managed locally without requiring network synchronization.
To simplify the process of synchronizing node properties...