Configuration¶
The server is configured through a TOML file. For available options see
comprl.server.config.Config below. Entries in the config file should have same
name as the Config class attributes. Default value “???” means that the parameter is
required. For all others the corresponding default value is used if not set.
- class comprl.server.config.Config(port: int = 8080, server_update_interval: float = 1.0, timeout: int = 10, log_level: str = 'INFO', game_path: ~pathlib.Path = '???', game_class: str = '???', database_path: ~pathlib.Path = '???', data_dir: ~pathlib.Path = '???', monitor_log_path: ~pathlib.Path | None = None, registration_key: str = '', server_url: str = 'comprl.example.com', matchmaking: ~comprl.server.config.MatchmakingConfig = <factory>, score_decay: ~comprl.server.config.ScoreDecayConfig = <factory>)¶
Configuration settings.
-
data_dir : Path =
'???'¶ Path to the data directory (used to save data like game actions)
-
database_path : Path =
'???'¶ Path to the database file
-
game_class : str =
'???'¶ Class name of the game
-
game_path : Path =
'???'¶ File containing the game class to run
-
log_level : str =
'INFO'¶ Log level used by the server
- matchmaking : MatchmakingConfig¶
Matchmaking settings
-
monitor_log_path : Path | None =
None¶ File to which monitoring information is written. Ideally use a in-memory file (e.g. in /dev/shm).
-
port : int =
8080¶ Port to listen on
-
registration_key : str =
''¶ Key that has to be specified to register
- score_decay : ScoreDecayConfig¶
Score decay settings
-
server_update_interval : float =
1.0¶ Update interval for the matchmaking
-
server_url : str =
'comprl.example.com'¶ URL of the competition server
-
timeout : int =
10¶ Seconds to wait for a player to answer
-
data_dir : Path =
-
class comprl.server.config.MatchmakingConfig(gauss_leaderboard_rater_sigma: float =
20.0, match_quality_threshold: float =0.3, percentage_min_players_waiting: float =0.1, percental_time_bonus: float =0.1, max_parallel_games: int =100)¶ Settings for matchmaking.
These settings can be reloaded at runtime.
-
gauss_leaderboard_rater_sigma : float =
20.0¶ Sigma value for the
GaussLeaderboardRater.
-
match_quality_threshold : float =
0.3¶ Threshold for matching players
-
max_parallel_games : int =
100¶ Maximum number of games that can be played in parallel
-
percentage_min_players_waiting : float =
0.1¶ Percentage of players always waiting in queue
-
percental_time_bonus : float =
0.1¶ (Minutes waiting * percentage) added as a time bonus for waiting players
-
gauss_leaderboard_rater_sigma : float =
-
class comprl.server.config.ScoreDecayConfig(enabled: bool =
False, interval_minutes: int =15, delta: float =0.5)¶ Settings for score decay.
These settings can be reloaded at runtime.
-
delta : float =
0.5¶ Amount added to sigma in each interval
-
enabled : bool =
False¶ Whether to apply score decay or not
-
interval_minutes : int =
15¶ Interval (in minutes) at which scores of inactive users are decayed.
-
delta : float =
Example¶
[comprl]
port = 65335
server_update_interval = 5
timeout = 10
log_level = "INFO"
game_path = "hockey_game.py"
game_class = "HockeyGame"
database_path = "hockey.db"
data_dir = "/tmp"
monitor_log_path = "/dev/shm/comprl_monitor"
registration_key = "secret"
server_url = "comprl.example.com"
[comprl.matchmaking]
gauss_leaderboard_rater_sigma = 20.0
match_quality_threshold = 0.4
percentage_min_players_waiting = 0.1
percental_time_bonus = 0.1
max_parallel_games = 100
[comprl.score_decay]
enabled = true
interval_minutes = 15
delta = 0.5
Reload Configuration¶
Parameters of the [comprl.matchmaking] and [comprl.score_decay] sections can be
changed during run time by changing the value in the config file and then sending a
SIGHUP signal to the comprl-server process to trigger a config reload.
Important:
Only parameters of the
[comprl.matchmaking]and[comprl.score_decay]sections will be reloaded. Changes to other parts of the config file will only take effect after restarting the server.If some of the affected settings have been set via the command line, using
--config-overwriteswhen starting the server, those settings will be lost and replaced by the values from the config file. So hot-reloading and--config-overwritesshould not be combined!