Defining this function sets a custom order in which to create chunks. The function should look like:
(i, j, k) => 1 // return a smaller number for chunks to process first
Game clients should set this if they need to manually control
which chunks to load and unload. When set, client should call
noa.world.manuallyLoadChunk
/ manuallyUnloadChunk
as needed.
Limit the size of internal chunk processing queues
Limit the size of internal chunk processing queues
Cutoff (in ms) of time spent each render
Cutoff (in ms) of time spent each tick
Set this higher to cause chunks not to mesh until they have some neighbors. Max legal value is 26 (each chunk will mesh only when all neighbors are present)
When true, worldgen queues will keep running if engine is paused.
Tells noa to discard voxel data within a given AABB
(e.g. because
the game client received updated data from a server).
The engine will mark all affected chunks for removal, and will later emit
new worldDataNeeded
events (if the chunk is still in draw range).
When manually controlling chunk loading, tells the engine that the chunk containing the specified (x,y,z) needs to be created and loaded.
Note: throws unless
noa.world.manuallyControlChunkLoading
is set.
When manually controlling chunk loading, tells the engine that the chunk containing the specified (x,y,z) needs to be unloaded and disposed.
Note: throws unless
noa.world.manuallyControlChunkLoading
is set.
Rest
...args: any[]Sets the distances within which to load new chunks, and beyond which to unload them. Generally you want the remove distance to be somewhat farther, so that moving back and forth across the same chunk border doesn't keep loading/unloading the same distant chunks.
Both arguments can be numbers (number of voxels), or arrays like:
[horiz, vert]
specifying different horizontal and vertical distances.
Clients should call this after creating a chunk's worth of data (as an ndarray)
If userData is passed in it will be attached to the chunk
the string specified when the chunk was requested
an ndarray of voxel data
an arbitrary value for game client use
specify a voxel ID here if you want to signify that
the entire chunk should be solidly filled with that voxel (e.g. 0
for air).
If you do this, the voxel array data will be overwritten and the engine will
take a fast path through some initialization steps.
Generated using TypeDoc
noa.world
- manages world data, chunks, voxels.This module uses the following default options (from the options object passed to the Engine):
Events:
worldDataNeeded = (requestID, dataArr, x, y, z, worldName)
Alerts client that a new chunk of world data is needed.
playerEnteredChunk => (i, j, k)
Fires when player enters a new chunk
chunkAdded => (chunk)
Fires after a new chunk object is added to the world
chunkBeingRemoved = (requestID, dataArr, userData)
Fires before a chunk is removed from world