Log inGet started
Package

terrain.module

Newest version

README.md

game.valley.terrain — the shape of the Ashen Valley

ONE height function, T.height(x, z), is the authority on where the ground is. The rendered mesh, the physics heightfield and every landmark's footing are all sampled from it, so what is drawn and what is stood on are the same surface by construction rather than by agreement.

T.height composes the valley out of its own parts, each a named term: the floor falling gently down-valley with the dead ground's roll, the valley walls climbing away from the centre line, the higher ridge on the +X side (the viewpoint the establishing shot is taken from), the raised shelf the chapel stands on, and the road — a corridor cut and flattened through all of the above so it stays walkable where the ground does not.

Also here: T.roadX(z) (the road's centre line), T.normalAt(x, z) (the surface normal by central difference), T.meshGeometry() (the terrain mesh as positions/indices/normals/uvs), T.collider() (the same grid as a HeightfieldCollider's rows, cols, extent and heights), and T.roadGeometry() (the road ribbon laid on the corridor the height function already cut).

The named places — T.CHAPEL, T.RIDGE_TOP, T.HEART — are what the rest of the valley is laid against.

Called by game.valley (which builds it) and game.valley.landmarks (which places everything standing on it) and by game.foes (which stands the Ash Warden's camp on it).