Saving and resuming a park#
Experimental Theme Park Inc layout checkpoints#
The TPI experimental HUD's pause menu has Save layout checkpoint and Load layout — new session. These use a separate application-owned format (opentpw-tpi-layout, version 5, .tpilayout), one slot per theme in the existing save folder: opentpw-science.tpilayout, for example. They do not use the TPW world-save picker or write native TPWS/TPWI/GMS/GMI/COS files, and they hold no economy, staff, career or campaign state (the Science continuation below keeps those).
A checkpoint records every typed cell and placed catalog object, its anchor/rotation/open flag, creation seed and attraction ID, the ID/seed allocators and world seed. Load explicitly confirms replacing the current world and starting a new experimental session: guests, queues' live membership, script instruction/variable/animation progress, fixed-step clock and audio restart. The saved queue geometry remains. Camera, speed and menu focus start fresh. This is layout persistence, never continuation or original TPI parity (an OpenTPW extension, EXT:tpi-layout-checkpoint). Prototype and coaster layouts are refused instead of losing their state. Version 3 keeps Theme Park Inc's owned land as one bit per cell. A version 1 or version 2 checkpoint, written before the owned land was kept (before PR #978), is refused with a message that names its version and asks for the layout to be saved again: it would restore every square as owned, which the original never reaches. Version 4 is the same layout written by a catalogue that holds Theme Park Inc's obstacles and camera paths; a version 3 checkpoint, written before the obstacles were kept, is refused the same way with a message that names its version and the obstacles (its asset manifest lacks their folders, so it would otherwise fail only with an asset it does not expect). Version 5 is written by a catalogue that also holds Theme Park Inc's facilities, and a version 4 checkpoint is refused the same way with a message that names its version and the facilities. The file and the running park are left untouched.
The format uses the existing trusted simulation-asset manifest without constructing TPW economy rules. Manifest identifiers from the file are compared with hashes captured from the selected catalog and terrain; they are never opened as paths. Changed/missing assets, wrong theme/dimensions, invalid objects/cells/IDs, unknown or duplicate JSON fields, unsupported versions/policies and native suffixes are refused. The strict file has the world-save size limit (64 MiB), contains metadata and layout records only, and stores no original asset bytes. File writes use a flushed unique sibling temporary file and move, preserving the prior checkpoint on ordinary validation/write/move failure.
Restoration reuses ParkLayoutSnapshot.RestoreObjects and RestoreCellMap before guests are wired, and skips shipped/default placement so fixed items are not duplicated. The candidate and its HUD are built under EntityConstructionScope before retiring the current world. Preflight or candidate construction failure preserves the live world; retirement callbacks throwing after replacement begins are outside this rollback guarantee. Successful load stops the retired HUD/frame immediately; later drawing uses the current HUD. Synthetic tests reconstruct actual CPU object/runtime/cell state with a valid dummy-only model, and check staged rollback/commit and callback lifetime. They do not qualify original data, GPU/browser persistence, crash recovery, disk-full or native save behavior.
Experimental Science continuation on desktop#
In a solo Theme Park Inc Science park, the pause menu offers Save Science park and Continue saved park. To continue after leaving the game, open the Personnel File (--front-end) and choose Load A Game. The button is enabled on desktop when the slot exists and always resumes Science, regardless of the selected zone. A rejected save leaves the Personnel File open. Both menus use one separate OpenTPW world-save slot, opentpw-tpi-science-world.json, and leave layout checkpoints untouched. The save retains the economy and clock, guests and queue membership, object and script state, and the shared world generator. It also retains the active and pending weather spells, the drop count, the wind angle, and whether precipitation has stopped within the active spell. The save records which spell start the attractions have already processed. Older saves without a wind angle resume from the original starting angle of 90 degrees. The save also keeps the Theme Park Inc parts of the park: the staff hiring pool, the placed cleaners, mechanics, researchers and gardeners with their walks, targets, job timers and watering stamps and their entries in the cell chains, the rides' wear gauges, maintenance calls and claims, the plants' scripts (in the object and script state), the object list the mechanics search, the challenge system, the owned land (one bit per cell), the mission controller and the current obstacle, the camera flight's thing, the tag tube's letters (each row's letter, numbers, read flag and date; a wage demand row keeps its member's thing and the demand), the members on strike or walking to the strike area with the roles' strike records, the special rides (the table of the rides awaiting their activation with the staff in their slots, and the activated rides), the player's career (mission counter, rank, firing line, golden tickets, the park awards and zone records) with its shares game (the shares owned, the share price, the company name and the annual-report slots, the 182 bytes the player file holds), the staff HQ (its twenty obstacle slots and the trained-staff counts per ability) with each member's training and research fields (ability, ability being learnt and its progress, chosen ability, HQ slot, lab-team listing, research room and its stamp), and the research lab (its 256 project records and their count, both slots' projects, consultants and teams, the workload, the object controls' researched words and levels, and the object types' research words it read; a park whose lab no park file brought saves none). On load, the career's current zone is always the park's own zone, whatever the save says.
Older Science saves are refused. A Science save written by a build from before any of these parts was kept cannot be continued: the staff hiring pool (PR #974; this covers saves from the builds of PR #970), the challenge system (PR #977), the owned land (PR #978), the player's career (PR #979), the mission controller with its current obstacle (PR #980), the obstacles with the camera flight (the cutscene thing's state, PR #983), the staff HQ with the research lab (the research and training port, PR #986), the mechanics with the ride wear (#985), the gardeners with the plants' watering (#987), the facilities (the facilities package: the toilets, bins, staff rooms and research and training rooms, whose folders the asset manifest now pins), the entertainers and guards with their cell effects (the entertainer and guard port), the tag tube (the tag tube package), the wage demands with the negotiation and the strikes in the park (the wages and strikes package), the shares game (the awards and shares package), the special rides (the share challenges package), and the advisor's queue with the advice history in the career (the advisor package, P1). The game shows a message that asks the player to start again (from the Personnel File for a new game), and it leaves both the save file and the running park untouched. Such a save cannot be continued exactly. The hiring pool draws from the same world generator as the rest of the park, so a pool rebuilt on load would change every later draw. The other parts hold state the old save does not record and that cannot be rebuilt from it: a new challenge system, a map with every square owned, a new career, a mission controller that never started its statistics, or a Science park without the research lab its prebuilt park brings (the whole catalogue on offer) and without the staff HQ's obstacle slots (an obstacle mission could never be met) would not be the park that was saved; an older save's rides were worn by other rules, or not at all, so its gauges are not the ones Theme Park Inc's wear would have left; an older save's plants ran no script, so they have no condition or timer to continue; and a save from before the entertainers and guards is refused by the same standing policy (refuse and document, user decision 2026-11-21) although it would be a valid park; and an older save holds none of the letters the original files as unread rows (the arrival's briefing at least), whose count drives the unread-mail advice; a save from before the wages and strikes kept its wage demands as notes the tube never filed and never considered a strike at a month's end; and an older save holds no shares game, so the holding and share price its challenges moved would restart at 1000 shares and a price of 100; and an older save holds no special-ride table, so its special rides could not be told from activated ones, and the share challenges' availability reads that; and a save from before the advisor's queue kept its forecasts in a queue and a play history of their own, which the career's advice history never saw (it is refused rather than migrated, by the same standing policy). A save from before the obstacles and the camera flight was written by a catalogue without the obstacles, so its world and asset manifest do not hold them; it is refused by this message when the save is validated, before its assets are compared, rather than with the asset check's report of an asset the save does not expect. A save from before the staff HQ and the research lab is recognised by its missing staff HQ, a save from before the ride wear by its missing ride-wear rules, a save from before the gardeners by its missing garden rules, a save from before the entertainers and guards by its missing performer rules, a save from before the tag tube by its missing tube, a save from before the wages and strikes by its missing wage rules, a save from before the shares game by its career's missing shares, a save from before the special rides by its missing special-ride table and a save from before the advisor's queue by its missing advisor (or its old forecast queue); all are refused the same way, before any asset check. A save from before the facilities is recognised by its asset manifest, which pins no facilities.sam, and is refused the same way before the asset comparison. Layout checkpoints written before the owned land, the obstacles or the facilities were kept are refused the same way (see the checkpoint section above). A save from the advisor's queue (P1) is not refused by its presentation (P2): it lacks the presentation stream and the AdvisorOn option, which load fresh from the session seed and on. Any Theme Park Inc load starts the advisor silent, as the original's init 0x715850 before the park file does; only the presentation stream is saved.
Native guest switch. The hidden switch --tpi-native-guests (off by default) runs Theme Park Inc's own guest state machine instead of Theme Park World's guest rules (TPI-GUESTS.md). A Science save made with it on records it in the guest snapshot's optional member ThemeParkIncNativeGuests and gives each guest an optional Tpi block; a save made with it off writes neither, so it is unchanged and the guest snapshot stays at schema 9. A save is refused, with a message and without touching the save file or the running park, when its setting differs from the running game's, in both directions: a save made with the switch on cannot be continued with it off, because its guests need the native state machine, and a save made with it off (every save from before the switch, too) cannot be continued with it on, because its guests ran Theme Park World's rules. A native guest in a state the current build does not run yet is refused the same way. Since phase P3b of the guest port a native guest may hold Theme Park Inc's own balloon (the balloon object +0x294 and its countdown +0x298, given by a balloon shop); only a countdown above the balloon's life (255) is refused. The Tpi block's member Wandered (the wander flag +0xE8) is optional: a save made before the native guests could wander lacks it, and it reads as not set. Phase P3b's members Fee, UseSucceeded, BalloonColour, SpriteCategory and SpriteVariant are optional the same way: a save made before the native visit lacks them. A native guest saved in the bridged boarding of phase P3a (state 16 with Theme Park World's boarding, waiting, ride or exit) restores only while it was still walking to the stand point, which is state 16 itself. A guest waiting, riding or leaving in that boarding is refused: it stands for Theme Park Inc's states 17, 20 or 19, whose chance roll, fee and mode the bridged boarding never saved, and the restore does not invent them. A Theme Park Inc park's litter holds the types 1 to 12 (Theme Park Inc's burst balloons are 9 to 12); a Theme Park World park's 1 to 8. When the switch is turned on by default (phase P4 of the guest port), Science saves made with it off will be refused by this rule; that refusal has to be documented here then.
Native walk switch. The hidden switch --tpi-native-walk (off by default) walks the guests and staff with Theme Park Inc's own navigator rules (TPI-NAVIGATOR.md). A Science save made with it on records it in the guest snapshot's optional member ThemeParkIncNativeWalk; a save made with it off does not write it, so it is unchanged and the schema stays. A save whose setting differs from the running game's is refused in both directions, as for the guest switch: a walk set up under one edge test cannot continue under the other (a staff member who stepped onto unowned land under Theme Park World's rules would be stranded under Theme Park Inc's). Only a Theme Park Inc park may carry the member. When the navigator port turns the switch on by default, Science saves made with it off will be refused by this rule; that refusal has to be documented here then.
Native walk records. With the switch on, the walk snapshot of every guest and Theme Park Inc staff member whose walk is native also carries the optional member NativeRecord: the navigator's 177-byte record (navigator phase NV2), the members the snapshot's own fields do not hold (mass, radius, the speed caps, the local axes, formation_pos, force, the five subpath distances, the whole progress history word). It is written for a walk to the walker's own point too (standing, riding), since the original keeps one navigator object. A restore refuses a record that disagrees with the walk's own fields, a guest record whose caps are not the guest's, and a record in a save made without the switch (the guests' restore, the resume file's validation and ParkEconomyRuntime.Load for the staff). A save made with the switch on before the record existed (navigator phase NV1) has no NativeRecord and still loads. That is safe because every member the record would add is either rewritten before anything reads it or never read: the speed caps by the speed step before the next walk step, the local axes by the next steering step, the subpath distances of the buffered waypoints rebuilt from the saved cells (a stale slot changes no result: follow_path subtracts the last buffered waypoint's slot just before the refill's set-up writes the sum again), the history bits above the 15-bit window never; mass, radius, formation_pos and force are constants or pass through to the next save. Such a walk joins the digest's native members from its next set-up or step.
Native stamp counter. With the switch on, the cell map's stamp counter counts every simulation call of the original's counter routine (navigator phase NV3, the user-approved label [EXT:tpi-stamp-counter-sim-only]), so it moves while no block is stamped. The layout then writes the counter even without block stamps, with the optional member SimulationStampCounter; a Theme Park World map and a Theme Park Inc map without the switch write neither, so their layout is unchanged. A save made with the switch on before NV3 holds the edit-only counter; it loads, and its stored walk stamps and stranded marks keep deciding as before, because every comparison is between values of distinct calls and the counter only grows.
Saving also writes the player file opentpw-tpi/users/1New Player/New Player.GMS (the career as the original's Global Master Save), and Load A Game takes the career from that file (TPI-CAREER.md). The player file lives in the opentpw-tpi folder of OpenTPW's own save folder (OPENTPW_SAVE_DIR when it is set, else the configuration's save folder). When that save folder is inside the game folder, which is where the original Theme Park Inc keeps its own save folder, the player file goes to <config>/save/opentpw-tpi/ in OpenTPW's configuration folder instead; the test applies to OPENTPW_SAVE_DIR too, and symbolic links in either path are resolved first. OpenTPW never writes into the original's save\users folder, where the original keeps its players' files. A player file larger than 4 MiB is refused unread. Leaving a park by quitting to the Personnel File saves as the original's leave does: the player file and, in Science, the Science slot, which the leave overwrites without asking. Nothing is saved when Continue saved park or Load layout — new session replaces the park, as the original saves nothing when a load replaces it (TPI-CAREER.md §3.4), and closing the window does not save.
OpenTPW validates the save and its assets before replacing the current park. Modes and state that the slice does not support remain unavailable. Apart from the player file, this does not import or write native Theme Park Inc saves (no native park files, no .GMI), save on a timer, enable sharing, or provide continuation in Arabian, Water or the browser.
The remainder of this document describes Theme Park World continuation saves.
OpenTPW saves parks in its own world-save format ("Format": "opentpw-world", version 1): one file holds the whole running park, and Load resumes it where it left off. This is separate from the original game's save format — original TPWS/TPWI files stay read-only imports (TPWS-PAYLOAD.md): nothing in the running game writes them (a library writer exists, OriginalParkExport, and no menu or command reaches it), and an own-format save is not an original-format save. What saves today is the fixed-ride Theme Park World park: paths, queues, placed objects with their scripts and animations, guests, staff, money and world state. The limits are listed below.
Saving#
Pause the game (Esc) and choose Save. The park is captured between simulation ticks; the game reports the save or the exact reason it failed, and play continues either way.
One slot per theme: the save is
save/opentpw-<theme>-world.json— for exampleopentpw-jungle-world.json. Saving again overwrites that theme's slot; each theme keeps its own park. The write is atomic (a complete temporary file is flushed and moved into place), so a failed write leaves the previous save untouched.Where the folder is: on the desktop,
savebeside the game'sDatafolder. When that folder is read-only (a mounted CD, for instance), saves go tosaveunder the settings folder (~/Library/Application Support/OpenTPWon macOS,~/.config/OpenTPWon Linux,%APPDATA%\OpenTPWon Windows; RUNNING.md) and the log says so.In the browser (play.opentpw.io) the same save is kept in the browser's storage (IndexedDB) and survives page and runtime reloads. Your original game files are not kept and nothing is uploaded: the next visit asks for the Theme Park World folder again (WEB.md), and the saved park is listed once you choose it.
Atomic I/O audit (2026-10-13)#
ParkResumeSaveFile.Save validates the snapshot, serializes the full JSON and checks its size before opening a file. It creates a unique sibling temporary file with CreateNew, records ownership only after opening succeeds, writes and flushes it to disk, closes it, and moves it over the destination. Failure cleanup deletes that exact owned temporary path; it does not search for other .tmp files.
ParkResumeAtomicIoTests uses synthetic snapshots and local temporary folders to check validation refusal, a regular file obstructing the parent path, a late move failure over an existing directory, a nonwritable Unix directory, repeated whole snapshot overwrites and preservation of foreign temporary files. These paths pass without production changes. The Windows case for a destination held without delete sharing is platform-specific and skipped on macOS; permission tests also skip when an elevated identity bypasses the tested directory permissions.
The audit covers ordinary local I/O failures, not abrupt power loss, disk-full or flush-failure injection, a concurrent directory/permission change that prevents cleanup, or crash recovery of interrupted temporary files. No original data or original-format save behavior is involved.
Periodic autosave#
[EXT:periodic-autosave] (user-approved 2026-10-18). A browser player lost a park to a crash because the only automatic save was the checkpoint of Exit To Lobby (AUTOMATIC-CHECKPOINT-INGRESS.md). OpenTPW now also saves a park in play on a timer, so a crash costs at most a few minutes.
What the original does. Checked statically in tp.exe (REA, 2026-10-18): the park-save writer
0x5AC610has four callers. The park state machine0x54E360calls it in state 0xB, and only when the game type is not the online visit (0x54E360case 0xB:if (DAT_00fb3b7c != 1) FUN_005ac610(&DAT_00877c60)); the main running state (0xA) reaches state 0xB only when the exit request wordDAT_00879088is 2 or 3 (the pause menu's Exit To Lobby and its relatives) or, in the online visit, when the chat session ends. The other three callers are the quick-save command0x40BF90(it logs "QuickSave_OK" or "Quicksave failed"),0x49E9B0, a save-screen action, and a menu callback at0x424BB0(code Ghidra has not defined as a function; it stores request 2 through0x5508B0and then saves at0x424BD7); none has a direct static caller (they run from the UI's callbacks and callback tables). No timer, frame counter or periodic call to the writer was found, so the original's per-themeautosave.TPWS(Mac evidence: ECONOMY.md, "Original flow that OpenTPW does not reproduce") is written when a park is left, not periodically. The file name itself is built from a buffer (0x877C60) filled at run time, so the PC name was not resolved statically. A timer reached through an indirect call, which the static callers do not list, cannot be ruled out from the executable alone; the periodic save is therefore an OpenTPW extension, not a reproduction.When it saves. After every 5 minutes of play time (
PeriodicAutosave.IntervalSeconds) in a park the player owns: a Theme Park World Full Simulation or Instant Action park of one of the four themes (the same eligibility as the Exit To Lobby checkpoint). It never runs in a read-only visit, the front end, the sandbox or a Theme Park Inc park. Play time is the real time of frames in which the park simulates: while the pause menu, the map window or a texture-pack download holds the park, or while the next park is being built, nothing counts, so a long pause delays the save rather than triggering one the moment play resumes; a frame of a suspended machine counts at most a quarter of a second. Changing the park (a new or resumed one) starts the count again.Refused captures are retried soon. The capture follows the manual save's rules and refusals (
Level.CaptureResumeSnapshot, the same validation against the catalogue, balance and assets). While the advisor is speaking the capture refuses (its speech has no snapshot seam), and so does a park with a staff member in hand or a hire being placed (the capture would cancel it, as the manual save does at the pause menu); the autosave tries again after 15 seconds, not after another 5 minutes, and logs the first refusal of a run once. After 8 refusals in a row (a park that can never be captured) it waits a full interval. A failed write is retried the same way, and the previous autosave stays.Where it saves.
save/opentpw-<theme>-autosave-world.json, its own slot per theme, in the same own format as every world save. It never touches the manualopentpw-<theme>-world.jsonor the Exit To Lobby checkpointopentpw-<theme>-automatic-world.json. The write is atomic like the manual save's (ParkResumeSaveFile.SaveBytes: a complete temporary file is flushed and moved over the slot), so a crash during the write leaves the previous autosave intact; a temporary file a dead process left behind is removed by the next write. Unlike the exit checkpoint, the autosave does not flush the ticket progress and does not retire the park.No hitch. The capture runs in one frame between two simulation ticks (it must see one consistent park), and takes 1.3 ms for a park of 1500 guests and 3.3 ms for the smoke's real park (measurements below); its closing validation, the JSON serialization and the file write are moved out of that frame. The snapshot is a detached copy of the park (every capture clones its mutable arrays), so
SlicedJsonSerializerwalks its top levels through the serializer's own contract metadata and serializes it in slices of 2 ms per frame, producing the same bytes as the manual save's serializer; the browser has no second thread, so the slices work everywhere. The file write runs on a worker thread on the desktop and inline in the browser, where/saveis an in-memory folder that the page mirrors to IndexedDB (WEB.md). The asset manifest, which hashes every simulation asset and would dominate a capture, is hashed once per park (the park start already does it for its restart snapshot) and kept; it is hashed again when the catalogue changes.No gameplay change. The capture draws from no random stream and changes nothing the simulation reads (
StaffPlacement.PrepareForSaveis the one capture step that does, so the autosave refuses instead of cancelling a tool in hand).PeriodicAutosaveTestscheck that the state hash, which covers every random stream, is the same after repeated captures, and that a captured snapshot serializes to the same bytes after the park has run on; the park-resume smoke does both on a real park. Determinism pins do not move.Recovery. When the player enters a theme, the continuation menu offers "Continue autosave" in place of "Continue automatic save" when the autosave is newer than the Exit To Lobby checkpoint and than the manual save (UI.md). Continuing reads and validates it like any resume.
Option. OpenTPW page of the options, "Autosave: On/Off" (
GameOptions.Autosave, on by default).
Measured (2026-10-18, Apple silicon, .NET 11 RC2, debug build, with other work running on the machine). A real jungle park of the park-resume smoke (14 guests, 0.85 to 0.92 MB, two runs): capture on the game thread 3.3 ms, then validation and serialization 9.4 to 9.8 ms over 4 frames (the longest 5.1 to 5.5 ms is the validation, which is one step), file write 4.8 to 6.5 ms on the worker; before the validation moved out of the capture, the capture alone took 7.8 to 8.7 ms. A synthetic fixture of two rides and a 30 x 30 path block, which makes the guests the whole cost (OPENTPW_AUTOSAVE_BENCH=<guests> dotnet test source/OpenTPW.Tests --filter MeasureCaptureSerializeAndWriteOfALargePark prints it): 1500 guests, a 2.7 MB save: capture 1.3 ms (median, 3.5 ms at worst), validation 4 ms, serialization 2 ms per frame over 4 frames, file write 6 ms on the worker. Serializing in one piece would have cost 8 to 20 ms for that park in one frame. At 60 Hz a frame is 16.7 ms. Browser (WebAssembly) timings are not measured here.
Loading#
Load (lobby or pause menu) lists your saved parks by name and theme above the shipped original saves. Loading resumes the saved park exactly: the same objects at the same cells with the same ids, guests in the same queues and rides with their routes and timers, the same money, loans, research, staff and prices, the same weather and clock, and the park open or closed as it was saved — the gameplay mode and start kind (Full Simulation, Instant Action, reference) come back with it, so an Instant Action park resumes under its saved balance layer and a closed park stays closed.
The save/weather roundtrip audit records synthetic file, clock and weather continuation coverage and the remaining asset-backed integration limits.
A save that does not validate is refused with its reason (a dialog in the UI), and the park or lobby you were in stays untouched — a rejected load never half-applies. Corrupt files, unknown or missing members, unsupported versions, inconsistent theme or balance values, and changed game assets are all refused this way before anything is replaced.
What the save holds#
| Part | Saved |
|---|---|
| Layout | every path, queue and placed object with its cell, rotation, attraction id and creation seed, plus the id allocators — a demolished object leaves its id hole, ids are never renumbered |
| Guests | every guest: needs, money, route and navigation buffers, the paid flag, the visitor number and the gate wait, queue/boarding/riding/walk-off/limbo/bounce state, and each attraction's queue cells and membership, and its entrance and exit cells as they stand (a placement resolves them once, the nearest walkable cell when nothing laid them, and a path laid nearer later does not move them; a save from before re-resolves them) |
| Thing pool | the park's one thing pool (Things, an optional part: the used list newest first with each thing's model, the head of the free list in its exact order, the destroy requests that wait and the placeholder slots of an imported original save; [EXT:resume-exact-thing-pool]), the objects' ThingId (layout) and the staff members' ThingId (economy), which every guest, object and member of the save must name as a slot of its own model; guest ids are slots from snapshot schema 8 on. A save from before the pool has none: its guests keep their counter ids as slots, and its objects and staff take the next free ones (docs/GUESTS.md, "Thing ids") |
| Ride scripts | the whole script world: every script's identity and graph position, program state, stacks, variables, timers and waits, RNG state, animation channels and rider head slots |
| Prototype ride | the developer Totem (the sandbox ride you place in a park): its position, open state, script seed and full runtime state — animator, head slots, cycle counters — with its economy association re-linked to the saved instance, never bought again; the entrance and exit cells its guests queue at are saved and restored verbatim (the placement's derivation is history: the live park keeps it across later path edits, so re-deriving from the saved paths would resume a different park) |
| Coasters | every live coaster station's track (station ends, pylons with height, pylon kind and stack, node flags), controller state (open, breakdown, speed, seats, money, clocks, whether the motion tick has run) and trains with every rider on board or leaving — joined by attraction id, a rider mid-hand-over (the script has seated it, the bridge has not marked it aboard yet) included; the curve, rating and braking are re-derived on load, so a loaded coaster continues exactly where it was; a track saved with the two-node station (before the three-node station of COAST-029) keeps its pylons on the station the placement builds, is sampled again and lets its riders leave, because the train placement of the new sampling is another one |
| Tracks | the kart/water track layer (every track cell with its mask, flow link, flags, parent, piece and segment), every water ride's controller (phase, state, laps, performance, tick clock, waiting and leaving guests, the sections for verification) with every boat (all integer fields, riders) joined by attraction id, and the cosmetic generator — on load each circuit is walked again and must reproduce the saved validity and sections; collision objects and buoys are rebuilt (TRACKS.md); absent for a park without a track |
| Economy | the full economy record (bank, loans, ledger, objects with price/level/repair/statistics, staff, research, challenges, golden tickets, RNG streams) and the exact attraction-to-economy-instance links, so two identical rides never swap their money |
| Staff locator order | StaffData.RoleOrder in the embedded economy: five independent arrays of member IDs, in StaffType order (handyman, mechanic, entertainer, guard, researcher), for presentation only; independent of the saved roster and global ThingPool order |
| Litter | every littered cell with its type and the claiming handyman (in the economy record); a save from before litter by cell had a park-wide count instead, which loads as a clean park (logged) |
| World | the fixed-step clock, the sound-event seed, weather with its pending thunder, the park gate, staff positions, and the advisor's pending advice and history when the park had them |
| Particles | the initialized particle pool's optional configuration, live emitters and effectors, generator, generation counters and free-list order, including empty pools (an optional presentation part, docs/PARTICLES.md): the particles themselves are not saved and screen-space emitters are killed on load, as in the original's PART/PTCL block; not part of the world hash |
| Header | theme, world seed, gameplay mode and start kind, park name, save date |
Staff locator order and compatibility#
ParkStaff owns the locator's independent role sequences. A fresh hire prepends to the matching role; firing removes only that member and preserves the survivors' order. The arrays contain roster member IDs, not ThingPool slot IDs. Employee-window arrows still follow the global pool, which is saved independently.
The optional StaffData.RoleOrder is additive in the existing economy/world formats. When present, it must contain exactly five non-null arrays in StaffType order, with every current member exactly once in the matching role and no invalid, duplicate, missing, unknown or wrong-role IDs. Validation covers the complete value before installation, with at most 10,239 current members (ThingPool.Capacity). Roster IDs may grow above that count; they are not pool slot IDs. Restore and capture use copies, so caller-owned arrays cannot mutate the live owner and captured arrays cannot alias it. Capture always writes the effective order, including empty roles.
Absent or null RoleOrder is the explicit older-save compatibility path: read matching live pool members in used-chain order, then unsupported members in reverse roster order. This projection remains read-only until a hire or fire materializes it. Opening/cycling the locator and capturing a save do not materialize it, reorder staff/pool data or consume RNG. Repeated AttachThings cannot replace an explicit or materialized order. The next capture records that effective projection, so loading the new save preserves it; it cannot recover an independent original role chain that the older save never retained.
Original TPWS import is separate from own-format validation. Each complete role chain is read from its saved world head and staff RoleNextId (+0x210), mapped from ThingIds to imported member IDs, and checked against all imported members of that role before being installed. A cycle, wrong-role or missing link, out-of-bounds ID, or orphaned member produces precise per-role import evidence and replaces the entire malformed role with its saved-global-order projection. A valid prefix is never partially installed; other valid roles keep their exact independent chains. The fallback is an explicit robustness policy, not evidence that global pool order equals role order. Existing file-layer rejection of a nonzero invalid role head is unchanged. A roster above the supported capacity remains unsupported; the fallback does not expand that limit.
RoleOrder is saved presentation state and is the only new nested staff property excluded from the canonical hash. Training budgets, HaveEverTrained, members and all other gameplay fields remain hashed. Synthetic coverage is in StaffRoleOrderTests and LocatorStaffRoleOrderTests; local C# execution is unavailable without the dotnet SDK and awaits exact-head CI.
Limits#
The prototype ride is saved as what it is. The developer Totem (the sandbox ride) saves and resumes like any attraction — its script mid-instruction, guests queuing, aboard or mid-boarding — but the part describes exactly the Inca Totem; any other entry in that slot is refused rather than accepted as opaque state. Player-built coasters are saved too (see above). The original
TPWSimport stays partial and read-only (TPWS-PAYLOAD.md).Transient sounds are not saved. No voice, chain, music or other audio state persists through a save. A ride that holds a scream is saved as its script holds it: the handle, its STARTSCREAM and SCREAMLEVEL operands, and the count of handles that refused starts lost. These are the same with or without audio. The held scream plays again once the loaded park's audio runs (AUDIO.md, "Held screams in a park save"); the chain of a lost handle does not. The pause menu's Save does not wait for advice being spoken: the speech goes on, it is not saved, and a loaded park starts silent. A park cannot be saved while a placed object owns a live flag-
0x8looping EVENT or repair-hide voice. This remains a live-audio persistence limitation: stop the owning object/sound before saving; one-shots, finished loop voices and headless/stopped owners do not trigger it.The camera and menu focus are not saved; the view and interface start fresh after a load.
Older saves keep their old cell types. The cell map is saved as it was. A save made before the cells were typed as tp.exe types them (no terrain, water, fixed walkway and the cell flags 0x80 and 0x400 at level start, and the 4/9/10 footprint types of placed objects;
ParkCellMap.MapStartCell,WriteFootprint) resumes with every such cell still empty (type 0). The load does not type them again, because that would change a newer save's cell map version and the caches keyed on it; the census, the litter counts and the park value of such a park count those cells as empty ground.Imported queues are restored once. A Jungle park saved before the import kept the shipped save's queue cells has empty ground where the Belly Bounce's queue lies; the load lays those cells again from the level's shipped save (
[EXT:legacy-save-queue-cells], user-approved 2026-10-20, GUESTS.md). It changes such a save's cell map once; a newer save, or one whose queue the player removed, is not touched. A save older than the access-link fix of 2026-10-17 is not repaired: its entrance cell has its queue link but no link byte, which is also the state of a newer save whose queue the player removed, so the load cannot tell them apart and leaves the ride as the save holds it (no heuristic guesses which it was).The analyser's caches are saved outside the run hash. The net worth and the litter/path block counts are cached with their turn stamps as the original's analyser keeps them; an older save without them counts afresh at the first read.
The statistics history is left out only when it is a fresh park's. The economy record omits
StatisticsHistoryonly when every ring has no entry and every slot word is +0 (bit for bit, so a -0 counts as data), the arrivals counter is zero and the ledger has no month. An imported original analyser that has run no month still keeps its saved slot words (Theme Park Inc's prebuilt Science analyser holds the0xCDCDCDCDfill), so its history is written; a restore without it would put zeros in their place. A save written before this rule from such a park lacks the block and loads with a fresh history, as before.The save is pinned to the game data it was made with. It carries a SHA-256 manifest of the simulation assets (the theme's object, balance and terrain files; see below). Load it with the same game files: when a simulation asset changed — another edition, modified data — loading is refused naming that asset, before your current park is touched. Textures, sounds, music and texture packs are not pinned; changing them does not invalidate a park.
The file#
JSON with "Format": "opentpw-world" and "Version": 1, capped at 64 MiB, written with its own suffix only (.json or .otpw). Parsing is strict — unknown members and inconsistent values are rejected — and TPWS/TPWI paths are refused outright, so an original save is never read or written as a world save. The economy part is the economy-only save of ECONOMY.md embedded by value, so both formats' validators run on every load.
Developer notes#
API.
Level.CaptureResumeSnapshotcaptures between ticks (refusing a placed object's live looping EVENT or repair-hide voice, and advice being spoken unless the pause menu's Save asks);ParkResumeSaveFile.Save/Loaddo the atomic, size-capped, suffix-checked file I/O;GameFlow.SaveCurrentPark(the pause menu's Save) andGameFlow.ResumePark(Load) wire it into the UI. The developer Totem rides along as the envelope's optional prototype part (PrototypeRideSave), joined by attraction id exactly like a placed object — the version stays 1, so saves from before the part (parks without the Totem) load unchanged.Loading is a transaction.
ParkResumeSaveFile.ValidateSnapshotvalidates purely against the freshly loaded catalog, balance settings and asset manifest; the park is then rebuilt into an isolated candidate (runtimes, the prototype Totem, script world, queue geometry, guests, clock, the coasters, then the optional weather/gate/staff/advisor parts, with reference graphs restored in two passes), and only a complete candidate replaces the live park. Every failure path keeps the current park running. Ids, iteration order and next-id allocators are restored exactly as saved: nothing is renumbered or re-registered, no construction fee is charged again, and no default fixed item appears twice.Validation layers. The pure shape check (identity, order, allocator agreement, bounds, cross-references — run before a byte is written and again on load), the park check (theme, balance layer, mode/start-kind pinning, catalog, economy bindings, the coaster part against the live coaster stations, asset manifest), and the destination modules' own validators during candidate construction.
Asset manifest. SHA-256 over the decompressed content of every
.sam,.rseand.MD2member of the theme's object catalog (bonus objects included), the category default settings, the balance layers (Standard.samglobal and theme,Easy_Standard.samin easy mode,Challenges.sam, the theme'sglobal.sam), the advisor settings and the theme's terrainbase.map/base.MD2. Presentation (textures, sounds, music, fonts, strings) and texture packs are out of scope by design. Keys are canonical identifiers; the loader hashes only files the trusted catalog names, never a path stored in the save.Legacy economy-only save.
ParkSaveFile("opentpw-park", version 2; ECONOMY.md "Save format", DETERMINISM.md "Park save") is unchanged: it holds the economy and the RNG streams, not the world, and does not save the start kind. The world envelope embeds its record by value. Older notes saying "the park save" keeps guests and scripts running describe that legacy file.Smoke hook (development builds from source): the two-phase native verification runs with
bash scripts/run.sh --game-path '/path/to/Theme Park World' --mute --no-advisor \ --park-resume-smoke capture --park-resume-file park.otpw --park-resume-evidence evidence/ bash scripts/run.sh --game-path '/path/to/Theme Park World' --mute --no-advisor \ --park-resume-smoke restore --park-resume-file park.otpw --park-resume-evidence evidence/The capture phase builds a seeded Jungle park (the same ride placed twice at rotations 0 and 180 with edited queues, two identical shops at different prices, a toilet, a demolished object leaving an id hole, two staff and fourteen guests), saves it through the pause menu's own save handler and continues the live park. The restore phase — a cold second process — requires the save's bytes to survive, rejects seven corrupted candidates (guest/queue/attraction references, a doctored asset manifest, a runtime script-identity mismatch, an unsupported version and a malformed menu entry) with the live park intact each time, then resumes and compares every typed section hash and the composite world hash against the capture run at each checkpoint, finishing with post-load economy checks (admission booked once, a sale credited once with its links removed, a new placement, wages charged once, payment bindings one-to-one). The capture phase continues one tick a frame and makes the continuation's edits between frames as the HUD does (the speed raised and set back, the first attraction closed and reopened, the entrance fee); the restore phase continues through the level's own frame step in seeded random frames of 1 to 16 ticks (
OPENTPW_SMOKE_BATCHING:randomby default, or1or16) with the same edits replayed inside its frames, so the pair also proves with game data that the park after a tick does not depend on how the ticks fall into frames (DETERMINISM.md, "Frame batching"). The continuation's clock section leaves out the clock's remainder of a tick, which follows the frames' time. The evidence JSON holds hashes and counters; the directory also contains the own-format save and screenshot readbacks, without original game files. These are controlled, accelerated fixtures that validate persistence of current OpenTPW behaviour, not original-game fidelity.Smoke hook, prototype variant (same command with
OPENTPW_SMOKE_PROTOTYPE=1exported for both phases): the fixture also places the developer Totem beside the path spine, so the pair proves the prototype part natively — the save written through the HUD handler carries the Totem, the cold resume rebuilds it with its saved guest cells and re-links its saved economy instance (never buying again), the Totem's own corrupt candidates (the part dropped, its guest cells moved off the map) are rejected like the rest, and the post-load checks remove the resumed Totem to see its instance sold exactly once when the live park had bought it (deregistered when it had not).
Verified in October 2026 development builds: the native capture/restore pair above passed as two separate processes on real Metal with identical section hashes throughout the continuation; the browser build saved from the real pause menu, kept the park across a page and WebAssembly reload with the game folder chosen again, and resumed with identical save bytes, stable ids, visitors and income still arriving; an invalid-version save and a late script-identity failure were both rejected with the running park's state unchanged. The browser also re-saved and reloaded the richer park with eight placed objects, fourteen visitors, two staff and two same-type shops priced at $60/$120. The save bytes, object/guest/staff ids, prices and closed-park state survived the page and WebAssembly restart. The 600-tick equality check above was performed in the native processes.
Continuing a theme from the lobby#
The explicit Continue choice described in UI.md reuses the existing manual own-world slot and staged resume. It does not create an automatic save, rewrite a manual checkpoint, change saved game mode or resume a TPI layout checkpoint. The automatic entry next to it reads the Exit To Lobby checkpoint or, after a crash, the newer periodic autosave, through the same staged resume. New Park remains a distinct action. A readable matching save makes Continue available; trusted game-asset and full candidate validation still happen on activation, and failures preserve the existing world instead of falling back to New.
New live-world mechanic dispatch may persist AwaitingJobArrival in the embedded own economy staff record. It is omitted when false; old missing fields retain already-started countdowns. A true phase requires a mechanic with positive work, matching assigned ride and reciprocal owner. Capture validation refuses invalid pending jobs before an owned save write, and load validates them again. Existing staff actor position/fraction supports mid-travel resume; no world binding means pending work waits rather than becoming a headless repair. The binding is rebuilt by the Level staff setup. This is an additive own-format phase, not a native staff field or a save-format version change; canonical gameplay hash schema14 includes it.
Restart snapshot persistence#
Each owned park start/load captures its restart point once, before play advances. Capture, asset hashing and validation stay on the game thread. The detached JSON is serialized in soft 2 ms slices. Desktop completion copies the immutable buffer, hashes it and performs the atomic writes on a worker; immediate Restart, park replacement and orderly shutdown wait for that job. The browser copies and hashes at most 64 KiB per copy/hash step, then writes into its in-memory filesystem. Allocation, an individual serializer step and the final browser write can still exceed the soft budget; this is not a hard frame-time bound.
opentpw-<theme>-restart.json.pending.json is an internal recovery marker, not a park save. It initially contains "pending"; before replacement it contains the completed JSON's SHA256. The previous restart JSON is retained during this work but is not accepted as the new park's restart point. A process interrupted before replacement leaves the prior file retained and unavailable through Restart; an interruption after replacement but before marker cleanup can recover the new file if its hash matches. A file with no marker keeps the existing format compatibility. The initial marker and target-digest marker retain the same flushed temporary-file/atomic-rename protocol as the snapshot; no durability barrier is removed. On failure, Instant Action can start a new park, while other modes display the load-failed message. The browser's durability boundary is its transactional IndexedDB mirror, described in WEB.md.
Source: docs/PARK-SAVES.md in the project repository.