OpenTPW

Smarter guests: plan, measurement and baseline#

The goal is an opt-in official extension that makes park visitors decide better, borrowing ideas (not code) from RollerCoaster Tycoon 1, 2 and 3. The faithful tp.exe simulation (GUESTS.md) stays the default: with the extension off, behaviour, determinism pins and saves do not change. OpenRCT2 is GPLv3, so only concepts are taken: no code, no data tables, no constants. Every phase is one pull request. This page holds the overview, the measurement that is built first, and its baseline.

Architecture in short (as built in phase 0b)#

Phases (one PR each)#

PhaseContent
0aPassive measurement: ParkScenario, instrumentation, --guest-report, this baseline and its thresholds. No extension, no behaviour change, every pin unchanged.
0bSeam and identity (built, below): both extensions, FeatureGates, IGuestDecisions with OriginalGuestDecisions as a pure extraction, the birth-id section, off/on pins and a resume test.
1Top 3 Thoughts (fidelity, built: below) and opentpw.guest-insights refusal-reason counters (built, selectable).
2Value for money (built, version 1.1.0: below): price enters the shop and sideshow choice; a guest that price keeps from every stand goes home; the booth weighs the fee against the park; a price sensitivity trait.
3Spreading (built, version 1.2.0: below): an expected-wait queue term for every attraction from a persisted, per-attraction throughput estimate; a stable per-guest preference per attraction instance; hysteresis between rides in the minor decision.
4Queue patience (built, version 1.3.0: below): a guest does not join a queue whose expected wait exceeds its patience, and gives up after waiting too long, when another ride it could choose would be clearly quicker. Measured honestly it acts rarely and does not meet the wait targets.
5Planning needs (built, version 1.4.0: below): a service whose need will cross its level before the guest is done with its ride is scored as if it had; a service on the guest's way gets one detour step; shortly after a meal a ride that would make the guest sick scores lower (a persisted meal time). Measured honestly it acts rarely and has no measurable effect.
6Clean and quiet paths (built, version 1.5.0: below): the wander goal moves to the cheapest of the original's own walk cells, the linked cells beside its goal and the goal itself when that is at least 2 cheaper (litter and guests around a candidate), and a guest standing in litter or a crowd complains (the original's "Too messy" or "Dissatisfied") at a cost of 0.1 happiness, at most once per 480 turns (a persisted complaint time). Measured honestly it lowers the share of guest time spent in crowds without changing happiness or revenue, and does not reduce litter exposure.
6bLitter (built, version 1.6.0: below): a guest with a full litter meter looks eight cells around it for a bin instead of three. Litter-aware routes were built and measured too and not kept. Measurable only where bins stand beyond the original's reach of where guests litter.
7Tuning by data mods (optional).
8RCT3 groups and families (only if wanted).

Phase 1: Top 3 Thoughts and the refusal counters#

Top 3 Thoughts (fidelity). Re-validated in tp.exe: the original park information window (builder 0x4A52A0, table 0x7537D0) shows the three most common guest thoughts as three icons of the ti_hungry model, ranked by 0x4C8430 (counts of the thought ids 0 to 22 over the guests on park cells, the count of id 0 discarded; three slots start as 0, 1 and 2 and take each larger id by the largest count difference, ties keep the lower id, slots unsorted, a zero count shows nothing) and refreshed by a one-second timer. The full rule, the layout and the order of the icons are in GUESTS.md "Top 3 Thoughts". It is not a "most common thought" statistic: GuestStatistics.CommonThought was removed. The window's graph, counts frame, happiness levels and navigation buttons are built from tp.exe too (UI.md).

Refusal counters (opentpw.guest-insights). A passive IGuestObserver (GuestRefusalCounters), created by the guest simulation when the extension is on (the gate is read once, when it is built), shares the observer slot with a measurement collector through GuestObserverChain. It counts five reasons from the queue-end reports the measurement already has: too expensive (Price, the stand-point refusal of a shop or sideshow), queue too long (Full, QueueLimit), too scary, too boring, and ride broken or closed (RideBroken, RideClosed: a queue head sent away). NotAccepting is left out because it cannot tell a closed ride from a double join, and the guests' own leaving tests are abandonments, not refusals. The totals show in the park information window, in the two free strips beside its title (above the graph and its toggles, so they never cover the plot), in the original UI style (the window's labels and fonts), with the labels in the nine interface languages. Never saved, never hashed, no draw: with it on, the guests' state hash, random state and guest snapshot are those of a run with it off (tested on the scenario park), ParkResumeMods records nothing for it, and a loaded park starts again from zero.

Phase 2: Value for money#

