Node metadata inventory is only updated every 2 seconds

User avatar
orwell
Member
 
Posts: 778
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Node metadata inventory is only updated every 2 seconds

by orwell » Sun Jul 05, 2015 17:20

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.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

Sokomine
Member
 
Posts: 3827
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Node metadata inventory is only updated every 2 seconds

by Sokomine » Mon Jul 13, 2015 00:54

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.
A list of my mods can be found here.
 

est31
Developer
 
Posts: 173
Joined: Mon Dec 29, 2014 01:49
 

User avatar
TenPlus1
Member
 
Posts: 2575
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Node metadata inventory is only updated every 2 seconds

by TenPlus1 » Sun Jul 19, 2015 08:56

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:

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,
})
 

est31
Developer
 
Posts: 173
Joined: Mon Dec 29, 2014 01:49

Re: Node metadata inventory is only updated every 2 seconds

by est31 » Sun Jul 19, 2015 22:01

Those checks are needed. If I'm right, if you remove them, you allow people with hacked cllients to steal things from chests.
 

Sokomine
Member
 
Posts: 3827
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Node metadata inventory is only updated every 2 seconds

by Sokomine » Fri Jul 24, 2015 15:26

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.
A list of my mods can be found here.
 

User avatar
orwell
Member
 
Posts: 778
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Node metadata inventory is only updated every 2 seconds

by orwell » Sun Jul 26, 2015 20:58

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
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

Sokomine
Member
 
Posts: 3827
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Node metadata inventory is only updated every 2 seconds

by Sokomine » Wed Jul 29, 2015 23:43

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.
A list of my mods can be found here.
 

User avatar
orwell
Member
 
Posts: 778
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Node metadata inventory is only updated every 2 seconds

by orwell » Mon Nov 16, 2015 21:13

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!
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
Fixer
Member
 
Posts: 888
Joined: Sun Jul 31, 2011 11:23
Location: Ukraine
IRC: Fixer
In-game: Fixer
 

User avatar
orwell
Member
 
Posts: 778
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Node metadata inventory is only updated every 2 seconds

by orwell » Mon Nov 23, 2015 11:14

Finally, someone who understands me.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

Re: Node metadata inventory is only updated every 2 seconds

by Hybrid Dog » Sun Dec 27, 2015 18:36


‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
yyt16384
Member
 
Posts: 46
Joined: Mon Nov 03, 2014 12:16
Location: China
GitHub: yyt16384
IRC: yyt16384
In-game: yyt16384

Re: Node metadata inventory is only updated every 2 seconds

by yyt16384 » Wed Dec 30, 2015 05:38

Hybrid Dog wrote:Maybe it's caused by that:
https://github.com/minetest/minetest/bl ... ample#L764


I think it is this one: https://github.com/minetest/minetest/bl ... e.cpp#L358

It 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.
 

zefron
New member
 
Posts: 1
Joined: Wed Dec 30, 2015 06:56
GitHub: zefron
IRC: zefron
In-game: zefron

Re: Node metadata inventory is only updated every 2 seconds

by zefron » Wed Dec 30, 2015 06:57

thanks a lot for the information .....well done
Graduated from Soran University with First Class Degree with Honours in Computer Science.
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

Re: Node metadata inventory is only updated every 2 seconds

by Hybrid Dog » Wed Dec 30, 2015 10:58

l didn't know using goto is allowed…

How about increasing that value to e.g. 10 seconds and testing what happens?

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

Re: Node metadata inventory is only updated every 2 seconds

by Hybrid Dog » Thu Dec 31, 2015 09:58


‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
orwell
Member
 
Posts: 778
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Node metadata inventory is only updated every 2 seconds

by orwell » Tue Feb 02, 2016 11:16

yyt16384 wrote:
Hybrid Dog wrote:Maybe it's caused by that:
https://github.com/minetest/minetest/bl ... ample#L764


I think it is this one: https://github.com/minetest/minetest/bl ... e.cpp#L358

It 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.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 


Return to Problems



Who is online

Users browsing this forum: No registered users and 2 guests