Input to Chunk Procedural World Generation
Home -->
Programming Projects -->
Fractal Block Engine -->
Procedural World Generation -->
Input to Chunk Procedural World Generation
What data do we need to create a chunk?
When a request is made to the procedural world generation system
to create a chunk C, here is the data the system is allowed
to access as input:
- The path of the chunk (from the root of the chunk tree).
- The block type of every chunk along the path
of the chunk path.
In particular, the block type of the chunk is given.
- The block types of nearby chunks.
Specifically, all block types of chunks in the
5x5x5 region surrounding the chunk are given.
- The block types of nearby chunks
of the parent chunk.
Specifically, if P is the parent chunk of C,
then we pass all block types of chunks in the
3x3x3 region surrounding P.
- The block variables both of the chunk being
created and the block variables of the parent chunk.
Giving all the information
When we generate a chunk, we give all the information above
to the procedural world generation system.
One could imagine a system where we only give a portion of this
information, and if the procedural world generation system needs
more information it will query the main system.
However this seems really complicated
and it could turn into a rabbit hole,
so Fractal Block World does not do it that way.
The 5x5x5 Region
We can make a chunk of type "flower".
If the chunk below the flower chunk has a certain
block type, we can change how we make the flower
(perhaps we do not create the flower if the
chunk below is of an "empty" type of block).
For most applications, only the 3x3x3 region
of blocks is needed, not the 5x5x5 region.
However we give the algorithm
the entire 5x5x5 region because 5^3 = 125 blocks
is not a huge number, but 7^3 = 343
is a little too much.
Note that we also pass the 3x3x3 region
surrounding the parent chunk.
Block Variables
Suppose we have a "wood" block which has a variable called
"health".
When we generate the chunk of that block,
if the health is less than 50 we can generate it
differently than if its health is more than 50.
Now consider a block type called "forest".
The bottom 15x15x1 blocks of the forest are all
also of type "forest".
Suppose we want these forest blocks to be
generated differently depending on their depth.
This can be accomplished using block variables.
That is, we can have all "forest" type blocks
have a variable called "depth".
When generating a "forest" type block,
if the block has a parent that does NOT have type
"forest", then the chunk generation algorithm
can set the depth variable of
the chunk being generated to be 0.
On the other hand,
if a "forest" type block has a parent
of type "forest" and that parent has the block
variable "depth" with value d,
then the chunk generation algorithm
can set the depth variable of the
chunk being generated to be d+1.
We could change the engine so the chunks being
generated have access to the block variables
off ALL blocks in the path for the chunk.
However we only want to make this change
if there is a compelling reason to do so.