OpenTPW

QUEUE-R: queue evidence and the QUEUE-I implementation plan#

Lane: QUEUE-R (research). Input: the M3 gate (f6ad99f, docs/M3-GATE.md) fails build.queue and leaves queues.no-stuck-queue unresolved. This document consolidates what was already proved, adds new bounded traces of the Feral Mac SimThemePark.data (SHA-256 04809cd4…e295f5), and specifies QUEUE-I.

Reproduce (private assets stay outside Git):

python3 -I tools/ppc-analysis/lanes/queue/queue_evidence.py /path/to/mac-feral/bin --pc-data /path/to/Data
python3 -I tools/ppc-analysis/run_evidence_checks.py --mac-bin /path/to/mac-feral/bin --pc-data /path/to/Data

Confidence uses the PPC-rides convention. High means an identity-pinned instruction or relocation path whose operations were interpreted. Medium means a role inferred from callers, strings or data. Unresolved means the path was not recovered. "Bounded" marks a claim that holds only for the enumerated sites. All results are static. Nothing original was executed.

1. What was already proved (consolidated)#

SourceClaimStatus after this lane
PPC-guests, queue statesJump table data 0x41314. State 10 0xeccb0 (heading to the ride / joining), 11 0xed244 (standing in the queue), 12 0xe6454 (walking to a queue position, returns to 11)Kept. Joining, standing, admission and leave paths are now traced (sections 4 to 6)
PPC-guestsQueue destination 0xee604 → 0xdd144, then 0xddc2c → 0xddcc4 and 0xe6864. Four positions per queue cell, following a prior-cell linkKept. The link byte, the cell type and the per-cell slot arithmetic are now identified (section 3)
PPC-guestsQueue acceptance 0xdcb74 reads +436 (QueueWaitTimeConstant) and is "not a universal 4*capacity"Completed: full formula for HasQueue rides, 100 for objects without HasQueue, physical room 4 × cells (section 4; polarity corrected after ORACLE-V, see there)
PPC-guestsTimeout compare +508 + 100 at 0xed670, then a boredom leaveRefined: the branch cannot be reached in game (section 5.3). It is not a usable bound
PPC-guests, scoreQueue match 100 − q·100 / (4·max(f60,1)) with object +60+60 is now identified as the queue size in cells (mQueueSizeInCells). The score's denominator is the physical queue room
PPC-rides RIDES-016VAR_DURATION written raw from InitDuration. Unit unknownPartially resolved: the native code writes the raw value too, clamped to [MinDuration, MaxDuration]. BOUNCE treats it as seconds of the scheduler clock (section 7)
APPROX-TRACE RIDES-016 step 1Hypothesis: upgrade record +0x1b4 (436) is InitDurationRefuted: 436 is QueueWaitTimeConstant. InitDuration is 416 (section 2)
PPC-ui UI-031The manual says the queue tool follows ride placementUnchanged. The native build tool is only partly traced (section 3.3)
PPC-ridesCOAST admission rings 0x3dbc0, 0x3dd14Separate controller layer. Not used by the BOUNCE bound

Current OpenTPW runtime (RideVisitorBridge, GuestSimulation) uses a virtual list per attraction. Its maximum is Capacity × QueueLengthPerCapacity (4), an approximation. Slots sit at the entrance cell, three abreast (QueueSlotSpacing 0.28). The front guest is offered as soon as VAR_LETMEON == 0. There is no queue-path tool and no queue cell in GuestPathGrid.

2. SAM schema binding (high)#

The ride descriptor table at data 0x39b64 is interpreted by the economy lane's schema.py with embedded_offset=4. It gives these runtime offsets on the object type record (0x118018(type)):

FieldOffsetIndependent anchor
Info.HasQueue64build 0xdac0c → ride flag 0x8
Info.RunsContinuously72build 0xdaca4 → ride flag 0x100
UsageInfo.ProvidesRelief244build 0xdab6c → ride flag 0x1
UsageInfo.Min/MaxCapacity292 / 296CAPACITY clamp 0xdc75c/0xdc760 (diagnostic CAPACITY = %d)
UsageInfo.Min/MaxDuration300 / 304DUR clamp 0xdc658/0xdc698 (diagnostic DUR = %d)
Upgrades[L].InitCapacity408 + 64·Lbuild 0xdad60
Upgrades[L].InitDuration416 + 64·Lbuild 0xdad78
Upgrades[L].InitSpeed424 + 64·Lbuild 0xdad4c. Queue-limit divisor 0xdcbf4
Upgrades[L].QueueWaitTimeConstant436 + 64·L (float, kind 7)queue limit 0xdcc58, diagnostic "No queue constant entered in SAM file"

