mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-02 00:05:26 +01:00
Allow the ABM time budget to be configurable.
This commit is contained in:
@@ -403,6 +403,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("dedicated_server_step", "0.09");
|
||||
settings->setDefault("active_block_mgmt_interval", "2.0");
|
||||
settings->setDefault("abm_interval", "1.0");
|
||||
settings->setDefault("abm_time_budget", "0.2");
|
||||
settings->setDefault("nodetimer_interval", "0.2");
|
||||
settings->setDefault("ignore_world_load_errors", "false");
|
||||
settings->setDefault("remote_media", "");
|
||||
|
||||
@@ -36,6 +36,7 @@ Environment::Environment(IGameDef *gamedef):
|
||||
m_cache_active_block_mgmt_interval = g_settings->getFloat("active_block_mgmt_interval");
|
||||
m_cache_abm_interval = g_settings->getFloat("abm_interval");
|
||||
m_cache_nodetimer_interval = g_settings->getFloat("nodetimer_interval");
|
||||
m_cache_abm_time_budget = g_settings->getFloat("abm_time_budget");
|
||||
|
||||
m_time_of_day = g_settings->getU32("world_start_time");
|
||||
m_time_of_day_f = (float)m_time_of_day / 24000.0f;
|
||||
|
||||
@@ -147,6 +147,7 @@ protected:
|
||||
float m_cache_active_block_mgmt_interval;
|
||||
float m_cache_abm_interval;
|
||||
float m_cache_nodetimer_interval;
|
||||
float m_cache_abm_time_budget;
|
||||
|
||||
IGameDef *m_gamedef;
|
||||
|
||||
|
||||
@@ -1354,8 +1354,8 @@ void ServerEnvironment::step(float dtime)
|
||||
std::shuffle(output.begin(), output.end(), m_rgen);
|
||||
|
||||
int i = 0;
|
||||
// The time budget for ABMs is 20%.
|
||||
u32 max_time_ms = m_cache_abm_interval * 1000 / 5;
|
||||
// determine the time budget for ABMs
|
||||
u32 max_time_ms = m_cache_abm_interval * 1000 * m_cache_abm_time_budget;
|
||||
for (const v3s16 &p : output) {
|
||||
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
|
||||
if (!block)
|
||||
|
||||
Reference in New Issue
Block a user