Log inGet started
World

Escapement

Branchmain
Branchesmain
Commit7683e73a7f

README.md

machine

The mechanism's dimensions — one table, no state and no behaviour.

Read by exactly two files: the Machine sceneModule that cuts the metal, and the Gearworks component that turns it. It exists so those two can never disagree about where a post stands, how fast a pinion turns, or how far a bridge reaches.

local M = require("game.machine")

What is in it

  • M.rings[1..3] — each ring's plate radii, the platform edges a unit stands between, and the tooth profile on its bore (int) and its rim (ext)
  • M.gaps[1..2] — the compound idlers coupling one ring to the next: where the posts stand, both pinions, and the ratio the idler turns at
  • M.idlerRestPhase — the phase that puts a pinion gap against a ring tooth
  • M.bridgeSpans, M.gateSpan — how long a plank is and how it lies at rest
  • M.bridgePool, M.bridgeApproach — how many planks are kept ready per crossing, and how far past Core.COUPLE_TOLERANCE one stays lifted
  • M.escapement, M.counterweights, M.farWheels — the rest of the movement

Functions

CallAnswers
M.hubAngle(ring, tick)where a ring's hub stands at a tick
M.idlerAngle(gap, postAngle, tick)where an idler on that post stands
M.deckTop(ring)the surface a unit stands on

Why the tooth counts are what they are

Concentric rings cannot mesh with each other, so each pair is coupled through compound idlers — two pinions of different module on one shaft, at the heights of the two rings they touch. Core.RINGS fixes each ring at one cell per tick, and the counts here reproduce those rates exactly:

(42 * 6) / (6 * 63)  = 2/3    ring 1 : ring 2
(70 * 9) / (6 * 140) = 3/4    ring 2 : ring 3

The full derivation, and why each post angle is a whole tooth pitch of every gear it touches, is in the module's own header.