Page 1 of 1
Node metadata inventory is only updated every 2 seconds

Posted:
Sun Jul 05, 2015 17:20
by orwell
Although this should be a common problem, nobody is complying about it.
Situation: server running locally, client running in an extra process.
Version: 0.4.12-dev from today(2015-7-5).
Process of putting or taking items into or out of metadata inventories:
1. In client: moving the item.
2. almost immediately: a debug message on the server tells that the item has been moved.
3. after a time ranging from 0 to 2 seconds: the item is actually shown in the new location.
It appears like everything is updated in a 2 seconds interval. Just try to put many items into a chest using the new listring feature: the new items appear simultaneously every 2 seconds!
That inventory lag cannot be caused by network connectivity, then it would be unexplainable that the client->server packet is transferred in <10ms, but the packet back takes 2 seconds. This leads me to 2 possible explanations:
1. the inventory metadata changes are only send from the server to the clients in a 2sec interval
2. the client displays the changes only every 2 seconds
Interestingly, movements inside the player inventory are not slowed down this way. I would therefore consider the first option.
i am not familiar with c++, so i can't figure out the problem myself.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Mon Jul 13, 2015 00:54
by Sokomine
That used to affect only locked chests from minetest_game. Normal chests had client prediction and had far less apparent lag. I don't know if anything changed there. Just compare the two chest types. If the locked chest is slower for you than the non-locked one, just screw the locked chest from minetest_game and replace it with an alternate locked chests. It's the hide-the-content-from-other-than-its-owner-"feature" that causes this huge annoyance.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Sat Jul 18, 2015 20:34
by est31
I agree, the bug is horrible.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Sun Jul 19, 2015 08:56
by TenPlus1
I've commented on this before where the locked chest node has so many checks to see if the player owns the chest... I would remove a few apart from on_rightclick to speed things up:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node("default:chest_locked", {
description = "Locked Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
paramtype2 = "facedir",
groups = {choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Locked Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
-- meta:set_string("infotext", "Locked Chest")
-- meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
end,
-- allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
-- local meta = minetest.get_meta(pos)
-- if not has_locked_chest_privilege(meta, player) then
-- return 0
-- end
-- return count
-- end,
-- allow_metadata_inventory_put = function(pos, listname, index, stack, player)
-- local meta = minetest.get_meta(pos)
-- if not has_locked_chest_privilege(meta, player) then
-- return 0
-- end
-- return stack:get_count()
-- end,
-- allow_metadata_inventory_take = function(pos, listname, index, stack, player)
-- local meta = minetest.get_meta(pos)
-- if not has_locked_chest_privilege(meta, player) then
-- return 0
-- end
-- return stack:get_count()
-- end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, clicker) then
minetest.show_formspec(
clicker:get_player_name(),
"default:chest_locked",
get_locked_chest_formspec(pos)
)
end
end,
on_blast = function() end,
})
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Sun Jul 19, 2015 22:01
by est31
Those checks are needed. If I'm right, if you remove them, you allow people with hacked cllients to steal things from chests.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Fri Jul 24, 2015 15:26
by Sokomine
Yes, it's the other way around. It's the hide-content-from-non-owners that's causing the huge visible lag - not the inventory movement as such. It won't act as a locked chest if everyone can take something out or put something in.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Sun Jul 26, 2015 20:58
by orwell
The bug has nothing to do with owners!
If i understand your posts right, the bug applies for locked chests only because of an display-only-to-owners system.
This is not what I think. I was using the "default" mod of minetest_game in another subgame when discovering this bug, and it appeared on normal chests (so apparently there was no prediction by client). I am not using the single player, I start a server locally and then join. And I see no reason why this is exactly a 2sec interval. (just try it using the new listring feature.)
It maybe could be the display-to-owners-only code, but for any reason it is used for non-locked chests too. Are normal chests behaving like locked ones too?
Note: the default mod I used I downloaded in March or so, because I am using Mintest on Win7 too and the current minetest_game from github is not working in the stable win7 build of 0.4.12
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Wed Jul 29, 2015 23:43
by Sokomine
No, that particular phenomenon only occours with locked chests. Of course block updates of non-locked chests also take some time - but that's usually less visible and thus less of a problem.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Mon Nov 16, 2015 21:13
by orwell
This discussion has died.
So I will revive it.
There is something like metadata and a specific interval, which does not only apply for inventories but for the forms itself. Read the posts above, this is also the case for the switches in the pipeworks sorting tube forms.
I'm playing Minetest for almost a year now and I recognized that I do not recognize those inventory lags anymore. Seems like one adjusts to it. But anyway, it is there, you can't deny!
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Mon Nov 16, 2015 21:57
by Fixerol
I have this lag on multiplayer.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Mon Nov 23, 2015 11:14
by orwell
Finally, someone who understands me.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Sun Dec 27, 2015 18:36
by Hybrid Dog
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Wed Dec 30, 2015 05:38
by yyt16384
I think it is this one:
https://github.com/minetest/minetest/bl ... e.cpp#L358It is not changed anywhere outside of this method, so once you set it to 2.0 you will not push blocks to send for 2 seconds, which looks wrong to me. Probably it should be reset when blocks are changed.
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Wed Dec 30, 2015 06:57
by zefron
thanks a lot for the information .....well done
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Wed Dec 30, 2015 10:58
by Hybrid Dog
l didn't know using goto is allowed…
How about increasing that value to e.g. 10 seconds and testing what happens?
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Thu Dec 31, 2015 09:58
by Hybrid Dog
Re: Node metadata inventory is only updated every 2 seconds

Posted:
Tue Feb 02, 2016 11:16
by orwell
yyt16384 wrote:I think it is this one:
https://github.com/minetest/minetest/bl ... e.cpp#L358It is not changed anywhere outside of this method, so once you set it to 2.0 you will not push blocks to send for 2 seconds, which looks wrong to me. Probably it should be reset when blocks are changed.
Yes, this is it. I made a
pull request for this.