Log inGet started
World

Escapement

Branchmain
Branchesmain
Commit7683e73a7f

README.md

Machine

The clock tower's movement: three concentric gear rings around the escapement column, the platforms the fight happens on, the bridges between them, the counterweights that drive the whole thing, and the great wheels turning beyond the board.

Placed once, by the scene, on the entity named Machine. Everything here is built at authoring time; the motion belongs to the Gearworks component on the same entity.

What it builds

EntityWhat it is
hub_<ring>the pivot a gear ring turns on — carries no geometry of its own
gear_<ring>the ring's wheel: plate, bore teeth and rim teeth, in one shell
cell_<ring>_<sector>the platform a unit stands on, set into the wheel
cell_0_0the escapement column, what the blight is climbing toward
post_<gap>_<n> / idler_<gap>_<n>a compound pinion and the post it turns on
bridge_<gap>_<n> / plank_<gap>_<n>a crossing's hinge and the plank on it
gate_<n> / gateplank_<n>the one approach to the escapement
EscapeWheel, PalletForkthe escapement itself
weight_<n>, chain_<n>a counterweight paying out as the movement runs
faryaw_<n> → farmount_<n> → farwheel_<n>a great wheel standing on edge beyond the board
GreatWheelthe wheel the whole movement hangs from, below the board

A cell entity stands at Core.cellPosition(ring, sector, 0) and is turned to its own sector's angle, and its platform mesh is authored in cell-local space — so the platform is a wedge of the wheel wherever the wheel happens to be, and the hub's rotation carries it.

The gear train is a real one

The three rings are concentric, so they cannot mesh with one another directly. They are coupled the way a clock couples them: through compound idlers on fixed posts standing in the gap between two rings, each carrying two rigidly joined pinions at different heights — the lower meshing the inner ring's rim teeth, the upper meshing the outer ring's bore teeth. External-to-external reverses direction; external-to-internal keeps it, which is what makes neighbouring rings counter-rotate.

Core.RINGS fixes each ring at one cell per tick, and the train reproduces exactly those rates:

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

Two gears mesh only when they share a module (2 * pitchRadius / teeth) and their pitch circles touch — and the two pinions of one idler carry different modules, because they mesh different rings. That is what lets the pitch radii land where the platforms need them while the ratios stay exact. Every post stands at an angle that is a whole tooth pitch of each gear it touches, so one rest phase puts a pinion gap against a ring tooth on both meshes at once.

The numbers are all in game.machine, which Gearworks reads too.

Geometry

Every solid is closed, flat-shaded, and wound counter-clockwise as seen from outside, which is the winding the engine's own primitives use. Two helpers cover almost all of it: strip, a solid between two rails, and prism, an extruded polygon.

A wheel is one closed shell — wheel() samples a bore profile and a rim profile at every angle where either turns a corner, so a plate and its teeth are a single surface. Teeth added as separate solids would leave the plate's own top and bottom faces sitting centimetres behind every tooth, and a few hundred parallel pairs at that separation is exactly what a depth buffer cannot resolve. For the same reason nothing here rests exactly on anything: a deck reaches well down into its wheel, a collar's bore runs inside the shaft it rides, and each stage of the column sinks into the one below.