]> git.lizzy.rs Git - minetest.git/commitdiff
Allow NodeTimer, ABM and block mgmt interval changes.
authorAuke Kok <sofar@foo-projects.org>
Wed, 2 Mar 2016 07:14:26 +0000 (23:14 -0800)
committerparamat <mat.gregory@virginmedia.com>
Sat, 19 Mar 2016 17:56:26 +0000 (17:56 +0000)
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.

builtin/settingtypes.txt
minetest.conf.example
src/defaultsettings.cpp
src/environment.cpp
src/environment.h
src/settings_translation_file.cpp

index 99106e00bd45fd2653112248724015db8ab918ab..0cacb528803d31c4dc7eb3965ca4b5f951c6d84d 100644 (file)
@@ -795,6 +795,15 @@ sqlite_synchronous (Synchronous SQLite) enum 2 0,1,2
 #    Length of a server tick and the interval at which objects are generally updated over network.
 dedicated_server_step (Dedicated server step) float 0.1
 
+#    Time in between active block management cycles
+active_block_mgmt_interval (Active Block Management interval) float 2.0
+
+#    Length of time between ABM execution cycles
+abm_interval (Active Block Modifier interval) float 1.0
+
+#    Length of time between NodeTimer execution cycles
+nodetimer_interval (NodeTimer interval) float 1.0
+
 #    If enabled, invalid world data won't cause the server to shut down.
 #    Only enable this if you know what you are doing.
 ignore_world_load_errors (Ignore world errors) bool false
index 6a9dc5ce3a5bd5665beeff411410f82855dadc59..65b1f19e595fff70935f1b755829c5f4045c5250 100644 (file)
 #    type: float
 # dedicated_server_step = 0.1
 
+#    Length of time between Active Block Management execution cycles
+#    type: float
+# active_block_mgmt_interval = 2.0
+
+#    Length of time between ABM execution cycles
+#    type: float
+# abm_interval = 1.0
+
+#    Length of time between NodeTimer execution cycles
+#    type: float
+# nodetimer_interval = 1.0
+
 #    If enabled, invalid world data won't cause the server to shut down.
 #    Only enable this if you know what you are doing.
 #    type: bool
index 84098e3d5595b39d9349de3dd322ce3ffa21b1ee..e00ff14898b3cef97700ff3e376b049b37efaef3 100644 (file)
@@ -280,6 +280,9 @@ void set_default_settings(Settings *settings)
        settings->setDefault("sqlite_synchronous", "2");
        settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
        settings->setDefault("dedicated_server_step", "0.1");
+       settings->setDefault("active_block_mgmt_interval", "2.0");
+       settings->setDefault("abm_interval", "1.0");
+       settings->setDefault("nodetimer_interval", "1.0");
        settings->setDefault("ignore_world_load_errors", "false");
        settings->setDefault("remote_media", "");
        settings->setDefault("debug_log_level", "action");
index 1de44e755011fe448894d937a179fbae7f402f29..902e2bda4f4b50f2ca179f54081881ddc964d33d 100644 (file)
@@ -59,6 +59,9 @@ Environment::Environment():
        m_day_night_ratio_override(0.0f)
 {
        m_cache_enable_shaders = g_settings->getBool("enable_shaders");
+       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");
 }
 
 Environment::~Environment()
@@ -1322,9 +1325,8 @@ void ServerEnvironment::step(float dtime)
        /*
                Manage active block list
        */
-       if(m_active_blocks_management_interval.step(dtime, 2.0))
-       {
-               ScopeProfiler sp(g_profiler, "SEnv: manage act. block list avg /2s", SPT_AVG);
+       if (m_active_blocks_management_interval.step(dtime, m_cache_active_block_mgmt_interval)) {
+               ScopeProfiler sp(g_profiler, "SEnv: manage act. block list avg per interval", SPT_AVG);
                /*
                        Get player block positions
                */
@@ -1399,11 +1401,10 @@ void ServerEnvironment::step(float dtime)
        /*
                Mess around in active blocks
        */
-       if(m_active_blocks_nodemetadata_interval.step(dtime, 1.0))
-       {
-               ScopeProfiler sp(g_profiler, "SEnv: mess in act. blocks avg /1s", SPT_AVG);
+       if (m_active_blocks_nodemetadata_interval.step(dtime, m_cache_nodetimer_interval)) {
+               ScopeProfiler sp(g_profiler, "SEnv: mess in act. blocks avg per interval", SPT_AVG);
 
-               float dtime = 1.0;
+               float dtime = m_cache_nodetimer_interval;
 
                for(std::set<v3s16>::iterator
                                i = m_active_blocks.m_list.begin();
@@ -1446,19 +1447,18 @@ void ServerEnvironment::step(float dtime)
                }
        }
 
-       const float abm_interval = 1.0;
-       if(m_active_block_modifier_interval.step(dtime, abm_interval))
+       if (m_active_block_modifier_interval.step(dtime, m_cache_abm_interval))
        do{ // breakable
                if(m_active_block_interval_overload_skip > 0){
                        ScopeProfiler sp(g_profiler, "SEnv: ABM overload skips");
                        m_active_block_interval_overload_skip--;
                        break;
                }
-               ScopeProfiler sp(g_profiler, "SEnv: modify in blocks avg /1s", SPT_AVG);
-               TimeTaker timer("modify in active blocks");
+               ScopeProfiler sp(g_profiler, "SEnv: modify in blocks avg per interval", SPT_AVG);
+               TimeTaker timer("modify in active blocks per interval");
 
                // Initialize handling of ActiveBlockModifiers
-               ABMHandler abmhandler(m_abms, abm_interval, this, true);
+               ABMHandler abmhandler(m_abms, m_cache_abm_interval, this, true);
 
                for(std::set<v3s16>::iterator
                                i = m_active_blocks.m_list.begin();
index 9b91a09289cd146a03d8d9aa1d82385ba5b212b8..660c6f1bc1840292dd4384958ab46db3cb674ce0 100644 (file)
@@ -136,6 +136,9 @@ class Environment
         *       a later release.
         */
        bool m_cache_enable_shaders;
+       float m_cache_active_block_mgmt_interval;
+       float m_cache_abm_interval;
+       float m_cache_nodetimer_interval;
 
 private:
        Mutex m_time_lock;
index 0e0c3acc0e1ceb8458ff0457f6268989e685184c..77fd6c68218250823582ad990b665b9b4fb41b67 100644 (file)
@@ -409,6 +409,12 @@ fake_function() {
        gettext("See http://www.sqlite.org/pragma.html#pragma_synchronous");
        gettext("Dedicated server step");
        gettext("Length of a server tick and the interval at which objects are generally updated over network.");
+       gettext("Active Block Management interval");
+       gettext("Time in between active block management cycles");
+       gettext("ABM modifier interval");
+       gettext("Length of time between ABM execution cycles");
+       gettext("NodeTimer interval");
+       gettext("Length of time between NodeTimer execution cycles");
        gettext("Ignore world errors");
        gettext("If enabled, invalid world data won't cause the server to shut down.\nOnly enable this if you know what you are doing.");
        gettext("Liquid loop max");