Integration best practices

Note: The content on this page pertains to Game Server Hosting (Clanforge). If you’re using Game Server Hosting (Multiplay), see the Game Server Hosting (Multiplay) documentation.

This topic guides you on how to get the most out of Game Server Hosting's services. This is not an exhaustive list of recommendations but rather the top tips to get your project working its best.

Process cleanup

At the end of a game session, Game Server Hosting recommends you use one of the following methods to “clean up” and prepare the game server for the next session.

  • Return to a lobby or a ready state.
  • Exit the process gracefully (for example, exit code 0), then Game Server Hosting restarts the process to a ready state.

Returning to the lobby (or a ready state) is preferable to restarting the game server process. Terminating the game server process at the end of a match is a less optional resource use because it’s typically more expensive to restart a process than it is to clean up a process.

Executable names

v specifies the name of your executable on its back-end to allow the system to locate your binary at startup. If you change the name of your binary files, you must let Game Server Hosting know. Otherwise, your server instances won’t start correctly.

Ports

Game Server Hosting doesn’t block any ports on its platform in the range of 8100 to 65355. To learn more about bindable ports, see Why does Game Server Hosting require bindable ports?.

Note: Contact the Multiplayer Support team if you want to block any ports within the allowed range.

Universally unique identifiers (UUIDs)

If you want to use allocations for backfill requests, you must configure your binary to read the Session ID from a file (for example, serverconfig.json) on an event trigger. You can configure Game Server Hosting's matchmaker to use any JSON formatted file by specifying it at startup with the -serverjson=<file> command-line argument.

Event triggers vary across operating systems. You can use a library to watch the file system for changes or you can continuously poll the file for changes. Keep in mind that continuously polling for file changes might lead to performance issues.

Child processes

Game Server Hosting advises against starting additional programs (for example, DataDog, Filebeat) as child processes beneath your game server process. Starting third-party programs in this way increases the likelihood of rogue processes that consume unnecessary compute power if your game server process crashes without initializing garbage collection operations.

Game image updating format

Game Server Hosting requires you to upload your game server files to an AWS S3 bucket, GCP bucket, or Steam. Game Server Hosting recommends uploading your game server as loose files as it allows for easier image comparison and upload to your fleet machines.

Unity engine recommendations

Use the following guidance to get the most out of Game Server Hosting when working with Unity.

Set target frame rate

To avoid causing your server to use 100% of your CPU, the recommended best practice is to set the target frame rate for a Unity server.

To set the target frame rate, add the following code into your server build:

Copy

C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetFPS : MonoBehaviour
{
    public int target = 60;

    void Awake()
    {
        QualitySettings.vSyncCount = 0;
        Application.targetFrameRate = target;
    }
}