OpenTPW

Roller coasters#

Players build roller coasters in OpenTPW the way the original does: a chain of pylons placed on map cells, joined by a smooth track that leaves and returns through the station. This page describes the implementation (COAST-I). The evidence and the specification are in reverse/COAST-plan.md, sections 9, 9.7 and 12 to 19. The register of what is still approximated is at the end.

Coasters are the ride objects with Bumper.WhichTrackType 3. The PC catalogue has twelve, three per theme, and three of them are water flumes (troughs). Go karts (track type 1) and water rides (type 2) use cell tracks. They are not part of this work.

Code#

FileContents
World/Coasters/CoasterDefinition.csThe definition: code defaults of 0x2d274, then the coaster.sam values (only nonzero values replace a default; the three pylon cost rates are copied as given). The StdPylon and LoopPylon controls.
World/Coasters/CoasterTrack.csNodes, the station's three nodes, the placement validator 0x36ba4, invalid marking, closure, completion, the height clamp, the pylon cost, node positions, node tangents, auto-banking and the knots.
World/Coasters/CoasterStationLayout.csThe station frame: the End, Mid and Start dummies of the station model (0x436ac0) that the three station nodes are built from.
World/Coasters/CoasterCurve.csThe curve: Hermite tangents along each knot's direction, one cubic Bézier per knot pair (0x41b00), the sampler 0x44ff4 (parameter steps of 0.05, one sample every 3.0 world units), yaw and pitch, and the 4096-entry sine table. ICoasterCurve keeps the curve swappable.
World/Coasters/CoasterRating.csThe rating pass 0x3fc18, the step 0x415b4, the final 0x41900, the train count and the guests' ride excitement.
World/Coasters/CoasterRide.csThe controller of one station: samples, rating, trains, the admission ring, the COAST commands of the station script, the train motion 0x43ce20, the station step 0x43b8b0 and the collision exchange 0x43cd60.
World/Coasters/CoasterCollision.csThe self-intersection pass 0x439ab0 → 0x439c40 → 0x43a2b0: its count feeds the guest predicate.
World/Coasters/CoasterBuilder.csThe headless build API: place, move, height, close, complete, reopen, delete, and the money of each.
World/Coasters/CoasterWorld.csThe coasters of one park and the boarding generator CoasterRng. It is owned by the park's RideScriptWorld.
World/Coasters/CoasterRenderer.cs, CoasterAssets.csPresentation: per coaster the track mesh, the pylon models and the cars, rebuilt only when the track or the build cursor changes (see "Presentation" below).
World/Coasters/CoasterCrossSections.cs, CoasterTrackMesh.csThe coaster.sam cross sections and their extrusion along the curve slices.
World/Coasters/CoasterPylonRig.cs, CoasterCarRig.csThe pylon models posed with their loft and rotate clips, the car models, their extents, spacing and pose.
World/Coasters/CoasterCarBend.csThe bend of a bBendCar boat's mesh along the samples around it (0x438800, 0x438ab0).
World/Level.Coasters.cs, Hud/ParkHud.csThe coaster tool of the park view.

Building#

