Joins follow the travel direction: the next piece goes right after the end (t67 phase 2b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 14:09:28 -04:00
co-authored by Claude Opus 5.5
parent fd35bf334f
commit 45538cc18e
16 changed files with 363 additions and 236 deletions
+14 -10
View File
@@ -486,16 +486,20 @@ above, including:
on warns first that the save will be marked, and the mark stays with the world; any future
achievements won't unlock in a marked world. Besides money, items and upgrades it may have
game speed and other things just for fun.
- **One join rule for every transport piece (2026-10-27, replaces the t62 same-row rule).** The
owner wants all pieces to place and join the same way, so players know what to expect when
building. At a diagonal piece's end, call E the block diagonally past its last block (the
block its end points into). Another diagonal of the same slope continues in E. A horizontal
piece (flat belt, flat filter, horizontal screw) joins on the same row at the high end, and
in E, one block lower, at the low end: the rule sloped belts already had. A vertical screw
joins in E at either end. Straight pieces join the next block along their axis. Any other
placement is two separate ends and nothing passes between them. The owner found the old
screw rule, which needed the horizontal placed over the diagonal's last block at the low
end, inconsistent with every other piece.
- **One join rule for every transport piece: the next piece goes right after the end
(2026-10-27, replaces the t62 same-row rule).** The owner wants all pieces to place and join
the same way, so players know what to expect when building. Joins follow the direction the
material travels: a piece's outlet points at the block right after its end, which is the
next block along a straight piece, or the block diagonally past a diagonal's end. The next
piece joins when it starts in that block and carries the same general way. So a horizontal
then a diagonal (up or down) starts the diagonal in the next block on the same row; a
diagonal then a horizontal or vertical starts it diagonally past the diagonal's end; a
vertical going up then a diagonal starts the diagonal directly above. Any other placement is
two separate ends that pass nothing. Belts carry grains on top, so they bend the rule where
grains can't follow it: an uphill belt's top feeds a flat belt on the same row, and a flat
belt one block below an uphill belt's low end also feeds it. The owner first approved a rule
based only on shape, then found in testing that horizontal → uphill and vertical → diagonal
didn't join the way the other pieces did.
## Ideas not built yet
+21 -19
View File
@@ -118,15 +118,17 @@ dist/, shots/ build output and screenshots (not committed)
- kind `mold`.
`hidden` pieces are not in the menu. The menu's tabs and order are `BUILD_CATS` in
`src/ui/build-menu.js`.
- **Transport geometry:** `joins.js` owns geometric ends and joins for belts, filters and screws.
`pieceEnds(code, v)` returns precomputed left/right ends (vertical screws: up/down).
`endJoin(bx, by, endIndex, planned = null)` returns `neighbourBlock * 2 + neighbourEnd`,
or -1; `pieceJoins(bx, by, planned = null)` returns bits 0/1 for the joined ends.
Plans override world blocks, including the queried block. Continuing diagonals take priority
over elbows; a join is returned only when both ends choose each other. Belt and screw drawing
use this module, as do diagonal screw grain and bar transfers (`diagonalScrewNext` and
`straightScrewNext`). Straight screws still feed the side of lifts. E elbows bend in the
straight end block; both looks, ghosts and previews share that geometry.
- **Transport geometry:** `joins.js` owns travel-directed ends and mutual joins for belts,
filters and screws. `pieceEnds(code, v)` returns precomputed geometric left/right ends
(vertical screws: up/down), with travel and inlet/outlet roles. `endJoin(bx, by, endIndex,
planned = null)` returns `neighbourBlock * 2 + neighbourEnd`, or -1; `pieceJoins` returns
bits 0/1. Plans override world blocks, including the queried block. Outlets target the next
block along travel, with the belt surface exceptions. Inlet ties prefer same-shape travel,
then top-to-bottom, left-to-right; a join must be reciprocal. Both looks, ghosts, previews,
diagonal screw grain/bar transfers and straight screw entry into diagonals share this rule.
Flat-belt bar entry uses `entBeltScrewEnter` and the swept-path collision check. Straight
screw side-feeding into lifts remains independent. Edge elbows bend inside the
diagonal; diagonal outlets bend inside the receiving straight block.
- **Placing and removing:**
- `placeBlock` / `removeBlock` (`blocks.js`);
- `placeMachineAt` / `addMachine` / `removeMachine` (`actions.js`, `machines.js`);
@@ -274,12 +276,12 @@ Pipes, pumps and outlets: each joined line holds one liquid as a count, not as g
Per-tick machine work: steam engines, fans, belts, filters, screw conveyors (machinesTick).
- functions: engineIntake, fanBlow, machinesTick
### src/sim/joins.js (71 lines)
Geometric transport ends. Tables are built once; querying a world or plan allocates nothing. Ends are left/right, except vertical screws (up/down). Travel direction is irrelevant.
### src/sim/joins.js (73 lines)
Travel-directed transport ends. Precomputed probes; world/plan queries allocate nothing. End indices stay geometric: left/right, or up/down for vertical screws.
- functions: pieceEnds, joinCandidate, endJoin, pieceJoins
- variables: JOIN_ENDS
### src/sim/conveyors.js (223 lines)
### src/sim/conveyors.js (211 lines)
How belts, filters and screw conveyors move what is on or in them. What rests on a belt or filter rides along: the whole stack standing on the carrying surface steps one cell toward d together (belts run front of the line first, so the way ahead is clear). If a powder grain is blocked, the load above it stands still and the belt slips underneath. A filter's own material drops through it instead, unless it is already full.
- functions: conveyorStep, carryColumn, beltDrain, launchGrain, rebuildFilters, filterCarry, carryBeltsAndFilters, setFilter, filterRun, roomFor, screwSpread, screwIntake, screwAccepts, straightScrewNext, diagonalScrewNext
- variables: CARRY_DEPTH, filterR, filterL, filtersDirty
@@ -298,9 +300,9 @@ Molds: cavities for castings; ingot troughs empty themselves below. Removal retu
- functions: moldCellsAt, canPlaceMold, newMoldRecord, addMold, castMix, cavityState, troughState, clearCavity, moldPlugCells, rakeAbove, furnaceJunkHint, unplugMold, ejectIngot, checkMolds, moldAt, tally, collectMold, removeMold
- variables: DROSS, grains, barWord
### src/sim/items.js (307 lines)
### src/sim/items.js (317 lines)
Bars and other loose objects (ents), and the bag: adding, taking, costs and refunds.
- functions: entSolidCell, entSupportCount, entFreeAt, entMark, spawnBar, removeEnt, entScrewAt, entScrewFree, entScrewMove, entScrewLane, entScrewEdge, entScrewEnter, entScrewTick, entDiagonalScrewTick, entSlopeBeltTick, entTick, entsInCircle, bagAdd, bagTake, giveOrDrop, refundAt, canAfford, payCost, fmtMoney, costText, needText
- functions: entSolidCell, entSupportCount, entFreeAt, entMark, spawnBar, removeEnt, entScrewAt, entScrewFree, entScrewMove, entScrewLane, entScrewEdge, entScrewEnter, entScrewTick, entDiagonalScrewTick, entBeltScrewEnter, entSlopeBeltTick, entTick, entsInCircle, bagAdd, bagTake, giveOrDrop, refundAt, canAfford, payCost, fmtMoney, costText, needText
- variables: BAR_W, BAR_H, entCurM, droppedLast
### src/sim/tools.js (52 lines)
@@ -376,17 +378,17 @@ Drawing (src/render/): browser only. This file: the renderer state R, colour tab
Propagated coloured light from glowing and burning cells.
- functions: builtForLight, looseForLight, computeLight
### src/render/slope-belts.js (157 lines)
### src/render/slope-belts.js (169 lines)
Drawing only: the face stays on its simulation cells; the band hangs below it.
- functions: slopeBeltConnections, flatBeltCaps, prepareSlopeBelts, slopeBeltSegment, slopeBeltCorner, slopeBeltShape, slopeBeltAt, slopeBeltColor, screenLoaded, slopeWallShape, slopeWallAt, slopeDetailAt, slopePreviewCleat
- variables: slopeBeltJoins, slopeBeltHalo, beltCaps, slopeAcross, slopeAlong, slopeDistance, slopeWallOwner
### src/render/diagonal-screws.js (78 lines)
### src/render/diagonal-screws.js (79 lines)
Screw casing geometry shared by both looks, ghosts and placement previews. smooth-look class of a screw conveyor cell by direction: 9 up, 10 right, 11 down, 12 left
- functions: diagonalScrewJoins, straightScrewJoins, diagonalScrewShape, diagonalScrewBlock
- variables: SCREW_CLASS, diagonalJoins, diagonalAcross, diagonalAlong, diagonalCap
### src/render/world.js (404 lines)
### src/render/world.js (405 lines)
Scale colour without changing the smooth-look class.
- functions: fogColor, drawWorld
@@ -403,7 +405,7 @@ Smooth look: WebGL setup, texture uploads, drawing and adaptive resolution.
- functions: smCompile, smoothAvailable, smUpload, smoothDraw, smoothPace
- variables: SM, smBytes
### src/render/slope-belt-shader.js (111 lines)
### src/render/slope-belt-shader.js (126 lines)
Smooth slope shading, kept beside the shared CPU geometry in slope-belts.js.
- variables: SM_SLOPE_HELPERS, SM_SLOPE_DRAW
@@ -582,7 +584,7 @@ The frame loop and boot.
- `tools/scenes/bar-lift.js`: A mold drops copper bars onto a belt, through a screw lift and onto the upper belt.
- `tools/scenes/belt-heap.js`: A belt feeding an upward screw: sand underneath a deep heap of copper ore. Run clear-sky.js first, e.g. python3 tools/shot.py /tmp/belt-heap.png --setup tools/scenes/clear-sky.js --js "$(cat tools/scenes/belt-heap.js)" --ticks 240 --zoom 7
- `tools/scenes/clear-sky.js`: A clear work area left of the bot's starting point (the trade dock is to its right): open sky 160 grains wide and 40 tall, over a flat stone floor. Money and a bag of building stuff to build with. Sets FLOOR (the first row of the floor), BX, BY (the leftmost block of the area that stands on the floor) and CAM (the middle of the area).
- `tools/scenes/joins.js`: Shared join grid: eight rows (UR/DR/DL/UL, left/right ends), nine columns. Screw H and V, then belt H; each tries the side, above/below, and E. Self-contained, paused and empty. Use --zoom 4 --viewport 2100x1500 --no-light.
- `tools/scenes/joins.js`: Travel join grid: UR/DR/DL/UL, both ends, and all three neighbouring placements. Screw H and V, then belt H; each tries the side, above/below, and E. Self-contained, paused and empty. Use --zoom 4 --viewport 2100x1500 --no-light.
- `tools/scenes/mold-labels.js`: Run after clear-sky.js: filling, blocked, set, and hot machinery in one view.
- `tools/scenes/silo.js`: Run after clear-sky.js; leave paused so the open gate keeps its demonstration charge.
- `tools/scenes/slope-conveyors.js`: Loaded sidewall conveyor and screen. Use --js 'slopeScene(false)' (belt) or 'slopeScene(true)' (screen).
+19
View File
@@ -4,6 +4,25 @@ What agents have done, newest first. Add an entry for every piece of work: the d
note or request it was for, what changed, the files touched, the tests run, and anything left
open or not verified. Keep each entry short; the git history has the details.
## 2026-10-27: t67 phase 2b, joins follow the travel direction (Claude Code + Codex)
- The owner tested phase 2: horizontal → uphill and vertical-up → diagonal didn't join like the
rest. New rule (DESIGN.md): a piece's outlet points at its block plus its travel vector, and
the next piece joins when it sits there travelling the same general way. Belts bend it where
grains can't follow: an uphill belt's top feeds a flat belt on the same row, and a flat belt
one block below an uphill low end still joins.
- `src/sim/joins.js` reworked around inlets and outlets; screw drawing, belt drawing, screw
grain flow and bars follow it. Straight-screw mouths no longer reach a diagonal across a
corner; straight-to-straight transfers (lift side-feeding) unchanged.
- Files: `src/sim/joins.js`, `src/sim/conveyors.js`, `src/sim/items.js`,
`src/render/diagonal-screws.js`, `src/render/slope-belts.js`, `src/render/slope-belt-shader.js`,
`src/render/world.js`, `src/ui/previews.js`, `tools/scenes/joins.js`, tests `t_joins.js`,
`t_diag_screws.js`, `t_slope_belt_art.js`, `t_smooth.py`, `docs/PROJECT_MAP.md`.
- Tests: `python3 test/run_all.py --browser` all passed.
- Open: Codex hit its usage limit before finishing. A flat belt feeding an uphill belt on the
same row is joined but draws badly in the smooth look (overlapping casing, stepped edges;
`shots/joins-belt-drop-smooth.png`). Not playtested; determinism diff not re-run by hand.
## 2026-10-27: t67 phase 2, screw conveyors follow the join rule (Claude Code + Codex)
- Screw drawing, grain flow and bars now all go through `endJoin`. New joins: a horizontal in