**Use for**: a rider, cyclist, runner or animal travelling along a path through hills, a meadow, a valley, any world that is not a city street. **Status**: the method comes from a verified demo (a stylised night ride, 60 fps at 1920 x 1080); the scripts below pass their offline checks and have not yet been run in Play.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Ride?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/josazar-ride)
<!-- sub-skill of endless-scene: read ../../SKILL.md first (shared rules, build order) -->
# Sub-skill: ride (a treadmill landscape under a rider)
**Use for**: a rider, cyclist, runner or animal travelling along a path through hills, a meadow, a valley, any world
that is not a city street. **Status**: the method comes from a verified demo (a stylised night ride, 60 fps at
1920 x 1080); the scripts below pass their offline checks and have not yet been run in Play.
## The model
- The hero stays put near the origin, facing -z; the camera looks down -z. The **road strip** (`Ride Road`) is one
fixed grid whose `uv.y` is the distance ahead: it never moves, its shader scrolls the surface by the distance ridden.
- **Side banks** are N >= 3 pieces per side (`Bank L A`...), each one piece long, carried toward the camera by the
document and sent back by `N x piece` once they pass behind it. Their height is periodic over one piece, so any two
pieces join. Everything on a bank (tufts, sprite trees) is parented to that piece.
- The **landmark** sits far enough down the road that its parallax is a few pixels: it does not move. The far layers
belong to [horizon](../horizon/SUBSKILL.md).
- The nearest piece's near edge stays `rear` behind the camera; the pool's **visible front** is
`(pieces - 1) x piece - rear`. The fog's far distance must be shorter, or each recycle pops at the far end.
## Build
1. Write `scene.json` (start from [../../scripts/example-scene.json](../../scripts/example-scene.json)): the shared
`clock` (speed table), `camera` (read the Play camera's vertical `fov`, and the delivery `aspect`), `fog`, and
`ride`: `piece`, `pieces`, `rear`, `roadWidth`, `bankWidth`, `bankRise`, `heroZ`, `wander`, `dressing`, `palette`.
2. `node scripts/compose.mjs scene.json out/` (from the skill folder) checks the numbers and writes the recipes:
`ride-stage` (fog, camera, `Hero Anchor`), `ride-road`, `ride-banks`, `ride-dressing` (tufts parented by handle to
pieces built in the call before), then `scene.html`.
3. Run each recipe as one `run_code` call, in order, and check its object count. Put the hero under `Hero Anchor`
(the [vehicle](../vehicle/SUBSKILL.md), or [sprites](../sprites/SUBSKILL.md) with `"parent": "Hero Anchor"`).
4. Set the document (`scene.html`). The ride part recycles the pieces, scrolls the road, sways the tufts, and moves
the anchor along the `wander` table (lateral drift, heading, lean), which the other parts read.
## The clock (one table, integrated once)
`clock` in `scene.json`: `unitSpeed` (scene units per second at pace 1), a `cruise` pace, a `rush` pace every
`period` seconds, eased in over `up` and out over `down` (seconds into the period). The document integrates the
distance once into a table, so any time, a frozen one too, gives the same distance; shaders read `U.distance`,
`U.rideTime` (distance / unitSpeed) and `U.rush`. Freeze for a capture with `window.KIT_FREEZE = 9`. Anything tied to
the hero's drift (tracks, dust) reads the same `wander` table at ride time.
## Rules
1. **3 bank pieces at least**: with 2 the far edge swings by a whole piece.
2. **Parent by handle, never by a name or a select() in the call that built the parent**:
`moveInto(select(o => o.name === 'Bank L A')[0], obj)` once the piece exists from an earlier call, or the handle
returned by `add` / `customMesh` in the same call. Otherwise nothing is reparented and nothing says so. Check with
`get_scene_mcp` (expanded) that the dressing sits under its piece.
3. **Low near dressing only**: big rounded masses beside the road read as static hills even when they scroll.
Fill the corners of the frame with repeated low dressing that the scroll carries past.
4. **Vegetation on a treadmill is baked per piece** (one mesh of tufts per bank piece, on the piece's real surface)
and parented to it. A view-following grass window is for open worlds.
5. **Tracks and dust need no geometry**: a point `back` units behind the wheel was under it `back / S` seconds ago;
the road shader draws the groove at the wander value of that time, fixed to the surface (`world z - S * rideTime`).
Particle meshes built at the origin need bounds spanning their real area, or they are frustum-culled.
6. **Loop budget**: a `run_code` call stops at about 1e6 loop steps. Precompute height tables instead of scanning
vertices per vertex; split a heavy piece into its own call. `remove()` on an empty selection throws.
7. **Double-sided blades with baked normals go black** where the normal faces away from the eye (a sheen term turns
NaN): the tufts here are lit with an up normal and no sheen.
8. **Rush moves the camera too**: closer, a little lower, a slight downward look, banking into turns, a shake
([speed-fx](../speed-fx/SUBSKILL.md)). Keep the landmark in frame at the rush pose.
## Verify
`node scripts/check.mjs` here (pieces join, refusals), then the skill's `node scripts/check.mjs` (recycling,
parenting and winding end to end). In Play: a full period of the speed table from the hero camera, the far edge of
the banks at the recycle, the corners of the frame at rush, the landmark at the rush pose.