The upgrade stride of 64 bytes matches slwi 6 of the level byte +76 at 0xdcbe4. The economy lane already pins WearRate 432 and RedLine 412/428 from the same table.

3. Queue geometry and data model#

3.1 Ride (object) fields (high unless marked)#

OffsetMeaningEvidence
+46 u16flags: 0x1 ProvidesRelief, 0x8 HasQueue, 0x100 RunsContinuously (others not needed here)build 0xdab6c..0xdacb8
+50 u16entrance cell id (1 + X + (Y << 7))0xdd2e0
+54 u16cached back-of-queue cell (mBackOfQueue, medium name)0xdd46c, 0xdd4bc
+56 u16head guest id of the queue list0xdd16c, append 0xdcda0
+60 u32queue size in cells (mQueueSizeInCells, medium name)0xdd4c0..0xdd4e4, 0xdc9a4
+76 u8upgrade level0xdcbd8
+84 u32SPEEDsetter 0xdc604 (SPEED = %d)
+88 u8DUR (operating duration), script variable 3setter 0xdc6e8, 0xdc6cc
+89 u8CAPACITY, script variable 2setter 0xdc810, 0xdc7f4
+104 u16pending visitor ("person being loaded")0xe1564, test 0xe0628

3.2 Guest fields (high for the offsets; names are analyst labels)#

OffsetMeaningEvidence
+476 u16target object idqueue handlers
+497 u8recorded queue position (0 = front)0xee688 (= list position)
+500 u32move delay in park turnsstate-11 entry 0xef8ac, decrement 0xed4e4
+504 u32called-forward flag0xee7e8 = 1, cleared 0xed2dc
+508 u32park turn at the last state-11 entry0xef884
+520 u32park turn at the last idle interlude (state 8)0xe8c0c, 0xefd30
+524happiness snapshot taken at join0xece58
+544 / +548state / state saved across the interlude0xef728, 0xe8c14
+552 / +554 u16next / previous guest id in the queue list0xdd1c8, 0xdce80

The queue is a doubly linked list of guest ids. Head is ride +56, links are guest +552/+554, and the terminator is id 0. Append (0xdcd34) walks to the tail. Position is the list index (0xdd144), and count is the position of the terminator (0xdd118). The geometry below only places guests. It does not order them.

3.3 Queue cells (high for the walk; bounded for building)#

3.4 Positions inside the queue (high)#

0xddcc4 (HasQueue objects, flag 0x8): remaining = position, starting at the front cell. While remaining ≥ 4 and the cell is not the terminator, subtract 4 and follow the next-cell link. The depth byte along the cell is trunc(255 × (0.25 × remaining)), computed in single precision, giving 0, 63, 127 and 191. The lateral byte is rand mod 28 + 114 (114..141) from the shared RNG 0x105328. Depth > 128 (the fourth slot) takes a branch toward the next cell (0xdde74) that was not traced further. The link direction then selects which sub-cell axis gets depth or 255 − depth.

Objects without HasQueue use a virtual queue (0xde02c). An assertion ("Virtual queue problem!") requires position < 4.

4. Joining and capacity (state 10 at the back cell, 0xeccb0) (high)#

