Deallocations

Note: The content on this page pertains to Multiplay Hosting, available on the Unity Cloud Dashboard. If you’re using Clanforge, refer to Clanforge documentation.

A deallocation is a request to Multiplay Hosting from a matchmaker to remove an allocation from a server after the game session finishes, the players disconnect, and the post-processing completes. Deallocating the server returns the server to the available server pool so it’s available for the next game session.

Multiplay Hosting only deallocates servers in the following scenarios:

  1. You (or a matchmaker) call the deallocation API.
  2. The game server shuts down cleanly (for example, an exit code 0 if the server is running on a Linux based operating system).

It’s the responsibility of the game server to decide when players have disconnected and it's safe to shut down.

Deallocation flow

The deallocation flow varies depending on the deallocation method your build uses. You can either call the deallocate API endpoint directly or have your game server process end with exit code 0.

If you (or your matchmaker) call the deallocate API endpoint directly, the deallocation flow generally looks something like this:

  1. A game session completes, the players disconnect, and any post-session cleanup completes.
  2. The game server notifies the matchmaker that the match has ended.
  3. The matchmaker requests a deallocation from the Multiplay Hosting API.
  4. Multiplay Hosting queues the deallocation request.
  5. Multiplay Hosting clears the allocation ID from the earlier allocation.
  6. Multiplay Hosting returns the server to the available server pool so it’s available for the next game session.

If you rely on your game server process exiting with code 0 when a game session completes (instead of calling the deallocate API endpoint directly), the deallocation flow looks something like this:

  1. A game session completes, the players disconnect, and any post-session cleanup completes.
  2. The game server process exits with code 0.
  3. Multiplay Hosting detects that the game server process exited cleanly and queues the deallocation request.
  4. Multiplay Hosting clears the allocation ID from the earlier allocation.
  5. Multiplay Hosting returns the server to the available server pool so it’s available for the next game session.