I am planning to design my turn-based asynchronous game like so:
This is a board game like chess. A game session can have 2-4 players, typically 2 (1 on 1). A player can have at any time, max 10 sessions persisted.
Is this a sound architectural design?
- Player1 creates a session, thereby creating a SharedGroupData (SGD) with ["roomKeyGuid"] to store the game state.
- Player1 also saves the roomKeyGuid to his/her readonly player data in cloudscript when the room is created.
- Player2 sees the open session (match making question below), joins it, and also saves the roomKeyGuid to his/her player data
- Whomever's turn is active has the right to modify the shared data. (The reason for storing the roomKeyGuid per player is to mitigate any hits for active session searches, but it also introduces a risk of orphaned data, in the case that the roomKeyGuid doesn't match with an actual session id...)
I imagine that SGD would contain each state of all the units on the board.
Additionally, the board may have certain dynamic attributes, which would also be stored in SGD. Or would it make more sense to have each player write his/her own game state to user data? This sounds a little awkward, as the state is disjointed from the SGD.
Re: matchmaking, how is this done? Is it possible to just iterate over all SGDs and find relevant opened sessions? This sounds impractical for large data sets. And I don't understand if I could use Photon's matchmaking services for this purpose.
Re: SGD value sizes... I would also like to support "custom maps", which would entail storing an NxM board including all attributes. Is there a max size limit for data stored? Suppose it's a 64x64 map with attributes about terrain. At 1 byte per tile, that's 4k (I suppose this could be compressed somehow)
Another note, I am also using Photon, but with the turn-based asynchronous nature that I've described, I don't necessarily need to go through Photon to get this to work, right? I could potentially communicate directly via PlayFab...
Thanks in advance! The answers I've found on the forum have been great, but I had all these specific questions for what I'm doing...