From ffad18e42442fed10c312adc989fc62b74e05896 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Sat, 24 Nov 2012 19:02:16 +0100 Subject: [PATCH 1/4] Use wielditem drawtype for all nodes in item_entity --- builtin/item_entity.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/item_entity.lua b/builtin/item_entity.lua index 2b12764f1..8657e64af 100644 --- a/builtin/item_entity.lua +++ b/builtin/item_entity.lua @@ -41,17 +41,17 @@ minetest.register_entity("__builtin:item", { prop = { is_visible = true, visual = "sprite", - textures = {"unknown_item.png"} + textures = {"unknown_item.png"}, + visual_size = {x=0.50, y=0.50} } - if item_texture and item_texture ~= "" then - prop.visual = "sprite" - prop.textures = {item_texture} - prop.visual_size = {x=0.50, y=0.50} - else + if item_type == "node" then prop.visual = "wielditem" prop.textures = {itemname} prop.visual_size = {x=0.20, y=0.20} prop.automatic_rotate = math.pi * 0.25 + elseif item_texture and item_texture ~= "" then + prop.visual = "sprite" + prop.textures = {item_texture} end self.object:set_properties(prop) end, From 6b927229f5f9cb9a8163ecec482160975199fa0f Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 26 Nov 2012 22:31:21 +0200 Subject: [PATCH 2/4] Default server step to 0.1s and sync object/player update intervals to it --- minetest.conf.example | 4 ++-- src/client.cpp | 11 ++++++++++- src/client.h | 3 +++ src/clientserver.h | 1 + src/defaultsettings.cpp | 2 +- src/environment.cpp | 8 +++++++- src/environment.h | 6 +++--- src/server.cpp | 3 ++- 8 files changed, 29 insertions(+), 9 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index 3f292c01e..aebab825c 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -194,7 +194,7 @@ # To reduce lag, block transfers are slowed down when a player is building something. # This determines how long they are slowed down after placing or removing a node. #full_block_send_enable_min_time_from_building = 2.0 -# Length of a server tick in dedicated server -#dedicated_server_step = 0.05 +# Length of a server tick and the interval at which objects are generally updated over network +#dedicated_server_step = 0.1 # Can be set to true to disable shutting down on invalid world data #ignore_world_load_errors = false diff --git a/src/client.cpp b/src/client.cpp index 1936c2ce9..4117a9130 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -267,6 +267,7 @@ Client::Client( m_time_of_day_set(false), m_last_time_of_day_f(-1), m_time_of_day_update_timer(0), + m_recommended_send_interval(0.1), m_removed_sounds_check_timer(0) { m_packetcounter_timer = 0.0; @@ -658,7 +659,7 @@ void Client::step(float dtime) { float &counter = m_playerpos_send_timer; counter += dtime; - if(counter >= 0.2) + if(counter >= m_recommended_send_interval) { counter = 0.0; sendPlayerPos(); @@ -1022,6 +1023,14 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) m_map_seed = readU64(&data[2+1+6]); infostream<<"Client: received map seed: "<= 2+1+6+8+4) + { + // Get map seed + m_recommended_send_interval = readF1000(&data[2+1+6+8]); + infostream<<"Client: received recommended send interval " + <setDefault("server_unload_unused_data_timeout", "29"); settings->setDefault("server_map_save_interval", "5.3"); settings->setDefault("full_block_send_enable_min_time_from_building", "2.0"); - settings->setDefault("dedicated_server_step", "0.05"); + settings->setDefault("dedicated_server_step", "0.1"); settings->setDefault("ignore_world_load_errors", "false"); settings->setDefault("mip_map", "false"); settings->setDefault("anisotropic_filter", "false"); diff --git a/src/environment.cpp b/src/environment.cpp index b8e037376..e70cb39b7 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -329,7 +329,8 @@ ServerEnvironment::ServerEnvironment(ServerMap *map, lua_State *L, m_send_recommended_timer(0), m_active_block_interval_overload_skip(0), m_game_time(0), - m_game_time_fraction_counter(0) + m_game_time_fraction_counter(0), + m_recommended_send_interval(0.1) { } @@ -940,6 +941,11 @@ void ServerEnvironment::step(float dtime) /* Step time of day */ stepTimeOfDay(dtime); + // Update this one + // NOTE: This is kind of funny on a singleplayer game, but doesn't + // really matter that much. + m_recommended_send_interval = g_settings->getFloat("dedicated_server_step"); + /* Increment game time */ diff --git a/src/environment.h b/src/environment.h index e2028d614..0cc53f9a6 100644 --- a/src/environment.h +++ b/src/environment.h @@ -205,9 +205,7 @@ public: { return m_gamedef; } float getSendRecommendedInterval() - { - return 0.10; - } + { return m_recommended_send_interval; } /* Save players @@ -367,6 +365,8 @@ private: // A helper variable for incrementing the latter float m_game_time_fraction_counter; core::list m_abms; + // An interval for generally sending object positions and stuff + float m_recommended_send_interval; }; #ifndef SERVER diff --git a/src/server.cpp b/src/server.cpp index 6f80c82f7..cb5447605 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2224,11 +2224,12 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) Answer with a TOCLIENT_INIT */ { - SharedBuffer reply(2+1+6+8); + SharedBuffer reply(2+1+6+8+4); writeU16(&reply[0], TOCLIENT_INIT); writeU8(&reply[2], deployed); writeV3S16(&reply[2+1], floatToInt(playersao->getPlayer()->getPosition()+v3f(0,BS/2,0), BS)); writeU64(&reply[2+1+6], m_env->getServerMap().getSeed()); + writeF1000(&reply[2+1+6+8], g_settings->getFloat("dedicated_server_step")); // Send as reliable m_con.Send(peer_id, 0, reply, true); From 5f798d944ee03beca205b107dda58bdc72dd2bf8 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Tue, 27 Nov 2012 01:35:18 +0200 Subject: [PATCH 3/4] Fix forgotten material properties for meshes (also seems to have been forgotten for cubes previously). This allows transparent png images to work properly --- src/content_cao.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/content_cao.cpp b/src/content_cao.cpp index c7d21d278..8229ded62 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -923,6 +923,11 @@ public: m_prop.visual_size.X)); u8 li = m_last_light; setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li)); + + m_meshnode->setMaterialFlag(video::EMF_LIGHTING, false); + m_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false); + m_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF); + m_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true); } else if(m_prop.visual == "mesh"){ infostream<<"GenericCAO::addToScene(): mesh"<getMesh(), video::SColor(255,li,li,li)); + + m_animated_meshnode->setMaterialFlag(video::EMF_LIGHTING, false); + m_animated_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false); + m_animated_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF); + m_animated_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true); } else errorstream<<"GenericCAO::addToScene(): Could not load mesh "< Date: Tue, 27 Nov 2012 17:32:58 +0200 Subject: [PATCH 4/4] Revert "Use wielditem drawtype for all nodes in item_entity" This reverts commit ffad18e42442fed10c312adc989fc62b74e05896. --- builtin/item_entity.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/item_entity.lua b/builtin/item_entity.lua index 8657e64af..2b12764f1 100644 --- a/builtin/item_entity.lua +++ b/builtin/item_entity.lua @@ -41,17 +41,17 @@ minetest.register_entity("__builtin:item", { prop = { is_visible = true, visual = "sprite", - textures = {"unknown_item.png"}, - visual_size = {x=0.50, y=0.50} + textures = {"unknown_item.png"} } - if item_type == "node" then + if item_texture and item_texture ~= "" then + prop.visual = "sprite" + prop.textures = {item_texture} + prop.visual_size = {x=0.50, y=0.50} + else prop.visual = "wielditem" prop.textures = {itemname} prop.visual_size = {x=0.20, y=0.20} prop.automatic_rotate = math.pi * 0.25 - elseif item_texture and item_texture ~= "" then - prop.visual = "sprite" - prop.textures = {item_texture} end self.object:set_properties(prop) end,