These checks run when the guest stands on the back-of-queue cell (0xdd3f4):

  1. Physical room 0xdc988: the guest may join only while count < 4 × (+60). Otherwise thought 21 and the guest wanders (state 6).

  2. Excitement gate: if 0xe02ec(ride,1) is set and |0xe9a84(guest,ride)| ≥ 45, the guest leaves with "ride is not exciting enough!" or "ride is too exciting!". Executed (ORACLE.md F16): 0xe02ec(ride,1) is the low byte of the type's UsageInfo.ExcitementLevel (not a kind test), and 0xe9a84 is clamp(excitement − preferred, −50, 50) over bytes with a live excitement (0xe02ec(ride,0): sideshow formula, speed and duration ratios, coaster 0.5 E + 50), or 100 when 0xdfe34 holds. A negative value is "not exciting enough" (thought 12), otherwise "too exciting" (thought 15). Implemented in C# (QueueJoinRules, RideVisitorBridge.ExcitementRefusal) except for the excitement of a ride with a thing behind ride +36 (QUEUE-004); the oracle pins the C# side to the original on every input without such a thing.

  3. Limit 0xdcb74: the queue is full when count ≥ limit (unsigned). Then "queue is too long!", thoughts 21/16, state 6. The limit is a u32:

    • Without HasQueue (+46 & 0x8 clear): 100.

    • HasQueue (+46 & 0x8 set): trunc(max(QWTC × (G × CAP) / DUR, 4.0)), single precision, where G = SPEED / Upgrades[L].InitSpeed (1.0 when SPEED is 0), SPEED is the unsigned word at +84 and QWTC is Upgrades[L].QueueWaitTimeConstant. A NaN quotient becomes 4. The quotient converts to unsigned (0x1c3fbc) and saturates at 2³² − 1. When QWTC ≤ 0 the formula path asserts "No queue constant entered in SAM file".

    Correction (ORACLE-V, docs/reverse/ORACLE.md F1/F2, REVIEW-ORACLE.md OV-1): this section first said "HasQueue: 100". The branch at 0xdcbac takes the constant when the bit is clear, and the ride build (0xda874 stores +46 = 0, then 0xdab6c..0xdacbc ORs one bit per type record boolean) sets 0x8 from record +64, Info.HasQueue. So the formula belongs to HasQueue rides.

  4. Join: +524 = happiness, append to the list, then 0xee604. It stores the position in +497, computes the slot and sets the destination, entering state 12. If the destination fails: "Couldn't get to my place in the queue, leaving!", the guest is removed, state 6.

So the maximum queue length is min(4 × cells, L) for HasQueue rides, with L the QWTC formula (Belly Bounce: trunc(130 × 5 / 30) = 21, so 6 cells hold the whole queue), and min(4 × cells, 100) for objects without HasQueue. Those use the one-cell virtual queue, so their room of 4 decides, which matches the virtual-queue assertion (bounded: a no-HasQueue object with more than one cell is not traced).

5. Standing in the queue (state 11, 0xed244) (high)#

5.1 Entry (0xef868)#

+508 = turn, +500 = trunc(1.2f × +497) (float data:0x55a0), animation 3.

5.2 One call per update, in order#

  1. Called forward: if +497 == 0, +504 ≠ 0 and the ride's pending visitor is this guest (0xe0620), then +504 = 0, the destination is set to the entry stand point (0xde1d8), and the guest enters state 13 ("being loaded"). If the path is lost, the guest is removed and leaves.

  2. Diagnostic only ("admitted … not first in queue").

  3. 0xdfe34(ride) set → thought 14, leave. Executed (ORACLE.md F15): 0xdfe34 is a relief object (toilet) whose wear gauge +64 is below 25, not VAR_BROKEN. A broken ride has no such exit; what it does to its queue is in section 6 (broken rides).

  4. Position lookup fails → "Problem with a queue", leave.

  5. Moving up: if the list position differs from +497:

    • When +500 ≠ 0 and 0 ≤ +497 − pos ≤ 2, decrement +500.

    • Otherwise, unless 0xdfe0c(ride) (ride state +408 == 1), call 0xee604. That gives the new +497, state 12, and then state 11 again.

    • On PC every one of these continues into the needs window (tp.exe 0x5002f2, from 0x5002eb, 0x50052a and 0x500539); only an unchanged place reaches the limit test (0x50059d). Re-entry resets +500 and +508. If it fails: "Couldn't get to my intended queue position", leave.

    A guest that becomes the front with a small gap waits at most trunc(1.2 × 2) = 2 turns.

  6. Position matches: if +497 > limit (0xdc9d4, same formula), thoughts 16/21 and leave. Thought 13 and leave also follow in two cases:

    • track type (Bumper.WhichTrackType, type record +156) is 3 and 0x45eac(ride) is zero;

    • track type is 1 and ride +40 is zero.

  7. Needs window 0xed58c: let w = turn − +520 (unsigned).

    • w > 30: happiness +412 > 80 starts idle interlude 5. < 10 gives thought 11 and leave. 10..19 starts idle interlude 4. If none applies, toilet +428 > 80 gives thought 4, and the guest leaves unless the object ProvidesRelief.

    • w ≤ 30: the boredom test. If turn > +508 + 100, "I'm bored and leaving the queue", thought 7/12, leave.

  8. Only when w ≤ 30 (every w > 30 path above returns): a 1-in-10 random facing change, a second draw adding (r mod 800) − 400 to the heading mod 2048 (tp.exe 0x4ffff0, +0x1C; the earlier ±400 reading is corrected).

