RoverDrive
How CINNAMON moves. Mounted on the local player's avatar — the `RoverBody` clone the scene's entrypoint hands it.
RoverDrive
How CINNAMON moves. Mounted on the local player's avatar — the RoverBody
clone the scene's entrypoint hands it.
It is the only thing that writes the rover's transform: a kinematic
integration of heading and speed across terrain.heightAt, with a lunar hop
arc on top. It spends nothing by itself — the tank belongs to Rules, and a
hop asks rules.spendHop() first — and it reports the pose it moved to back
to Rules every frame, so ledger() and the picture on screen never disagree.
The controls
It reads the game.loop.rover scheme, which carries every control on all
three device classes, so one set of handlers answers a keyboard, a pad and a
thumb on a phone alike:
| Action | Keyboard / mouse | Gamepad | Touch |
|---|---|---|---|
drive — throttle and steer | WASD | left stick | the on-screen stick, left zone |
hop — burn xylidine | Space, left mouse | south (A / Cross) | the large HOP button, lower right |
pause | Escape, P | start | the small Pause button above it |
The on-screen controls a touch player sees are those bindings — the engine draws the stick and the buttons from the live map, so there is nothing here that lays out a phone's controls in pixels.
The scheme is live exactly while there is a run to steer (playing or
paused) and is asked for every frame rather than subscribed to, so it comes
back by itself after a reload of anything it depends on. While a card is up
the screens slice's console map stands the whole rover group down, and the
rover's controls resume the moment it releases.
Driving
Throttle accelerates and brakes; steering has a little authority standing
still and full authority rolling, so a stalled rover can still line up its
next hop. The corridor's rim walls are NS.ROUTE.halfWidth.
A hop costs NS.FUEL.hopCost and throws the rover on a lunar arc that
clears craters and boulders both. A boulder taken on the ground turns the
rover aside rather than pinning it — the hull is pushed back out along the
radius, which leaves the tangential part of the move intact. A crater
driven into, or landed in without having hopped over, holds the rover for
NS.ROVER.craterStallSeconds.
Cans and craters are tested against the whole step the rover took this frame, not just where it ended up: at fifteen metres a second a heavy frame moves the rover further than a can is wide, and one it drove straight through would otherwise go unclaimed.
Until the nearside slice publishes terrain, this drives on flat ground at
NS.ROUTE.groundY with a fixed line of test cans, so the loop is playable
before the ground exists.
Events it fires
hop {x, z} · land {x, z, crater} · stall {seconds} · can {id, x, z}.
Fields
| Field | Default | Meaning |
|---|---|---|
controls | game.loop.rover | The scheme this rover answers to |
bodyRadius | 1.9 | Metres of clearance the hull asks for against a boulder or the rim |
pickupRadius | 4.0 | Metres from a can at which the rover scoops it up |
debugLog | false | Print a line on every hop, landing, stall and pickup |
ticks | 0 | Frames driven since the component woke — readable from outside, so a silent rover can be told from one that is not being ticked at all |
Scoped to this part · feeds back into the world's score.