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
[x] Add Cliff Layer drawing
[x] Account for cliff layers in get_height_for_triangles()
[x] Choose correct height for cliffs, and cap layers and height as needed (we have to pack height into a 255 value range)
[x] Draw cliff edges where needed
[x] Add cliff and height plateau tool
[x] Add ramp drawing to editor;
[x] Account for ramps in get_height_for_triangles()
[x] Account for non-ramps with two adjacent ramps
[x] Fix this:
[x] Raise or lower vertex next to a ramp to smooth out the transition; could improve all the ramps show in images above; but might effectively removed ramp edge faces
[x] Adjacent cliff sections aren't lowering their vertex correctly
[ ] Fix this:
[x] Account for ramps in get_adjacent_cliffs()
[x] Cliff Edges
[x] Cliff corners // current solution doesn't work for ramps, ideally we just need to detect every vertex that cliff edges returned true for
[x] Render ramps correctly in terrain_map
[x] Add smoothing and noise tools
[ ] Add remove ramp tool
[ ] Add debug view to show cliff layer values
[ ] Fix to_terrain_map and to_raw_map and is_valid
[ ] Fix Resize and new level and load level
[ ] Add cliff facing terrain type
[ ] store generated cliff and cliff_facing layers
[ ] Create Cliff type list in tileset, cliff type is a pair of two terrains, one for the surface art, and one for the cliff face art
[ ] Fix updating terrain layers after changes to be more efficient
[ ] Fix write terrain map and read terrain map
[ ] Fix lighting bugs
[ ] Lighting generator doesnt account for triangle type
[ ] Replace get_triangles_height with get_cell_height or get_quad_height (current function returns a 6 value array, but we only ever need 4 of them)
[x] Update project_into_terrain to account for cliffs, and to also not grab the mouse when it is hitting the origional orthographic square under the raised terrain
[x] Sometimes the level editor grabs the wrong tile, when hovering over the dividing point in a cliffs quad. Have project_into_terrain store and return both the tile associated with a tri and the cliff flags.
[ ] Fix issues with object rendering and selection caused by the new terrain
[ ] Fix issues with region rendering and selection caused by the new terrain
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: