question

larilof avatar image
larilof asked

Match-making for two-player asynchronous turn-based game

I'm a newby to game development and after reading several posts about match-making I have the following questions regarding match-making for a two-player asynchronous turn-based board game:

1. What are 'rooms' used for? Are they same as 'boards' / 'games'?

2. Is it possible to do the match-making without Photon, using Playfab's Shared Group Data and/or Title Data?

3 If so, Should I worry about race conditions, i.e. multiple players trying to join the same board simultaneously?

4. Are Cloud Script for a single title processed sequentially or should I take into account the possibility that multiple script calls are handled in parallel?

Many thanks in advance for helping me out.

Matchmaking
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

Sure thing:

1. In Photon, a "room" is simply a shared game session, running in their service (https://doc.photonengine.com/en/realtime/current/getting-started/realtime-intro).

2/3. Matchmaking can be done via Photon Realtime's matchmaker, or the PlayFab matchmaker for titles using hosted game servers. Shared Group Data and Title Data cannot be used for matchmaking.

4. Each executing Cloud Script handler is distinct from every other one, and they are all started asynchronously via calls to ExecuteCloudScript. No client should ever be attempting to run multiple Cloud Script handlers simultaneously - you should always wait on the response from the running handler before the same client tries to start another.

2 comments
10 |1200

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

larilof avatar image larilof commented ·

Many thanks for your reply. What happens if two clients simultaneously call a script which updates SharedGroupData? Will the calls be handled sequentially or in parallel? If in parallel, how can I avoid the SharedGroupData becoming inconsistent?

0 Likes 0 ·
brendan avatar image brendan larilof commented ·

The scripts run completely independently - they may not even be running on the same server, for that matter. So it's the same as if you make calls from two different devices to update the same piece of User Data or Shared Group Data - you have to take steps to ensure they don't step on each other, if that could cause issues for your title.

For asynchronous turn-based games, the best thing to do is to have one part of the value be whose turn it is. That way, if you're only updating that via Cloud Script, you can have it check to make sure it's the right player's turn before updating.

0 Likes 0 ·

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.