Log inGet started
World

Paper Sky

Branchmain
Branchesmain
Commit1c3ac06ea9

README.md

rules

The contract the whole of Paper Sky is written against. require("rules").

  • Rules.tune — every number the game feels like.
  • Rules.state — phase / score / best / distance / nextGate / speed. Slice A writes; everyone reads.
  • Rules.events — :on(name, fn) / :emit(name, payload). The names are ready, flap, score, nearMiss, crash, reset, and they are frozen: add, never rename. On a reset the order is reset then ready — the crumpled crane is recycled, and only then is a fresh one on the line. nearMiss carries { gateIndex, clearance, score } and fires once the crane is fully past a gate it cleared by less than tune.nearMissWindow.
  • Rules.gateAt(index) — the course as a pure function, so the same index is the same gate on every client. gateWindow, hitsGate, tiltFor beside it.
  • Rules.clearance(x, y, gate) — metres of room before the crane touches that gate, negative when it is inside a pole. hitsGate is this below zero. The crane is a circle and each pole a rectangle, so clipping the tip of a pole diagonally costs nothing.
  • Rules.rampAt(index) — how far into the difficulty ramp a gate is, 0 to 1. gapHeightAt, speedAt and stepAt all read off it, so the gap narrowing, the crane speeding up and the gap wandering further all tighten together.

Rules.state, Rules.events and Rules.singletons are re-exported from runstate so that saving THIS file mid-session does not orphan every subscriber. Do not move them back in here.

Owned by slice A. See /zero/source/design/spec.md.