question

Jakub Smekal avatar image
Jakub Smekal asked

List of all open rooms for async game

Hello,

we are making a correspondence chess game - in short, it's a chess match that's played asynchronously. Match must exist even if both players are offline.

Workflow:

- every player sees a list of games they are participating in, and can return to it to make a turn

- every player sees a part of a list of all open games (which have only 1 player waiting for an opponent), depending on their skill level

- player can choose to manually join any game from this list

- player can choose to automatically join a game. In this case, a suitable match from the list will be picked up. If there is no suitable match, a new game will be created and shown to other players for them to join.

I understand that I can store a game state that will be shared between two players that are in the same match, but I am not sure about the list of all open games. Is that possible with PlayFab? I found this topic - Persistent turn based games, but it's 4 years old, and I don't see what's the best solution. We are using Photon for room management.

Flow from the player POV can look like this:

- Player A creates new match. After he creates it, he can see the match in the list of games he are participating in. He can create/join more matches.

- Player A quits the game.

- Player B sees the match that Player A created in a list of open games.

- Player B joins the match. It gets removed from the list of open games, and gets added to the list of games the player B is participating in. He can create or join more matches.

- Player A starts the game, and makes a turn in any of games he is participating in

Shared Group DataMatchmaking
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

·
Sarah Zhang avatar image
Sarah Zhang answered

PlayFab SharedGroupData can be used to make a correspondence chess game. But there is no PlayFab API that returns a “Shared Group Data List” to players. In this case, a shared group corresponds to a “room”. You can use the following Server/Client API to manage the shared groups and update the shared group data CreateSharedGroup, AddSharedGroupMembers, GetSharedGroupData, RemoveSharedGroupMembers, UpdateSharedGroupData. If a chess match finishes, you can use Server API DeleteSharedGroup to delete the shared group. Besides, there is a turn-based multiplayer Async games example that can be a reference in the documentation Using Shared Group Data.

For a summary, the following bold things are what cannot be implemented using PlayFab. You need to use an external cache to manage the “Room” lists, such as Redis.

- Player A creates new match. After he creates it, he can see the match in the list of games he are participating in. He can create/join more matches.

- Player A quits the game.

- Player B sees the match that Player A created in a list of open games.

- Player B joins the match. It gets removed from the list of open games, and gets added to the list of games the player B is participating in. He can create or join more matches.

- Player A starts the game, and makes a turn in any of games he is participating in

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.