Monitor for configuration variable changes
Each game server build should monitor the
server.json file for configuration variable changes. For example, when you allocate a server instance, the IP address, port number, and game mode might contain different values from the previous allocation.
Monitor allocation ID changes
Each game server instance must detect its allocation ID by monitoring the value of the
allocatedID configuration variable in the
server.json file. The
allocatedID variable value changes each time you allocate or deallocate the server instance. Game server builds should also monitor the
server.json file to detect its allocation status and its allocation ID.
- When you allocate a server, the value updates to the current allocation ID.
- When you deallocate a server, the value updates to contain an empty string.
If you're using a container build, the
server.json file is already mounted into your container. You can find the
server.json file location by checking the container's home environment variable.
- For Linux containers, it's in the
- For Windows containers, it's in the
The recommended way monitor changes to the
server.json file depends on the game engine your game is built on.
|Game engine||Best practice|
|Unity Engine||Game Server SDK for Unity|
|Unreal Engine||Game Server SDK for Unreal|
If your game is built using Unity, the recommended way to monitor for configuration variable changes is to use the Game Server SDK.
If your game is built using Unreal Engine, the recommended way to monitor for configuration variable changes is to use the Game Server SDK.
If you’re using a custom game engine, the recommended way is to use
inotify to detect
CLOSE_WRITE events. For an example of what a
CLOSE_WRITE event looks like, see the following
inotify log sample.
MODIFY server.json OPEN server.json OPEN server.json CLOSE_NOWRITE,CLOSE server.json MODIFY server.json CLOSE_WRITE,CLOSE server.json OPEN server.json ACCESS server.json CLOSE_NOWRITE,CLOSE server.json