Server.json file
Documentation for Server.json file
Read time 1 minuteLast updated a year ago
To use the Clanforge allocation system, you must enable a method to dynamically specify the file within your server ID directory that has the allocation UUID supplied by your matchmaker along with other configuration variables. This file is the file.
server.jsonAt a minimum, the file must include the allocation UUID.
server.json{ "AllocationUUID": "$$allocated_uuid$$"}
The file exists within each server instance’s server ID directory relative to the game server binary. It has dynamic information about the game server instance, such as the allocation UUID supplied by your matchmaker, the session authentication key, the connection IP address, and the connection port. Your build can consume variables from the build configuration or the launch parameters. Refer to Configuration variables.
server.json{ "AllocationUUID": "$$allocated_uuid$$", "SessionAuth": "$$session_auth$$", "ConnectionIP": "$$ip$$", "ConnectionPort": "$$port$$"}
The allocation UUID variable changes with each session, so you’ll need to monitor it for changes. To detect changes within the server.json file, you can set up an event trigger that detects file changes or a process to check the file for changes at a regular interval. It’s best practice to use an event trigger because the interval check causes unnecessary resource usage. Refer to Monitor allocation UUID changes.
Monitor allocation UUID changes
Each game server instance must detect its allocation UUID by monitoring the value of the configuration variable in the server.json file.
$$allocation_uuid$$Detect an allocation
The variable value changes each time you allocate or deallocate the server instance. Each game server build should monitor the server.json file to detect its allocation status and its allocation UUID.
$$allocation_uuid$$- When you allocate a server instance, the value updates to the current allocation UUID.
- When you deallocate a server instance, the value updates to contain an empty string.
Note: The server start and server stop actions don't impact the allocation status of the server instance or the allocation UUID.
Detect configuration variable values
Each game server build should monitor the 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.
server.jsonThe recommended way to monitor changes to the file on Linux is to use to detect events. For an example of what a event looks like, refer to the following log sample.
server.jsoninotifyCLOSE_WRITECLOSE_WRITEinotifyMODIFY titanping.jsonOPEN titanping.jsonOPEN titanping.jsonCLOSE_NOWRITE,CLOSE titanping.jsonMODIFY titanping.jsonCLOSE_WRITE,CLOSE titanping.jsonOPEN titanping.jsonACCESS titanping.jsonCLOSE_NOWRITE,CLOSE titanping.json