question

undertheweatherllc avatar image
undertheweatherllc asked

Multiplayer Design for TurnBased Asynchronous Chess-like Game

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...

Shared Group Data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

I would far rather have one source for the data, since coordinating sync between multiple sources could introduce errors. The limit on the size of data in Shared Group Data is 1,000 bytes for our free tier, but I'd always recommend signing up for one of our professional tiers if you're not a hobbyist, since the free tier has no SLA (we do everything we can to support the free tier, as we're very passionate about helping new game developers, but we have to be realistic that we have a responsibility to folks with whom we have contracts to make sure any issues they have are resolved first). Our pro tiers have significantly higher limits, so your custom board wouldn't be an issue in them.

The PlayFab matchmaker is for titles using custom game servers. For an asynchronous game, you could use Photon Realtime to create lobbies/rooms which you could use for matchmaking, or else find other player from their score using GetLeaderboardAroundPlayer. There's a good guide to using the Photon Realtime matchmaker here: https://doc.photonengine.com/en/realtime/current/reference/matchmaking-and-lobby.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.