Version 1.1.0 of opentpw.smarter-guests. In TPW price plays no part in the choice: a guest walks to a shop or sideshow, queues, and is turned away at the stand point when the price is above its willingness to pay or its money (GuestSimulation.TooExpensive, which also records the economy's price statistics). The original guest then loses happiness twice (the refusal and the dismissal), chooses again, and in the end leaves by the happiness byte. Rides cost nothing per use, so nothing below touches them. All rules are [EXT:smarter-guests-value], live only in SmarterGuestDecisions / SmarterGuestsRules and are gated by the extension; with it off the host does no extra work and every pin is unchanged.

What the host adds (the policy stays pure). A policy that returns UsesValueForMoney (the smarter one; script mods forward their base's answer) gets, for each shop or sideshow with a price above 0 in a candidate view: Price and Willingness (QueueJoinRules.WillingnessToPay with this guest's meters, the same word the stand-point test uses, computed as a pure function: it records no statistic). The booth view gets OpenAttractions, the number of rides and sideshows that are open, not broken and have a join cell (shops and toilets are services, not draws; a park with none open reads 0). The stand-point test is untouched and still records its statistic exactly once per test (a test runs the scenario with and without the facts asked for and compares the counts and the hash). Two additive members of IGuestDecisions (with default implementations, so a policy that ignores them, including the original and every script policy, is unchanged) serve rule 2: PriceTurnedAway and DecidePriceStall (returning PriceStallDecision).

1. Price in the choice. ScoreAttraction returns the original score, except 0 for a priced shop or sideshow the guest expects to refuse, which is below the choice floor of 10 and so never chosen. The guest expects a refusal by the stand's own rule (price > willingness or price > money, unsigned) with the willingness divided by its sensitivity (rule 4). The minor decision (a walking guest looking for something nearer) is the original's: a zero score can still tie the initial 0 on an odd park turn. Overriding that (a zero never wins) was measured and made Halloween worse (guest-time happiness -4.6 SE, revenue per admitted guest -15 SE) by removing a quirk that happens to help there, so it is not part of the rule.

2. A guest that price keeps from every stand goes home. Rule 1 alone has a flaw an independent review found: where the original guest walks to the dear shop, is refused (two medium happiness steps) and soon leaves, the rule-1 guest finds no choice, which costs one small step, and then wanders and tries again every ~30 turns. The review counted over 8 seeds: "can't decide" outcomes rose from 59 to 1,150, and in 81% of them a stand scoring at least 10 had been zeroed by rule 1. That loop is what guests.stuck counts (1.25 to 19.75), and the extra guests in the park are its symptom, not a longer healthy stay. The host now flags a major decision as price-emptied when it chose nothing and the policy says (PriceTurnedAway) that it left out a stand (open, working, with room) that the original would have let the guest choose. It counts a run of such decisions per guest in SmarterGuestsState.Stalls (PriceStalls, keyed by birth id, reset when the guest chooses something, goes home or leaves), asks the policy (DecidePriceStall) and, when the answer is "go home", walks the guest to the gate as the leaving test does (with the decision's own draw, state "leaving the park", reported as a leaving without a predicate) with thought 6, the original's "too expensive" thought (Dissatisfied, the thought of the stand refusal and of the booth's far-too-expensive verdict; no other original thought fits better). The shipped limit is StallsBeforeGoingHome = 1 (see the sweep below). The runs are saved in the SmarterGuests section as Stalls (absent while there are none, birth-id order), checked strictly on load (birth ids the section holds, strictly ascending, 1 to 255, a run saturates at 255), and join WorldStateHash only while there is one. With a limit of 1 nothing stays counted in practice; the counter is exercised by a test policy with a limit of 3. The earlier "too expensive" memory of a refused stand was removed: with rule 1 on, a refused guest has already lost happiness, so its willingness is below the price and the prediction (the same function as the stand-point test) already skips the stand; switching the memory off gave identical state hashes in every measured park, so it never acted.

3. The booth. The original verdict is the fee against GP = points / (N + R % (N / 2 + 1)) + base (the park rating is ParkPoints; BoothVerdict). The smarter booth keeps that, the host's draws and the original bands, and scales only the rating part of the value (GP - base, the minimum entry fee being the base) by the park's variety: 100 + 3 x min(open rides and sideshows, 5) percent, so the original value with none open, 109% with three and 115% from five on. A park with no rating, or a fee and value at the minimum, is the original's verdict. It is never harsher than the original: a first version with 85 + 5 x min(open, 6) percent was measured and made the level parks worse (one ride gave 90%, more expensive verdicts, guest-time happiness -9 to -15 SE in Jungle, Fantasy and Space), so the rule only rewards variety. The scenario has no park rating (its booth reads 0 points), so the report cannot exercise it: it is validated by unit tests (never harsher with more open rides, the original's verdict with none open, some verdicts move) and by a test on a scenario variant with a rating (ParkScenarioOptions.ParkPoints, not part of the report), which shows the booth sees the rating and the four rides and that the guests differ from the original's. In the level parks it changed no verdict (their runs are identical to the default's).

4. Price sensitivity. DecisionContext.Trait( guest, 0 ) (a stateless hash of the park seed and the birth id, so stable for the guest's whole visit) gives a sensitivity of 90 to 110 percent (90 + trait % 21). A guest judges a stand by willingness x 100 / sensitivity: a sensitive guest (110) expects to pay about 9% less than the stand would accept and skips borderline stands, a relaxed one (90) expects 11% more and tries them (and may be refused at the stand: the stand-point test stays the host's). The band is narrow on purpose.

Constants (all in SmarterGuestsRules, all OpenTPW's own): go home after 1 price-emptied decision; sensitivity 90 to 110; booth 100 + 3 x min(open rides and sideshows, 5) percent.

Measured effect#

--guest-report --guest-scale extended --guest-extension smarter-guests against the default, 8 seeds per scenario (the same seeds as the baseline above), --guest-compare with 3 standard errors, release build.

park-scenario (mean ± σ over the 8 seeds):

MetricDefaultSmarter 1.1.0SEVerdict
Queue attempts (queue.attempts)341.500 ± 22.916337.875 ± 11.205-0.4same
Boarded / attempts (queue.boarded.rate)0.544 ± 0.0200.717 ± 0.01519.6improved
Rejected / attempts (queue.rejected.rate)0.410 ± 0.0190.245 ± 0.015-18.8improved
Price rejections / attempts (queue.rejected.price.rate)0.280 ± 0.0260.024 ± 0.007-26.7improved
Abandoned / attempts (queue.abandoned.rate)0.026 ± 0.0080.009 ± 0.004-5.1changed
Wait p50, turns (queue.wait.p50)11.625 ± 2.06617.000 ± 1.6905.7regressed
Wait p90, censored (queue.wait.p90.censored)73.375 ± 7.090101.000 ± 6.5258.1regressed
Wait p99, censored (queue.wait.p99.censored)108.125 ± 4.643123.875 ± 16.0132.7same
Happiness, guest-time weighted (happiness.guestTime)49.007 ± 3.13062.836 ± 1.11411.8improved
Happiness of the guests still inside (happiness.survivors)48.217 ± 4.60662.867 ± 2.9227.6improved
Departures per admission (departures.perAdmission)0.599 ± 0.0510.506 ± 0.064-3.2improved
Happiness-0 departures per admission (departures.happinessZero.perAdmission)0.528 ± 0.0470.084 ± 0.014-25.5improved
Use Gini over the rides (use.giniRides)0.198 ± 0.0370.132 ± 0.025-4.2improved
Revenue per admitted guest (revenue.perAdmittedGuest)82.062 ± 8.50294.238 ± 12.1382.3same
Admissions (admissions)63.875 ± 0.35464.000 ± 0.0000.4same
Guests with no choice for over 50 turns (guests.stuck)1.250 ± 1.0355.250 ± 2.3154.5regressed
Guests in the park (mean) (guests.meanInPark)32.840 ± 1.87736.473 ± 1.2624.5changed

Price rejections fall from 761 to 65 over the eight seeds. The four level parks (Jungle, Halloween, Fantasy, Space) are bit-identical to the default: every seed ends in the same guest state hash and every metric is equal. They have no price rejections at all (rejected by reason holds Full and QueueLimit only; their shops are priced so that nobody is turned away), so rules 1 and 2 have nothing to act on, and the booth rule moved no verdict there. --guest-compare therefore prints the level parks' phase targets as "did not improve (0.0)" and exits 1.

Limit K, by measurement. The same run for each limit (scenario; the level parks are identical to the default for every K; the K = 2, 3 and 5 rows were measured before the booth change, which the scenario's booth, with no rating, does not see):

Limit KPrice shareHappiness (SE)Revenue (SE)Wait p90 censored (SE)Wait p99 censored (SE)Stuck guests (SE)Guests in park
none (rule 1 alone)0.01659.92 (+9.0)99.9 (+4.0)103.3 (+11.4)121.0 (+5.2)19.75 (+15.2)43.1
10.02462.84 (11.8)94.24 (2.3)101.00 (8.1)123.88 (2.7)5.25 (4.5)36.5
20.01562.63 (10.7)96.68 (3.5)104.00 (10.5)123.50 (4.0)13.75 (11.1)38.7
30.01561.84 (10.6)99.20 (3.8)105.62 (11.1)126.25 (4.4)18.62 (12.5)41.0
50.02061.02 (9.9)98.77 (3.5)103.00 (10.2)122.38 (3.5)20.50 (10.8)42.0

K = 1 is the best on every guard that fails: the fewest stuck guests (5.25, against 18.6 to 20.5 for rule 1 alone, K = 3 and K = 5), the smallest wait regression and the guests-in-park count nearest the default, with the largest happiness gain (+11.8 SE); its cost is revenue per admitted guest, +2.3 SE ("same", still above the default) instead of +3.5 to +4.0 SE. A longer run only brings the rule-1 loop back.

Verdict, honestly. Passing at 3 SE on the scenario: price rejections (-26.7 SE), guest-time happiness (+11.8), the survivors' happiness (+7.6), departures per admission and happiness-0 departures (-3.2, -25.5), the use Gini (-4.2), admissions (0.4), revenue per admitted guest (+2.3, not a regression), wait p99 (+2.7) and every level park. Still failing on the scenario: the wait p50 (11.6 to 17.0 turns, +5.7 SE), the wait p90 (73 to 101 turns, +8.1 SE) and the stuck-guest count (1.25 to 5.25, +4.5 SE; at most about 5 guests in a seed).

CPU: 1.31 us per tick for the default and 1.42 us for the rules on the scenario's first seed (machine under load, noisy; ratio 1.08, limit 1.10) with 36.5 against 32.8 guests in the park; allocation 615 B against 612 B per tick.

Version history of opentpw.smarter-guests#

VersionPhaseBehaviour
1.0.00bThe seam and the guests' identity (birth ids, park seed, the SmarterGuests section). Every decision delegates to the original.
1.1.02Value for money: price in the shop and sideshow choice, a guest that price keeps from every stand goes home (Stalls in the section), the booth's variety scaling and the price sensitivity trait. A 1.0.0 park is refused (needs opentpw.smarter-guests 1.0.0, not 1.1.0).
1.2.03Spreading: the expected-wait queue term for every attraction (Throughputs in the section), the 94 to 106 percent preference and the ride-to-ride hysteresis. A 1.1.0 park is refused (needs opentpw.smarter-guests 1.1.0, not 1.2.0).
1.3.04Queue patience: no join when the expected wait (the queue ahead) exceeds the guest's patience, and a give-up after waiting too long, each only when another ride the guest could choose is clearly quicker (a 70 to 130 percent patience trait, stateless: no new saved state). It acts rarely and does not meet the wait targets (see phase 4). A 1.2.0 park is refused (needs opentpw.smarter-guests 1.2.0, not 1.3.0).
1.4.05Planning needs: the three rules above (Meals in the section, the meal times by birth id). The rules act rarely and have no measurable effect on the needs metrics (see phase 5). A 1.3.0 park is refused (needs opentpw.smarter-guests 1.3.0, not 1.4.0).
1.5.06Clean and quiet paths: the wander goal weighted by litter and crowding on the cells of the original's own walk, and a rate-limited complaint (Complaints in the section). It lowers the crowded share of guest time and leaves litter exposure alone; about one complaint per visit at 0.1 happiness (see phase 6). A 1.4.0 park is refused (needs opentpw.smarter-guests 1.4.0, not 1.5.0).
1.6.06bLitter bins: the bin search of a guest with a full litter meter looks eight cells around it, not three (no new saved state). It lowers litter and litter exposure in a park whose bins stand beyond the original's three cells of where guests litter, and does nothing in a park without such bins (see phase 6b). A 1.5.0 park is refused (needs opentpw.smarter-guests 1.5.0, not 1.6.0).

Version 1.6.0 is the released version: player-selectable and off by default (see Cost and release).

Phase 3: Spreading#

Version 1.2.0 of opentpw.smarter-guests. In TPW a guest's queue term is the original's near-only match: it counts only within a squared distance of 8 of the back of the queue, counts only the guests already in the queue, and knows nothing of how fast the attraction serves them. Phase 2 moved the guests that the dear shop used to absorb onto the four one-guest rides, whose queues then grew; this phase makes the choice see the queue it is walking into. All rules are [EXT:smarter-guests-spread], live in SmarterGuestDecisions / SmarterGuestsRules / RideThroughputs, and are gated by the extension; with it off the host does no extra work and every pin is unchanged.

What the host adds (the policy stays pure). A policy that returns UsesSpreading (the smarter one; the script policy forwards its base's answer) gets, in every candidate view, Reservations (the guests other than the asking one walking to the attraction: state "going to a ride" with it as their target; counted by the host once per decision, exact at the moment of the decision, because the candidate loops change no guest) and TurnsPerGuest256 (the attraction's observed time per guest in 1/256 park turn; the throughput is its inverse). It also feeds the throughput estimates from the boardings it already sees (OnVisitorBoarded, in the host's deterministic order), looks at the attractions once per park turn, and asks SwitchesTarget in the minor decision. Two additive members of IGuestDecisions with default implementations (a policy that ignores them, including the original and every script policy, is unchanged): UsesSpreading and SwitchesTarget( context, guest, target, targetScore, candidate, candidateScore ); AttractionView gained two optional trailing members; AttractionScoreInput gained an optional trailing QueueMatchOverride.

1. The queue estimate, for every attraction. The expected wait of a guest who joins now is (guests in the queue + guests walking there) x time per guest, which is ahead / throughput with throughput = capacity / cycle duration. The smarter score is the original score with its queue match replaced by 100 - 100 x wait / 120 turns (clamped to 0..100, QueueWaitScaleTurns = 120), counted at any distance and with the original's queue weight. An attraction without an estimate (a host that was not asked, interval 0) is scored by the original alone. The score is never lowered below the choice floor for a candidate the original would have chosen, and a ride the guest has not used lately (in neither history, not of the type it used last) whose excitement the admission gate would let the guest through to is kept at the floor too, so a guest does not stand still while an unused ride exists. The candidates kept at the floor rank as 10 + score / 5, so their own wait and preference still order them. a long wait orders the candidates but does not remove them. Leaving a queue is the patience rule's job (phase 4); a first version without this protection let a long expected wait take a guest's only ride out of the choice, which raised "can't decide" outcomes (jungle: 72.5 to 93 stuck guests, guest-time happiness -8.6 SE).

The throughput estimate (RideThroughputs, one entry per attraction instance, persisted):

2. A stable preference per guest and attraction instance. The score of a candidate is scaled by 94 + hash % 13 percent (94 to 106), where the hash mixes the guest's Trait( guest, 1 ) (a stateless hash of the park seed and the birth id) with the attraction's id. It is the same for the guest's whole visit, takes no random number, and differs between guests and between instances, so two identical rides have different favourites. The band is narrow on purpose: it breaks ties, it does not override excitement or distance. A score of 0 stays 0.

3. Hysteresis. In the minor decision (a guest walking to a ride looks at the attractions within a 4 x 4 window that are nearer than the guest is) the host scores the target once with the same policy, inside the same metered decision, and asks SwitchesTarget. A ride target is kept unless the best ride in reach beats it by max(2 points, 20 percent of the target's score); a target scoring below the choice floor holds nothing. A walk toward a shop, toilet or sideshow, and a shop, toilet or sideshow in reach, stay impulse stops as in the original. The restriction is measured: the same margin on every kind removed the original's impulse purchases and cost the shop-and-toilet park (Halloween) 14 SE of revenue per admitted guest (59.3 to 51.1) and 6 SE of boarded share, with no gain elsewhere. Two host counters (TargetsKept, TargetsSwitched, not saved or hashed) show it acts: 5 kept and 1 switched in 40 days of seed 1, 3 and 7 in seed 2, 4 and 4 in seed 3. It is rare in these parks (a decision needs two rides within a few cells), so the measured effect is nil; it is insurance against the original's "any better score steals the guest" quirk on parks with ride clusters.

Constants (all in SmarterGuestsRules / RideThroughputs, all OpenTPW's own): wait scale 120 turns; preference 94 to 106 percent; margin 20 percent and at least 2 points; cold start 60 turns per cycle for a ride and 12 for a service; weight 1/(samples + 2) up to 1/16; gap and interval limits a quarter turn to 1,200 turns; floor order 10 + score / 5; stall at 2 cycles.

Measured effect (phase 3)#

--guest-report --guest-scale extended --guest-extension smarter-guests against the default, 8 seeds per scenario (the same seeds as the baseline above), --guest-compare with 3 standard errors, release build. 1.1.0 is the phase 2 run of the table above.

park-scenario (mean ± σ over the 8 seeds):

MetricDefault1.1.01.2.0vs default (SE, verdict)vs 1.1.0 (SE, verdict)
Queue attempts341.50 ± 22.92337.88 ± 11.21387.38 ± 14.614.8 changed7.6 changed
Boarded / attempts0.544 ± 0.0200.717 ± 0.0150.755 ± 0.02021.3 improved4.4 improved
Rejected / attempts0.410 ± 0.0190.245 ± 0.0150.208 ± 0.020-20.3 improved-4.1 improved
Abandoned / attempts0.026 ± 0.0080.009 ± 0.0040.008 ± 0.004-5.4 changed-0.5 same
Price rejections / attempts0.280 ± 0.0260.024 ± 0.0070.027 ± 0.006-26.5 improved1.0 same
Wait p50, turns11.62 ± 2.0717.00 ± 1.6913.50 ± 1.692.0 same-4.1 improved
Wait p90, censored73.38 ± 7.09101.00 ± 6.5296.12 ± 3.238.3 regressed-1.9 same
Wait p99, censored108.12 ± 4.64123.88 ± 16.01117.00 ± 3.664.2 regressed-1.2 same
Happiness, guest-time weighted49.01 ± 3.1362.84 ± 1.1163.26 ± 1.1612.1 improved0.7 same
Happiness of the guests still inside48.22 ± 4.6162.87 ± 2.9264.32 ± 3.258.1 improved0.9 same
Departures per admission0.599 ± 0.0510.506 ± 0.0640.413 ± 0.031-8.9 improved-3.7 improved
Use Gini over the rides (raw and capacity-normalised: every ride has capacity 1)0.198 ± 0.0370.132 ± 0.0250.106 ± 0.015-6.6 improved-2.5 same
Revenue per admitted guest82.06 ± 8.5094.24 ± 12.14103.80 ± 8.315.2 improved1.8 same
Guests with no choice for over 50 turns1.250 ± 1.0355.25 ± 2.311.250 ± 1.4880.0 same-4.1 improved
Guests in the park (mean)32.84 ± 1.8836.47 ± 1.2640.73 ± 0.8810.8 changed7.8 changed
Admissions63.88 ± 0.3564.00 ± 0.0063.88 ± 0.350.0 same-0.4 same

The four level parks, 1.2.0 against the default (they have one ride, so spreading has little to do; they are no longer bit-identical to the default (no seed ends in the same state hash), but little moves beyond 3 SE, see below):

Default → 1.2.0 (SE and verdict against the default), mean ± σ:

MetricJungleHalloweenFantasySpace
Boarded / attempts0.254 ± 0.010 → 0.254 ± 0.006 (-0.0 same)0.684 ± 0.041 → 0.719 ± 0.028 (2.0 same)0.454 ± 0.025 → 0.467 ± 0.019 (1.2 same)0.481 ± 0.021 → 0.499 ± 0.021 (1.7 same)
Wait p50, turns31.88 ± 0.83 → 32.75 ± 0.46 (1.8 same)11.62 ± 1.19 → 11.38 ± 1.06 (-0.4 same)25.62 ± 2.62 → 26.62 ± 1.41 (1.0 same)33.00 ± 1.07 → 35.25 ± 0.71 (4.3 regressed)
Wait p90, censored528.50 ± 24.05 → 516.88 ± 17.71 (-1.1 same)194.12 ± 6.81 → 196.50 ± 4.81 (0.8 same)738.38 ± 36.35 → 710.75 ± 37.32 (-1.5 same)432.38 ± 9.97 → 387.12 ± 26.25 (-4.6 improved)
Happiness, guest-time weighted53.04 ± 0.51 → 53.68 ± 1.04 (1.5 same)37.82 ± 0.89 → 38.70 ± 0.82 (2.1 same)49.22 ± 0.47 → 49.60 ± 0.40 (1.6 same)48.45 ± 0.55 → 48.51 ± 0.62 (0.2 same)
Revenue per admitted guest47.63 ± 0.50 → 48.25 ± 0.32 (2.5 same)59.31 ± 1.49 → 60.12 ± 2.40 (0.8 same)55.27 ± 2.31 → 57.57 ± 0.95 (2.6 same)46.00 ± 0.53 → 48.30 ± 0.48 (8.9 improved)
Guests with no choice for over 50 turns72.50 ± 3.70 → 67.50 ± 5.29 (-2.2 same)59.12 ± 2.47 → 57.12 ± 3.72 (-1.3 same)70.50 ± 8.64 → 71.88 ± 6.47 (0.4 same)64.00 ± 4.54 → 65.00 ± 5.32 (0.4 same)
Guests in the park (mean)104.34 ± 1.62 → 103.18 ± 1.57 (-1.4 same)36.95 ± 0.92 → 35.89 ± 1.15 (-2.0 same)87.06 ± 4.11 → 87.13 ± 2.41 (0.0 same)97.88 ± 1.67 → 97.07 ± 2.46 (-0.8 same)

Level parks, honestly: space waits at the median are 2.3 turns longer (33.0 to 35.3, +4.3 SE, regressed) while its p90 falls (432 to 387, -4.6 SE), its revenue per admitted guest rises (46.0 to 48.3, +8.9 SE) and its use Gini over all attractions changes (0.285 to 0.302, +6.6 SE: the spread over the ride, the shops and the toilet shifts); Halloween's happiness of the guests still inside rises (29.7 to 33.1, +3.2 SE). Everything else is equal within the spread. The shipped parks have one ride, so the unused-ride fallback below has nothing to act on there.

Tuning. (Swept on the build before the unused-ride fallback, the demand-follows-the-queue estimator and the live capacity; the last row is the final build.) 24 seeds of the scenario (--guest-seeds 24 --guest-levels none; 8 seeds are too few to tell settings of this size apart), the shipped rules against variants of one constant at a time (the default and the phase 2 run on the same 24 seeds are the first two rows):

VariantBoardedWait p50Wait p90 cens.Departures / adm.Use GiniRevenue / adm.HappinessStuckIn park
default0.55411.972.60.5920.19781.248.81.3932.6
1.1.00.72316.61020.5190.13394.762.74.7936.5
wait scale 600.76712.397.80.4640.12710462.75.1238.9
shipped: scale 1200.76913.093.50.4070.10810362.85.5440.5
wait scale 2400.75514.596.00.3370.10310863.73.8341.9
ride cycle 300.76414.491.20.3970.09710863.44.9641.1
ride cycle 1200.77412.394.70.4000.13110662.56.7940.2
service cycle 300.76512.791.70.4150.10211063.85.3840.1
no hysteresis0.77513.291.80.4120.10710563.05.0440.7
margin 00.76812.993.30.4030.10910362.85.9640.6
margin 50 percent, 4 points0.76913.093.50.4070.10810362.85.5440.5
no preference0.76713.092.20.3880.10710762.95.2541.0
preference 97 to 1030.77113.492.60.4020.10410662.85.6740.4
preference 88 to 1120.77212.890.30.3940.11010862.95.1240.5
final build0.75213.895.70.3940.10710563.31.5441.3

Every variant of every constant lands within about 1.5 SE of the shipped value on each headline metric, so none of them is a lever: the step from 1.1.0 to any of them is the rule itself (the expected-wait term), not its tuning. The wait scale trades the median wait for crowding: a larger scale lets the park fill (departures per admission 0.46, 0.41, 0.34 and guests in the park 38.9, 40.5, 41.9 for 60, 120 and 240 turns) and leaves fewer guests with nothing to do (stuck 5.1, 5.5, 3.8), while the median wait grows (12.3, 13.0, 14.5). 120 is the middle value; the preference band and the hysteresis margin did not move the scenario, where the two identical rides were already used evenly under 1.1.0 (368 and 364 boardings over 8 seeds) and are now (354 and 347 with more guests), so they keep their narrow, documented values; the hysteresis acts rarely there and its margin never changed a run (margin 50 percent is the shipped run to the digit). A multiplicative variant that keeps the original's near-only queue match and scales the score by 100 down to 40 percent of the expected wait was measured at 8 seeds: it matched the replacement within the spread (wait p50 13.9 against 13.6, p90 96.8 against 93.0) and was dropped, because the specified design replaces the queue match.

Verdict, honestly.

Phase 4: Queue patience#

Version 1.3.0 of opentpw.smarter-guests. In the original a queued guest leaves only by its own tests (happiness below 10, a toilet need above 80, the queue limit); the 100-turn boredom branch of GuestSimulation is unreachable (QUEUE-plan section 5.3: +508 >= +520 always holds there), so TPW has no time limit that can fire and no guest judges a queue before joining. Phase 3 keeps every candidate at the choice floor on purpose, so a long wait never makes a guest give up. This phase adds two rules for that. Both are [EXT:smarter-guests-patience], live only in SmarterGuestDecisions / SmarterGuestsRules, and cost nothing with the extension off.

Plain summary of the result. With the rules built correctly (below) they act rarely: in park-scenario about two guests per seed are turned away and nobody gives up in 8 extended seeds, so the censored p90 and p99 wait do not move toward the default's (93 and 116 turns against the default's 73 and 108; 1.2.0 has 96 and 117). The phase 4 wait targets are not met, at any setting tried. An earlier build of this phase did cut the p90 to 43 and the p99 to 81 turns, but that was an artifact: it counted guests still walking to the ride as ahead of a guest that was already standing at the back, and it let a guest be refused for a ride that no other ride could replace, so it refused guests whose real wait was fine and the guests rode less (details under "What the first build got wrong"). Phase 4 as shipped is a small safety net, not a wait reduction: a queue wait cut by refusals is a cut by having guests ride less, and the guarded metric below says so.

The base is measured, not borrowed. BoredomThreshold is not used: its unit is unproven and its test cannot fire. The base is the original's own wait in the scenario baseline: boarded waits of p90 73 and p99 108 turns (baseline). The join patience is 90 turns (between p90 and p99) and the give-up patience 120 turns (above the baseline's p99). Both are scaled by a stateless per-guest trait, PatienceTrait (Trait( guest, 2 ), a hash of the park seed and the birth id, the same for the whole visit): 70 to 130 percent. Being a trait, patience needs no saved state.

What the host adds (additive; the policy stays pure). IGuestDecisions.AlternativeLookAfterTurns( context, guest ) (default -1, forwarded by ScriptGuestDecisions) asks the host for the best alternative: AdmissionView.BestAlternativeWait256 at every admission and QueuePatienceView.BestAlternativeWait256 for a guest not at the front once it has waited the returned number of turns (the smarter policy returns the guest's own give-up turn, 84 to 156, so the scan of the park's rides is not paid before it can matter). It is the shortest phase 3 expected wait, in 1/256 turn, over the other rides the guest could actually choose next: open, working, with room, admitted by its excitement gate, and not in its used or temporary history, not of the type it rode last and of an excitement it likes (SmarterGuestsRules.IsUnusedAdmissibleRide, the criteria of phase 3's floor rule), or -1 for none. The scan (GuestSimulation.BestAlternativeWait256) is pure: no draw, no state. QueuePatienceView.Position is the guest's current place (after a move-up the new one; scripts' leaveQueue sees the same).

1. Do not join. DecideAdmission runs the original gates first (excitement, queue limit). A guest that passes them is refused when it is at a ride whose expected wait is above 90 x patience turns and another ride it could choose has a wait of at most 80 percent of it. At admission the guest already stands on the queue's last cell, so only the queue ahead counts: guests still walking to the ride will stand behind it (Reservations is set to 0). The refusal is QueueTooLong, so the host's existing path applies: the "queue too long" thought (16), QueueEndReason.QueueLimit (counted as a refusal, in the insights' "queue too long" counter), the refused ride pushed into the temporary history and the guest's next choice is the host's. No happiness is lost, as in the original refusal.

2. Give up. DecideQueuePatience runs after the existing leave tests, on a turn the guest stays, never while it is called forward and never in an interlude (the host's call sites; it can run on the turn a move-up starts, which keeps the original's flow, with the new place in the view). A guest not at the front leaves when it has waited longer than 120 x patience turns from QueueJoinTurn and another ride it could choose has a wait of at most 80 percent of its own remaining wait (position x time per guest). It thinks "queue too long" (16, the nearest original thought for "waited too long") and is dismissed by the host's existing path with QueueEndReason.Impatient (counted as abandoned): the original dismissal's medium happiness step is the cost, and the guest chooses again at once. The hook is still called for a guest at the front (script mods' leaveQueue sees it, as before); the host scans nothing for it and the smarter policy declines.

Does rule 2 earn its place? In the 8 extended seeds of park-scenario it fires 0 times (4 times with a give-up of 50 turns; waits of the scenario's four rides stop near 117 turns, below the 84 to 156 turns of the band for any guest with a clearly quicker ride), and the level parks have no alternative at all. It is kept as insurance for a park with many rides and one badly slow one, where the guests of the slow queue otherwise wait for ever for a ride far slower than the rest; a test builds exactly that (a ride of 120 turns a guest next to quick ones) and checks that it fires. It costs nothing where it does not apply.

Only rides, only with somewhere better to go. Shops, sideshows and toilets are services a guest wants for its own reason, and the alternatives are rides, so neither rule concerns them. A park with one ride (the four level parks) has nothing to go to: the rules never act, and every seed of Jungle, Halloween, Fantasy and Space ends in the same state hash as under 1.2.0.

Interactions.

Measured effect (phase 4)#

--guest-report --guest-scale extended --guest-extension smarter-guests against the default and against 1.2.0 (the same build with both rules switched off), 8 seeds per scenario, --guest-compare with 3 standard errors, release build. The new guarded metric, guest seconds per ride boarding (use.guestSecondsPerRide: the window's guest time over the boardings of rides in it, the pooled form of "time between a guest's boardings"; down is good, and --guest-compare flags a regression), is there because the queue wait is measured over the boardings that happened: a wait cut bought with refusals leaves it unchanged or lower while guests ride less.

park-scenario (mean ± σ over the 8 seeds):

MetricDefault1.2.01.3.0vs default (SE, verdict)vs 1.2.0 (SE, verdict)
Queue attempts341.500 ± 22.916387.375 ± 14.609394.000 ± 18.3075.1 changed0.8 same
Boarded / attempts0.544 ± 0.0200.755 ± 0.0200.745 ± 0.02219.2 improved-1.0 same
Rejected / attempts0.410 ± 0.0190.208 ± 0.0200.219 ± 0.022-18.4 improved1.0 same
Abandoned / attempts0.026 ± 0.0080.008 ± 0.0040.010 ± 0.003-5.0 changed1.1 same
Price rejections / attempts0.280 ± 0.0260.027 ± 0.0060.025 ± 0.005-27.0 improved-0.8 same
Wait p50, turns11.625 ± 2.06613.500 ± 1.69013.500 ± 2.2041.8 same0.0 same
Wait p90, censored73.375 ± 7.09096.125 ± 3.22793.125 ± 2.5327.4 regressed-2.1 same
Wait p99, censored108.125 ± 4.643117.000 ± 3.665116.250 ± 2.5504.3 regressed-0.5 same
Guest seconds per ride boarding (use.guestSecondsPerRide)97.478 ± 3.53191.157 ± 3.27991.825 ± 2.833-3.5 improved0.4 same
Happiness, guest-time weighted49.007 ± 3.13063.260 ± 1.16063.812 ± 1.07012.7 improved1.0 same
Happiness of the guests still inside48.217 ± 4.60664.323 ± 3.24765.133 ± 3.0878.6 improved0.5 same
Departures per admission0.599 ± 0.0510.413 ± 0.0310.405 ± 0.033-9.1 improved-0.5 same
Happiness-0 departures per admission0.528 ± 0.0470.100 ± 0.0240.096 ± 0.020-23.9 improved-0.4 same
Use Gini over the rides0.198 ± 0.0370.106 ± 0.0150.107 ± 0.010-6.8 improved0.2 same
Revenue per admitted guest82.062 ± 8.502103.801 ± 8.311107.961 ± 7.3976.5 improved1.1 same
Guests with no choice for over 50 turns1.250 ± 1.0351.250 ± 1.4881.375 ± 1.0610.2 same0.2 same
Guests in the park (mean)32.840 ± 1.87740.726 ± 0.88040.803 ± 0.84310.9 changed0.2 same
Admissions63.875 ± 0.35463.875 ± 0.35463.875 ± 0.3540.0 same0.0 same

1.3.0 is the same as 1.2.0 within the noise on every metric (the censored p90 is 2.1 SE lower, "same"), and its two wait targets fail against the default (+7.4 and +4.3 SE; the same as 1.2.0 failed them). Phase 2 and 3's gains hold: happiness +12.7 SE, revenue per admitted guest +6.5, price rejections -27.0, the use Gini -6.8, departures per admission -9.1. Boardings per seed are 293 (1.2.0: 293, default 186), and 16 refusals by patience happen in all 8 seeds together. Only 2 of the 8 seeds end in a different state hash from 1.2.0. --guest-compare against the default exits 1 because of the wait targets; against 1.2.0 it exits 0.

Level parks. Every seed of the four level parks ends in the same state hash as under 1.2.0, so every metric equals the 1.2.0 run (and the phase 3 table above): one ride, no alternative, no rule acts. Against the default the only regression is the one phase 3 already had (Space's median wait 33.0 to 35.3).

What the first build got wrong (found by an independent review, kept here so the next phase does not repeat it). The first 1.3.0 build counted the walkers (Reservations) as ahead of a guest that was already on the back cell, and scanned every open ride as an alternative. It measured p90 43 and p99 81 turns, "both targets pass", with a boarded share of 0.583 and 266 boardings a seed (1.2.0: 293). Those wait numbers were not a better queue: refused guests re-attempted (attempts 457 against 387), 34 percent of refusals were followed by another, and by the guest's own clock the build was worse: 104.2 guest seconds per ride against 1.2.0's 91.2 (the metric above, added because of this), a mean time from a refusal to the next boarding longer than the p99 wait. With walkers set to 0 alone the effect nearly vanished (p90 91, p99 117, boarded share 0.741). The fix is the two corrections above (queue ahead only; alternatives the guest could choose).

Tuning (after the fixes). Every row is the same 8 seeds. Scenario censored p90 / p99 (default 73 / 108, 1.2.0 96 / 117), boardings per seed, patience refusals and give-ups (totals over the 8 seeds; the scenario has no other QueueLimit rejection under these rules):

Variant (join / give-up / alternative share)p90 / p99BoardingsRefusals / give-upsGuest s per ride
1.2.0 (rules off)96 / 117292.50 / 091.2
90 / 120 / 80 (shipped)93 / 116293.116 / 091.8
60 / 120 / 8094 / 118291.921 / 091.3
45 / 120 / 8095 / 119293.524 / 090.2
30 / 120 / 8095 / 120293.422 / 090.1
45 / 120 / 10096 / 116290.470 / 092.1
30 / 120 / 100 (also 20 and 10 / 120 / 100)96 / 116289.474 / 091.7
20 / 120 / 15088 / 116290.8182 / 093.3
60 / 90 / 80 and 60 / 70 / 8094 / 118291.921 / 091.3
60 / 60 / 10094 / 118292.047 / 091.6
60 / 50 / 10094 / 118289.253 / 491.4

No setting meets the targets (the best p90 is 88, at 20 / 120 / 150, which also refuses a guest for a ride only 1.5 times slower than the best: about 23 refusals a seed, guest seconds per ride 93.3). A lower join limit changes nothing: guests that have a clearly quicker, choosable ride rarely stand in a queue beyond 30 turns, and the tail of the scenario's waits (90 to 117 turns) belongs to guests whose rides all have the same queue. The shipped values are the baseline-derived ones; lowering them gains nothing and tighter ones only add refusals.

Constants (all in SmarterGuestsRules, all OpenTPW's own): join patience 90 turns; give-up 120 turns; patience trait 70 to 130 percent; alternative at most 80 percent of the wait.

Cost. The scan runs at an admission and, for a guest not at the front, from its own give-up turn (84 to 156 turns of waiting) on every update, over the park's rides (a view per ride, the host's pure estimate). --guest-compare reports the whole extension at 1.25 of the default's CPU per tick on this noisy machine (limit 1.10), of which phase 4's share was not isolated; the gate and the position-0 skip are what keep the scan off the common path.

Phase 4 tests. SmarterGuestsPatienceTests covers the band, the base, rule 1 (refusal with a clearly quicker alternative as QueueTooLong, none without one or with an alternative that is no quicker, walkers behind the guest not counted, the band moving the limit, the original's gates first, services and a missing estimate untouched), rule 2 (the turn it fires on, the thought, none for the front of the queue, without an alternative or a join turn, for a shop, sideshow or toilet, or when the remaining wait is short, the band moving the turn, the current place), the host (alternatives asked only when the policy wants them and only from the guest's give-up turn, nothing scanned at the front, the hook only ever running for a waiting guest, never called forward or in an interlude, an alternative being a ride the guest could choose, IsUnusedAdmissibleRide's exclusions), and three constructed parks that use ParkScenarioOptions.TwinAHoldMilliseconds and SingleRide with the original's choice so queues form: a slow ride refuses guests who have a quicker one (non-empty, rides only), the same park makes a guest give up (non-empty, Impatient, after 84 turns), and a one-ride park, whose guests do wait longer than the patience, sees neither. GuestMeasurementTests.GuestTimePerRideBoardingIsAGuardedHeadlineMetric covers the new metric and its direction. There is no new saved state, so the save and resume tests are the phase 3 ones (their version strings are 1.3.0): a 1.2.0 park is refused with the usual message. The off path is unchanged: every existing pin holds.

Phase 5: Planning needs#

Version 1.4.0 of opentpw.smarter-guests. The plan: eat or use the toilet before a thrill when a meter is rising, pick shops on the way, and no thrill right after a meal. All three rules are [EXT:smarter-guests-planning], live in SmarterGuestDecisions / SmarterGuestsRules, and cost nothing with the extension off. They are built on the real meter dynamics of the code, not on a guess of them, and the first thing the dynamics say is that needs are slow, which shapes the whole phase.

Plain summary of the result. Measured honestly the three rules act rarely and have no measurable effect: over 8 extended seeds of the default park-scenario the planning rule changes one seed's run and the other two change none; with a food shop in the scenario (24 seeds) planning and the meal rule change every other seed's run and no needs metric moves beyond 0.9 standard errors (the 3 SE rule: nothing is "changed"). The detour step changed no decision in any of 24 seeds, in any level park or in the default scenario. They are kept because they are small, cheap (the cost of the extension did not move beyond the noise: 0.997 to 1.02 of 1.3.0's) and defined on the original's own numbers; the page says what they do not do.

The meter dynamics the rules stand on (NeedsUpdate, the oracle-checked needs block 0xeece4):

1. Plan (SmarterRuleSet.Planning). When a guest decides, the host looks at whether any of its meters will cross a level within the longest look ahead (SmarterGuestsRules.MayCross: 180 turns, which is the give-up patience of phase 4 plus a default cycle: a longer commitment is not a plan, the guest would have left the queue first). Only then, and in practice only for a grower within about 22 to 24 points of 100 or 11 to 12 of 80 (11 or 12 growth steps in 180 turns, by where the multiples of 16 fall), it scans the rides the guest could choose (open, working, with room, admitted by its excitement, not used lately: IsUnusedAdmissibleRide) and gives the policy the shortest commitment: the phase 3 expected wait (queue ahead plus walkers over the observed time per guest) plus one cycle (AttractionView.CycleTurns256, the time per guest times the capacity, capped at the nominal cycle of 60 turns: the product overestimates for a ride that boards partly loaded or has stalled, and a plan that errs short only makes the rule act less; a ride whose real cycle is longer than 60 turns is read short too), in GuestView.PlanTurns256. In the minor decision it is the commitment of the ride the guest is already walking to. The shortest on purpose: the rule acts only when even the quickest ride leaves a need to cross. The policy then scores a service that answers a crossing need (a shop with a thirst or hunger effect, a relief object) as if the need had already grown to what NeedsUpdate gives it by then (Planned): a pre-emptive need, so the host's choice mechanics and the original's score decide, nothing is forced. A ride, and a need that does not cross, are scored on the guest as it is. The price rule stays on the real guest's willingness (the host computes it from the real meters, as the stand-point test does) while PriceTurnedAway judges "would the guest have chosen it" on the planned guest, so it agrees with the score about which stands the price emptied. The projection is the needs block's growth only; it leaves out the environment words of the guest's cell (entertainers, vomit and the like), which the same block adds and which can push either way where they are not 0, so it is approximate there.

2. Detour (SmarterRuleSet.Detour). "Near the route" is the original's own definition: the minor decision's window (the attractions within 4 x 4 cells of a guest that are nearer its target than the guest is, GuestSimulation.MinorDecision), so the host computes nothing new; it marks the window's candidates AttractionView.OnTheWay. A service on the way is scored with each need it serves one step higher: DetourStep = 10 meter points for hunger and thirst (one step of the original's table, which reads the need in tens) and ReliefDetourStep = 5 for a relief object (one step of the relief curve, which the original indexes in fives; 10 would move two entries), at most 100. By the tables that is a few points of score on a shop or toilet that is not new (a test walks the whole table and bounds it at 5) and none below a need of 20.

3. Meal time (SmarterRuleSet.MealTime). The host notes the park turn of a guest's meal, a use of an attraction with a hunger effect, in the extension's state, by birth id (MealTimes, GuestView.MealTurn), and forgets it when the guest leaves. Within MealWindowTurns = 160 turns of the meal a ride whose illness gain for this guest is at least MealGainLimit = 25 is brought halfway to the choice floor (LowerAfterMeal: floor + (score - floor) / 2, so a ride stays a candidate, two rides keep their order and nothing ends above what it was; the 2 is the weakest of the original's own history divisors). Where the numbers come from: 160 is the time the hunger meter takes to grow back the 20 points a typical meal takes off (the shipped Fries Shop's HungerEffect; burgers and restaurants 25, ice cream 15) at the only rate there is, 2 points per 16 turns (20 / 2 x 16); that rate belongs to a grower, so for the other guests the window is the rule's own limit, not a measurement. 25 is a quarter of the illness meter: four such rides in a row make a guest vomit. The gain is the original's formula over the guest's own stomach (RideOutcome.IllnessGain, shared by the outcome and the rule), so the same ride is judged by what it would really do: a thrill ride (excitement 95) after a meal (hunger 10) adds 36; at excitement 70 it adds 28; a calm ride (20) 8. Neither number is tuned.

An honest caveat of the design, found while measuring: the stomach factor is read from the hunger meter itself, so it is exact whenever the guest rides, meal or not; what the window adds is only a recency gate, and what the rule can win is bounded by how few rides follow a meal: in the 24 food-shop seeds 0.054 of a guest's vomits per admission happen within 160 turns of a meal, out of 0.357 in all.

What the host adds (additive; the policy stays pure). IGuestDecisions.UsesPlanning (default false; forwarded by ScriptGuestDecisions; needs UsesSpreading); GuestView.MealTurn and PlanTurns256 (defaults -1); AttractionView.CycleTurns256 and OnTheWay (defaults 0 and false). A policy that does not plan is given the defaults and the host does none of it, so the original path does no extra work. The scan is paid only by a guest MayCross selects, which is a grower near a level and nobody else (MayCross returns false at once for an id that is not a multiple of 4). The look at the rides is made only when the planning rule is on (UsesPlanHorizon): a meal-only or detour-only policy pays nothing for it, and it runs inside the decision's reservation count, so the walkers are counted once.

State and saves. Meals in the SmarterGuests section (like Stalls and Throughputs, only in a save that records the extension: a script-mod-only save that carries any of them is refused): (birth id, turn) pairs in birth-id order, left out while empty (so a section from before and a park nobody ate in are as they were), hashed only while it holds an entry (marker "MEAL"). Validation: every birth id one the section holds, strictly ascending, a turn of 0 or more, no empty list; a meal after the saved park's turn is refused at restore. A 1.3.0 park is refused by the version check (needs opentpw.smarter-guests 1.3.0, not 1.4.0).

Constants (all in SmarterGuestsRules, all OpenTPW's own, none tuned): planning cap 180 turns; toilet level 80 and full level 100 (the original's); detour step 10; meal window 160 turns; meal gain limit 25; meal divisor 2.

Measured effect (phase 5)#

The new passive metrics (GuestMetrics, hash-neutral): needs.vomits.perAdmission, needs.vomitsAfterMeal.perAdmission (a vomit within 160 turns of a boarding of an attraction with a hunger effect, watched by the collector itself so it counts in any configuration), needs.thoughts.perAdmission (hungry, thirsty, both, need the toilet), departures.unmetNeeds.perAdmission (an admitted guest leaving with hunger or thirst at 100 or toilet above 80), departures.meanIllness and queue.abandoned.needToilet.rate, all with "down is good" in --guest-compare. Two flags make the comparison possible from one build: --guest-rules none|all|planning,detour,meal (none is version 1.3.0's behaviour; the pin of 1.3.0 holds for it; the rule set is passed to each simulation explicitly as its policy, there is no process-wide switch, and it cannot be combined with --guest-mod) and --guest-food (the scenario's fourth branch with a Burger-Shop-like food shop, 25 off hunger and 15 on illness, off by default so the baseline is the baseline). The default park-scenario has no food shop; a food shop is also the only way its guests can fill their stomach.

Release build, --guest-scale extended (20 + 60 days), --guest-extension smarter-guests, 3 standard errors. "Same hash" counts seeds whose end state equals 1.3.0's (8 or 24 seeds). Mean ± σ over the seeds, SE of the difference to 1.3.0 in brackets.

park-scenario with the food shop, 24 seeds (the most power; the 8-seed run says the same):

Metric1.3.0 (rules none)planning onlydetour onlymeal onlyall (1.4.0)
Seeds with the same end state as 1.3.024132400
Vomits per admission0.357 ± 0.0500.349 (-0.5)0.357 (0.0)0.350 (-0.5)0.358 (+0.1)
Vomits within 160 turns of a meal0.054 ± 0.0320.053 (-0.1)0.054 (0.0)0.051 (-0.3)0.053 (-0.1)
Need thoughts per admission1.234 ± 0.2971.220 (-0.2)1.234 (0.0)1.183 (-0.6)1.164 (-0.9)
Departures with an unmet need per admission0.078 ± 0.0210.081 (+0.4)0.078 (0.0)0.079 (+0.1)0.077 (-0.2)
Mean illness at departure42.7 ± 4.843.6 (+0.6)42.7 (0.0)43.0 (+0.2)42.0 (-0.5)
Queue exits for the toilet, per attempt0.0000.000 (-0.2)0.0000.000 (-0.2)0.000 (-0.2)
Happiness, guest-time weighted64.27 ± 1.5864.51 (+0.5)64.27 (0.0)64.23 (-0.1)64.34 (+0.1)
Revenue per admitted guest144.8 ± 9.7145.2 (+0.1)144.8 (0.0)145.5 (+0.3)145.2 (+0.1)
Boarded share of queue attempts0.860 ± 0.0230.862 (+0.4)0.860 (0.0)0.869 (+1.6)0.867 (+1.1)
Departures per admission0.198 ± 0.0430.201 (+0.2)0.198 (0.0)0.200 (+0.2)0.205 (+0.6)
Guest seconds per ride boarding101.9 ± 3.8101.0 (-0.8)101.9 (0.0)101.4 (-0.5)101.7 (-0.2)

Every verdict is "same"; --guest-compare exits 0 for each pair. The default park-scenario (no food shop, 8 seeds): planning changes 1 seed's end state, detour and meal none, every metric equals 1.3.0 to the third decimal (need thoughts 1.622 to 1.618), and so do the level parks Jungle, Hallow and Fantasy (all 8 seeds of each end in 1.3.0's state hash). In the Space park, which has a food shop, the meal rule changes 7 of 8 seeds and nothing beyond 1.9 SE moves (need thoughts +1.9, unmet needs +1.2, departures per admission +0.4, mean illness -0.3, happiness -0.3). The level parks have no vomits at all in these runs (one ride, few uses): the meal rule has nothing to prevent there.

How often the rules act (a one-off count with a throwaway harness that scored every candidate with 1.4.0 and with the rules off, 8 seeds x 80 days; the meal count is from the first build, before the review's changes to the lowering and the cycle): without a food shop 26,438 scores, 475 of a service whose guest had a plan, 8 changed by planning, 147 of a service on the way, 1 changed by detour, none by the meal rule; with the food shop 31,900 scores, 630 with a plan, 87 changed by planning, 245 on the way, 1 changed by detour, about 600 ride scores lowered by the meal rule. A changed score is not a changed decision: the minor decision already retargets to any open attraction in its window with a score above 0 (BeatsInMinorDecision starts from a best of 0; the original's route test only wants the candidate nearer), so a shop on the way is picked for its presence and the detour step can only reorder the window's candidates among themselves. That is why it never changes a decision: the original already has the behaviour the plan wanted ("shops on the way"), and what is left for a bonus to do is nothing. It is the first candidate to drop if the extension needs to be smaller.

Why the meal rule cannot show a gain here. It moves guests from a thrill ride to a calmer one only in the 160 turns after a meal, which is about a third of a visit, and only when the thrill ride is one of the two or three rides the guest would take; a calmer ride still adds illness (6 x 4 = 24 against 36), so a vomit is a little later, not avoided. Total illness is the sum over all rides, and a vomit needs it to reach exactly 100: the rule lowers the rise for about 4 percent of the ride scores it sees (the 600 of about 15,900 above) by a third, a few percent of the total, below the seed noise (σ 0.05 on 0.35 vomits per admission). A larger effect needs a different rule (a guest who uses a toilet when its illness is above 90, which clears it, would remove vomits outright), which is not phase 5's.

Cost. Phase 5 costs nothing that the noise lets us see. A Stopwatch over ParkScenario runs of 250 in-game days (3 seeds, 7 repeats each, the median of 21, Release, the machine otherwise quiet) gives, without a food shop, original 105.7 ms, 1.3.0's rules 136.1 ms, 1.4.0 135.8 ms (0.997 of 1.3.0), and with the food shop 118.5, 179.1 and 182.5 ms (1.019; the best runs are 174.1 and 173.1 ms, 0.994; two earlier passes of the same measurement gave 1.00 and 1.00, so the run-to-run noise is about two percent). The ratio of the whole extension to the original in this scenario is 1.29 (1.51 to 1.54 with the food shop), above the 1.25 of the earlier noisy measurement; it is not a per-guest figure, because the extension keeps about 40 guests in the park where the original keeps 33 (happier guests stay longer), so the same simulated days hold more guests to update. The phase 6 limit of 1.10 is the extension's as a whole and is not met by phases 2 to 4 either; phase 5 does not make it worse. The scan is paid only for a grower near a level, and nothing per guest per turn is new: no path search, one GrowthSteps computation per decision and a score for a service that does arithmetic on three meters.

Phase 5 tests. SmarterGuestsPlanningTests (29) covers the growth arithmetic against NeedsUpdate.Apply turn by turn, the levels, the plan (a crossing need is read grown for the service that answers it and nothing else, no plan and no crossing leave the guest alone, the score is the original's over the projected guest), the detour (one step, clamped, only the need the shop serves, at most a few points over the whole table, never lowers a score), the meal rule (window edges, the gain against RideOutcome.Apply over a grid, the limit, the lowered score keeps the floor and is monotone), the rules as switches, MealTimes (order, replace, forget, no id), the hash, the save (round trip into a fresh instance, left out while empty, bad data refused: unknown or repeated birth ids, a negative turn, an empty list, a meal after the park's turn) and the host (the meal turn and plan only for a policy that plans, notes at the food shop and forgets at departure, a plan only for a grower near a level, OnTheWay in the minor decision only). GuestMeasurementTests pins the food-shop scenario with the extension on (ScenarioFoodSmarterFixedRunHash) and shows the rules off reproduce 1.3.0's pin; the resume test of the extension now includes meal times.

Phase 6: Clean and quiet paths#

Version 1.5.0 of opentpw.smarter-guests. The plan: wander goals weighted by litter and crowding, and "disgusting path" and "too crowded" thoughts with a small cost. Both rules are [EXT:smarter-guests-paths], live in SmarterPathComfort and cost nothing with the extension off.

Plain summary of the result. The rule measurably lowers the share of guest time spent in crowds (about 20 percent less in the busy and dirty scenarios, beyond 5 standard errors; 10 to 25 percent in the four level parks, 2.2 to 3.7 t) without a measurable change of happiness, revenue, admissions or stuck guests in the scenarios (each within 1.4 SE, except guests in the park, -3.0 SE in the busy one, 76.1 against 77.2) and with one real cost in the level parks: the Jungle park's guest-time happiness is 0.8 points lower (54.2 to 53.4, t = -4.8); the other three are within the noise. It does not reduce litter exposure (steps onto litter per visit and the share of time on litter are unchanged in every scenario and park): where a guest meets litter is decided by its route to a ride or shop, not by where its idle wander ends. The complaints are rare (at most one per 480 turns, one cooldown for both kinds) and cost 0.1 happiness, so they do not drive the result.

How the original wanders, and where the rule hooks in. The destination search (GuestWander.Pick, tp.exe 0x4F9490) draws a step count (rand % 5 + 1) and walks that many random steps over the cell links, choosing each step with one draw (rand & 3) and finishing with two sub-cell draws. The number of draws depends on the path. The rule does not change that: the host runs Pick exactly as before, with the same draws in the same order, and also keeps a copy of the cells the walk stood on (GuestWander.Pick's trail, at most TrailCapacity = 8, the goal last). The policy chooses among cells the host enumerated and draws nothing. (The off-path search of a start cell without links stays host-only and is not offered.)

1. Goal weighting (SmarterPathComfort.Decide, hook IGuestDecisions.ChoosePath, asked before ChooseWanderGoal, so script mods chain over the result). The candidates are the cells of the original's walk, the linked path cells beside its goal that the walk did not visit (at most 4) and the goal itself, last. The host builds a PathCellView for each and for the guest's own cell: LitterUnits (the litter in the cell and the eight around it: 1 for a piece, 2 for vomit or a stinkbomb), Crowd (the guests in the cell, from the per-cell lists occupants the host keeps) and NearCrowd (the guests in the eight cells around it, the crowd a guest walks into on its way). A candidate costs LitterUnits x 5 + Crowd x 2 + NearCrowd x 1. The goal moves to the cheapest candidate (ties go to the later one, nearer the goal) when it is at least SwitchMargin = 2 cheaper, i.e. one more guest in the goal's own cell. The goal's sub-cell bytes stay the original's. Litter and Crowding count only their own kind of cost (--guest-rules litter, crowding, paths).

2. Complaints. A guest standing where the litter in its nine cells reaches LitterComplaintUnits = 2 complains of litter with the original's "Too messy" (id 7). A guest in a cell of CrowdComplaintGuests = 5 or more complains of a crowd with the existing "Dissatisfied" (id 6; the original has no crowd thought, and a new id would need a sprite, a THOUGHTS.str entry and snapshot validation). Litter wins when both apply. A complaint costs HappinessCost = the small happiness step over 50 (PeepInfo.SmallHappinessChange = 5, so 0.1) and a guest complains at most once per ComplaintCooldownTurns = 480 turns (a whole visit, the exit counter). The cooldown is the guest's last complaint turn (GuestView.ComplaintTurn, from the extension's state); a guest without a birth id does not complain.

Where the constants come from. LitterComplaintUnits 2 is the original's "Too messy" share (GuestThoughts.MessyShare = 0.2 of the path cells of a 4 x 4 block) over the nine cells around a guest (1.8, rounded up). CrowdComplaintGuests 5 is one more than a queue cell holds (RideVisitorBridge.PositionsPerCell = 4). The litter weight 5 and crowd weight 2 cross the two complaint levels (2 x 5 = 5 x 2). The margin 2, the neighbour weight 1, the candidate set, the complaint cost 0.1 and the cooldown 480 were chosen by the sweep below, not derived; the sweep is reported in full.

The sweep (24 seeds, busy and dirty scenarios, 3 SE; all with the complaints off unless stated; baseline is 1.4.0's rules). Crowded share of guest time, busy scenario (baseline 0.062): the first version (the walk only, margin 10, goal cell only, complaints 0.5 at 240 turns) 0.058 (-1.9 SE); margin 10 with no complaints 0.057 (-2.3); plus the goal's neighbours and the crowd around a candidate 0.058 (-2.3); the same with margin 3 0.048 (-8.7); margin 1 0.046 (-9.4); margin 3 with a litter weight of 8 0.048 (-7.5) and no better litter exposure. Margin 1 and 3 lowered happiness by 0.2 to 0.6 points (up to -2.1 SE in the dirty scenario); margin 2 (shipped) is the largest margin that keeps most of the gain with happiness inside the noise (-0.4 and -0.7 SE). Complaints at 0.5 and every 240 turns cost up to 1.5 happiness points (-1.5 SE dirty); 0.1 and 480 turns cost nothing the noise shows.

Before and after the strengthening, the two red flags of the first version, and a bug found in review. The first version (walk cells only, margin 10) did almost nothing useful: crowded share -1.9 SE in busy and -1.8 in dirty, litter flat, happiness -0.4 to -1.5 SE from the complaints. Two things in its level-park run looked like bugs and were investigated, on the first version: (a) Fantasy, stuck guests 54 to 95 and admissions 97 to 131. In a diagnostic run (about 110 moves in the Fantasy park) none of the moved goals left the guest stuck (0 of 116, against 0 of 3,122 unmoved) and none was the guest's own cell; the route to a moved goal was as short as to an unmoved one. It was not a bug: admissions in this park are chaotic, and moving only the arrival timer of the rule-off park from 17 to 25 gives 126, 120, 105, 103 and 84 admissions and 94 to 50 stuck guests. With the final rule, over five arrival timers, admissions change by -4.8 on 114 (t = -1.7) and stuck guests by -3.6 on 78 (t = -2.0): not beyond the band. (b) Busy scenario, revenue per admitted guest -2.4 to -3.9 SE under the crowding rule. It did not reproduce after main's per-cell list change and with the final rule revenue is +0.2 SE (busy), -0.7 (plain) and +1.4 (dirty): seed noise on the old trajectories. (c) The dirty-scenario crowd drop (-3.0 SE) was the rule working weakly; the final rule makes it systematic. Review then found a real bug in the strengthened rule, which the diagnostic above (made on the first version) could not show: the new "linked cells beside the goal" candidates and the walk's own cells could be the guest's own cell (a walk passes back through its start, and a goal next to the start offers it), and the asking guest counted itself in the crowd of its own cell (+2) and of the cells around it (+1), which biased the weighting towards staying put. Fixed: no candidate but the original's goal may be the start cell, only path cells are offered (a walk from a queue cell can enter queue cells), and the asking guest is taken out of every count; a test asserts no move names the start cell. Everything below was measured after the fix.

What the host adds (additive; the policy stays pure). IGuestDecisions.UsesPathComfort (default false; forwarded by ScriptGuestDecisions), ChoosePath (default: keep the goal, no complaint), GuestView.ComplaintTurn (default -1), PathCellView, WanderPathView (a ref struct over the host's stack), PathDecision and PathComplaint; IGuestObserver.PathComplained and WanderGoalMoved (default no-ops). The host checks the verdict (a walk index outside the candidates, a complaint without a thought or with a negative, non-finite or larger-than-big-step cost, a thought without a complaint) and throws naming the policy. A policy that does not ask pays nothing. With the rules on, a wander reads at most 13 candidates (a candidate repeated by the walk is read once): nine litter reads (skipped while the park holds no litter) and nine cell-list lookups each, no scan of the guests.

State and saves. Complaints in the SmarterGuests section (birth id and park turn, the same bookkeeping as Meals, birth-id order, left out while empty, validated, refused after the park's turn, forgotten when the guest leaves, hashed under the marker "CMPL" only while it holds an entry). The litter map belongs to the economy's save and the cell lists are rebuilt from the guests on a restore, so a resumed park sees the same litter and crowds and continues like the uninterrupted one with complaints in flight. A 1.4.0 park is refused by the version check (needs opentpw.smarter-guests 1.4.0, not 1.5.0).

Measured effect (phase 6)#

New passive metrics (GuestMetrics.Paths, hash-neutral, sampled every tick for every paid guest in the park): path.littered.timeShare, path.litterNear.timeShare, path.litterEncounters.perAdmission, path.crowd.guestsPerOccupiedCell, path.crowded.timeShare (the share of path guest time spent in a cell of 5 guests or more), the complaint and moved-goal counts per admission and path.litter.meanCells. The first five and the last are "down is good" in --guest-compare. --guest-rules gains phase5 (version 1.4.0's behaviour), litter, crowding and paths; none is still 1.3.0.

The scenario needed litter, so ParkScenario has a litter variant (ParkScenarioOptions.Litter, --guest-litter; off by default so the baseline and its pins are untouched): shops add LitterEffect to the litter meter (5, the shipped value, --guest-litter-effect), guests drop it and vomit on the paths, and a handyman proxy removes one littered cell every HandymanTurns park turns (--guest-handyman-turns). --guest-scenario-arrivals N sets the arrival timer. "plain" is the default scenario, "busy" the litter scenario with the food shop, an arrival timer of 10 (77 guests in the park instead of 41) and a sweep every 40 turns, "dirty" the same with a sweep every 400 turns and a litter effect of 25.

Release build, --guest-scale extended (20 + 60 days), 24 seeds, 3 standard errors, after merging main's per-cell list order and after the start-cell fix. Mean over the seeds, 1.4.0's rules (--guest-rules phase5) to 1.5.0, difference in standard errors in brackets:

Metricplainbusydirty
Crowded share of guest time0.011 to 0.009 (-2.8)0.062 to 0.048 (-6.6)0.060 to 0.049 (-5.4)
Steps onto litter per visit02.41 to 2.27 (-0.6)13.9 to 13.5 (-0.4)
Littered share of guest time00.030 to 0.028 (-0.6)0.206 to 0.192 (-1.6)
Happiness, guest-time weighted63.39 to 63.24 (-0.3)61.23 to 61.58 (+1.0)61.42 to 61.40 (-0.1)
Revenue per admitted guest110.3 to 108.4 (-0.7)127.8 to 128.3 (+0.2)125.3 to 127.8 (+1.4)
Guests in the park41.3 to 41.4 (+0.3)77.2 to 76.1 (-3.0)76.6 to 76.2 (-1.1)
Stuck guests1.7 to 1.8 (+0.4)3.9 to 4.3 (+0.5)3.5 to 3.4 (-0.2)
Goals moved per admission6.08.38.4
Litter / crowd complaints per admission0 / 0.200.40 / 0.460.90 / 0.27

Level parks (the four themes, extended scale; a level seed ends in the same state, so five arrival timers 14, 17, 20, 23 and 26 stand in for seeds, a paired difference per timer and its t value, 4 degrees of freedom):

ParkCrowded share, 1.4.0Difference (t)HappinessAdmissionsStuck guestsRevenue per guest
Jungle0.502-0.051 (-3.3)-0.8 (-4.8)+1.6 (+2.4)+1.4 (+0.4)-0.2 (-2.0)
Hallow0.106-0.028 (-2.2)-0.5 (-0.7)-1.2 (-2.4)-0.8 (-0.3)+1.9 (+1.0)
Fantasy0.275-0.098 (-3.7)-0.2 (-0.2)-4.8 (-1.7)-3.6 (-2.0)+0.4 (+0.7)
Space0.372-0.066 (-2.8)-0.1 (-0.1)+0.6 (+0.9)+2.6 (+0.8)+0.1 (+0.2)

Litter exposure in the level parks (about 1 to 3 steps per visit, 1 to 2 percent of guest time) does not fall: Jungle's steps onto litter rise 1.29 to 1.51 (t = +2.2) and its littered share by 0.001 (t = +3.7), the other parks' change is within 2.1 t either way. Complaints in the level parks are 1.2 to 1.5 per admitted guest (a guest there stays longer than the 480-turn cooldown; one cooldown for both kinds), 0.1 happiness each. The Jungle happiness drop (the one real cost, 1.5 percent) is not explained: the complaints alone cost 1.5 x 0.1 = 0.15 points per guest and the rest of it is the changed wandering; a Jungle-specific rerun with the complaints off was not made.

What it does not do, and open doubts. It does not lower litter exposure, which is the other half of the plan's aim: only a change of the guests' routes (the original's path search) could, and that is not a wander goal. The crowd complaint reuses "Dissatisfied", so the Top 3 Thoughts row counts it as that. The per-park figures rest on five arrival timers each (4 degrees of freedom): the crowd effect is consistent in sign across all four parks but its t values are 2.2 to 3.7, so it is established less firmly in the parks than in the 24-seed scenarios.

Phase 6 tests. SmarterGuestsPathsTests (27) covers the constants, the litter kinds, the pure rule (a clean walk keeps the goal, the margin boundary, ties, one kind of cost at a time, the complaint thoughts, the cost, the cooldown at its boundary, no id no complaint), the original's walk (the same goal and draws with and without the trail over 200 starts; a long walk reports its last cells), the host (only a policy that asks gets the views; a policy that keeps every goal leaves guests, draws and state as they were; the candidates are the walk, its goal's linked neighbours and the goal last, never the guest's own cell and all path cells (a walk through the start and off the path is fed in directly); the sub-cell bytes of a moved goal are the original proposal's; a cell's crowd and the crowd around it are the guests standing there, the asking guest not counted; the litter around a cell is read by kind; a complaint costs happiness, thinks the thought, notes the turn; a goal move names a candidate and keeps the original's bytes; an invalid verdict is refused naming the policy; the shipped rules complain and move goals in a crowded dirty park and replay the same, each rule on its own), the scenario variant, the complaint times (order, replace, forget, hash marker, round trip into a fresh instance, a restored park sees the same crowds and litter, bad data refused, absent while empty) and the report. AResumedParkContinuesLikeTheUninterruptedOneWithTheExtensionOn includes a complaint in flight and one after the save point.

Phase 6b: Litter, routes and bins#

Version 1.6.0 of opentpw.smarter-guests. Phase 6 left one condition open: the path rule lowered crowding but not litter exposure, because where a guest meets litter is set by its route to a ride or shop. Two ways to a measurable litter effect were built and measured with the same protocol (24 seeds, 3 standard errors, the litter scenarios, the four level parks at five arrival timers): litter-aware routes and bins that guests find from further away. Only the second is kept.

Plain summary of the result. The bin rule measurably lowers litter where it can act: in the very dirty scenario with four bins along the street, litter on the paths falls by 27 percent (-6.9 SE; -11.7 SE over 64 seeds), the littered share of guest time by 31 percent (-7.5 SE) and steps onto litter per visit by 34 percent (-6.2 SE), with happiness, revenue, admissions and the guests in the park within 1 SE; stuck guests rose 3.4 to 4.3 at 24 seeds (1.7 SE) and 2.3 SE at 64 seeds but only 3.76 to 3.99 (1.0 SE) at 200 seeds, so it is most likely seed noise (see below). It does nothing in the three other scenarios, the shops-layout of bins, and the four level parks (every metric identical to 1.5.0), because there the guests either never fill their litter meter (their litter is vomit, which no bin takes) or already stand within three cells of a bin. So the extension has a measurable litter effect in a park whose guests fill their meters and whose bins stand more than three cells from where they litter, and none in the level parks as the gate builds them (no bins, vomit only). Litter-aware routes lower exposure by 8 to 12 percent at most (-0.9 and -2.5 SE) and only on a three-cell-wide street; on the one-cell-wide streets of every scenario and level park they find no detour at all.

What was built and why the routes were not kept#

1. Litter-aware routes (prototype, commit 61cfa902, not kept). The original's route search is not a weighted shortest-path search. It is a line-and-boundary tracer (WalkSearch, tp.exe 0x511420: a four-connected line towards the goal, boundary tracers at a wall, corner shortcuts, a refinement), so a per-cell cost cannot be added to it without replacing it, and the walk searches again each time it has used its five buffered waypoints. The prototype therefore left the original search untouched and refined its result: for the first five segments whose straight walk crosses litter, a Dijkstra search over the four-connected path cells replaced the segment by the cheapest walk (one cell of walking per step plus 3 per litter unit on a cell entered), at most 4 cells longer than the Manhattan distance, ties broken by the heap order with an insertion counter. The policy supplied the cost per littered cell and the bound (IGuestDecisions.RouteCellCost, RouteMaxExtraCells) and the host ran the search, only when the park held litter. With the rule off the route is byte-identical (the hook is a null delegate).

WhereRoute segments that crossed litterDetours foundEffect on litter exposure
Busy and dirty scenario (one-cell street)4,995 (busy)0none (every metric identical)
The four level parks (one-cell paths at the rides; arrival timer 17)137, 69, 83, 1210 in eachnone; the littered cell is the only way, or the goal itself
Busy, three-cell street (--guest-wide)5,4011,010steps onto litter per visit 2.353 to 2.149 (-0.9 SE), littered share 0.033 to 0.030 (-0.8), litter cells 0.954 to 0.885 (-0.5)
Dirty, three-cell street37,8657,451steps onto litter 12.81 to 11.19 (-2.5 SE), littered share 0.196 to 0.194 (-0.3), litter near 0.268 to 0.298 (+1.7), litter cells 6.99 to 7.20 (+0.7)

Happiness, revenue, admissions and stuck guests stayed within 0.8 SE (the wide scenarios) and a larger cost per unit (6, 12) or bound (8, 16) changed nothing, so the limit is the streets and the goals, not the constants: most litter lies on the cells guests stand on (queue ends, shop stand points, entrances: 29,696 of the 37,865 segments could not be improved), not on cells they pass over. No metric reached the 3 SE bar, so the rule was removed from the shipped code (the prototype stays in the history, commit 61cfa902, with --guest-rules routes and --guest-wide).

2. Bins (kept). The original already carries litter to bins: a guest whose litter meter byte is at least 90 and who decides in state 6 looks for a bin (SeekBin, tp.exe 0x00500DC0) whose cell is closer than 3 cells (squared distance below 9), walks to the cell in front of it (state 9) and throws the litter in; without one it drops 1 + rand % 5 on its own cell. The rule changes one number: the radius is 8 (SmarterBinCarry.SearchRadius; IGuestDecisions.UsesBinCarry, BinSearchRadius, accepted by the host from 0 to GuestSimulation.MaxBinRadius = 16, otherwise it throws naming the policy). Everything else is the host's, as before: the bin list, the nearest-bin choice (squared distance, strict), one route request per closer candidate, the walk, the throw and the drop with its draw. Random draws, and what a binning guest skips. The decision (GuestDecision.Decide) tests the litter first and returns ToBin as soon as a bin is chosen, so a guest that now goes to a bin ends that turn's decision there: it takes none of the later tests and none of their draws (leave, watch or perform, prank, ride choice, wander), exactly as the original does for a bin within three cells; those tests run again when the walk ends and the guest decides again. The drop's own draw (random.NextWord() % 5) is taken only when the guest drops. With no bin in reach the draws are the original's, in the same order, and a park without bins asks nothing (the host reads the radius only when Bins is set and a guest's meter is full). The route bound: the 8 cells are a straight line to the bin's cell, and the route to the cell in front of it is not bounded by that (a bin across a hedge or a river can be a 30-cell walk). With the rule on, a candidate beyond the original's reach whose route (the host's Grid.FindPath, already searched for the candidate) is empty or longer than SmarterBinCarry.MaxRouteCells = 16 (twice the radius; IGuestDecisions.BinMaxRouteCells) is skipped before the route request, so it retargets nothing; a bin within three cells is never skipped, as in the original.

Where the constant comes from. The radius 8 was chosen by a sweep (the very dirty scenario with bins, 24 seeds; litter cells, litter share, steps onto litter, difference in SE): 3 (the original's) nothing; 5 -2.1, -1.4, -1.9; 6 -3.0, -3.2, -2.5; 8 -6.9, -7.5, -6.2; 12 the same as 8 (the four bins stand 4 to 15 cells apart: a larger radius reaches no further bin). It is therefore tied to that layout; in a park with bins further apart it would reach fewer. The walk is the original's bin walk, a few park turns out of the guest's way.

Measured effect (phase 6b)#

New passive metrics (GuestMetrics.Paths, hash-neutral): path.litterDropped.perAdmission (a guest's litter that landed on a free cell) and path.litterBinned.perAdmission; IGuestObserver.LitterDropped and LitterBinned (default no-ops). New scenario variants: --guest-bins (four bins beside the street, columns 5, 20, 24 and 34; the guests litter on the shop branches and the street, 3 to 15 cells away), --guest-bins-shops (three bins beside the shop branches, within three cells of every shop stand point), --guest-level-bins N (a proxy bin on a path cell about every N cells in the level parks) and --guest-rules phase6 (version 1.5.0's rules, the baseline here). The scenarios: "busy" has a litter effect of 5 per shop use and a handyman every 40 turns, "mid" an effect of 12 and a handyman every 120, "dirty" an effect of 25 and a handyman every 400; plain has no litter. Release build, --guest-scale extended, 24 seeds, 1.5.0's rules to 1.6.0, difference in SE:

ScenarioLittered shareSteps onto litterLitter cellsDropped / binned per admissionHappinessRevenueGuests in parkStuck guests
plain, busy, dirty (no bins)identicalidenticalidenticalidenticalidenticalidenticalidenticalidentical
busy, four binsidentical (no guest fills its meter)0.185 / 0identicalidenticalidenticalidentical
mid, four bins0.106 to 0.104 (-0.1)7.20 to 7.15 (-0.1)3.20 to 3.16 (-0.1)0.145 to 0.142 / 0.00561.33 to 61.30 (-0.1)128.1 to 128.7 (+0.3)75.8 to 75.8 (+0.1)3.3 to 4.1 (+1.5)
dirty, four bins0.192 to 0.133 (-7.5)13.51 to 8.90 (-6.2)6.32 to 4.60 (-6.9)0.141 to 0.125 (-3.5) / 0 to 0.29761.40 to 61.22 (-0.5)127.8 to 128.1 (+0.1)76.2 to 76.2 (-0.1)3.4 to 4.3 (+1.7)
dirty, bins at the shopsidentical (bins already within three cells)0.138 / 0.205 in bothidenticalidenticalidenticalidentical

The very dirty scenario is robust to the load: at arrival timers 8, 12 and 14 (24 seeds each) litter cells fall 6.4, 4.9 and 6.8 SE, the littered share 8.3 SE each time, steps onto litter 6.5, 5.3 and 4.9 SE; happiness -0.7, -0.9 and 0.0 SE, revenue -0.5, +0.3, -0.5, guests in the park +0.4, +0.5, -0.1. Over 64 seeds (the same scenario) litter cells fall 11.7 SE, littered share 12.8, steps onto litter 9.9; happiness -0.04 points (-0.2 SE), revenue +0.6 (+0.5), admissions -0.05 (-0.2), stuck guests 3.45 to 4.31 (+2.3 SE).

The stuck-guest count and happiness (investigated). Hypothesis from review: a guest walks to a street bin farther from the rides, which lowers its scores under the choice floor. Checked by logging the cell and the turns since the last bin throw when a guest became stuck (24 seeds, the very dirty scenario): in both 1.5.0 and 1.6.0 the stuck guests stand at the far end of the street (x 30 to 38, beyond the toilet at 28, 15 of 24 and 25 of 34 logged), and only 3 of 34 became stuck within 150 turns of a bin throw. Removing the farthest bin (column 34) changed nothing (it is never used), a fifth bin next to the shop branches gave +2.1 SE again, and the longer route bound changes nothing in this scenario (a street bin's route is 6 to 9 cells, below 16: the results with and without it are identical). The rise does not grow with more seeds (+1.7 SE at 24, +2.3 SE at 64, +1.0 SE at 200: stuck guests 3.755 to 3.985; litter cells -18.4 SE, littered share -21.0 SE and steps onto litter -17.2 SE at 200 seeds; happiness 61.24 to 61.09, -1.3 SE; revenue +0.5, guests in the park +1.0 SE). It is most likely the divergence of seed trajectories once any guest uses a bin (stuck counts vary by several guests per seed), not a side effect I could find, so nothing was changed for it; at 200 seeds it is below 1.1 SE. Happiness is 0.0 to -0.35 points in five 24-seed runs and -0.15 at 200 seeds (-1.3 SE), a possible small cost of the walks to bins (a guest that carries its litter eight cells spends a few turns not choosing a ride).

Level parks (five arrival timers 14, 17, 20, 23, 26, 4 degrees of freedom): every metric of all four parks is identical to 1.5.0, with and without a proxy bin every 10 path cells (--guest-level-bins 10: no guest of a level park ever fills its litter meter; its 0.1 to 0.3 dropped pieces per admission are vomit, which no bin takes). The gate's parks place no bin, and the guests' litter there is vomit: the rule has no effect on the level parks and cannot have one while their guests litter only by vomiting.

The Jungle happiness drop of phase 6. The drop (-0.81 points, t = -4.8, timers 14 to 26) reproduces exactly on this build. Rerun with the complaints switched off (an experiment, not shipped) it is -0.92 (t = -4.0): the complaints are not the cause, they even cost a little less (+0.11). Each rule on its own, complaints off: litter alone +0.01 (t = 0.0), crowding alone -0.11 (t = -0.3); both together -0.92 (t = -4.0). A replication on six other timers (12, 15, 18, 21, 24, 28) gives -0.30 (t = -1.4) with and -0.36 (t = -1.6) without complaints; over all eleven timers -0.53 (t = -3.4). So the drop is real but smaller than the first five timers showed (about 0.3 to 0.5 points, 1 percent), it comes from the changed wandering of the two goal rules together and not from the complaints, and its mechanism is still unexplained; the Jungle park (half the guest time in crowds) is where the goal rule moves most goals.

Cost. CPU per guest-turn: see Cost and release; the rule adds no work to a park without bins or litter-full guests.

What it does not do, and open doubts. It does not touch litter that is not carried: vomit (2 units each, the larger part of litter in the level parks), drops by guests with no bin within eight cells, and pranks. The effect is the size of the gap between where guests litter and the original's three cells: the same four bins that never catch a guest at three cells catch 0.3 per admission at eight, and a park with bins at its shops has nothing to gain. The radius is tied to one layout. The stuck-guest rise above is unexplained. The scenario's bins are proxies (a bin is an object in the game; Level.LitterBins), the walk and the throw are the host's own and are tested, but the bin script (TriggerBin) is not exercised by the scenario.

Phase 6b tests. SmarterGuestsBinsTests (12, adding the exact squared distance of 64 and a bin behind a wall that is 5 cells away in a straight line and 20 on foot): the constants and the policy's switches (only a policy with the rule asks; 1.5.0's rules do not; the version), a bin six cells out is carried to by 1.6.0 and not by the original or 1.5.0, the radius boundary (exclusive, as the original's), a park with no bin in reach hashes like 1.5.0, a park without a bin list never asks, a radius outside 0 to 16 is refused naming the policy, the carried litter stays in the meter until the throw, the scenario with bins replays the same and bins only under the rule, and a park resumed while a guest walks to a far bin continues like the uninterrupted one. GuestMeasurementTests.ParkScenarioWithBinsAndTheSmarterGuestsExtensionOnIsPinned pins the bin scenario (see DETERMINISM.md).

Cost and release#

Phase 6 is the last phase before the extension is released to players, so it also settles the CPU gate of the plan: at most 1.10 times the original guests' CPU.

How it is measured. --guest-report --guest-cost (GuestCost, Release build) runs the same ParkScenario for the original guests and for the extension's rule sets (1.3.0, 1.4.0, 1.5.0) over 250 in-game days (85,709 ticks), 3 seeds x 11 repeats = 33 runs per variant, the variants interleaved and their order rotated inside each repeat, one unmeasured round to warm the JIT, a full GC before each run. ParkScenario.RunTimed is Run with the caller's clock around the guests' own part of each tick (the guest tick or the turn's sweep over the thing pool and the arrival update; the ride scripts and the admission are left out; a test-time check proves it runs the same scenario). It prints medians of the total time, the process CPU time, the guests' own time, the guests in the park and the time and allocation per guest-turn (a guest in the park for one park turn). Two things matter for reading it. The extension keeps more guests in the park than the original (happier guests leave later: in the default scenario departures per admission fall from 0.60 to 0.41 and guest-time happiness rises from 49.0 to 63.7, with the same 63.9 admissions), so a total ratio mixes the cost of a guest with the number of guests. And the machine is shared: these runs had a load average of 6 to 8 from other work, which is why variants are interleaved and the two rounds below are shown as two rows; the noise between rounds is about 0.01 to 0.02 in a ratio.

Before the optimisation (the build at the commit before it), 1.5.0 against the original, two rounds:

ScenarioGuests in the park (original / 1.5.0)Total timeGuests' own updatePer guest-turnAllocation per guest-turn
default41.7 / 51.11.276, 1.2721.344, 1.3331.097, 1.089230 B / 239 B
with the food shop45.2 / 64.21.480, 1.4721.599, 1.5971.124, 1.123246 B / 251 B

What costs. The sampling profile of dotnet-trace was no use (91 percent of its samples land on the runtime's GC poll, a safe-point artefact), so the hot paths were found with timers around the host's own methods (a throwaway instrumentation, not committed) and a timing decorator over the policy. The policy itself is small: about 4 percent of the guests' time (ScoreAttraction about 12,000 calls per run at 260 ns, the patience and alternative-look hooks about 30,000 calls each at 20 to 30 ns; the whole policy 6 ms of 150 per run). The cost was in the host's views for the policy:

What changed, with no change of behaviour (every pin, off and on, is unchanged; a spy that is always asked gives the same run as the skipping host, TheQuietWindowIsTheTurnsBeforeTheGiveUpTestCanFireAndSkippingItChangesNothing):

After, same method, two rounds:

ScenarioGuests in the park (original / 1.5.0)Total timeGuests' own updatePer guest-turnAllocation per guest-turn
default41.7 / 51.11.215, 1.2071.264, 1.2551.032, 1.025222 B / 203 B
with the food shop45.2 / 64.21.407, 1.4041.514, 1.4951.065, 1.051238 B / 207 B

1.3.0 and 1.4.0 measure 1.03 to 1.05 per guest-turn in the default scenario in the same runs, so phase 6 adds nothing the noise shows. The original's own time per guest-turn did not move (380 ns to 381 ns and 375 ns to 384 ns in the two rounds; the shared allocation fix saves it 10 B).

Final numbers (after the path rule was strengthened and main's changes were merged; Release, 3 seeds x 9 repeats, the same method): per guest-turn 1.5.0 is 1.057 of the original in the default scenario (1.3.0 1.049, 1.4.0 1.036) and 1.068 with the food shop (1.032 and 1.049); the totals are 1.19 and 1.43 against 1.20 and 1.40 for 1.3.0 (the guests in the park are 51.5 against 43.8, and 63.8 against 44.3). The path rule costs about 0.02 per guest-turn; the wander is read for at most 13 candidates, a repeated cell once.

The verdict. The gate is at most 1.10 times the original guests' cost per guest-turn (a guest in the park for one park turn). It is met in both scenarios, with room (1.06 and 1.07; the single worst sample of any run was 1.11 with the food shop, before the repeated-cell shortcut). In total the cost is 1.2 (1.4 with the food shop) of the original's guest time; that is the guest count, not a per-guest cost: 1.5.0 holds 18 percent more guests in the default scenario (44 percent with the food shop). The extension's rules are what make guests stay (fewer departures, higher happiness), so more guests to update is its intended outcome, and stating the gate per guest-turn is the honest form of it. What is not measured: the browser build (Mono AOT, a different machine) and a whole frame.

Phase 6b (1.6.0). The bin rule runs only inside the bin search, which a guest reaches when its litter meter is full and the park has bins (GuestSimulation.SeekBin: one UsesBinCarry test and one policy call per search, then the original's loop over the bins, at most 8 cells out instead of 3); a park without bins or without full meters runs the same instructions as 1.5.0. Measured with --guest-cost (now taking the scenario flags, here --guest-litter --guest-bins --guest-litter-effect 25 --guest-handyman-turns 400 --guest-scenario-arrivals 10 --guest-food, 27 runs per variant, medians): per guest-turn 1.5.0 is 1.082 of the original and 1.6.0 1.062, total 0.98 and 0.96 (this scenario holds more guests in the original, 102 against 92). In the plain and food-shop scenarios 1.6.0 and 1.5.0 run the same code and measure 1.04 to 1.15 and 1.09 to 1.14 per guest-turn in two passes on a machine that other sessions kept 60 to 85 percent busy: the noise of that machine is larger than the gate's margin (the quiet-machine figure of phase 6 was 1.057 and 1.068), so the 1.10 gate of the release was not re-confirmed under quiet conditions in phase 6b and should be measured again on an idle machine before the extension is released; nothing in 1.6.0 adds work to those scenarios.

Release status (1.6.0). The user decided to release the extension as opt-in (PlayerSelectable: true, DefaultEnabled: false) once the review findings were fixed, the tests green and the CPU gate (at most 1.10 per guest-turn) re-confirmed on a quiet machine. The development machine never became quiet (other sessions kept 60 to 98 percent of the CPU busy; a measurement taken anyway gave 1.000 to 1.363 per guest-turn, the spread of the noise), so the gate was measured on GitHub's hosted runners by the Smarter guests CPU cost workflow (.github/workflows/guest-cost.yml: the four synthetic scenarios, --guest-cost-variants original,1.5.0,1.6.0, 3 seeds x 11 repeats, medians). It is met, and 1.6.0 is released:

Scenario (Ubuntu runner)1.5.0 per guest-turn1.6.0 per guest-turnGuests in the park (original / 1.6.0)
default1.0771.07243.8 / 51.0
food shop1.0901.09144.3 / 63.8
litter and bins1.0731.07543.8 / 51.9
litter, bins and food1.0821.08144.3 / 62.7

On this runner the noise is small: 1.5.0 and 1.6.0 run the same code wherever the park has no bins (SeekBin returns at once) and agree within 0.005. The macOS runner (arm64, a shared virtual machine) is noisy and was not used for the decision: the original's own time per guest-turn was 772 ns in the default scenario and 587 ns in the litter-and-bins one, which runs nearly the same work (770 and 781 ns on Ubuntu), and 1.6.0 against 1.5.0 differed by up to 0.05 in either direction where they run the same code; its 1.6.0 figures were 1.018 to 1.120 (above 1.10 in three of eight). In total time the extension costs 1.19 to 1.44 times the original, because it keeps 16 to 44 percent more guests in the park (happier guests stay longer).

Measurement#

Everything here is passive: no behaviour change, nothing saved, nothing in WorldStateHash or GuestSimulation.ComputeStateHash, no WorldRng draw.

Instrumentation. GuestSimulation.Observer (IGuestObserver, source/OpenTPW/World/Guests/GuestObserver.cs) is null by default; each hook is one null test. The collector GuestMetrics (World/Guests/Measurement/GuestMetrics.cs) tallies, for a measured window:

Scenarios. ParkScenario (World/Guests/Measurement/ParkScenario.cs) is a headless park with no game data and no economy (its park turns are swept the way the game's are): a 40-cell street from the gate with three branches carrying two identical rides, a thrill ride (excitement 95, too scary for the calm guest type) and a calm ride (excitement 20, too boring for the thrill-seeking type), a cheap shop (price 30) and a dear shop (price 220, which most guests refuse at the stand point), and a toilet at the far end of the street (a long walk; the rides and shops are a short one). Every attraction serves one guest at a time through the corpus shop protocol with its own hold time. With game data, --guest-report also runs the level parks of the four themes through the M3 gate's park builder (M3-GATE.md): one ride, a shop and a toilet each. The level parks use an arrival timer of 20 (--guest-arrivals), because the themes' 150 would bring no group within a few days. SyntheticPark in DeterminismTests and its pin are unchanged.

Seeds that stay different. The original reseeds the world generator with each new guest's thing id (WorldRng.Reseed, tp.exe 0x004FB19E), so two seeds' streams merge into one after a few dozen days and their runs become identical: with plain seeds the scenario's seeds 1 and 4 were the same park from about day 40, and the pairs 5 and 10, 9 and 11 by day 80, so the baseline had fewer than eight independent samples. ParkScenario therefore gives every seed its own ride and shop times (a hold-time offset of -200 to +199 ms, HoldJitterMilliseconds), which the reseed cannot erase; the load is the same on average. The report records every seed's end state hash, flags seeds with the same hash (WARNING in the table, duplicateSeeds in the JSON), leaves the duplicates out of the spread and prints the distinct-seed count; a test checks that eight seeds stay distinct at 40 and 80 days. The level parks' seeds vary the economy's streams as well and also end distinct (8 of 8 in every park).

Turn order. The runs use the game's turn order (below), with these differences from Level.AdvanceSimulation that remain: the scenario has no economy (its turns are the guests' own); the gate's sweep walks the guests by the pool newest first but then updates the economy's things in ParkEconomy.UpdateThings' fixed order, not interleaved with them, and has no staff world, weather, challenge system or gate retry; only the gate and the lights hold thing slots besides the guests; the guests' and the economy's turns must agree (the gate asserts it instead of falling back to a plain tick).

Protocol. Eight fixed seeds (WorldSeed 1 to 8) per scenario, a warm-up, then a measured window, both in in-game days (23 park turns, about 343 fixed ticks, 5.7 s at normal speed).

dotnet source/OpenTPW/bin/Release/net11.0/OpenTPW.dll --guest-report [--guest-scale plan|extended] [--guest-seeds 8] [--guest-warmup-days N] [--guest-days N] \
  [--guest-levels jungle,hallow,fantasy,space|all|none] [--guest-level-seeds 8] [--guest-arrivals 20] [--guest-report-json report.json] [--guest-no-perf]

Without game data (OPENTPW_GAME_PATH or --game-path) only park-scenario runs. The command prints a short table (mean, σ, minimum and maximum over the seeds, and the reject and abandon reasons) and, with --guest-report-json, the stable machine-readable report (opentpw.guest-report/1: every seed's metrics, the per-metric spread and, unless --guest-no-perf, a machine-dependent performance block that is left out of comparisons). Two runs with the same options give the same JSON apart from performance. The plan scale (2 warm-up + 10 measured days, the default) takes about 20 s with the four level parks; --guest-scale extended (20 + 60 days) about 35 s.

Decision: two scales. The plan scale (2 + 10 days) stays the quick default of --guest-report; --guest-scale extended (20 + 60 days) is the scale of the baseline and of every acceptance threshold on this page.

With --guest-extension smarter-guests (repeatable; the extension's id works too) the whole run builds its simulations with the extension on (each reads the gate once, when built), the JSON gets an extensions list beside its protocol (always present, [] for the default run), and the table says Extensions on: .... With the delegating policy of 1.0.0 the report was the default's (every seed ended in the same guest state hash); since 1.1.0 the scenario differs (see phase 2) and a note names the two extension sets.

With --guest-mod <folder or id> (repeatable) the run switches the named mods on (a mod folder, or the id of a mod shipped with OpenTPW, such as the example script mod); the JSON gets a mods list beside extensions, each scenario a scriptMods list (calls, steps, the largest call and tick, failures, seeds that disabled the mod), the table the same as script mod ... lines, and --guest-compare names differing mod sets. A mod that cannot run is an error, not a silent baseline. The measured budgets and the example mod's effect are in SCRIPT-MODS.md.

To compare two runs: --guest-compare baseline.json candidate.json [--guest-targets metric,metric] [--guest-compare-k 3] prints every metric's change in standard errors with a verdict (improved, regressed, changed, same, undefined) and exits 1 on a regression, a named target that did not improve, or a non-zero queue.superseded.

Why an extended scale. A day is about 343 ticks, and a guest's exit counter runs about 120 s (about 21 days). At the plan's 2 + 10 days the scenario sees 3 to 8 queue attempts and no departures per seed, far too little for a spread to mean anything. The baseline and the thresholds below therefore use the extended scale (20 warm-up + 60 measured days); the plan scale is recorded for completeness.

Baseline#

Re-measured on October 17, 2026 on main after #325 and #326 (see What moved); the earlier numbers are listed there.

The runs go through the game's turn order, not plain Tick loops: the tick that starts a park turn runs the substep's ride scripts and then the turn's thing sweep over the thing pool newest first (the guests, the attractions' admission), the turn's destroys and the arrival update, as Level.AdvanceSimulation and DeterminismTests.SyntheticPark.Run do (BeginSweepTick, SweepGuest, FinishSweep, UpdateTurnEndArrivals). ParkScenario.Run and the level parks (M3GateOptions.SweptTurns, which only the report sets, so the gate keeps its own loop) both use it. The scenario has no economy, so its turns are the guests' own; the level parks' economy turns are aligned to them. Measured on plain loops first, the baseline differed slightly (for example the scenario's guest-time happiness was 48.8 and its boarded share 55.1%).

Original policy, release build, 8 seeds per scenario. Reproduce with --guest-scale extended. The same seeds reproduce these numbers exactly; σ is the sample standard deviation over the 8 seeds, so it is the seed-to-seed variation a rule has to beat.

park-scenario, extended scale (20 + 60 days)#

Metric (key)MeanσMinMaxBand (3 SE)
Admissions in the window (admissions)63.8750.3546364±0.958
Queue attempts (queue.attempts)341.522.916305374±34.374
Boarded / attempts (queue.boarded.rate)0.5440.020.5250.577±0.03
Abandoned / attempts (queue.abandoned.rate)0.0260.0080.0110.036±0.013
Rejected / attempts (queue.rejected.rate)0.410.0190.3710.427±0.029
Unfinished / attempts (queue.unfinished.rate)0.020.0060.0130.028±0.009
Wait p50, turns (boarded only) (queue.wait.p50)11.6252.066915±3.099
Wait p90 (boarded only) (queue.wait.p90)73.6257.3086180±10.962
Wait p99 (boarded only) (queue.wait.p99)108.254.743100113±7.115
Wait p90, boarded + unfinished ages (queue.wait.p90.censored)73.3757.096180±10.635
Wait p99, boarded + unfinished ages (queue.wait.p99.censored)108.1254.643100113±6.964
Superseded attempts (must be 0) (queue.superseded)0000±0.75
Happiness, guest-time weighted (happiness.guestTime)49.0073.1344.3353.311±4.695
Happiness of the guests still inside (happiness.survivors)48.2174.60642.23855.421±6.91
Departures per admission (departures.perAdmission)0.5990.0510.5310.672±0.076
Happiness-byte-0 departures per admission (departures.happinessZero.perAdmission)0.5280.0470.4690.625±0.071
Exit-counter-0 departures per admission (departures.exitCounterZero.perAdmission)0.070.030.0160.109±0.045
Park-closed departures per admission (departures.parkClosed.perAdmission)0000±0.003
Use Gini over the rides (use.giniRides)0.1980.0370.1470.255±0.055
Use Gini over the rides, per capacity (use.giniRidesPerCapacity)0.1980.0370.1470.255±0.055
Use Gini over all attractions (use.giniAll)0.2880.030.2350.328±0.045
Revenue per admitted guest (flow ratio) (revenue.perAdmittedGuest)82.0628.5027095.556±12.753
Guests with no choice for over 50 turns (guests.stuck)1.251.03503±1.553
Guests in the park (mean) (guests.meanInPark)32.841.87729.94635.107±2.815

Outcome mix over the 8 seeds: rejected Full 90, Price 761, TooBoring 106, TooScary 162; abandoned NeedToilet 2, Unhappy 69. About 54% of the attempts board, 41% are rejected (most of them the dear shop's price at the stand point), 3% abandon and 2% are unfinished when the window closes (the oldest has waited 30 to 87 turns). About 0.6 guests depart per admission in the window, mostly by the happiness byte reaching 0 (the exit counter fires only for a guest that is in the right state when it passes 0, see GuestLifecycle). Guests wait a median of 12 turns and a p99 of 108 turns; no wait is capped, because no queue time limit is reachable in tp.exe. Here the censoring is small (the unfinished attempts are young); in the level parks it is not.

Level parks, extended scale (mean ± σ over 8 seeds)#

MetricJungleHalloweenFantasySpace
Queue attempts802.875 ± 24.416154.875 ± 11.969391.625 ± 39.619494.75 ± 17.044
Boarded / attempts0.254 ± 0.010.684 ± 0.0410.454 ± 0.0250.481 ± 0.021
Abandoned / attempts0.013 ± 0.0030.011 ± 0.0090.041 ± 0.0060.054 ± 0.012
Rejected / attempts0.698 ± 0.0110.279 ± 0.0420.41 ± 0.0340.389 ± 0.03
Wait p50 (turns, boarded)31.875 ± 0.83511.625 ± 1.18825.625 ± 2.61533 ± 1.069
Wait p90 (boarded)538.875 ± 20.677194.25 ± 6.902531.875 ± 22.535434.375 ± 9.054
Wait p99 (boarded)642 ± 39.648213.75 ± 3.495999.875 ± 43.813468.125 ± 7.624
Wait p90, boarded + unfinished ages528.5 ± 24.054194.125 ± 6.813738.375 ± 36.347432.375 ± 9.97
Wait p99, boarded + unfinished ages641.625 ± 40.007213.625 ± 3.5831006.5 ± 55.185468.125 ± 7.624
Happiness, guest-time weighted53.043 ± 0.51537.822 ± 0.88649.217 ± 0.46948.452 ± 0.555
Departures per admission0.276 ± 0.0220.451 ± 0.0660.355 ± 0.0420.373 ± 0.02
Happiness-0 departures per admission0.166 ± 0.0090.273 ± 0.0290.246 ± 0.0250.313 ± 0.021
Exit-counter-0 departures per admission0.111 ± 0.0220.177 ± 0.0490.109 ± 0.0310.063 ± 0.01
Revenue per admitted guest47.633 ± 0.50359.312 ± 1.4955.268 ± 2.31446.002 ± 0.533
Guests with no choice > 50 turns72.5 ± 3.70359.125 ± 2.47570.5 ± 8.63564 ± 4.536
Guests in the park (mean)104.336 ± 1.62436.951 ± 0.92287.059 ± 4.11597.885 ± 1.671

Outcome mix (all seeds): Jungle rejected Full 813, QueueLimit 3674, abandoned NeedToilet 1, Unhappy 81; Halloween rejected Full 348, abandoned Unhappy 14; Fantasy rejected Full 1293, abandoned NeedToilet 1, Unhappy 127; Space rejected Full 649, QueueLimit 892, abandoned Unhappy 214. With a single ride a park saturates: most attempts are rejected, waits reach hundreds of turns and a large share of the guests find no choice for a long time. The waits are right-censored: in Fantasy 9.5% of the attempts are still queued at the end, the oldest for 888 to 1,134 turns of a 1,380-turn window, so its boarded p99 (1,000) and even its p90 (532 against a censored 738) understate the waiting; use the censored rows. That is the headroom the later phases are measured against.

No ride is closed or broken in these runs. (An earlier version of this report counted RideClosed rejections that were the gate stopping its objects after the last tick, which turns the queues away; the window now closes before the teardown.)

park-scenario, plan scale (2 + 10 days)#

MetricMeanσ
Queue attempts5.51.069
Boarded / attempts0.6040.235
Rejected / attempts0.2670.215
Wait p90 (turns)15.7514.099
Happiness, guest-time weighted49.472.885
Happiness-0 departures per admission00
Use Gini over the rides0.5430.163
Revenue per admitted guest20.4691.326

Too few events for thresholds (this is the plan-scale re-measure, so these rows also moved with #325): queue.attempts is about 5 and there are no departures.

What moved in the October 17 re-measurement#

The first baseline was measured before two merges. #326 (the substep scheduler: script slices once per eight passes, tours on even substeps, the bump module) leaves every number of this report unchanged: the report was re-run on the commit before and on #326 and the 40 end hashes and all spreads are identical (the parks of the report do not exercise what the new scheduler changes). The whole shift therefore comes from #325 (old saves' access links, WALK-006 retired, stand cells in ParkScenario): a guest whose stand-point route search is refused is now dismissed as tp.exe dismisses it, instead of walking in on the route-walk fallback, and the scenario's attractions now have their entrance cells, so called guests walk the original's search walk.

Scenario (old baseline to new, 8 seeds; the band is the new 3 SE): queue attempts 326 to 341.5 (±34), boarded share 0.560 to 0.544 (±0.030), rejected 0.392 to 0.410, abandoned 0.021 to 0.026, wait p90 (censored) 79.1 to 73.4, p99 119.5 to 108.1, guest-time happiness 48.53 to 49.01 (±4.7), departures per admission 0.562 to 0.599 (±0.076), happiness-0 departures 0.481 to 0.528 (±0.071), guests in the park 31.9 to 32.8, revenue per admitted guest 79.1 to 82.1, stuck guests 0.625 to 1.25 (at most 3 in one seed, ±1.55). Every scenario change is inside the new band. The scenario's fixed-run hash is 0xBD62B929BDB55659 (was 0xF430B24D6D6B950E).

Level parks: Space boards more (0.398 to 0.481, rejected 0.488 to 0.389, QueueLimit rejections 1,283 to 892), Jungle boards more (0.219 to 0.254, rejected 0.736 to 0.698), Fantasy slightly more (0.433 to 0.454), Halloween slightly less (0.712 to 0.684, censored wait p90 165 to 194). Queue waits fall in the three busy parks (censored p90: Jungle 556 to 529, Fantasy 787 to 738, Space 479 to 432), guests in the park and happiness move by under 1 point or 2 guests, and the stuck-guest counts are unchanged within their spread (Jungle 70 to 73, Halloween 59, Fantasy 72 to 71, Space 65 to 64). These parks are all the single-ride saturated case, so the shift is guests being called into the stand point more reliably, not a change in demand.

Checked and not a regression: no ride goes unused (the scenario's ride Gini is 0.198, min 0.147 over the seeds), the scenario's stuck guests stay at most 3 in a seed and the level parks' counts keep their spread, no scenario or park lost its boarded share beyond Halloween's 0.03, which is inside the seed spread (±0.04), the 5 scenarios x 8 seeds still end in 40 distinct state hashes (duplicateSeeds is empty everywhere) and queue.superseded is 0. The acceptance thresholds are defined in code from the report (GuestReportCompare), so no constant changed; the bands above are the new ones. Compare a smarter-guests run only against a report made on the same commit or later.

Cost of the instrumentation#

CPU and allocation per tick over the extended window (release build, Apple silicon, machine under load, so about ±20% noise): observer off about 1.2 µs and 612 B per tick (the production path: one null test per event), observer on 1.2 µs and the same 612 B; the two sides are indistinguishable. The default path was also compared with the commit before this change on a 41,160-tick run of the earlier plain-tick scenario loop (the best of eight runs in each of five alternating process pairs): 1.182 µs per tick before, 1.194 µs after (+1%, inside the noise), and the guests' state hash is identical. The allocation per tick is the simulation's own; the observer adds none on the default path. Compare CPU only as a ratio on one machine, from the performance block of one report.

Acceptance thresholds#

Defined from the extended baseline above, in code (GuestReportCompare, --guest-compare). A later phase re-runs --guest-report --guest-scale extended with its extension on and compares scenario by scenario against the original policy, in the same environment and with the same seeds.

Tests#

GuestMeasurementTests (and GuestMeasurementAssetTests on the level parks, with game data) covers: every queue attempt ends as exactly one outcome (attempts = boarded + abandoned + rejected + unfinished, also per attraction); waits cover boarded attempts only; turning the observer on leaves the pinned fixed run's hash (DeterminismTests.FixedRunHash) and a scenario run's hash unchanged; ParkScenario is deterministic and its fixed-run hash is pinned (a change moves this baseline); the report JSON is stable for fixed seeds; seeds stay distinct and duplicates are flagged; superseded is 0 and unfinished attempts report their age; save and restore keep the tallies; the compare thresholds. The determinism guard scans the simulation folders, so Stopwatch lives in Client/GuestReport.cs, not beside the simulation.

SmarterGuestsTests, SmarterGuestsParkResumeTests and two tests of DeterminismTests cover phase 0b: both extensions are registered, off by default, at version 1.0.0 and only the smarter one is recorded in saves; the gates follow the active set and the policy is read once when the simulation is built (OriginalGuestDecisions off, SmarterGuestDecisions on); a counting policy proves every decision point goes through the layer and that a delegating policy gives the same guest hash and the same WorldRng state; a patience policy exercises the new hook; the policy sources name no generator; birth ids are given at creation (the booth sees them), never repeat, are assigned in thing-list order on the first tick for guests without one, and a limit counter is refused; the trait hash is well mixed; the section round-trips, validates and restores into a fresh instance, and a resumed park hashes like the uninterrupted one every tick for 1,500 ticks; the level captures the section only while the extension is on and a mismatched set refuses the load. Pins: with the extension off every existing pin is unchanged; with it on DeterminismTests.SmarterGuestsFixedRunHash pins the SyntheticPark run's world hash (the extension's state included), while that run's guests, economy and guest snapshot are asserted equal to the off run's every 1,200 ticks and ParkScenarioFixedRunHash ParkScenarioFixedRunHash is the off path's.

Phase 2 tests. SmarterGuestsValueTests covers the rules in isolation (the sensitivity band, the prediction against the stand-point test, the zeroed score, PriceTurnedAway, the booth's scaling, its monotonicity and that it is never harsher than the original), the run counter (PriceStalls), the guest that goes home (a policy with a limit of 3 keeps and bounds the runs; the shipped limit of 1 sends guests home at once and keeps none), the host's facts (none and no state off; the stand-point statistic recorded the same number of times with the facts asked for, and the same hash), the section (round trip, empty omitted, strict validation, a refused restore changes nothing), the scenario variant with a park rating, and the section, the first-tick bootstrap and the world hash on the shipped policy. SmarterGuestsTests keeps the identity tests on an identity-only policy (what 1.0.0 was) where they compare guests with the off run, extends the resume test with runs that continue equal, and holds the compare test (price rejections improve beyond 3 SE; happiness, revenue per admitted guest and admissions do not regress). Pins in phase 2: the off-path pins are unchanged, DeterminismTests.SmarterGuestsFixedRunHash did not move (the synthetic park has one cheap shop that never turns a guest away, so the rules never act there; see DETERMINISM.md), and GuestMeasurementTests pins the scenario with the extension on (ScenarioSmarterFixedRunHash), where the rules do act. The script-mod pins run over the original policy and are unchanged.

Phase 3 tests. SmarterGuestsSpreadingTests covers the estimator (cold start for a ride, a shop and a capacity below 1; the first boarding, the half-weight first gap, the 1/(samples + 2) weights, no folding of a gap without demand; convergence on a steady gap and the 1/16 cap; gap and interval clamps and saturating samples; closure, breakdown and an empty queue starting a new gap, a queue forming again starting the silence clock, a repaired ride with guests still queued and a ride that never boards read as stalled, two boardings in one turn; an upgrade restarting by capacity or speed in the read, the turn-start look and the boarding, and a ride-settings change of the live capacity restarting the estimate in a park run; zero capacity and a stalled ride read as their silence; ordering and removal), the expected wait and the queue match (unknown without an estimate, reservations as guests ahead, the inverse of throughput, saturation), the score (the original's for a view without an estimate, longer waits score lower, the queue counts at any distance, the floor protection over a sweep that reaches it, the order kept among the candidates at the floor, the unused-ride fallback and its exceptions), the preference band (94 to 106, every value occurs, roughly even, stable for the visit, two identical rides get different favourites, 0 stays 0), the hysteresis (the margin at the boundaries, rides only, shops stay impulse stops, the original always switches, the script policy forwards both new members), the host (no spreading fact, no state and no extra work off; reservations exclude the asking guest; throughput is tracked on the boardings; a removed attraction takes its estimate), the section (round trip, strict validation of every field, an unknown attraction refused at file level and a future boarding turn at restore, absent while empty, hashed only while non-empty) and that the spreading rules act in the scenario run. AResumedParkContinuesLikeTheUninterruptedOneWithTheExtensionOn also checks that the estimates are in the section and continue equal to the uninterrupted park's, every tick, and that they moved after the save point.

Source: docs/SMARTER-GUESTS.md in the project repository.