The previous terrain experiment came out quite cursed. This version is inspired by the warcraft3 map format and should sidestep many of the issues that affected the previous version.
Each tile as 4 vertex which are shared with adjacent tiles.
So a 256x256 tile map will have 257x257 vertex
Each vertex has the following data
Vertex Format:
vector of terrain type: grass, dirt, bricks(resource ptr)
vector of Cliff Layer per vertex(8bit int)
vector of Heightmap per vertex(8bit int)
vector of Ramp flags(control how ramps are connected to this vertex): 1 bit per edge to disable cliffing on
How cliffs work:
Each cliff layer in the editor adds 2 to the cliff layer value for the tile.
Each vertex height is is the hightmap + the cliff layer value(multiplied by some value)
Ramps can be placed on the vertex near cliffs, as long as they're only 2 layers difference in height.
The ramps themselves are the in-between values ( ie. bottom(0) -> ramp(1) -> plateau (2) )
When rendering the terrain, cliffs are generated on any tile that has a higher cliff layer adjacent to it.
warcraft 3 ramp example:
Tasks:
[x] Terrain Palette
[x] Refactor Terrain Data Storage for the new system
[x] Repair Height rendering if the refactor broke it
[ ] Add Cliff Layer drawing
[ ] Account for cliff layers in get_height_for_triangles()
[ ] Choose correct height for cliffs, and cap layers and height as needed (we have to pack height into a 255 value range)
The previous terrain experiment came out quite cursed. This version is inspired by the warcraft3 map format and should sidestep many of the issues that affected the previous version.
See this for reference: Warcraft 3 map format
Each tile as 4 vertex which are shared with adjacent tiles. So a 256x256 tile map will have 257x257 vertex
Each vertex has the following data Vertex Format: vector of terrain type: grass, dirt, bricks(resource ptr) vector of Cliff Layer per vertex(8bit int) vector of Heightmap per vertex(8bit int) vector of Ramp flags(control how ramps are connected to this vertex): 1 bit per edge to disable cliffing on
How cliffs work: Each cliff layer in the editor adds 2 to the cliff layer value for the tile. Each vertex height is is the hightmap + the cliff layer value(multiplied by some value)
Ramps can be placed on the vertex near cliffs, as long as they're only 2 layers difference in height. The ramps themselves are the in-between values ( ie. bottom(0) -> ramp(1) -> plateau (2) )
When rendering the terrain, cliffs are generated on any tile that has a higher cliff layer adjacent to it.
warcraft 3 ramp example:
Tasks: