Block updating

For people working on the C++ code.
dodomorandi
New member
 
Posts: 6
Joined: Fri Oct 07, 2011 13:29

Block updating

by dodomorandi » Tue Oct 25, 2011 21:19

I'm quite in trouble when updating a block.
As you can see from my fork I'm trying to implement a "modular door", as suggested in a post. I need to use quite a lot the NodeMetadata class to define properties and let a single node handle every "child" (if a portion of a door is opened, for example, every node must be "opened"). To make the code run smooth I decided to let the doors handle pointers to parent and children. And that's the problem: when a TOCLIENT_BLOCKDATA command is sent, the new block is naturally deserialized. But the deserialization process is gradual, and the client crashes exactly when the MapNode and NodeMetadata information is partially saved in the MapBlock.
I thought to one solution (and maybe it could be THE solution, but I need your help) for this problem: I added the method MapSector::setBlock, to which a Mapblock object is passed (like MapSector::insertBlock) and sets (instead of inserting) the new node and then deleting the old one. The problem is... the client "flashes" when the block is completely rewritten.
So... what do you think I can do? Mutex-ing the client so a block is not rendered as new when it's rewritten? Making a new command to explicitly update Metadata? I'm trying to find a good solution, but I'm quite short of ideas.

I'll wait for your help!
-- dodomorandi
 

dodomorandi
New member
 
Posts: 6
Joined: Fri Oct 07, 2011 13:29

by dodomorandi » Fri Oct 28, 2011 15:26

Ok, there are some news.
I implemented a new server to client command in my fork. I called simply TOCLIENT_UPDATENODE and it's been developed to update little portion of map. TOCLIENT_BLOCKDATA is useful when a block has to be completely passed ex-novo to the client. But with this command you can specify a vector of absolute coordinates to update. The update is done either on MapNodes and NodeMetadatas, and it's done grouping coordinates by blocks, so it's passed the position of a block and a collection of block relative positions with serialized data. I'm testing this with doors, and it's so much faster than updating full blocks (with edges). And naturally I don't have the problem I was talking in the main post.

What do you think about this kind of approach? I think your opinion it's important, because I'm trying to develop minetest (like everyone, I think :-) ) in a developer-friendly way. Discussing and maybe changing point of view could be a good thing, for me, for everyone who want...

Thank you for everything!
-- dodomorandi
 

User avatar
Staffs
Member
 
Posts: 329
Joined: Thu Aug 04, 2011 13:16

by Staffs » Fri Oct 28, 2011 15:38

You said "As you can see in my fork" Lol i didnt even know you had a fork do you have it in bitbucket if yes tell me the link :)
I love mods :D
 

dodomorandi
New member
 
Posts: 6
Joined: Fri Oct 07, 2011 13:29
 

User avatar
Melkor
Member
 
Posts: 292
Joined: Sat Sep 24, 2011 01:03
Location: Underground

by Melkor » Sun Nov 06, 2011 17:57

Thank you for adding this! :) the doors can be made of wood or iron, right? Can i suggest stone and cobble too? They can be usefull making secrets passage doors. Dont forget the hatches too :D
 


Return to Partly official engine development



Who is online

Users browsing this forum: No registered users and 0 guests