Core Concepts
Map anatomy
Terrain/Map
A map (or terrain grid) is the top level representation of a Tycoon Tile terrain. It contains all the tile data in a flattened 2D array. It has a set width and length.
Chunk
A chunk is standard sized partition of a map. It is used as an optimization measure to update the graphical mesh that represents a part of the terrain. By using chunks and only updating meshes of parts of the terrain that have changed, updating all the meshes of the entire terrain is prevented. Update work is distributed across background threads on a per-chunk basis. The chunk size is configurable on the TycoonTileMap component. Larger chunks means that larger parts of the terrain will be regenerated when changes are made. Smaller chunks allow for more refined control over which parts of the terrain needs regeneration, but has more memory overhead for managing these chunks and their separate meshes, while also increasing the number of draw calls.
A chunk size of 16 to 32 is recommended.
Image shows a Tycoon Tile map of 32 by 32 size. One chunk of 16 by 16 in size is highlighted in yellow.
Tile
A tile represents a 1 by 1 unit area of the terrain that consists of 4 corners of which the height can be individually adjusted. A tile is the basic unit on which TycoonTile operates.
Image shows a 3 by 3 tile map with the center tile extruded.
Tile corner
Represent a single height sample in one corner of a tile. Each corner height can be adjusted in steps. The world height per step can be configured on the TycoonTileMap component.
Image shows a tile corner selected by the terraformer tool.
Tile type
A tile type defines the way a tile is rendered. Tiles can have one tile type assigned at a given time. The terrain painting tool assigns terrain types to tiles. One can use tile types to define custom game rules for their game.
The included renderer creates a submesh for each different tile type, such that tile types can be rendered with different materials.
Terrain type collection
A terrain type collection holds references to all used terrain types. A single terrain type collection can be assigned to a map at a given time. A maximum of 65536 terrain types can be referenced in a terrain type collection.
Terrain Operations
Terrain operations read or modify (part of) the terrain. Any reads or modifications to the terrain should be done via an operation. An terrain operation should be considered as an atomic unit of work. Operations automatically keep track of which tiles and chunks are modified, such that terrain meshes will update appropriately at the end of the frame.