-
Notifications
You must be signed in to change notification settings - Fork 35
Chunk and Terrain materializers storages
Chunks are stoked in classes inherited from ChunkData
, theses classes contains everything necessary to create the chunk view.
Here is the current available Chunk storage classes:
class | description / content |
---|---|
ChunkData | base class, can not be instanciated, contains an int size of the chunk. |
SideView2DData | for sideview procedural generation (like terraria / starbound), |
TopDown2DData | for topdown procedural FLAT maps like old rpg games. contains Texture2D texture to apply to a plane. |
Planar3DData | comming soon |
Spherical3DData | comming soon |
Cubic3DData | comming soon |
Density1DData | comming soon |
Density2DData | comming soon |
Density3DData | comming soon |
MeshData | comming soon |
Terrain materializers are used to render ChunkData
inherited classes to a visual terrain.
We currently support: PWTopDown2DTerrain
and PWSideView2DTerrain
.
If you want to create your own terrain materializer, create a class inherited from PWTerrainBase
and override the folowing functions:
- public override object OnChunkCreate(ChunkData cd, Vector3 pos)
- public override void OnChunkRender(ChunkData cd, object userDefinedObject, Vector3 pos)
The OnChunkCreate
function is called when a new chunk is generated. Once you generate your rendering GameObject, you need to return it so the base class can store it with the chunk.
When a chunk need to be visually updated (LOD, hide/show, ...), the OnChunkRender
function is called and the userDefinedObject
parameter is the object you create and return in OnChunkCreate
.
Terrain storage saves/load the generated terrain. Two modes are supported: PWStorageMode.MEMORY
and PWStorageMode.FILE
, the variable terrainStorage.storeMode
in the PWTerrainBase
class can be edited to modify the chunk storage mode.
Memory storage is used to test, Chunks will only be available for the current session, they are stored in the ram.
File storage is kind of obvious, the storageFolder
field can be modified to changed the chunk location, by default the location is: Application.dataPath + "/Levels/"