I'm working on a sanbox game project. I use voxel terrain and my world is infinite. It is divided into 16x16x16 chunks. Generating the heightmap is quite easy, but generating structures like trees or ponds is a problem and here's why:
Each of these structures can reach outside the given chunk and my generator works like this:
The easiest solution would be to just create a map full of chunks and then run the generator over the whole map using world.setVoxel that would work out the proper chunk and set the block, but my world generates also as the player moves so the problem is that if eg. I generate a big tree and its trunk resides on the chunk, which just has been created by player motion, an already existing chunk could be altered eg. by the leaves which generate along with a tree and this is really bad:
consider a tunnel starting on a chunk created due to the player's motion. This chunk gets generated and it changes half of the world player can see because it is carved so that it changes the existing chunks!
I don't know how to resolve that problem and setting sth like MAX_SPREAD to each component is not also good because then a lot more chunks would have to be generated. Doing everything only based on noise (like heightmap) is not an option either, because I'll want also to generate from some pre-loaded structures like villages or castles.
Please help me and thanks in advance.