question

andrewalpha avatar image
andrewalpha asked

Proper custom server lifecycle

Hi,

Our game is using a custom game server, created in Unity, and hosted by PlayFab (not external).

When I say "host" or "instance" I'm attempting to use the same meanings helpfully given here: here

So my question scenario is:

- I have a single host running.

- Clients call Matchmake, PlayFab starts running an instance for them, and they play through a game on the instance.

- When the game is over, I do any cleanup (NotifyMatchmakerPlayerLeft and other things), then call Application.Quit(). This is what tells PlayFab to write the logs to S3 and kill that instance (correct?).

My main question: if that was the only instance running, after it exits, does the host continue running?

So if another group of clients Matchmake, and it spins up a new instance, is it still on that same host?

My concern is that I want to make sure I understand how the server hours are consumed. If the host is shut down after the last instance exits, then a new one spools up for a new client game, then that is going to count as 2 server hours.

Thanks for any clarification.

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

andrewalpha avatar image andrewalpha commented ·

I ran a test and found that it will still use the same host if you Application.Quit() on the last remaining instance and then Matchmake into a new instance being created, which is perfect.

0 Likes 0 ·

1 Answer

·
Andy avatar image
Andy answered

As you've found, Matchmaking will reuse an existing host as long as it hasn't met its instance quota (which is configurable in a build's settings).

While you're in development, you'll probably want to manually control when you're spinning up VMs. The easiest way to do this is through controlling the available builds. To ensure all VMs are deprovisioned you can either delete all valid builds or remove all regions from all builds. This will spin down all existing VMs and prevent any more from starting until there is a valid build again.

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.