Skip to content

Commit c5c727d

Browse files
sofarparamat
authored andcommittedMar 19, 2016
Allow NodeTimer, ABM and block mgmt interval changes.
ABM's are hardcoded to run every 1.0s, NodeTimers are hard coded to run at every 1.0s. Block mgmt is running every 2.0sec. However, these timers can be better tuned for both higher and lower values by server owners. Some server owners want to, and have the resources to send more packets per second to clients, and so they may wish to send smaller updates sooner. Right now all ABM's are coalesced into 1.0 second intervals, resulting in large send queues to all clients. By reducing the amount of possible timers, one can get a far better response rate and lower the perception of lag. On the other side of the camp, some servers may want to increase these values, which again isn't easily doable. The global settings abm_interval and nodetimer_interval are set to current values by default. I've tested with 0.2/0.5 type values and noticed a greatly improved response and better scattering of nodetimers, as well as enjoying not faceplanting into doors with pressure plates anymore.
1 parent d915ca1 commit c5c727d

6 files changed

+45
-12
lines changed
 

Diff for: ‎builtin/settingtypes.txt

+9
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,15 @@ sqlite_synchronous (Synchronous SQLite) enum 2 0,1,2
795795
# Length of a server tick and the interval at which objects are generally updated over network.
796796
dedicated_server_step (Dedicated server step) float 0.1
797797

798+
# Time in between active block management cycles
799+
active_block_mgmt_interval (Active Block Management interval) float 2.0
800+
801+
# Length of time between ABM execution cycles
802+
abm_interval (Active Block Modifier interval) float 1.0
803+
804+
# Length of time between NodeTimer execution cycles
805+
nodetimer_interval (NodeTimer interval) float 1.0
806+
798807
# If enabled, invalid world data won't cause the server to shut down.
799808
# Only enable this if you know what you are doing.
800809
ignore_world_load_errors (Ignore world errors) bool false

Diff for: ‎minetest.conf.example

+12
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,18 @@
980980
# type: float
981981
# dedicated_server_step = 0.1
982982

983+
# Length of time between Active Block Management execution cycles
984+
# type: float
985+
# active_block_mgmt_interval = 2.0
986+
987+
# Length of time between ABM execution cycles
988+
# type: float
989+
# abm_interval = 1.0
990+
991+
# Length of time between NodeTimer execution cycles
992+
# type: float
993+
# nodetimer_interval = 1.0
994+
983995
# If enabled, invalid world data won't cause the server to shut down.
984996
# Only enable this if you know what you are doing.
985997
# type: bool

Diff for: ‎src/defaultsettings.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ void set_default_settings(Settings *settings)
280280
settings->setDefault("sqlite_synchronous", "2");
281281
settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
282282
settings->setDefault("dedicated_server_step", "0.1");
283+
settings->setDefault("active_block_mgmt_interval", "2.0");
284+
settings->setDefault("abm_interval", "1.0");
285+
settings->setDefault("nodetimer_interval", "1.0");
283286
settings->setDefault("ignore_world_load_errors", "false");
284287
settings->setDefault("remote_media", "");
285288
settings->setDefault("debug_log_level", "action");

Diff for: ‎src/environment.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Environment::Environment():
5959
m_day_night_ratio_override(0.0f)
6060
{
6161
m_cache_enable_shaders = g_settings->getBool("enable_shaders");
62+
m_cache_active_block_mgmt_interval = g_settings->getFloat("active_block_mgmt_interval");
63+
m_cache_abm_interval = g_settings->getFloat("abm_interval");
64+
m_cache_nodetimer_interval = g_settings->getFloat("nodetimer_interval");
6265
}
6366

6467
Environment::~Environment()
@@ -1322,9 +1325,8 @@ void ServerEnvironment::step(float dtime)
13221325
/*
13231326
Manage active block list
13241327
*/
1325-
if(m_active_blocks_management_interval.step(dtime, 2.0))
1326-
{
1327-
ScopeProfiler sp(g_profiler, "SEnv: manage act. block list avg /2s", SPT_AVG);
1328+
if (m_active_blocks_management_interval.step(dtime, m_cache_active_block_mgmt_interval)) {
1329+
ScopeProfiler sp(g_profiler, "SEnv: manage act. block list avg per interval", SPT_AVG);
13281330
/*
13291331
Get player block positions
13301332
*/
@@ -1399,11 +1401,10 @@ void ServerEnvironment::step(float dtime)
13991401
/*
14001402
Mess around in active blocks
14011403
*/
1402-
if(m_active_blocks_nodemetadata_interval.step(dtime, 1.0))
1403-
{
1404-
ScopeProfiler sp(g_profiler, "SEnv: mess in act. blocks avg /1s", SPT_AVG);
1404+
if (m_active_blocks_nodemetadata_interval.step(dtime, m_cache_nodetimer_interval)) {
1405+
ScopeProfiler sp(g_profiler, "SEnv: mess in act. blocks avg per interval", SPT_AVG);
14051406

1406-
float dtime = 1.0;
1407+
float dtime = m_cache_nodetimer_interval;
14071408

14081409
for(std::set<v3s16>::iterator
14091410
i = m_active_blocks.m_list.begin();
@@ -1446,19 +1447,18 @@ void ServerEnvironment::step(float dtime)
14461447
}
14471448
}
14481449

1449-
const float abm_interval = 1.0;
1450-
if(m_active_block_modifier_interval.step(dtime, abm_interval))
1450+
if (m_active_block_modifier_interval.step(dtime, m_cache_abm_interval))
14511451
do{ // breakable
14521452
if(m_active_block_interval_overload_skip > 0){
14531453
ScopeProfiler sp(g_profiler, "SEnv: ABM overload skips");
14541454
m_active_block_interval_overload_skip--;
14551455
break;
14561456
}
1457-
ScopeProfiler sp(g_profiler, "SEnv: modify in blocks avg /1s", SPT_AVG);
1458-
TimeTaker timer("modify in active blocks");
1457+
ScopeProfiler sp(g_profiler, "SEnv: modify in blocks avg per interval", SPT_AVG);
1458+
TimeTaker timer("modify in active blocks per interval");
14591459

14601460
// Initialize handling of ActiveBlockModifiers
1461-
ABMHandler abmhandler(m_abms, abm_interval, this, true);
1461+
ABMHandler abmhandler(m_abms, m_cache_abm_interval, this, true);
14621462

14631463
for(std::set<v3s16>::iterator
14641464
i = m_active_blocks.m_list.begin();

Diff for: ‎src/environment.h

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ class Environment
136136
* a later release.
137137
*/
138138
bool m_cache_enable_shaders;
139+
float m_cache_active_block_mgmt_interval;
140+
float m_cache_abm_interval;
141+
float m_cache_nodetimer_interval;
139142

140143
private:
141144
Mutex m_time_lock;

Diff for: ‎src/settings_translation_file.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ fake_function() {
409409
gettext("See http://www.sqlite.org/pragma.html#pragma_synchronous");
410410
gettext("Dedicated server step");
411411
gettext("Length of a server tick and the interval at which objects are generally updated over network.");
412+
gettext("Active Block Management interval");
413+
gettext("Time in between active block management cycles");
414+
gettext("ABM modifier interval");
415+
gettext("Length of time between ABM execution cycles");
416+
gettext("NodeTimer interval");
417+
gettext("Length of time between NodeTimer execution cycles");
412418
gettext("Ignore world errors");
413419
gettext("If enabled, invalid world data won't cause the server to shut down.\nOnly enable this if you know what you are doing.");
414420
gettext("Liquid loop max");

0 commit comments

Comments
 (0)
Please sign in to comment.