Chunks
Planetary Processing works by dividing your world into chunks. Chunks are cuboid segments of the world of fixed width and depth, and of infinite height.
Chunk Information
One can access information about the current chunk from the global variable 'chunk
'.
Initialising a Chunk
You may have noticed the existence of a file called init.lua
in the root of your game's git repository. This should contain a function called init
which is called whenever this chunk is loaded and is designed to initiate the state of this chunk.
Below is the example from the template that comes pre-installed in your repository. You can see that we spawn things only if chunk.Generated
is false, this is to ensure we only spawn things on the first load. However, in a game where state is not persisted (i.e. entities have entity.Transient = true
, this might be useful on every load).
Last updated