Cuboid (voxel) MC style generator

I am trying to code a 3D voxel cube world (think Minecraft, Minetest, Terasology et al) using the Panda3D engine. Initial work is up on github and is related to an old necro topic [url]Minecraft-like chunk generator].

Ultimately the goal is a space exploration game with blocky planets and other stuff to land on, each being a separate world of varying blocks whose available resources may differ from world to world (some ores or various types may be absent or present planet-to-planet). The blockships built to travel space might also conflict with those of other players (or NPCs) and have fights like in typical space world MMOs.

My plan is to use something like minecraft, minetest et al’s chunked format (using zlib to crunch them small) and a 3D sparse database (using sqlite3 perhaps) to store locations of celestial features (including ships) in suitably scaled coordinates (unit of 1 meter is certainly far too small, a million km being perhaps more reasonable for celestial scale). The rendering would switch from space to world when a vehicle issues the action to land on an atmosphere-containing body (small asteroids and stuff will be small and render in place without any special change in rendering mode).

Right now just doing POC for chunk based rendering and trying to get that part to work.

I welcome any suggestions for how to go about this. I fear at current the flatten function takes too long so I may need to generate unified meshes myself. As far as I can tell there has to be one mesh per unique texture meaning every different block type generates a new geom.

I’m lost on this since the manual states a very low maximum for geoms (it’s in the low hundreds) to maintain performance. It certainly cannot be per block (tens of thousands) or even per chunk (pi R square yields 805 chunks in a 16 chunk viewing range and this would be multiplied by the average of unique block types --thus textures-- encountered per chunk). Thus it turns into a complex problem rather quickly to be able to have addressable geometry for primitive adding/removal whenever a block is mined since the geoms needed to coalesce all encountered chunks into a single mesh per texture (block type). It gets even murkier when I consider that the chunks also need to be loadable and unloadable as the player moves.

I also suspect I might need to go into MinGW and use C++ as this chunk loader/unloader logic might be asking too much at the python level.

But again I welcome any suggestions.

You might want to consider another level, such as a “region” of several chunks, that can be merged together as well. I dont’ know if merging can be done in another thread/process, but that is an option if it could.

Another optimization is that the chunk and adjacent chunks the player and any other block altering item is in can remain unmerged as that is the only location that is likely to be changed.