question

iljatoldayev avatar image
iljatoldayev asked

Photon Server use case

I read other topics mentioning Photon Server as well as docs about custom game servers and external server hosting. And I have some questions about Photon Server integration into PlayFab.

The usual way for Photon Server to operate is to have Master Server (one or several in case of different regions) which is basically matchmaking and game session / game room management part of the platform. And one or several Game Servers which are actually running the game rooms.

Do I understand correctly, that in case of integrating with PlayFab:

1) Photon Master Server becomes obsolete, PlayFab's own matchmaking substitutes it?

2) In case more advanced or custom matchmaking logic is required it could be implemented using Matchmaker API.

3) Photon Game Servers can be hosted by PlayFab, but in this case each one will handle only 1 Game Room (in Photon platform terms) per server because PlayFab will launch new server instance each time the new game session is requested. Not several rooms per Game Server like Photon platform usually does it? Any possible workaround for that?

4) Photon Game Servers can be hosted independently and connected to PlayFab as external game servers. But in this case, some external loadbalancing service is required, which will launch/stop servers based on demand. Also, similar to previous point, docs (https://api.playfab.com/docs/external-server-hosting) suggest that using Game Servers with multiple game rooms is not intended scenario too.

Overall, I just want to know, what is best integration scenario for Photon Server and PlayFab, considering I already have a game made with Photon Server.

Thanks!

Custom Game Servers
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

To be very candid, we get very few requests for hosting Photon Server, largely because it isn't a simple drop-in. It requires running a "shim" executable, which reads the command line parameters and writes them to a file that the actual server executable code then reads when it starts. Your shim then has to keep running until the Photon Server executable stops, since the executable our game wrangler launches is the thing we're monitoring to see when we need to shut down the server host machine.

Our server hosting was specifically designed for the model where you have an executable which will run as an instance, for N people (as defined by the game mode you choose). We run up to M instances per host machine, and let you choose that M value, as well as the EC2 server model you want to use. You also tell us how many instance slots need to be available at all times, since start-up of a new server host in EC2, loading the base image, and then loading the game executable (and associated files) takes several minutes - so you want to have capacity available for the largest number of players you think will need to join games in that period.

Within a single instance, you can sub-divide the players into any number of sessions - that's entirely up to your server logic. So it's certainly possible to have many "rooms" in a Photon Server, similar to the way the Photon Cloud operates.

For your specific questions:

1) I wouldn't describe their model as obsolete at all. You can run a matchmaking server either separately or in our server hosting, and use our matchmaker to get players to connect to it, and from there do the allocation of players to servers. If you're using our hosting, you should use a simple cryptographic signature system to give clients a token they can validate with the gameplay server they connect to (create the signature on your matchmaker with your private key, decode it on your gameplay server and check the contents). The way the PlayFab matchmaker works is that it returns an available slot across all active game instances, ordering the list by the absolute value of the difference between the statistic you specify (if you want to use ranked matchmaking) and the statistic set on the server.

2) Yes, if you need custom matchmaking, you would use that API to implement the logic needed on your custom matchmaker server.

3) See above - you can have a single instance handle any number of players, and subdivide those players into sessions however you need to.

4) Sure, you can use any external servers with our external server hosting API calls. But yes, in that case, you would be responsible for spin up/down of servers, as well as collecting any log and output files, as we do not have the necessary access to the servers in that model. But again, you can subdivide players into rooms/sessions any way you want to - it's your server logic, which you can use however makes sense for your needs.

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.

iljatoldayev avatar image iljatoldayev commented ·

Thanks for answering!

One more question:

5) Is following setup possible:

We can have several Photon Master Server instances running on your hosting or separately and use it as custom matchmaking servers for each geographical region. And besides that I can order from you up to M game server instances in different regions ready to start and awaiting the largest number of players with at least K game servers running at all times.

If its correct, who's making the decision to start or stop additional servers? Its automatically based on player count? Admin API calls?

0 Likes 0 ·
brendan avatar image brendan iljatoldayev commented ·

So, presumably you mean a single matchmaking server in each region (given that coordination between matchmaker servers would be problematic, unless you're planning on dividing the user base between them with some other factor, like game mode). You can certainly host matchmakers in our server hosting or separately, and using Photon Server or not.

For the rest, the way our scalable hosting works is that you specify how many server instances can run on a host machine, and how many instance slots need to be free at any time. So, if you specify that 10 instances of your gameplay server can run on a server host, and that 5 always need to be free, if you have one server host running, as soon as it has 6 instances running (meaning only 4 more could start on that machine), we automatically start the spin-up of another server host in EC2. Conversely, when the last session running on a host machine ends, we check to see if removing that host machine from the active set will still leave enough free instance slots available (5 in the case described above). If so, we shut down that host.

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.