19#ifndef HEADER_SERVER_CONFIG
20#define HEADER_SERVER_CONFIG
22#include "config/user_config.hpp"
23#include "race/race_manager.hpp"
25#ifndef SERVER_CFG_PREFIX
26#define SERVER_CFG_PREFIX extern
29#ifndef SERVER_CFG_DEFAULT
30#define SERVER_CFG_DEFAULT(X)
46 using FloatUserConfigParam::operator=;
54 using IntUserConfigParam::operator=;
62 using BoolUserConfigParam::operator=;
69 const char* param_name,
const char* comment);
70 using StringUserConfigParam::operator=;
73 template<
typename T,
typename U>
81 std::array<std::string, 3> key_names,
82 std::map<T, U> default_value);
92 "Name of server, encode in XML if you want to use unicode "
97 "Port used in server, if you specify 0, it will use the server port "
98 "specified in stk_config.xml. If you wish to use a random port, "
99 "set random-server-port to '1' in user config. STK will automatically "
100 "switch to a random port if the port you specify fails to be bound."));
104 "Game mode in server, 0 is normal race (grand prix), "
105 "1 is time trial (grand prix), 3 is normal race, "
106 "4 time trial, 6 is soccer, 7 is free-for-all and "
107 "8 is capture the flag. Notice: grand prix server doesn't "
108 "allow for players to join and wait for ongoing game."));
112 "Difficulty in server, 0 is beginner, 1 is intermediate, 2 is expert "
113 "and 3 is supertux (the most difficult)."));
117 "Number of grand prix tracks per game (If grand prix enabled)."));
121 "Use goal target in soccer."));
125 "Enable wan server, which requires you to have an stk-addons account "
126 "with a saved session. Check init-user command for details."));
130 "Enable network console, which can do for example kickban."));
134 "Maximum number of players on the server, setting this to a value "
135 "greater than 8 can cause performance degradation."));
139 "Maximum number of players in the game, all other players on "
140 "the server are spectators. Specify 0 to allow all players on "
141 "the server to play."));
145 "private-server-password",
"Password for private server, "
146 "leave empty for a public server."));
150 "motd",
"Message of today shown in lobby, you can enter encoded XML "
151 "words here or a file.txt and let STK load it."));
155 "If this value is set to false, the server will ignore chat messages "
156 "from all players."));
160 "If client sends more than chat-consecutive-interval / 2 chats within "
161 "this value (read in seconds), it will be ignore, negative value to "
166 "Allow players to vote for which track to play. If this value is set "
167 "to false, the server will randomly pick the next track to play."));
171 "Timeout in seconds for selecting karts and (or) voting tracks in "
172 "server, you may want to use a lower value if you have track-voting "
177 "Timeout in seconds for validation of clients in wan, currently "
178 "STK will use the stk-addons server to share AES key between the client "
183 "By default WAN server will always validate player and LAN will not, "
184 "disable it to allow non-validated player in WAN."));
188 "Disable it to turn off all stun related code in server, "
189 "it allows for saving of server resources if your server is not "
190 "behind a firewall."));
194 "Enable to allow IPv6 connection if you have a public IPv6 address. "
195 "STK currently uses dual-stack mode which requires server to have both "
196 "IPv4 and IPv6 and listen to same port. If STK detects your server "
197 "has no public IPv6 address or port differs between IPv4 and IPv6 "
198 "then it will use IPv4 only socket. For system which doesn't support "
199 "dual-stack socket (like OpenBSD) you may fail to be connected by "
200 "IPv4 clients. You can override the detection in config.xml at "
201 "supertuxkart config-0.10 folder, with default-ip-type option."));
205 "No server owner in lobby which can control the starting of game or "
206 "kick any players."));
210 "Time to wait before entering kart selection screen "
211 "if satisfied min-start-game-players below for owner less or ranked "
216 "official-karts-threshold",
217 "Clients below this value will be rejected from joining this server. "
218 "It's determined by number of official karts in client / number of "
219 "official karts in server"));
223 "official-tracks-threshold",
224 "Clients below this value will be rejected from joining this server. "
225 "It's determined by number of official tracks in client / number of "
226 "official tracks in server, setting this value too high will prevent "
227 "android players from joining this server, because STK android apk "
228 "has some official tracks removed."));
232 "Only auto start kart selection when number of "
233 "connected player is larger than or equals this value, for "
234 "owner less or ranked server, after start-game-counter reaches 0."));
238 "Automatically end linear race game after 1st player finished "
239 "for some time (currently his finished time * 0.25 + 15.0)."));
243 "Enable team choosing in lobby in team game (soccer and CTF). "
244 "If owner-less is enabled and live-spectate is not enabled, than this "
245 "option is always disabled."));
249 "If strict-players is on, no duplicated online id or split screen "
250 "players are allowed, which can prevent someone using more than 1 "
251 "network AI with this server."));
255 "Server will submit ranking to stk-addons server "
256 "for linear race games, you require permission for that. "
257 "validating-player, auto-end, strict-player and owner-less will be "
262 "If true, the server owner can config the difficulty and game mode in "
263 "the GUI of lobby. This option cannot be used with owner-less or "
264 "grand prix server, and will be automatically turned on if the server "
265 "was created using the in-game GUI. The changed difficulty and game "
266 "mode will not be saved in this config file."));
270 "If true, players can live join or spectate the in-progress game. "
271 "Currently live joining is only available if the current game mode "
272 "used in server is FFA, CTF or soccer, also official-karts-threshold "
273 "will be made 1.0. If false addon karts will use their original "
274 "hitbox other than tux, all players having it restriction applies."));
278 "If true, server will send its addon karts real physics (kart size, "
279 "length, type, etc) to client. If false or client chooses an addon "
280 "kart which server is missing, tux's kart physics and kart type of "
281 "the original addon is sent."));
285 "Time in seconds when a flag is dropped a by player in CTF "
286 "returning to its own base."));
290 "Time in seconds to deactivate a flag when it's captured or returned "
291 "to own base by players."));
295 "Hit limit of free for all, zero to disable hit limit."));
299 "time-limit-ffa",
"Time limit of free for all in seconds, zero to "
300 "disable time limit."));
304 "Capture limit of CTF, zero to disable capture limit."));
308 "Time limit of CTF in seconds, zero to disable time limit."));
312 "Value used by server to automatically estimate each game time. "
313 "For races, it decides the lap of each race in network game, "
314 "if more than 0.0f, the number of lap of each track vote in "
315 "linear race will be determined by "
316 "max(1.0f, auto-game-time-ratio * default lap of that track). "
317 "For soccer if more than 0.0f, for time limit game it will be "
318 "auto-game-time-ratio * soccer-time-limit in UserConfig, for goal "
319 "limit game it will be auto-game-time-ratio * numgoals "
320 "in UserConfig, -1 to disable for all."));
324 "Maximum ping allowed for a player (in ms), it's recommended to use "
325 "default value if live-spectate is on."));
329 "Tolerance of jitter in network allowed (in ms), it's recommended to "
330 "use default value if live-spectate is on."));
334 "kick-high-ping-players",
335 "Kick players whose ping is above max-ping."));
339 "high-ping-workaround",
340 "Allow players exceeding max-ping to have a playable game, if enabled "
341 "kick-high-ping-players will be disabled, please also use a default "
342 "value for max-ping and jitter-tolerance with it."));
346 "kick-idle-player-seconds",
347 "Kick idle player which has no network activity to server for more "
348 "than some seconds during game, unless he has finished the race. "
349 "Negative value to disable, and this option will always be disabled "
355 "Set how many states the server will send per second, the higher this "
356 "value, the more bandwidth requires, also each client will trigger "
357 "more rewind, which clients with slow device may have problem playing "
358 "this server, use the default value is recommended."));
363 "Use sql database for handling server stats and maintenance, STK "
364 "needs to be compiled with sqlite3 supported."));
369 "Database filename for sqlite to use, it can be shared for all "
370 "servers created in this machine, and STK will create specific table "
371 "for each server. You need to create the database yourself first, see "
372 "NETWORKING.md for details"));
377 "Specified in millisecond for maximum time waiting in "
378 "sqlite3_busy_handler. You may need a higher value if your database "
379 "is shared by many servers or having a slow hard disk."));
384 "IPv4 ban list table name, you need to create the table first, see "
385 "NETWORKING.md for details, empty to disable. "
386 "This table can be shared for all servers if you use the same name. "
387 "STK can auto kick active peer from ban list (update per minute) which"
388 "allows live kicking peer by inserting record to database."));
393 "IPv6 ban list table name, you need to create the table first, see "
394 "NETWORKING.md for details, empty to disable. "
395 "This table can be shared for all servers if you use the same name. "
396 "STK can auto kick active peer from ban list (update per minute) "
397 "which allows live kicking peer by inserting record to database."));
401 "online-id-ban-table",
402 "Online ID ban list table name, you need to create the table first, "
403 "see NETWORKING.md for details, empty to disable. "
404 "This table can be shared for all servers if you use the same name. "
405 "STK can auto kick active peer from ban list (update per minute) "
406 "which allows live kicking peer by inserting record to database."));
410 "player-reports-table",
411 "Player reports table name, which will be written when a player "
412 "reports player in the network user dialog, you need to create the "
413 "table first, see NETWORKING.md for details, empty to disable. "
414 "This table can be shared for all servers if you use the same name."));
418 "player-reports-expired-days",
"Days to keep player reports, "
419 "older than that will be auto cleared, 0 to keep them forever."));
423 "ip-geolocation-table",
424 "IP geolocation table, you only need this table if you want to "
425 "geolocate IP from non-stk-addons connection, as all validated "
426 "players connecting from stk-addons will provide the location info, "
427 "you need to create the table first, see NETWORKING.md for details, "
429 "This table can be shared for all servers if you use the same name."));
433 "ipv6-geolocation-table",
434 "IPv6 geolocation table, you only need this table if you want to "
435 "geolocate IP from non-stk-addons connection, as all validated "
436 "players connecting from stk-addons will provide the location info, "
437 "you need to create the table first, see NETWORKING.md for details, "
439 "This table can be shared for all servers if you use the same name."));
443 "If true this server will auto add / remove AI connected with "
444 "network-ai=x, which will kick N - 1 bot(s) where N is the number "
445 "of human players. Only use this for non-GP racing server."));
449 "If true this server will allow AI instance to be connected from "
450 "anywhere. (other than LAN network only)"));
454 static const uint32_t m_server_version = 6;
458 static const uint32_t m_server_db_version = 1;
461 extern std::string m_server_uid;
463 void loadServerConfig(
const std::string& path =
"");
465 void loadServerConfigXML(
const XMLNode* root,
bool default_config =
false);
467 std::string getServerConfigXML();
469 void writeServerConfigToDisk();
471 std::pair<RaceManager::MinorRaceModeType, RaceManager::MajorRaceModeType>
472 getLocalGameModeFromConfig();
474 std::pair<RaceManager::MinorRaceModeType, RaceManager::MajorRaceModeType>
475 getLocalGameMode(
int mode);
477 core::stringw getModeName(
unsigned id);
479 inline bool unsupportedGameMode()
480 {
return m_server_mode == 2 || m_server_mode == 5; }
482 void loadServerLobbyFromConfig();
484 std::string getConfigDirectory();
Definition: user_config.hpp:296
Definition: user_config.hpp:329
Definition: user_config.hpp:194
ATM only map with 1 key and 1 value is supported.
Definition: user_config.hpp:110
Definition: server_config.hpp:58
Definition: server_config.hpp:42
Definition: server_config.hpp:50
Definition: server_config.hpp:75
Definition: server_config.hpp:66
Definition: user_config.hpp:256
utility class used to parse XML files
Definition: xml_node.hpp:48