RhTerrain
A module script.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2Railhead: Dust Sea — heightfield sampling without a GPU mesh. `terrain.fromAsset` builds a handle AND uploads a fresh GPU mesh, so calling it just to ask "how high is the ground here" allocates a quarter of a million vertices every time. Gameplay asks that question thousands of times a second (every machine, every slug sub-step), so this module reads the `.terrain` asset's heights once and samples them on the CPU. The origin convention matches `terrain.create`: `originX` / `originZ` are the patch CENTRE, not its minimum corner.
load(source: string) → Field
Read a `.terrain` asset's heightfield. `source` is the asset folder or the inner `terrain.json`. Returns nil when it can't be read or is malformed.
| arg | type | description |
|---|---|---|
| source | string |
heightAt(f: Field, x: number, z: number) → number
Bilinear height at a world XZ. Clamps to the patch edge rather than returning nil, so a machine that wanders off the map still has ground.
| arg | type | description |
|---|---|---|
| f | Field | |
| x | number | |
| z | number |
normalAt(f: Field, x: number, z: number) → void
Surface normal at a world XZ, from central differences.
| arg | type | description |
|---|---|---|
| f | Field | |
| x | number | |
| z | number |
slopeAt(f: Field, x: number, z: number) → number
Slope in radians. 0 is flat.
| arg | type | description |
|---|---|---|
| f | Field | |
| x | number | |
| z | number |
Field = {CPU heightfield sampling for .terrain assets. Reads the heights once and answers height/normal/slope queries without uploading a GPU mesh, which is what gameplay needs when it asks thousands of ground queries a second.Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.