cyanskies / hades

A 2d game framework
1 stars 0 forks source link

Terrain 2.0 #143

Open cyanskies opened 1 week ago

cyanskies commented 1 week ago

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: image

Tasks:

cyanskies commented 1 week ago

Note this effectively obsoletes #132 #133 #136 #137 #139