The idle interlude (0xe8b74) sets +520 = turn, saves the state in +548 and enters state 8. State 8 restores the saved state once turn > +520 + 10 (0xef6c8). Restoring re-enters state 11 and so resets +508.

5.3 The boredom exit is unreachable (high for the arithmetic; bounded for writers)#

It needs turn − +520 ≤ 30 and turn − +508 > 100. In state 11, +508 ≥ +520, because every write of +520 is followed by state 8 and then a state-11 re-entry that writes +508. That makes the two conditions contradictory (turn − +520 ≥ turn − +508 > 100 > 30). The writer enumeration below is bounded: it lists the D-form stores (base not r1) whose bytes overlap +508..511 or +520..523 that were found by a whole-code-section scan (REVIEW-QUEUE S4: 28 sites, no stmw). By context, only the first five belong to the guest class:

No stmw with a base other than r1 covers these offsets. There are no indexed stores in 0xe4000..0xf0000. The 0x6xxxx writers of +520 belong to another class (+516/+519 neighbours).

Bound: a raw write outside these sites (save loading of inconsistent values, memcpy) is not excluded. The witness test test_simulated_state_11_never_bores models the turn-by-turn logic.

Consequence: in the original, a guest standing in a queue has no time-based exit. It leaves only through:

OpenTPW must not invent a boredom timeout for queues.

6. Admission (ride update) (high, bounded cadence)#

The object dispatcher 0xfa9b0 calls the ride update 0xe0a8c (0xfaa78) for each live object on each park turn (subject to the live-list eligibility noted in PPC-guests). When ride +408 == 0 it calls 0xe1864 → 0xe1404:

Then: head +504 = 1 (0xee794), pending +104 = head ("LetMeOn - person being loaded is %d").

The guest notices on its next state-11 call (5.2 step 1) and walks to the stand point. State 13 (0xed7e0) runs the price check ("too expensive, I'm leaving the queue") and the admission method 0xe03d0. That method writes the guest into script variable 0 only if it is 0. State 14 waits until the script consumed it (0xe05c8), then the guest is removed from the list and enters state 16. The track-type bypass is not needed for BOUNCE rides (Belly Bounce has track type 0).

Broken rides (ORACLE.md F15, queue-ride-update, executed). The ride update 0xe0a8c dispatches on the ride state +408: state 0 runs the admission above (0xe1864, which first runs 0xe1404 and then reads script variable 7; non-zero calls SetState(1), or SetState(4), condemned, when the life gauge +68 truncates to a zero byte); state 3 does nothing; states 1, 2 and 4 run the head-guest step below; anything else asserts. The head-guest step runs on every update while the ride stays in the state, then releases the script's rider (0xe1758):

So a broken ride's queue drains head first at one guest per ride update, i.e. per park turn (QUEUE-016); the guests behind keep their positions, state 11 neither moves them up (step 5 is blocked in state 1) nor sends them away (step 3 is the toilet predicate). SetState(1) itself (0xe0ec4) runs the same head step once, logs "Closing...", zeroes the pending visitor +104, sets script variable 6 (VAR_RIDECLOSED) to 1 and clears the open word +100; the SetState(0) callers that reopen the ride (0xdad24, 0xde8e4, 0xdf4d4, 0xdf90c, 0xdfb08) write variable 6 back to 0 and +100 to 1. The repair (0xdef2c, executed in the oracle, ORACLE.md F27) uses 0xdf4d4; the open routine 0xde7e4 (0xde8e4), maintenance off (0xdf90c) and an upgrade's end (0xdfb08) are the others.

