set_pos or move_node

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

set_pos or move_node

by neko259 » Sun Mar 15, 2015 13:33

Is there a way to do subj? Now to move a node we need to do 2 heavy actions: remove one node and create a new node, and serialize/deserialize their metadata. Also, with this we lose all callbacks made on a node (IMO, I can be wrong).
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: set_pos or move_node

by Krock » Sat Mar 21, 2015 08:09

Those functions look interesting.
I doupt there will be a huge speedup if you add this into the core because the data must be deleted somewhere in the database and added on another place. But on the other side, it wouldn't require to (de)serialize the data everytime.

I support this idea :)
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

Re: set_pos or move_node

by neko259 » Sat Mar 21, 2015 08:20

Krock wrote:I doupt there will be a huge speedup if you add this into the core because the data must be deleted somewhere in the database and added on another place.

It does not need to be deleted. Just update its coordinates. I doubt minetest data structure is so horrible to store coordinates and data in the same field which can cause update of all row.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: set_pos or move_node

by rubenwardy » Sat Mar 21, 2015 19:58

Nodes are stored in MapBlocks. Each MapBlock is a row which contains a "blob" of binary data to store the nodes within it. Therefore, nodes are not stored in their own rows. I'm not sure how meta data is stored, however.
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

Re: set_pos or move_node

by neko259 » Sat Mar 21, 2015 21:19

rubenwardy wrote:Nodes are stored in MapBlocks. Each MapBlock is a row which contains a "blob" of binary data to store the nodes within it. Therefore, nodes are not stored in their own rows. I'm not sure how meta data is stored, however.

Oh gosh. Then I think this structure should be first rewritten to normal "1 node - 1 row" structure, and then we could talk about performance of moving nodes or doing anything else to them. If the whole block gets updated every time one node changes in it, this means we have around 4095x slowness (if I remember correct and block is 16*16*16 nodes)?
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron