istvanvoros88 avatar image
istvanvoros88 asked

Master server in CloudScript + Unity3D custom game servers ?

@Brendan: My question may be very basic. However, I've been checking the documentation and tutorials for a while and am still not sure if my concept is feasible using PlayFab so I'd need some feedback here.

The idea is the following: Player logs in using PlayFab API and selects one from the several championship options. Let's assume he or she chooses 16-player mode. He or she is registered for the championship using CloudScript as some kind of master server. Once 16 players come together for the upcoming championship, CloudScript tells the players that championship is about to start. CloudScript arranges the players in pairs (8 pairs in total) and starts 8 different game instances using the uploaded custom game server (Unity) in PlayFab. When the different game instances finish, they let CloudScript know the result. Then, CloudScript arranges new player pairs within the same championship and starts next game round with the required number of game instances.

I intend to use Unity's UNET during gameplay and otherwise CloudScript for all master server functionalities.

Can I control the number of concurrent game instances as described above using CloudScript?

Thank you.

CloudScriptCustom Game ServersMatchmaking
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

No, Cloud Script isn't a master server or matchmaker, so that wouldn't work precisely as described. But that doesn't mean your goal can't be reached with PlayFab. Rather than go with a specific implementation from the start, it's best to start with the design goal, and work top-down to find the right way to handle it.

In this case, you want to have players entering the game be able to select from a list of ways to play the game. Once they select a mode, that mode dictates how matchmaking occurs. Part of your design is a championship mode where a pool of players play against each other in pairs, using some type of match-up approach (random, everyone-plays-against-everyone, ladder) where players would play in game instances, then come back to the main "room" to wait on their next opponent. There are a number of potential approaches to this:

One way would be to run the whole thing in one custom game server, where all the players join, and the actual matches are sub-sessions within the "master" game session. This would have the advantage of being fairly simple, and would allow you a simple means to then connect a player not in a match to the data stream for a match in progress, to observe it. Once all the matches are complete, that server would then report the results.

Another way would be by having two different custom game server builds - one for the "lobby", which would act more like a chat server while players were waiting on matches, and one for the "match", which players would be sent to with their specified opponents. In this model, you would need to persist some information about the progress of all the matches in the championship, which you could do by creating a Shared Group Data at the start of the championship. When launching match servers, the players would pass the information about the Shared Group Data to the match server, which would update that data with information about the outcome of the match. The players would then tell the "master" server which Shared Group Data they were using when they return to it after the match.

A third method would be to use Photon Realtime as the aggregation point for the players looking to play a championship style game, with one of the players triggering creation of the Shared Group Data to track the results of the matches, and a Cloud Script that determines the match-ups, writing that info to the Shared Group Data and informing the players. The rest would be largely the same as the second option, though a) the last match server would be the one responsible for updating the overall championship results, and b) this route does provide more opportunity for a misbehaving client to throw off your management of the championship, potentially.

1 comment
10 |1200

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

istvanvoros88 avatar image istvanvoros88 commented ·

Now, it's crystal-clear. Thank you for the detailed response.

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.