From: Perttu Ahola Date: Tue, 18 Oct 2011 23:17:23 +0000 (+0300) Subject: Fix and tune block sending X-Git-Tag: 0.3.dev-20111021~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3a06fb88314cff3dd0c96665229b47af0f01b276;p=oweals%2Fminetest.git Fix and tune block sending --- diff --git a/minetest.conf.example b/minetest.conf.example index 6f817d337..30adc5e60 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -143,8 +143,8 @@ #active_block_range = 2 #max_simultaneous_block_sends_per_client = 2 #max_simultaneous_block_sends_server_total = 8 -#max_block_send_distance = 8 -#max_block_generate_distance = 8 +#max_block_send_distance = 7 +#max_block_generate_distance = 5 #time_send_interval = 20 # Length of day/night cycle. 72=20min, 360=4min, 1=24hour #time_speed = 72 diff --git a/src/client.cpp b/src/client.cpp index 816ab39ca..5ec53a524 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -156,7 +156,7 @@ void * MeshUpdateThread::Thread() continue; } - ScopeProfiler sp(g_profiler, "mesh make"); + ScopeProfiler sp(g_profiler, "Client: Mesh making"); scene::SMesh *mesh_new = NULL; mesh_new = makeMapBlockMesh(q->data); diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 8429ff22c..7f0d46a10 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -101,8 +101,8 @@ void set_default_settings(Settings *settings) // This causes frametime jitter on client side, or does it? settings->setDefault("max_simultaneous_block_sends_per_client", "2"); settings->setDefault("max_simultaneous_block_sends_server_total", "8"); - settings->setDefault("max_block_send_distance", "8"); - settings->setDefault("max_block_generate_distance", "8"); + settings->setDefault("max_block_send_distance", "7"); + settings->setDefault("max_block_generate_distance", "5"); settings->setDefault("time_send_interval", "20"); settings->setDefault("time_speed", "96"); settings->setDefault("server_unload_unused_data_timeout", "60"); diff --git a/src/server.cpp b/src/server.cpp index 3a3d0b823..1a441e819 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -354,11 +354,10 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime, // Increment timers m_nothing_to_send_pause_timer -= dtime; + m_nearest_unsent_reset_timer += dtime; if(m_nothing_to_send_pause_timer >= 0) { - // Keep this reset - m_nearest_unsent_reset_timer = 0; return; } @@ -410,17 +409,13 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime, /*infostream<<"m_nearest_unsent_reset_timer=" < 10.0) + // Reset periodically to workaround for some bugs or stuff + if(m_nearest_unsent_reset_timer > 20.0) { m_nearest_unsent_reset_timer = 0; m_nearest_unsent_d = 0; - /*infostream<<"Resetting m_nearest_unsent_d for " - <getPlayerName(peer_id)<getPlayerName(peer_id)<getS16("max_block_generate_distance"); // Don't loop very much at a time - if(d_max > d_start+1) - d_max = d_start+1; + s16 max_d_increment_at_time = 2; + if(d_max > d_start + max_d_increment_at_time) + d_max = d_start + max_d_increment_at_time; /*if(d_max_gen > d_start+2) d_max_gen = d_start+2;*/ //infostream<<"Starting from "<getPlayerName(peer_id)<m_emerge_queue.addBlock(peer_id, p, flags); server->m_emergethread.trigger(); + + if(nearest_emerged_d == -1) + nearest_emerged_d = d; + } else { + if(nearest_emergefull_d == -1) + nearest_emergefull_d = d; } // get next one. continue; } + if(nearest_sent_d == -1) + nearest_sent_d = d; + /* Add block to send queue */ + /*errorstream<<"sending from d="<getPlayerName(peer_id)< g_settings->getS16("max_block_send_distance")){ + new_nearest_unsent_d = 0; + m_nothing_to_send_pause_timer = 2.0; + /*infostream<<"GetNextBlocks(): d wrapped around for " + <getPlayerName(peer_id) + <<"; setting to 0 and pausing"<= - g_settings->getS16("max_block_send_distance")) - { - // Pause time in seconds - m_nothing_to_send_pause_timer = 1.0; - /*infostream<<"nothing to send to " - <getPlayerName(peer_id) - <<" (d="<