When a coaster station is placed, the HUD starts the coaster tool. The station is three nodes (COAST-029, 0x436ac0), built from the three dummies of the station model that carry attribute 0x400000 (numbered 1, 2, 3: End, Mid, Start; in the 12 PC stations End is half a cell before the < column, Start half a cell past the > column and Mid between them, with the placement's rotation applied):

NodeWhereNode flagsCreation parameters
S0 (ordinal 0)a StdPylon in the cell of End: the cell before <, outside the footprint0x400, winch, no previous link (0x80000)0x274
S1 (ordinal 1)pylon-less, at the exact position of Mid (its knot is the dummy, not a cell centre)0x200 | 0x400, winch0x3c
S2 (ordinal 2)a StdPylon in the cell of Start: the cell after >0x200, no next link (0x40000)0x28c

All three carry descriptor flag 2: they are never picked up, no pylon stacks on them (the bottom-node flags 0x200/0x400 refuse it) and the entrance limits apply after S2. The station pylons are as high as the dummies (dummy y − the station's base), without the fMinHeight/fMaxHeight clamp (creation parameter bit 4, 0x433790), so the loft parameter is clamp((h − h0)/(h1 − h0), 0, 1); the station's cost belongs to the station. The track leaves at S2, runs through the player's pylons and returns to S0: the closing click is on S0's cell (OpenTPW also takes a click on the station's own < and > cells). S0 leaves straight toward S1, S1 is straight between S0 and S2 and S2 leaves straight along the platform whatever the first pylon (the tangent routine 0x431660 drops the previous neighbour on 0x80000 and the next on 0x40000). The station links S0 → S1 and S1 → S2 are ordinary links of the collision pass.

A station whose dummies lie below the StdPylon's h0 (Ghosta Coasta 2.04 against 4, Scatty Batty 3.5 against 5, Candy Coaster 7.09 against 10) stands on pylons raised to h0, so S0 and S2 sit above the middle knot: the original's knot pass clamps the height parameter to [0, 1] and writes it back (0x430ca0) and stands the node at ground + h0 + t(h1 − h0) (0x430ed0). A station placed without its model (a headless test) takes the same frame from its cells (CoasterStationLayout.FromCells, [EXT:coaster-station-frame]).

Headless API (tests, the M3/M4 gates):

var ride = runtime.Coaster;                               // OriginalObjectRuntime of a coaster station
var builder = new CoasterBuilder( ride, CoasterSite.FromGrid( grid ), () => economy );
builder.SetStation( depart, back, layout );               // CoasterBuilder.StationEnds( shape, x, y, rotation ); layout: the model's dummies
builder.Height = 40;
builder.Place( x, y );                                    // per pylon: charges trunc(cost), marks invalid links
builder.Place( back.X, back.Y );                          // closes the circuit
builder.Complete();                                       // end node, curve, rating, trains
// ride.Rating, ride.Trains, ride.Command( n, p ), ride.Advance( dt ), builder.Move / SetHeight / Reopen / Delete

Level exposes the same through GetCoasterBuilder, EnterCoasterTool, CoasterClick (a click on the closed circuit's station end completes it) and DeleteCoasterTrack; the tool's writes are park commands (CoasterCommands.cs, COOP.md, "Tools").

The tool panel#

The coaster tool shows the original's slide-out panel (COAST-028, tp.exe 0x4982a0, 0x446fa0, 0x445910, table 0x751530): a left box with the build (cb_track, control 0x1f) and loop (cb_loop, 0x20) buttons, a middle box with move (cb_move, 0x1b), height (cb_loft, 0x1a), stack up (cb_swapup, 0x1e), rotate (cb_rotate, 0x1c), tilt (cb_incline, 0x19) and stack down (cb_swapdown, 0x1d), and the demolish button (cb_dellast, 0x21) at the right. The rectangles, models and tooltip help ids come from the table; the click help is 0x486b00 with 0x125 (build), 0x126/0x127 (loop), 0x121 (move) and 0x124 (demolish). The tool's entry puts the panel into the HUD arm (0x4988c0: 0x4a2590, message 10 of the arm drawer 0x4a14f0), so it slides out as the camera and message panels do: the 675 x 274 root (859, 916) starts at the arm's left less its width less 50, centred on the arm, and moves right by 88 units per 20 ms tick to left 486, top 1145 (the video's measured offset (−372, +232) was these (−373, +229) within a pixel or three); the tool's exit and the arm's retract button slide it in, and another panel that takes the arm ends the tool (message 0x1001d8, 0x4a17dc). The loop button's model and help follow the flume flag (cb_trough, help 0x134; else help 0x132, 0x4987f0). Its background takes the clicks of the area it covers.

Way in. The ride window's track button (b_track, control 0x3e2a, help 10; shown when the object's type record has a track type, 0x4ad53a) calls 0x4af200, which sends a coaster (type 3) to 0x4988c0: it enters the tool (0x4474d0, state 2 for a finished circuit) and selects the first button (0x4455c0). The table-driven ride window (ParkHud.ObjectWindow.cs) has that button at its original place and ParkHud.EditTrack is its click, so select a coaster, press it, cut, extend, complete. The build buttons' pylon click is the tool object's release (0x524960, mode 0x15: the click sound 0x65, the placement and the help 0xCD, at the cell under the pointer at the release); the move, height, rotate and tilt buttons pick a pylon up on the press (0x524790 in mode 0x16 and the drag class 0x6FEAA0, 0x446300(1)) and settle on the release (0x446300(0)), as before; a quick right click leaves the tool on its release. A drag does not fit the controller on every pointer move (the original rebuilds the track each frame): the renderer draws the nodes as they are and the track is fitted, rated and the trains placed once on the release. Backspace waits for a drag; a drag let go while the game is paused ends there. A save taken while the tool is open lets the ride out of state 2 on load, as leaving the tool would. CoasterToolPanel is the headless controller, ParkHud.CoasterPanel.cs the pointer side. One tool is on at a time, as the original has one tool mode: the coaster tool's entry ends every other tool, the track tool's entry ends the coaster tool, and a coaster tool still on next to a tool that started after it ends at the HUD's next frame; the track button on the coaster whose tool is on starts nothing again.

Shared parks. In a co-op session the coaster tool works through the coaster's claim, as a kart or water ride's track tool does: one player edits a coaster at a time, a guest's clicks, Backspace, swaps and cuts wait for the host one at a time, and a guest's drags go to the host as their latest values at most every 0.2 s ([EXT:online-coop-claims], [EXT:online-coop-commands]; docs/COOP.md, "A guest's coaster tool (C3c-2)"). The claim's end leaves the coaster's tool state as the tool's end does, so no player that leaves leaves a coaster closed. Backspace takes back only the player's own last pylon, placed in that run of the tool and unchanged since ([EXT:online-coop-undo]; docs/COOP.md, "The coaster tool (C5-3)").

Every loop routine of the original (the mode starter 0x442cd0, the resumption 0x442d10, the pending test 0x444c00, the mode setters 0x444c50/0x444c80, the selection 0x4445b0) first tests the definition's flag 2, which the definition builder 0x42fad0 sets when pylon control 1 (the loop pylon) has a mesh (0x42fd57; CoasterDefinition.HasLoopPylon): on a coaster without a loop pylon the loop button is still shown and enabled (the panel only looks at the ride's level, 0x4980D6, 0x4987f0) and its selection just picks the build mode. The auxiliary dispatcher 0x447a10 is the layout replay's action 0x38 (the replayer 0x785a08 rebuilds a downloaded online park from its recorded actions, 0x4045b0 at 0x40463e); OpenTPW runs no layout replay. COAST-035 is retired (October 30, 2026).

The loop tool resumes a pending pair from the open chain endpoint after closing/reopening the panel or using an edit button: the second pylon keeps counter 1, its cursor omits LoopFirst, and placing it ends loop mode. The endpoint is the incomplete chain's tail or a completed cut circuit's predecessor, not an arbitrary picked pylon. Build stays disabled while that endpoint carries 0x80, independently of the active tool. Availability and upgrade gates remain in force. See loop-pair resumption for the static evidence, synthetic coverage and remaining COAST-035 dispatch/loader qualifications.

Running#

The station runs its original script (Coaster.RSE). The script's COAST commands reach the station's CoasterRide:

CommandEffect
COAST 8creates the controller; the speed cap is 80·(1 − s/100) + 130·(s/100) with the setting s = 60 (110)
COAST 5closes or opens the ride
COAST 6the seats of a train
COAST 2the free seats of the train at the station (0 when closed, broken or not runnable)
COAST 1seats the guest the admission called (VAR_LETMEON) in a random car (CoasterRng)
COAST 3lets one rider off into VAR_LETMEOFF
COAST 4argument 0, 1 or 2 selects ride mode 16, 64 (the breakdown) or 32; mode 64 sets the power factor to 0, so moving trains coast to a stop

Guests queue and are admitted by the same machinery as other rides (RideVisitorBridge). Track type 3 skips the capacity test. A coaster that is not complete takes no guests. For track type 3, the guests' ride excitement is trunc(0.5·E + 50), where E is the coaster's excitement rating. The sickness has no guest consumer (COAST-013 retired: the guest rating 0x4e0560 fetches it from 0x43e0b0 and discards it). The guest predicate 0x441970 tests controller +0x140 == 0, which is the self-intersection count (not riders on board: its only writers are the pass 0x439c40 and its inverse 0x43ad50), that the track is complete and not open, and that the coaster is not the one being edited (0x790fec). CoasterRide.AcceptsGuests is that predicate: BeingEdited stands for the global 0x790fec, which the tool's entry (0x447520 through 0x430ac0) sets and its exit clears (Level.EnterCoasterTool, ExitCoasterTool). The choice (0x4dd920), the reopen guard and the queue's state 11 read it: a guest queueing for a failing coaster, an edited one included, thinks 13 and is dismissed at its own update (tp.exe 0x500612, in GuestSimulation), while the join (0x4ffbc0) and the ride's own admission (0x4e1220) do not read it, so a guest already walking to the coaster joins and an open ride still calls its head forward (APPROX:COAST-024, retired).

The count comes from CoasterCollision (0x439ab0 → 0x439c40 → 0x43a2b0, COAST-004). Every node with a successor has a box of the samples of its link grown by its pylon's fCollisionPossibleRadius (0x439920). A link is tested against every link that shares no node with it (two nodes away, forward and backward): the boxes must overlap, the samples of each link inside the shared box become segments, and two segments whose boxes overlap are tested as prisms. The five collision points of the definition ((4, 8), (4, 0), (0, −3), (−4, −1), (−4, 8), no PC .sam names others) are posed at both samples of each segment (roll, pitch, yaw through the PC sine table with truncated indices) and a profile edge of one prism cuts the plane of a side face of the other when its cut lies inside the face (the four corner angles sum to at least 2π − 0.001). A crossing puts an entry in the lists (eight at most) of the two links' first nodes and adds 2 to the count. The original runs this incrementally per edit; here a pass runs over the finished track at every rebuild.

Trains move in hops of half a sample (0x43ce20). Each hop averages the cars' speed after the height change to the point half a sample ahead. It then applies station braking (x⁴ toward the winch floor when a car is past ctl+0x134, unless the train is flagged bumped) or friction (on the sample the train stood on at the start of the step), the floor (winch speed when a car's half-sample point is on a chain-lift section, else the minimum speed, both times the power factor) and the cap. A hop takes d / ((v + v')/2) seconds, and the last hop of a step is partial; its end speed is capped but not floored, so a train at rest builds up speed over several frames. Below speed 2 the speed decays by 0.95 per hop, and below 0.01 it is 0. The trains of a frame hop one at a time from a queue (0x43ced8): the train with the most of the frame's time left hops next, a full hop puts it back before the first train with no more time left, a partial hop takes it out.

The frame's time. The motion tick takes as its frame time the scaled game clock since the controller's clock word ctl+0x120, in whole milliseconds × 0.001 (0x43ce20; the clock 0x7b496c is the one that drives the substep clock, refreshed once per frame by 0x473440). It writes the word only at its end, and the first tick of a controller (flag 0x10 clear) sets it first and takes no time (0x43ce85). The controller tick runs the motion tick only in states 2, 4 and 8 (0x435ac9), so while a track stands cut or reopened (state 1) the word stands and the clock runs on. The first tick after the track is completed again takes all the time since the last tick: one tick, no clamp, no substeps, every train hopping from the queue until it has spent it. The game pause (0x4092a0: the pause menu, the map, the postcard, message boxes, the pause key) freezes the clock, so a paused stretch adds nothing. OpenTPW counts that clock in fixed steps: they stop while the park is paused and multiply with the game speed, as the substep scheduler's clock does (CoasterRide.MotionClockLagSeconds, the steps since the last motion tick). A reopened coaster therefore catches up exactly as the original does. The catch-up stays cheap in practice: measured on the test circuit, a coaster cut open for six hours of simulation time catches up in one tick of about 145,000 hops (about 0.1 s). Like the original's float frame time, the catch-up only stops progressing once a hop is shorter than half the float step of the remaining time, which takes weeks of simulation time cut open. A restored lag that is not a finite time of 0 or more is refused. What stays OpenTPW's own ([EXT:coaster-fixed-step]) is the frame: the original runs one controller tick per rendered frame with that frame's milliseconds, OpenTPW one per 60 Hz simulation tick of 1/60 s. While the game clock stands still, the original still runs a zero-time motion tick and the station step on every frame (0x435a30 is gated only by the application's activation test at 0x54F8E0), which caps the speeds and decays the slow trains (×0.95 below 2.0); OpenTPW's paused park runs no tick. Both depend on the rendered frames, which no reproducible simulation can read.

The speed setter's gate. The script's speed word reaches the controller through 0x43b2b0 (COAST 8 at 0x554ab4 and the slice tail at 0x5517ea), which skips a changed word when controller bit 0x8000 is set and no layout replay runs (0x785a2c, the action replayer 0x785a08, which rebuilds a downloaded online park from its recorded actions). Only the replayed action 0x45 sets the bit (0x447e30: it applies the speed through the same setter and then sets 0x8000), and the saver does not write it. So a speed a layout replay set holds against the script's word afterwards. CoasterRide.SpeedSetByReplay ports the bit and the gate; OpenTPW runs no layout replay, so the bit stays clear and the gate stays open.

The train. A train's position is its middle car's, car (n − 1) >> 1 (train +0x2c); every other car stands its offset ahead or behind (0x43bc20): the car types' extents (0x430130: the model's header bounds around its root node plus fFrontDistanceAdd and fRearDistanceAdd) give three pair distances (0x42fad0: front type's rear + centre type's front, centre rear + centre front, rear type's front + centre rear), and going forward from the middle car each car adds the pair its own index selects (front for car 0, rear for the last car, centre otherwise), going back each car subtracts it. The hop measures its distance on the middle car, the braking blend on car 0, and the train's span is car 0's offset and front extent to the last car's offset and rear extent. Only the cars of the centre type seat (0x43ba90): a train's capacity, by default its head sockets (the dummy records with flag 0x80 of each car's model, summed over the cars, definition +0x2f8), is split over them; the caterpillar's head and tail carry none. COAST 6 bounds a request by 0, the fleet's sockets and one train's sockets, and 0 stands for the train's sockets. The admission ring holds one train's sockets, the leaving ring twice the fleet's. After every rating pass (0x43c450) the trains are placed again (0x43c1f0): train 0 keeps its last car where it stood (on a new track where it last ran, since the idle train slot keeps its cars' coordinates), each next train's last car stands where the walk over the rated sample speeds from the previous one's reaches uiTrainReleaseRate, a train's cars are laid out from the last car forward, and its speed is the mean rated speed under its cars. Trains below a new count keep their riders, the ones past it give theirs to the leaving ring. Without the car models (a definition from settings alone) every car type is 3.5 units each side of its pivot with four sockets ([EXT:coaster-car-fallback]).

Trains never stop. The motion tick has no zero-speed branch (0x43ce20): in the station a train's speed blends toward the chain-lift floor and stays there. The controller tick (0x435a30) runs the motion in the built, open and closed states (state & 0xE) and the station step (0x43b8b0) only in the open and closed states outside mode 64 (a breakdown). The station step works on the train's span (front and rear on the sample list, which starts on S0, the start of the platform) and the window [ctl+0xf8, ctl+0xfc] (the sample coordinates of S0 and S2, narrowed toward its middle by fEntranceSizeInterval, 0 in every PC .sam; 0x43b750). The sampler walks every pair from S0 and, at the end node, the closing pair E → S1: it emits one sample there (0x440c10; E stands on S0, so the pair repeats S0 → S1), so the list ends just before the platform and the braking zone [ctl+0x134, n) is the stretch before it:

Headway comes from the winch floor, halved (0x43d041..0x43d05d) for a train with flags 0x80 (since the power came back) and 0x20 (in the station), and from the collision exchange 0x43cd60: when the rear of the train ahead (the next index) is behind a train's front and the train ahead is slower, the two speeds become (T + 2·O)/3 and (O + 2·T)/3 and the train ahead is flagged 0x40 (no station braking until it is past the window). Flag 0x80 clears at the end of the tick when the time to the train ahead (the samples between them times spacing over the speed of the sample whose index is the train's own index, 0x43d85f) reaches uiTrainReleaseRate. The crash effect 0x439840 plays its sound (AUDIO.md, "Finishing pass") when the two new speeds differ by more than 1.0: cat_rides 0xC at the bump (CoasterRide.Crashed); its particles are not reproduced.

The station commands follow the Windows twins (tp.exe 0x43b1f0..0x43b330, which agree with the Mac readings). COAST 5 is gated: argument 0 opens (state 4) only from state 8 or 2, a nonzero argument closes (state 8) only from state 4, so a repeated command changes nothing and a ride whose track is not finished (state 1) takes neither; closing moves the admission ring into the leaving ring that COAST 3 pops.

Controller states (COAST-012, 0x435730): 1 the track is not finished (no trains), 2 built or out of service (the trains circulate empty, no station step), 4 open, 8 closed. Completion sets 2; the script's COAST 5 makes it 4 or 8. The coaster tool's entry (0x4474d0 → 0x447520, which round 2 labelled the tool's exit) closes the ride object (0x4df300: the guest being loaded is dropped) and sets state 2 for a finished track with its circuit closed, else 1; leaving the tool opens the ride object again when the state is 2 (0x4df390). The transitions: 1 → 2 sets the trains up, 2 → 1 removes them, 4 → 2 and 8 → 2 unload both seat lists of every train (8 → 2 then runs the closing move), 1/2/4 → 8 run the closing move, every other pair changes nothing. OpenTPW lets the guests of the admission ring leave with the riders on 4 → 2: the original does the same, since 4 → 2 and 8 → 2 unload and then fall through to the closing move 0x43b390 (0x43587f, 0x4358c9 → 0x4358cb). It does nothing on 4 → 1 and 8 → 1, which the tool never reaches (it goes through state 2 first); OpenTPW's headless edits take the trains off there ([EXT:coaster-state-clear]). A finished coaster entered by the tool keeps its trains (empty) and its pylons can be moved and re-heighted there; extending the circuit goes through the panel's demolish button, whose cut sets state 1 (see "The tool panel"). COAST 4 maps 0/1/2 to the modes 16/64/32; mode 32 is treated exactly like 16 by the mode setter 0x435730 and nothing tests it. In mode 64 the station step (0x43b8b0) is skipped, so a train on the platform does not unload until the power is back (an arriving train unloads open or closed; boarding is state 4 only). COAST 6 takes min(max(request, 0), definition +0x318, first train definition +8): the lower bound is the literal 0 on the PC where the Mac reading takes a global (documented difference, OpenTPW follows the PC); the upper bounds are the fleet's and one train's head sockets. COAST 8 makes the ride script's speed bias (script +0xC0, 50 at creation, 0x558c3c) the speed setting through 0x43b2b0/0x43c3d0, so the speed cap is lerp(maxAtMin, maxAtMax, 0.5) instead of the constructor's setting 60; the loop calls the setter every pass, and the bias changes only when an upgrade completes (it then becomes that level's InitSpeed when above 0, 0x4DF8F0). A suspended coaster's roll is the swing of pass 0x43c450 (0x43c76c..0x43ca45): the force plus gravity rotated into the sample frame by −yaw, −pitch and −old roll through the runtime sine table (4096 entries, T[k] = f32(fsin(k/4096 · f32(2π))), scale f32(4096 · f32(1/2π)), the index rounded to nearest, 0x4708d0), approached through atan2(−X, Y) at rate min(|F′|·fForceMultiplier, 1) and faded to 0 over the braking zone (COAST-018 retired; the x87 intermediates stay with COAST-032).

Rating#

The rating pass runs once when the track is completed. It starts at the winch speed and marks every section whose speed sits on the winch floor as a chain lift. Each sample's force is a·(v/10) with a = −((p₋ − p) + (p₊ − p))/spacing, so a dip gives a negative Fy. The first sample gets the winch speed and no force, the last copies the one before it. The step and the final are single precision, with the original's fused decay and final sum. The step's discomfort term uses Fz when the inverted arm does not apply, and the final counts the sections with both node flags 0x40 and 0x80; node flag 0x80 is never set in OpenTPW, so that count is 0. Both are bit-exact against the original routines in the PPC differential oracle (ORACLE.md F7, F8; REVIEW-COAST.md). CoasterRating.Step, CoasterRating.Restore and CoasterRating.FinalFor are the seams for the oracle hooks coaster_rating_step and coaster_rating_final. The Windows executables (tp.exe and the Theme Park Inc Game.exe) differ from this Mac rule in the step's non-inverted arm, where they add u instead of Fz, and in the last bits of S, E and the final excitement (x87 rounding); C# follows the Mac and is unchanged (ORACLE.md 7.8, X11 and X12).

The train count is min(uiMaxTrains, max(1, trunc(lap / (uiTrainReleaseRate/1000)))).

Determinism#

Coasters are in the canonical state hash (schema 6, docs/DETERMINISM.md): the coaster generator, then every coaster's track (with each node's loop rotate and the middle station node's exact position), controller state (1, 2, 4 or 8), the station window, the intersection count, samples, rating, trains (position, speed, flags, boarding span, the riders of the lap and the guests seated at the station per car), the admission ring and the leaving ring. The park save holds them all (PARK-SAVES.md): the track verbatim, the controller scalars and trains with their riders, and the shared generator through the script world; the curve samples, rating, winch marks and braking point are re-derived on load by the same rebuild completion ran, so a loaded coaster continues bit-for-bit. The original's own coaster chunks between EMAK and SAOC are read structurally (SaveCoasterBlock: each coaster's 32-byte header, auxiliary link block, 34-byte sections with links, and the train slots and cars once the coaster type's train and car counts are known; docs/TPWS-PAYLOAD.md "Coasters block") — proven on the tp.exe saver and loader, the Easymode empty boundary and a labelled Theme Park Inc cross-check of the sections — and the block is imported into a runtime coaster with its trains and riders (OriginalCoasterImport; SAVE-920 and SAVE-923 are retired, SAVE-921 is narrowed to the track flags' readers); nothing is written. CoasterSections exposes recognized scene records and attraction ids joined by cell and Info.Id; this does not identify a controller's station. Nonempty original TPW controllers are refused at ParkObjects.ImportOriginal before any runtime object is created. This includes controllers with no saved sections: an empty topology is not proof of an empty controller.

Presentation#

The coaster is drawn the way the original builds it (traced in tp.exe: the rebuild 0x43eb70, the slice emitter 0x43f4e0 with 0x43fd60, the cross-section loader 0x42d5a0/0x42d6d0, the select 0x43e9c0, the model loader 0x42fad0, the car setup 0x42f1a0/0x430130, the car pose 0x43ce20/0x43d8f0 and the edit step 0x435d50).

Used since the register round 2 (a model whose track dummy is missing or does not move with the loft clip keeps the settings' heights, which no PC model needs since the clips turn the nodes relatively; the original applies them as they come): the pylon loft heights, the track dummy's height at loft 0 and 1 (15.56 and 95.56 for the Gorilla Thrilla pylon): they are the node heights h0 and h1, read when the coaster's definition is built from its catalogue entry (CoasterDefinition.FromCatalogEntry; a definition built from settings alone keeps fMinHeight and fMaxHeight). The model's attribute records name the track dummy (the node of the first record with 0x800000: record i belongs to the node stored as header +0x46 + i, 0x44ab90) and the stack dummy (record 0x100000); for the Skull coaster's standard pylon that is its TrackCentreDummy (10 to 100, the dummy its loft, incline and bank clips move) with the stack dummy TrackHeightDummy 20 above it.

Tests#

Approximation register#

CoasterApproximations lists every [APPROX:COAST-NNN] tag: ten open IDs. COAST-022 (the train layout, the hop queue and the placement by the release time) and COAST-023 (the seat types, COAST 6's bounds and the ring sizes) were retired by the coaster train round of October 15 ([EXT:coaster-fixed-step], [EXT:coaster-car-fallback] and [EXT:coaster-full-ring] are its deliberate differences). COAST-012 (the controller states and the tool's entry and exit) and COAST-019 (the sampler's closing pair) were retired by the three-node station round of October 15, which narrowed COAST-004 (the platform links are ordinary links now) and COAST-029 (to the stations below the pylon's h0 and the middle knot's height adjust) and took the station clauses out of COAST-014, 015, 024 and 030 ([EXT:coaster-state-clear] is the one deliberate difference of the states). COAST-013 (the sickness has no guest consumer) was retired by the register round of October 14 and COAST-007 (the distance waiver exempts the station's own internal nodes), COAST-016 (the completion click), COAST-018 (the swing's sine table) were retired by round 2; COAST-025 (own-format save), COAST-027 (generator seed) and COAST-031 (the station's total spent) became extensions ([EXT:coaster-own-save], [EXT:coaster-rng-seed], [EXT:coaster-ledger]) and COAST-016 the extension [EXT:coaster-completion-click] (APPROX:COAST-007, APPROX:COAST-016, APPROX:COAST-018, APPROX:COAST-025, APPROX:COAST-027 and APPROX:COAST-031 no longer exist). The IDs below 15 are the unknowns of COAST-plan §10 that are still open, narrowed to what the PC executable did not settle. COAST-015..019 are the new unknowns of §10.1, COAST-024..030 are rules OpenTPW chose while implementing the plan, now narrowed. COAST-032 is the arithmetic precision of the knot chord, the node tangent, the knot-control norms and the swing, where the original uses x87 steps with extended intermediates. COAST-020 (cost rates) and COAST-021 (force term) were resolved by the COAST-V review and are traced now. The generated table is in the fidelity register (generated by tools/fidelity_register.py).

The coaster tool panel round of October 15 narrowed COAST-028 (the panel, every sub-mode handler, the drag rates and ranges and the placement area's box are traced and built; the pointer's pixel scale, picking by cell, the area's occupancy test, the guessed clip angles of the hand-set yaw and incline and the panel's window position stay approximations) and COAST-035 (the cursor node and its flags are built as a translucent ribbon; the original's renderer for the flags is not found) and the cut-end flags of COAST-030.

The read round of October 15 (tp.exe) narrowed COAST-004 (the collision count +0xB0 is read by the section builder 0x43F4E0, which draws a crossing link with material variant 2; flag 0x400000 at 0x4376CC is the coaster save writer's), COAST-014 (the PC cost 0x447830 is the Mac formula with x87 steps scaled by 0.1), COAST-032 (tp.exe sets single precision only around the renderer 0x576EC0; the simulation runs with the start-up or 64-bit precision) and COAST-035 (the section builder recolours a link into a node with 0x800000/0x2000, or 0x4000); the cursor now keeps its last cell beyond the 300-unit reach of 0x435D50, as the original does.

The presentation is traced but still approximated in places: COAST-026 (track mesh details) and COAST-034 (cars); COAST-033 (pylons) is retired (October 31, 2026), its last difference, the build cursor's writes into the last pylon's stored bank and half turn, being [EXT:coaster-cursor-no-node-writes]. A rider's head hangs from its car's socket of its index in the car's seated list (0x43b600 → 0x44b410: socket j is the node of the car model's (j + 1)-th attribute record with flag 0x80, CoasterCarRig.Seats). The ride view (RideCameraMode) rides the car 0x436880 selects: the train with the smallest reference position (controller +0x124, 0x43d7dd) and its car 0, or car 1 behind a front car of another type than the seats' (train +0x34, 0x436f15), on that car model's camera seat; CoasterRide.TryGetRideView gives the same car's pose. FIRSTPERSONVIEWDISTANCE, COASTERSMOOTHNESS and Info.FirstPersonSprites have no reader in tp.exe that was found (COAST-011).

The wheel-lifecycle slice of October 18 moves the looping wheel clip's start time from the first renderer update to train-slot setup (0x43be10: id 5, sub 0, loop flag 1, initial speed 1.0). The rating pass sets up only newly activated slots (0x43cad6); existing slots keep their start through re-rating and speed changes. The state setter's incomplete → built transition (0x435730, 1 → 2) starts every slot again, while opening, closing, entering the tool, changing capacity and changing power do not. A replacement renderer reads the same live slot epoch; a removed and reactivated slot gets a fresh one. The existing WheelTick arithmetic and its current-speed multiplier are unchanged. This is presentation-only state, excluded from the simulation hash and save format: restoring a park initializes fresh clips at the restored controller time, without promising wheel-phase continuity across saves. COAST-034 was narrowed by the presentation follow-up of October 30 (below) to the untraced flume clip invocation. CPU phase-query and private-asset UV fixtures cover this slice; they do not establish GPU or full original-game visual parity.

The pylon tag round of October 16 built the knot pass over the pylon models' posed track tags (COAST-015 narrowed to the knot pass's write-back of the clamped height parameter and the no-model fallback; COAST-028's guessed clip angles apply only without the model; COAST-029 lost its middle-knot height-adjust clause, the knots taking no fTrackHeightAdjust). Saves record the knot pass (KnotPass): a save from before it places the trains of a coaster with pylon models again and its riders leave. The same round traced the stack parts (0x432df0) and the kept half turn (COAST-033 narrowed), the mesh's slices, shared rings, winding and marker links (COAST-026 narrowed to the cross-section runs and blends, lighting and the Add-mode UV animation; the runs, blends and UV keys were built on October 30) and the cursor link (COAST-035 narrowed: the ribbon is gone; the closing target's marks are not set). COAST-015 is retired (October 30, 2026): the only difference left, the pylon heights of a definition built without game data (tests and tools), is [EXT:coaster-pylon-fallback], user-approved.

The coaster rest round of October 16 settled COAST-017 and COAST-030 and narrowed COAST-011 and COAST-034. COAST-017: a sample's roll is the angle of the second rail's point about the sample's tangent (0x440c10), a slice's or a car frame's adds the lerp of the nodes' tag rolls by the fraction of the nodes' ordinals' lerp (0x43e6b0), and a suspended coaster's frames lerp the swing's sample rolls instead; the second rail stands one unit above every knot, two units along the tag's up row on a loop pylon and at (−sin a, 0, −cos a) on a model-less loop node (0x430ed0), fitted with its own chords (0x4321c0). The node's tag roll is written only for a posed pylon without node flag 0x40, so the rating step reads sample rolls that are zero up to the sag of the sampler's chords where the nodes' banks used to enter; the coaster hash content changes with the rolls (the run pin does not). COAST-030: no edit is refused for riders any more (0x446300, 0x446740 have no such test; the tool's entry already put the controller in state 2), the move validator skips the turn test across the cut of a reopened circuit (0x4348af..0x4348d8) and stops re-validating at a cut end (0x434e06, 0x434ea1), and the close step OpenTPW keeps for a fresh circuit is the extension [EXT:coaster-closing-check] (the original closes a reopened circuit by a click without a test and completes a fresh one by 0x435570); APPROX:COAST-030 and APPROX:COAST-017 no longer exist.

The second read round of October 16 narrowed COAST-004 (the candidate readers of the node's collision list +0xB4: loads at 0x430867, 0x43420A, 0x43B159, 0x43B3E5, 0x43B63F, 0x443087, 0x44309C and 0x44ACE9, not decoded), COAST-011 (the option table 0x7442C0 has 0x3C-byte named entries and no instruction addresses an entry; its only reference is its start in the stub at 0x402BFD, so a reader reads fields a generic key loader filled), COAST-014 (the PC's sampler 0x440C10 rounds its sine-table indices with fistp at 0x44123F..0x441271, as the knot pass does at 0x4313A5; C#'s curve keeps two truncating Mac-table lookups), COAST-015 (the knot pass 0x430CA0 clamps the loft parameter and writes it back, which every node built here already has: ClampHeight, StationHeight), COAST-029 (the PC rating pass 0x43C450 only sets the node's winch mark 0x800 on a floor speed) and COAST-032 (tp.exe's SetCooperativeLevel calls 0x563914 and 0x563B92 carry DDSCL_FPUSETUP without FPUPRESERVE, so DirectDraw sets single precision for the thread; the control word itself is not read back).

The fidelity round of October 18 (tp.exe) retired COAST-029 and narrowed COAST-004, 011, 014, 028, 032, 033, 034 and 035. COAST-029: the rebuild 0x43eb70 runs the knot pass 0x430ed0, then 0x432b50, which clears the winch mark 0x800 on every node without 0x1000, then the sampler 0x440c10 and the rating pass 0x43c450, which sets it again on a floor speed; the creation parameter 0x20 of S0 and S1 gives them 0x1800, so the two keep their mark (CoasterNodeFlags.WinchKept; a save from before it gets the pair again on load). COAST-004: the pass re-tests only the nodes marked 0x200000; a node dropped out of an overflowed holder's list re-marks the holder (0x43ad50), so the pass repeats until no mark is left, the cut-end skip 0x10000 is built, and the rebuild runs the sampler and the pass on an unfinished chain too, so the build cursor's link and a dragged pylon show the crossing marker live (CoasterRide.ChainCrossings). COAST-014: the sampler's sample angles (0x4411db -> 0x43e590) and the loop knot factor (0x432430) round the sine-table index to the nearest (the Mac lookups truncated); only the x87 arithmetic (COAST-032) is left. COAST-028: the placement area's cell test (Level.IsCoasterAreaCell, 0x5243a6 with the predicates 0x535db0, 0x536310..0x536450) and the tilt drag's camera yaw (0x443371, the park camera's OriginalYaw) are the original's. COAST-011: the options table's accessor 0x402bf0 is a virtual method (vtable 0x6fd630), which explains why no static reader was found.

The fidelity round 8 of October 18 (tp.exe, coasters-2) retired COAST-011 and narrowed COAST-014 and COAST-032. COAST-011: the options table 0x7442C0 has a single static reader, the virtual accessor 0x402bf0 (vtable 0x6fd630), which only the options instance's own loader and initialiser use: the instance 0x785868 is built by 0x401030 and filled by the loader 0x401650/0x4017a0, and no code reads the value slots of COASTERSMOOTHNESS (0x7858C0) or Info.FirstPersonSprites (0x78596C), and FIRSTPERSONVIEWDISTANCE (0x7858B4) is read only by the option apply 0x44DB60, which turns it into the fog range and far plane of every view (UI-107), so the ride view's fixed parameters are the original's. COAST-032: the thread's x87 precision is 24 bits (DDSCL_FPUSETUP at 0x563914/0x563B92, then the shipped D3DIM device creation sets the control word 0x7F and nothing restores it), so every PC multiply, add, subtract and square root rounds to a single, which C#'s single arithmetic does one operation at a time. The pylon cost (0x447830, 0x4346a0), the suspended swing (0x43C76C), its cosine index (0x43C7D0) and the loop knot factor (0x432430) are now built from the instruction sequences (fpatan and fmod are exact, the subtractions with the double constants round to a single); the knot chord, the knot norms and tangents and the self-intersection pass are still to be read on the PC side.

The presentation follow-up of October 30 (round 10, package N) built the track mesh's run table and compared the bend tables. COAST-026: the section of a normal link is read from the run table 0x4402D0 builds over the sampled track (steps of 0.25 on the sample coordinate, the select table 0x43E9C0 with its speed, direction, pitch and bank windows in radians, a run written at every change of the answer), and a type whose sections blend (the Jungle flume: sections 3 and 4 blend point blocks 2 and 3 over +1 and -1 sample coordinates) adds the transition runs: a positive length opens the blend after the change, a length of zero or below puts it before the change, and two blends that meet share the stretch by their lengths (CoasterExtrusionRunBuilder). The slice lists 0x43F030 hold every run key strictly inside two neighbouring values, a ring is emitted again when the run moves, and a transition run's rings blend the section's points to its blend-to row by (coordinate - previous run's position) / (this run's position - previous run's position) x weight, plus 1 - weight for a positive length (CoasterTrackMesh.BlendWeight, 0x43FD60). The run table is compared bit-exactly with isolated tp.exe runs (ORACLE X42, CoasterRunsGolden: non-suspended chains of single-knot nodes with zero rolls only); a chain the demolish button cut open has no sample list here and keeps the per-segment pitch selection. COAST-034: the bend car's tables 0x438AB0 are compared bit-exactly with tp.exe (ORACLE X43, CoasterBendGolden; the PC acos at single precision was an ulp off); the bend writes only the body mesh's vertices, so a rider's head socket stays unbent as ported; the Croc and Maggot boats' vertices all lie inside their tables. The boats' own clips (no start behind the bend flag was found) and the widening of a bend type's model bounds (0x4302AA..0x43041A) stay open. The track mesh's vertices carry the texture's lighting as an assumption: a texture with bIsSelfIlluminating gets the texture flag 4 (0x42f390: 2, plus 4 for a nonzero flag word before the scroll rate, plus 0x20 when it scrolls) and the three marker textures flags 7, and their corners take the renderer's self-lit vertex flag (TextureSlotAddressing.SelfLitFlag, CoasterRenderer.TrackVertex); a self-lit texture named like a light source (IsLightSource) also takes the evening extension's light-source flag, the markers do not. That the original's dynamic model draw reads texture flag 4 as "constant colour instead of the scene light" is not traced (the only traced unlit path, 0x580C51, tests the model material word +0xC bit 0x1); it stays in COAST-026. The shader (native and the web JSON build) already honours both vertex flags. The pylons' loft, incline and bank clips carry texture-coordinate keys (record flag 0x10000: the Jungle pylon's loft adds 14.985 to the V of its top corners over the clip); the add mode adds them to the stored coordinates (0x4745C0 through 0x471860, ModelUvAnimation.AddTo), so a lofted pylon's coordinates run past 1 along its height. Whether they wrap or clamp follows the shared texture's accumulated flags: the texture cache 0x575870 keeps one object per (directory, name), the slot setup 0x575E10 and the rebinding 0x575C60 OR the wrap bits into it for good (nothing clears them, 0x590FA0 clears only 0x4000), so a clamping slot wraps as soon as any model of the ride (the other pylon, the P* previews) wraps the same texture (CoasterAssets.WrapNames, ASlotThatClampsWrapsWhenAnotherModelOfTheRideWrapsTheSameTexture). The cache counts its holders: the set unload (0x575F10..0x575F88) releases each texture through 0x575AD0, which frees the object and drops its entry when the last holder goes (only the whole-cache teardown 0x574B10 clears the rest), so a build preview's wrap bits last only while the preview or another model of the ride holds the texture; the object renderer's models load through the same cache (0x87A268) and are not given the accumulated bits here.

The fidelity round 11 (package H, October 31, 2026) ported the coaster's rating pass (0x43C450 with its step 0x43DC50, final 0x43DF90 and swing), the speed cap 0x43C3D0, the car offsets 0x43BC20, the train placement 0x43C1F0 and the motion tick 0x43CE20 in tp.exe's own single-precision order, with the trains wrapping by the controller's end coordinate +0xA8 (CoasterRide.EndCoordinate) instead of the sample count, and the placement validator's turn angle and window (0x434740); all compared bit for bit with isolated tp.exe runs (CoasterRatingGolden, ORACLE X46). COAST-014 is retired (its last clause was this arithmetic); COAST-032 keeps the cars' curve point and pose (0x43C0A0, rendering only), the pylon tags' pose engine and slot n past the sample list. COAST-004: the link test skips a link pair whose end node shares its cell descriptor with the other link's first node or the reverse (0x439C5F..0x439C81; the descriptor is the cell's pylon column, so stacked pylons share it), the asTrackCollisionPoints keys are read (fCollisionX/fCollisionY, field table 0x73ED30), and the four loads at 0x430867, 0x43420A, 0x443087, 0x44309C are a position pair of a pylon control or cell descriptor, not the collision list; the sampler across a demolish cut stays open. COAST-034 and PTCL-900 stay narrowed with the call scans written into their register texts.

Source: docs/COASTERS.md in the project repository.