开发者

How to insert and remove blocks quickly in a Minecraftian world?

开发者 https://www.devze.com 2023-02-26 16:02 出处:网络
I currently have volume data for the world stored as an array of booleans. I then check each empty block and if it has non-empty neighbors the faces get drawn. This prevents me from sending a bunch of

I currently have volume data for the world stored as an array of booleans. I then check each empty block and if it has non-empty neighbors the faces get drawn. This prevents me from sending a bunch of faces to the graphics card using opengl.

I'm now working on inserting and removing blocks but I'm not sure how to do this quickly. It is simple enough to change the volume data b开发者_开发技巧ut I don't want to recompute all the vertices from the volume data each time someone inserts or removes a block. It occurred to me just to add the block to the vertex buffer at the end of the existing vertex data but then I don't have a good way of destroying it as I have no way to correlate between the volume and vertex buffer data.

Any help is appreciated.


I think you might want to add the "algorithm" tag to it. I think the way the real minecraft works is it stores blocks of 16x16x16, and every time one small block is updated, it simply reupdates the vertices info for that larger block.

That's my understanding, I could be very wrong. I'm sure you can learn more about this all over the internet and the minecraft forums. Lots of minecraft algo talk over there.


Octree might help you to recompute just changed block.

0

精彩评论

暂无评论...
验证码 换一张
取 消