Use fixed value of battle hit, capture and time limit
This commit is contained in:
parent
8951ef0cbf
commit
b0d1bf6cce
@ -98,23 +98,23 @@ The current server configuration xml looks like this:
|
||||
<!-- If true, the server owner can config the difficulty and game mode in the GUI of lobby. This option cannot be used with owner-less or grand prix server, and will be automatically turned on if the server was created using the in-game GUI. The changed difficulty and game mode will not be saved in this config file. -->
|
||||
<server-configurable value="false" />
|
||||
|
||||
<!-- If true, players can live join or spectate the in-progress game. Currently this feature is only available if the current game mode used in server is FFA, CTF or soccer, also no addon karts will be available for players to choose, and official-karts-threshold will be made 1.0. -->
|
||||
<live-players value="false" />
|
||||
<!-- If true, players can live join or spectate the in-progress game. Currently live joining is only available if the current game mode used in server is FFA, CTF or soccer, also no addon karts will be available for players to choose, and official-karts-threshold will be made 1.0. -->
|
||||
<live-players value="true" />
|
||||
|
||||
<!-- Time in seconds when a flag is dropped a by player in CTF returning to its own base. -->
|
||||
<flag-return-timemout value="20" />
|
||||
|
||||
<!-- Value used to calculate hit limit in free for all, which is min(number of players * hit-limit-threshold, 30), negative value to disable hit limit. -->
|
||||
<hit-limit-threshold value="3" />
|
||||
<!-- Hit limit of free for all, zero to disable hit limit. -->
|
||||
<hit-limit value="20" />
|
||||
|
||||
<!-- Value used to calculate time limit in free for all, which is max(number of players * time-limit-threshold-ffa, 3.0) * 60, negative value to disable time limit. -->
|
||||
<time-limit-threshold-ffa value="0.7" />
|
||||
<!-- Time limit of free for all in seconds, zero to disable time limit. -->
|
||||
<time-limit-ffa value="360" />
|
||||
|
||||
<!-- Value used to calculate capture limit in CTF, which is max(3.0, number of players * capture-limit-threshold), negative value to disable capture limit. -->
|
||||
<capture-limit-threshold value="0.7" />
|
||||
<!-- Capture limit of CTF, zero to disable capture limit. -->
|
||||
<capture-limit value="5" />
|
||||
|
||||
<!-- Value used to calculate time limit in CTF, which is max(3.0, number of players * (time-limit-threshold-ctf + flag-return-timemout / 60.0)) * 60.0, negative value to disable time limit. -->
|
||||
<time-limit-threshold-ctf value="0.9" />
|
||||
<!-- Time limit of CTF in seconds, zero to disable time limit. -->
|
||||
<time-limit-ctf value="600" />
|
||||
|
||||
<!-- Value used by server to automatically estimate each game time. For races, it decides the lap of each race in network game, if more than 0.0f, the number of lap of each track vote in linear race will be determined by max(1.0f, auto-game-time-ratio * default lap of that track). For soccer if more than 0.0f, for time limit game it will be auto-game-time-ratio * soccer-time-limit in UserConfig, for goal limit game it will be auto-game-time-ratio * numgoals in UserConfig, -1 to disable for all. -->
|
||||
<auto-game-time-ratio value="-1" />
|
||||
|
@ -2703,34 +2703,17 @@ void ServerLobby::getHitCaptureLimit(float num_karts)
|
||||
if (race_manager->getMinorMode() ==
|
||||
RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
|
||||
{
|
||||
if (ServerConfig::m_capture_limit_threshold > 0.0f)
|
||||
{
|
||||
float val = fmaxf(3.0f, num_karts *
|
||||
ServerConfig::m_capture_limit_threshold);
|
||||
hit_capture_limit = (int)val;
|
||||
}
|
||||
if (ServerConfig::m_time_limit_threshold_ctf > 0.0f)
|
||||
{
|
||||
time_limit = fmaxf(3.0f, num_karts *
|
||||
(ServerConfig::m_time_limit_threshold_ctf +
|
||||
ServerConfig::m_flag_return_timemout / 60.f)) * 60.0f;
|
||||
}
|
||||
if (ServerConfig::m_capture_limit > 0)
|
||||
hit_capture_limit = ServerConfig::m_capture_limit;
|
||||
if (ServerConfig::m_time_limit_ctf > 0)
|
||||
time_limit = (float)ServerConfig::m_time_limit_ctf;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ServerConfig::m_hit_limit_threshold > 0.0f)
|
||||
{
|
||||
float val = fminf(num_karts *
|
||||
ServerConfig::m_hit_limit_threshold, 30.0f);
|
||||
hit_capture_limit = (int)val;
|
||||
if (hit_capture_limit == 0)
|
||||
hit_capture_limit = 1;
|
||||
}
|
||||
if (ServerConfig::m_time_limit_threshold_ffa > 0.0f)
|
||||
{
|
||||
time_limit = fmaxf(num_karts *
|
||||
ServerConfig::m_time_limit_threshold_ffa, 3.0f) * 60.0f;
|
||||
}
|
||||
if (ServerConfig::m_hit_limit > 0)
|
||||
hit_capture_limit = ServerConfig::m_hit_limit;
|
||||
if (ServerConfig::m_time_limit_ffa > 0.0f)
|
||||
time_limit = (float)ServerConfig::m_time_limit_ffa;
|
||||
}
|
||||
m_battle_hit_capture_limit = hit_capture_limit;
|
||||
m_battle_time_limit = time_limit;
|
||||
|
@ -145,6 +145,18 @@ void loadServerConfigXML(const XMLNode* root, bool default_config)
|
||||
return;
|
||||
}
|
||||
|
||||
int config_file_version = -1;
|
||||
if (root->get("version", &config_file_version) < 1 ||
|
||||
config_file_version < stk_config->m_min_server_version ||
|
||||
config_file_version > stk_config->m_max_server_version)
|
||||
{
|
||||
Log::info("ServerConfig", "Your config file was not compatible, "
|
||||
"so it was deleted and a new one will be created.");
|
||||
delete root;
|
||||
writeServerConfigToDisk();
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < g_server_params.size(); i++)
|
||||
g_server_params[i]->findYourDataInAChildOf(root);
|
||||
|
||||
@ -265,16 +277,13 @@ void loadServerLobbyFromConfig()
|
||||
if (unsupportedGameMode())
|
||||
Log::fatal("ServerConfig", "Unsupported game mode");
|
||||
|
||||
// TODO Remove when config directory changed from 0.10-git
|
||||
if (m_voting_timeout == 20.0f)
|
||||
m_voting_timeout = 30.0f;
|
||||
|
||||
if (stk_config->time2Ticks(m_flag_return_timemout) > 65535)
|
||||
if (stk_config->time2Ticks(m_flag_return_timemout) > 65535 ||
|
||||
m_flag_return_timemout <= 0.0f)
|
||||
{
|
||||
float timeout = m_flag_return_timemout;
|
||||
// in CTFFlag it uses 16bit unsigned integer for timeout
|
||||
Log::warn("ServerConfig", "Invalid %f m_flag_return_timemout which "
|
||||
"is too large, use default value.", timeout);
|
||||
"is invalid, use default value.", timeout);
|
||||
m_flag_return_timemout.revertToDefaults();
|
||||
}
|
||||
|
||||
@ -349,19 +358,17 @@ void loadServerLobbyFromConfig()
|
||||
}
|
||||
else if (is_battle)
|
||||
{
|
||||
if (m_hit_limit_threshold < 0.0f &&
|
||||
m_time_limit_threshold_ffa < 0.0f)
|
||||
if (m_hit_limit <= 0 && m_time_limit_ffa <= 0)
|
||||
{
|
||||
Log::warn("main", "Reset invalid hit and time limit settings");
|
||||
m_hit_limit_threshold.revertToDefaults();
|
||||
m_time_limit_threshold_ffa.revertToDefaults();
|
||||
m_hit_limit.revertToDefaults();
|
||||
m_time_limit_ffa.revertToDefaults();
|
||||
}
|
||||
if (m_capture_limit_threshold < 0.0f &&
|
||||
m_time_limit_threshold_ctf < 0.0f)
|
||||
if (m_capture_limit <= 0 && m_time_limit_ctf <= 0)
|
||||
{
|
||||
Log::warn("main", "Reset invalid Capture and time limit settings");
|
||||
m_capture_limit_threshold.revertToDefaults();
|
||||
m_time_limit_threshold_ctf.revertToDefaults();
|
||||
m_capture_limit.revertToDefaults();
|
||||
m_time_limit_ctf.revertToDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,33 +243,22 @@ namespace ServerConfig
|
||||
"Time in seconds when a flag is dropped a by player in CTF "
|
||||
"returning to its own base."));
|
||||
|
||||
SERVER_CFG_PREFIX FloatServerConfigParam m_hit_limit_threshold
|
||||
SERVER_CFG_DEFAULT(FloatServerConfigParam(3.0f, "hit-limit-threshold",
|
||||
"Value used to calculate hit limit in free for all, which "
|
||||
"is min(number of players * hit-limit-threshold, 30), "
|
||||
"negative value to disable hit limit."));
|
||||
SERVER_CFG_PREFIX IntServerConfigParam m_hit_limit
|
||||
SERVER_CFG_DEFAULT(IntServerConfigParam(20, "hit-limit",
|
||||
"Hit limit of free for all, zero to disable hit limit."));
|
||||
|
||||
SERVER_CFG_PREFIX FloatServerConfigParam m_time_limit_threshold_ffa
|
||||
SERVER_CFG_DEFAULT(FloatServerConfigParam(0.7f,
|
||||
"time-limit-threshold-ffa",
|
||||
"Value used to calculate time limit in free for all, which "
|
||||
"is max(number of players * time-limit-threshold-ffa, 3.0) * 60, "
|
||||
"negative value to disable time limit."));
|
||||
SERVER_CFG_PREFIX IntServerConfigParam m_time_limit_ffa
|
||||
SERVER_CFG_DEFAULT(IntServerConfigParam(360,
|
||||
"time-limit-ffa", "Time limit of free for all in seconds, zero to "
|
||||
"disable time limit."));
|
||||
|
||||
SERVER_CFG_PREFIX FloatServerConfigParam m_capture_limit_threshold
|
||||
SERVER_CFG_DEFAULT(FloatServerConfigParam(0.7f,
|
||||
"capture-limit-threshold",
|
||||
"Value used to calculate capture limit in CTF, which "
|
||||
"is max(3.0, number of players * capture-limit-threshold), "
|
||||
"negative value to disable capture limit."));
|
||||
SERVER_CFG_PREFIX IntServerConfigParam m_capture_limit
|
||||
SERVER_CFG_DEFAULT(IntServerConfigParam(5, "capture-limit",
|
||||
"Capture limit of CTF, zero to disable capture limit."));
|
||||
|
||||
SERVER_CFG_PREFIX FloatServerConfigParam m_time_limit_threshold_ctf
|
||||
SERVER_CFG_DEFAULT(FloatServerConfigParam(0.9f,
|
||||
"time-limit-threshold-ctf",
|
||||
"Value used to calculate time limit in CTF, which "
|
||||
"is max(3.0, number of players * "
|
||||
"(time-limit-threshold-ctf + flag-return-timemout / 60.0)) * 60.0,"
|
||||
" negative value to disable time limit."));
|
||||
SERVER_CFG_PREFIX IntServerConfigParam m_time_limit_ctf
|
||||
SERVER_CFG_DEFAULT(IntServerConfigParam(600, "time-limit-ctf",
|
||||
"Time limit of CTF in seconds, zero to disable time limit."));
|
||||
|
||||
SERVER_CFG_PREFIX FloatServerConfigParam m_auto_game_time_ratio
|
||||
SERVER_CFG_DEFAULT(FloatServerConfigParam(-1.0f, "auto-game-time-ratio",
|
||||
|
Loading…
x
Reference in New Issue
Block a user