Our scenario is the following:
- Players can create clans and invites other players
- Each clan has it's own world state
- A player can start a realtime game in that world
- If an other player wants to play in that clan, it will join the same game
My current plan:
- I plan to use a Group entity to store the clan world state and the server infos.
- When a player wants to play in a clan he call a CloudScript function
// Pseudo code of that function function(groupId) {
// retrieve the clan data data = getGroup(groupId); // if a server already exist, return it
if (data.server) return data.server; // if there's no server, request a new server
data.server = requestServer(groupId); // Write the new group state
if (updateGroup(data))
return data.server; // if there was a problem during the Group update
// ie. a sync issue with 2 players joining at the same time
shutdownServer(data.server); // Ask the client to retry
return RETRY }
- When a server is empty it removes itself from the Group entity
This plan assumes a lot of things as I'm new to PlayFab. In particular:
- there's a way to tell when 2 players update the Group at the same time
- a server can reliably remove itself from the Group
The question is then: Does it sounds viable ? Is there a better way ? Or should I look somewhere else ?
And as a bonus question:
I was hoping there would be a way to request the list of active server and get some infos (I'm interested in the Group id) but some other forum post seems to imply there's no way to do it. ( https://community.playfab.com/questions/40393/getting-a-list-of-servers-on-20.html )