Well, as long as regions are connected I don't see any immediate benefit to further divisions besides chunks. Maybe within the far cache regions could be used to determine which chunks are cached in memory and which are left on disk. It might be useful to assemble temporary "regions" of chunks for light propagation as well I guess.
hagish said:
Is there currently anything to prevent "cascading" simulations to spawn the whole world?
The current system has a concept of a "fresh" chunks. These are chunks that exist but haven't been generated yet. While anything can create a new chunk, only the renderer currently can cause a chunk to be generated. I'm kind of tossing up replacing fresh chunks with semi-generated chunks - that have had any local features generated, but not features that can overlap chunks (like trees) or their lighting connected outwards.
So the chunk lifecycle would be something like:
Created as Semi-Generated - has basic terrain, internal lighting. Generated disconnected from the world by generators working directly on the chunk. Not eligible for rendering or communicating to clients. Can be updated through the world though.
-> Fully Generated - has (potentially) chunk-boundary crossing features generated, and lighting has been propagated out of it. The features are generated by generators working against the world rather than directly on the chunk (so using the same interfaces as any other block changing process).
-> Fully Connected - surrounded by fully generated chunks. Eligible for rendering and communication. Only at this point is a chunk correctly lit. Surrounded means all 8/26 chunks (2D/3D) around it. This means that to get a single renderable chunk requires a layer of 8 fully generated, surrounded by a layer of 16 semi generated chunks - or if we add vertical chunks, 26 fully generated and 98 semi generated. Although if we have vertical chunks we would drop the vertical height of each chunk I guess?
Preferably simulations should be set up to work only on fully connected chucks, and retain information for simulating unloaded chunks until they are next loaded or reanalyze them then. So generators should be hooked into the chunk lifecycle and receive events as chunks are loaded and unloaded.
I do like that changes are done through a World interface in the current system, that automatically handles lighting propagation and hides the existence of chunks from clients. Basically it is just changing blocks and I wouldn't want to lose that. Simplest fix I can think of is to change from setBlock(Vector3i pos, Block type) to boolean setBlock(Vector3i pos, Block newType, Block oldType), with it failing cleanly if oldType doesn't match the existing block. Oh, and something like changeBlocks(Vector3i[] positions, Block[] newBlockTypes, Block[] oldBlockTypes) to handle multiple at once. An alternative that may be good for longer running background processes is a transaction proxy through which state can be queried and changes requested, before being committed to the world. The proxy can keep track of chunk versions or do whatever magic is necessary for optimistic concurrency.
Begla, if you're about, any thoughts/comments? Am I missing something?