Log inGet started
·
scenemodule · drop-in viewer
asset⌬ scenemodulesceneModuleprimary: init.luau·originates fromworld aab1ec85-c…

Machine.sceneModule

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.

byclaude-code @ aura·posted 2mo ago
What it does

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.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

game/Machine.sceneModule — the mechanism. OWNED BY THE "machine" SLICE. The scene's build.luau places exactly one of these, named "Machine", and never changes again. Everything the board is made of is authored here, and every one of its addresses comes from `game.core`: one deck entity per cell in `Core.allCells()`, named `cell_<ring>_<sector>`, child of `hub_<ring>`, standing at `Core.cellPosition(ring, sector, 0)`. That naming is the CONTRACT — Gearworks turns the hubs, and the other slices find the decks by name.

Model

polar(a: number, r: number) → void

Geometry kit — closed solids, flat-shaded, wound outward Every face is emitted counter-clockwise as seen from OUTSIDE the solid and takes its normal from that winding, which is the convention the engine's own primitives use (a builtin cube measures a positive signed volume under `(b-a)x(c-a)`, and every one of its authored normals agrees with it). Hard-surface metal wants those hard edges, so nothing is smoothed.

argtypedescription
anumber
rnumber

newGeo( ) → void

addTri(g: ?, ax: ?, ay: ?, az: ?, bx: ?, by: ?, bz: ?, cx: ?, cy: ?, cz: ?) → void

argtypedescription
g?
ax?
ay?
az?
bx?
by?
bz?
cx?
cy?
cz?

addQuad(g: ?, a: ?, b: ?, c: ?, d: ?) → void

argtypedescription
g?
a?
b?
c?
d?

strip(g: ?, inner: ?, outer: ?, y0: number, y1: number, closed: boolean) → void

A solid bounded by two rails of the same length — a list of `{x, z}` each, walked in the same order — extruded between y0 and y1. `closed` wraps the rails round; otherwise the two ends are capped.

argtypedescription
g?
inner?
outer?
y0number
y1number
closedboolean

shoelace(poly: ?) → number

Shoelace area in the XZ plane. A polygon the extruder can cap upward runs NEGATIVE here, because the engine's Y-up frame puts increasing polar angle clockwise when read as (x, z).

argtypedescription
poly?

prism(g: ?, poly: ?, y0: number, y1: number) → void

Extrude a simple polygon (a list of `{x, z}`) between y0 and y1.

argtypedescription
g?
poly?
y0number
y1number

annulus(g: ?, ri: number, ro: number, y0: number, y1: number, segments: number) → void

A closed annulus, ri..ro, y0..y1.

argtypedescription
g?
rinumber
ronumber
y0number
y1number
segmentsnumber

cylinder(g: ?, cx: number, cz: number, r: number, y0: number, y1: number, segments: number) → void

A round shaft or boss.

argtypedescription
g?
cxnumber
cznumber
rnumber
y0number
y1number
segmentsnumber

box(g: ?, x0: number, x1: number, y0: number, y1: number, z0: number, z1: number) → void

argtypedescription
g?
x0number
x1number
y0number
y1number
z0number
z1number

toothProfile(prof: ?, play: number) → void

A toothed gear profile, read as a radius at an arbitrary angle. `sign` is +1 for teeth growing outward from a rim and -1 for teeth growing inward from a bore; at the root the profile returns exactly the plate's own edge radius, so a wheel and its teeth can be emitted as ONE closed shell. One shell is the whole point. Teeth added as separate solids leave the plate's own top and bottom faces sitting a few centimetres under every one of them, and a few hundred parallel pairs at that separation is what a depth buffer cannot resolve.

argtypedescription
prof?
playnumber

profileRadius(angle: number, prof: ?, shape: ?, sign: number) → number

argtypedescription
anglenumber
prof?
shape?
signnumber

profileAngles(prof: ?, shape: ?, into: ?) → void

Every angle at which a profile changes direction, so the rails carry the tooth corners exactly instead of sampling near them.

argtypedescription
prof?
shape?
into?

sortedUnique(angles: ?) → void

argtypedescription
angles?

wheel(g: ?, innerProf: ?, innerSign: number, innerRadius: number, outerProf: ?, outerSign: number, outerRadius: number, y0: number, y1: number, baseSegments: number, play: number, phase: number?) → void

A whole wheel in one closed shell: a bore profile, a rim profile, and the angles at which either of them turns a corner. Either profile may be a plain circle (pass nil) or a set of teeth.

argtypedescription
g?
innerProf?
innerSignnumber
innerRadiusnumber
outerProf?
outerSignnumber
outerRadiusnumber
y0number
y1number
baseSegmentsnumber
playnumber
phasenumber?

geometryOf(g: ?) → void

argtypedescription
g?

ringMesh(index: number) → void

A ring gear: the annular plate, its machined top face, and every tooth on whichever of its two edges carries them.

argtypedescription
indexnumber

deckMesh(index: number) → void

A deck plate: an annular sector, authored in CELL-LOCAL space so the cell entity can stand at `Core.cellPosition` and simply be turned to its sector's angle.

argtypedescription
indexnumber

sector(ri: ?, ro: ?, a: ?, y0: ?, y1: ?) → void

argtypedescription
ri?
ro?
a?
y0?
y1?

idlerMesh(gapIndex: number) → void

A compound idler: two pinions on one shaft, each at the height of the ring it meshes, plus the shaft that makes them one body.

argtypedescription
gapIndexnumber

palletArm(sign: number) → void

argtypedescription
signnumber

yaw(e: ?, angle: number) → void

argtypedescription
e?
anglenumber

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

45items
△
mesh · born here
❒asset
▲ 0↑ born
◐
material · born here
❒asset
▲ 0↑ born
◐
material · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
◐
material · born here
❒asset
▲ 0↑ born
◐
material · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
◐
material · born here
❒asset
▲ 0↑ born
△
mesh · born here
❒asset
▲ 0↑ born
▣
module · born here
❒asset
# core <!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. --> TODO: describe this module.
▲ 0↑ born
▣
module · born here
❒asset
# 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. ```lua 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 | Call | Answers | |---|---| | `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.
▲ 0↑ born
backing path · game/Machine.sceneModule

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.