C# runs the admission on the turn it first sees VAR_BROKEN ≠ 0 and then enters state 1 (RideVisitorBridge.EnterBrokenState: head dismissed, pending visitor withdrawn, VAR_RIDECLOSED = 1); from then on the ride counts as closed and dismisses the head each park turn (DismissHead, QUEUE-019). It keeps no state word, so a queue that is still there when the script clears VAR_BROKEN is turned away at once.

OpenTPW differences:

7. Time units (high where stated)#

8. QUEUE-I implementation spec#

All items carry the confidence of the section that proves them.

  1. Data

    • Cell type Queue (original type 3) in the path grid, with a link direction (one of four).

    • Per ride: entrance cell, front cell, cached back cell, size in cells, and the guest list (head/next/prev) with a pending visitor.

    • Per guest: recorded position, move delay, called flag, state-11 entry turn, interlude turn.

  2. Building (partly APPROX until the tool is traced)

    • A queue tool places type-3 cells. Each new cell links toward its predecessor. The first cell must be the entrance's neighbour in the entrance's connection direction.

    • After every edit, recompute the back and size like 0xdd43c (stop at

      1. and run the re-evaluation of 0xdd57c.

    • The placement-validity rules, cost and maximum length are unresolved: keep them as APPROX:QUEUE-BUILD.

  3. Join (state 10 at the back cell): room count < 4·cells, the excitement gate (section 4: the level byte, the live excitement, the clamped difference, 45), then the limit (the QWTC formula for HasQueue, 100 otherwise), then append and walk (state 12).

  4. Standing (state 11): section 5.2 exactly. That includes the move delay trunc(1.2f·pos), the gap ≤ 2 rule, the 30-turn needs window and the ProvidesRelief exception. Keep the boredom test as written (it is dead code), and add no timeout.

  5. Positions: 4 per cell, depth bytes 0/63/127/191, lateral 114..141 from the shared RNG. The fourth-slot branch is unresolved (APPROX:QUEUE-SLOT3).

  6. Admission: section 6 gates on each ride update, with the pending-visitor handshake. Remove the guest from the list after the script consumes LETMEON.

  7. Units: convert park-turn constants with the existing park-turn clock. Do not use 60 Hz ticks. DUR stays raw. BOUNCE holds DUR seconds of the scheduler clock with release at most 1 s late.

9. Proposed bound for queues.no-stuck-queue#

The original gives no wall-clock timeout (5.3), so the gate should check liveness against the admission rule, plus a throughput bound for BOUNCE rides.

(a) Admission progress (exact, original-derived). Suppose all of these hold on a ride update:

Then the head must be called on that same update. A violation for two consecutive updates is a stall. OpenTPW's tick-to-park-turn mapping must be used, and the gate already samples every tick.

(b) Wait bound for BOUNCE rides (derived from data plus one APPROX parameter). Take a guest at 0-based position p on joining, with the ride open and unbroken throughout. Each of the CAP slots frees after DUR s plus less than 1 s release granularity. The guest boards at the (p+1)-th free slot, so

W(p) ≤ (⌊p / CAP⌋ + 1) × (DUR + 1 s + τ)

and over a queue of at most Qmax guests, W_max = ⌈Qmax / CAP⌉ × (DUR + 1 + τ).

Belly Bounce (1100, jungle): DurationUnit 1, HasQueue (default layer), CAP = 5, DUR = 30, InitSpeed 60, QWTC 130 (limit trunc(130 × 5 / 30) = 21), RunsContinuously 1 (Bouncy.sam), so the RUNNING gate in section 6 is bypassed and admission runs whenever ONRIDE < 5.

The gate's measured 149.95 s against 124 s implies τ ≈ 6.5 s per turnover under the current OpenTPW model. Report it as a measured τ, not a pass/fail threshold, until τ is traced.

(c) Out of scope. For non-BOUNCE rides (coasters with DurationUnit 0, DurationUnit 2/3 rides, TOUR/BUMP/COAST controllers) the cycle time is controller-driven and not derived. The row stays UNRESOLVED for them, with (a) still checkable.

10. Unknown, or must stay APPROX#

11. Witnesses and tests#

The lane is tools/ppc-analysis/lanes/queue/: queue_evidence.py and test_queue_evidence.py. The runner discovers it automatically.

Source: docs/reverse/QUEUE-plan.md in the project repository.