Page 1 of 1

set_pos or move_node

PostPosted: Sun Mar 15, 2015 13:33
by neko259
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).

Re: set_pos or move_node

PostPosted: Sat Mar 21, 2015 08:09
by Krock
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 :)

Re: set_pos or move_node

PostPosted: Sat Mar 21, 2015 08:20
by neko259
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.

Re: set_pos or move_node

PostPosted: Sat Mar 21, 2015 19:58
by rubenwardy
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.

Re: set_pos or move_node

PostPosted: Sat Mar 21, 2015 21:19
by neko259
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)?