Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Save-game containers

SAVEGAME.SAV and per-map .TSG files store saved engine state in tagged chunks.

Overall Structure

[SVGM — save metadata]
[Image and state chunks — length-prefixed payloads]
[END — four-byte terminator]

Chunk lengths are big-endian. Numeric fields within the SVGM payload are little-endian. Chunks have no alignment padding.

OffsetSizeTypeEndianNameDescription
0x004[u8; 4]—nameFour-byte chunk identifier.
0x044u32BEdata_lengthPayload size, excluding the eight-byte header.
0x08data_length[u8]—dataChunk payload.

The terminal identifier is END , including its trailing space. It has no length field or payload. An empty chunk still has an eight-byte header with a zero length.

SVGM metadata

Version 1.31 uses a 272-byte metadata payload. Offsets below are relative to the payload, after the chunk header.

OffsetSizeTypeEndianNameDescription
0x004[u8; 4]—versionSave-format version text, 1.31.
0x044u32LEunknown_04Engine compatibility value.
0x084u32LEunknown_08Engine compatibility value.
0x0C128[u8; 128]—descriptionSlot display text, ending at the first NUL or the field boundary.
0x8C4u32LEworld_idCurrent world identifier, corresponding to WORLD.INI.
0x90128[u8; 128]—bitmap_filenameStored bitmap filename, ending at the first NUL or the field boundary.

The engine checks the version and compatibility values before restoring a save. An incompatible format version prevents state restoration. A mismatch in the two compatibility values displays a warning but does not prevent state restoration when the format version matches. The stored bitmap filename is separate from the THMB thumbnail and SCR3 screen-image chunks.

Saved images

SCR3 stores a 640 by 480 screen image and THMB stores a 256 by 192 book preview. Each pixel occupies one little-endian RGB565 framebuffer word: red is in bits 11 through 15, green in bits 5 through 10, and blue in bits 0 through 4. Consecutive pixels form rows from the upper-left origin. Neither payload has an image header or an embedded palette. Their nonempty payload sizes are 614400 and 98304 bytes, respectively. Empty image chunks contain no image.

The screen and preview capture routines sample the framebuffer independently. Each computes single-precision horizontal and vertical source-to-output ratios. For output pixel (x, y), it truncates the scaled source coordinates toward zero and copies that source pixel’s two bytes. It does not average neighbouring pixels. The preview samples the source framebuffer directly, rather than a previously reduced screen image. Book entry captures the screen before the preview and before book rendering; startup and ending entries omit the preview capture. Quick Save also refreshes the screen before the preview.

The book Load path displays SCR3 behind its progress bar instead of selecting the destination world’s loading artwork. The metadata bitmap filename does not supply this screen.

The book Load handler disables destination artwork selection before starting the saved-game restoration. That route configures progress over the saved screen without drawing from the shared random stream for a loading image. The retained world-artwork frame index is not a new selection when this policy is disabled.

The ordinary world-artwork route opens the configured GXA. A one-frame image selects frame zero without consuming shared randomness. An image with multiple frames consumes one value from the shared engine random stream through the bounded selector, then stores the selected frame index. This selection belongs to opening that loading presentation, rather than each progress update. Sky opening has its own independent random-direction selection.

State chunks

Save containers include global state and per-world state. Object and script records depend on the corresponding RGM scene and runtime definitions. They are not replacement scene assets.

The world loader constructs object, rope and code owners before applying their saved records. The SMOB, SMRP and SMCO readers consume the number of records established by that initialized world, rather than deriving a count from the chunk length. SMSH includes a count, which must match the initialized shell count.

Each SMCO record starts with a four-byte little-endian code-object identifier followed by a 204-byte packed runtime body. The reader resolves that identifier against the initialized code owners. Nonzero saved script references are offsets rebased against the loaded world’s code and native-hook bases. Live list links and the code owner’s runtime-only pointer are retained instead of accepting the saved pointer values. Matching a world number alone therefore does not supply the owners and script bases needed to interpret these records.

SMOB, SMRP, SMCO, and SMSH hold object, rope, code, and shell state, respectively. SVCM holds camera records, and SMFM holds family references. Other state chunks include SVGF, SMGR, SVRG, SVGV, SVG2, SVIT, SVCB, SVMV, and SVMD.

Temporary .TSG snapshots use the same container and metadata layout. Their image chunks can be empty. The engine can restore these snapshots during a world reload after initializing the player.

Camera records

SVCM is 1016 bytes: a little-endian u32 record count of nine, nine 112-byte records, and a little-endian u32 selected-record slot. The final slot identifies the selected record, independently of the camera’s separate selected-index word.

All numeric record fields are little-endian.

OffsetSizeTypeNameDescription
0x0012[i32; 3]position_offsetCamera offset.
0x0c12[i32; 3]angle_offsetCamera angle offset.
0x1812[i32; 3]requestRequested position or displacement.
0x2424[[i32; 3]; 2]basisRetained camera basis vectors.
0x3c4u32position_referenceRuntime pointer, reconstructed during load.
0x4012[i32; 3]bound_position_historyRetained bound position.
0x4c4u32angle_referenceRuntime pointer, reconstructed during load.
0x504i32ownerSaved actor identity; zero and minus one resolve to no actor.
0x5412[i32; 3]target_offsetTarget offset.
0x604i32distanceDistance before candidate-stage Q8 conversion.
0x644i32minimum_distanceMinimum distance.
0x684u32flagsCamera stages consume the low-byte flags.
0x6c4u32maximum_movementMovement limit.

The loader resolves each owner against the initialized actors. For a resolved owner, it reconstructs the position and angle references using that actor’s local position and local angles, and retains the initialized slot’s angle offset instead of the saved angle offset. Every other record byte is copied from the save. The selected record must have a resolved owner.

The chunk does not contain the published logical pose, render pose, glide marks, or separate selected-index word. The saved runtime pointer words do not provide portable references to these values.

SVGV retains the previous position at 0x17c, current position at 0x18c, current angles at 0x198, previous angles at 0x1a4, two transformed basis vectors at 0x1b0 and 0x1bc, scripted-camera active word at 0x22e, nesting count at 0x230, and selected-index word at 0x24e. Vectors contain three signed 32-bit components; the active word is 16 bits and the nesting count is 32 bits. The render position at 0x5fa contains three rounded signed map-unit coordinates. The reader converts these coordinates to renderer floats.

After restoring the chunks, the session loader selects the record identified by the low byte of the saved selected-index word, replacing the temporary SVCM selection. It replaces that record’s flags with the sign-extended 16-bit word at SVG2 offset 0x08, clears the transition and screen-shake state, and marks the next presentation as a cut. That first presentation copies the published pose instead of interpolating from earlier renderer angles.

Object-record framing

SMOB concatenates variable-length records. Each record begins with the following header; numeric fields are little-endian. The length excludes its own four-byte field. The next record therefore starts 4 + record_length bytes after the current record’s start.

OffsetSizeTypeNameDescription
0x004u32record_lengthBytes remaining in this record, including its identity header and payload.
0x044i32object_idObject identity; -2 and -3 select the two player objects, and zero creates an object.
0x084u32rope_idRope identity used to reconstruct the actor’s attachment.
0x0C1u8record_kindRecord-kind discriminator used by the restore path.
0x0Dvariable[u8]payloadPacked object state and conditional trailing records.

The full object restore reads a 783-byte packed object body before its conditional trailing records. The body is not the complete record: additional state includes an optional script-state body of 422 bytes, attachment node and motion words, and other object-owned data. The reader seeks to the recorded end after applying the supported fields. Record framing alone does not resolve the saved references or establish a restorable actor.

Conditional object tails

The full object body is followed by these fields in order. Presence offsets refer to the 783-byte body, not the record header. Unnamed blocks remain opaque.

Presence conditionSizeContents
Byte 0xC1 equals one1 or 10Presence byte, then nine name bytes when nonzero.
Word 0x272 nonzero256Actor attributes.
Word 0x23F nonzero41Retained script light controls, strength and modulation.
Word 0x243 nonzero20Retained flat sprite controls and playback, with regenerated texture binding.
Word 0x247 nonzero37Mutable animation header; installed animation allocation is retained.
Word 0x23B differs from 0xFFFFFFFF422Script state. Zero is a present identity. The loader additionally requires the initialized script allocation.
Record rope identity nonzero8Attachment node and motion words.
Always48Saved vector blocks of 36 and 12 bytes.
Word 0x21 equals one60Retained block with an object identity in its first word.
Word 0x1C nonzero4 × byte at 0x20Private variable array.

Position occupies three signed little-endian 24.8 words at body offsets 0xCB, 0xCF, and 0xD3. The retained orientation occupies three signed little-endian words at 0x120, 0x124, and 0x128: pitch, heading and roll. Angles wrap modulo 2048; heading is the middle word. The saved object references at offsets zero, four, eight, twelve, and 0x1D4 are object identities. The unsigned two-byte field at 0x14 is the initialized runtime actor identity. Ordinary actor records bind to initialized actors by that identity; the special player record identities remain distinct. The signed word at 0x1D4 names the supporting actor’s SMOB record identity, or minus one when no actor supports the object. Support replacement resolves the complete saved owner population before writing the identity, preserving every unrelated controller, reference and tail byte. A null reference is distinct from runtime actor identity zero. The support record carries its own world position and orientation; these are not offsets from the supported player. The 422-byte script state starts with a separate installed actor identity followed by two object identities. Its other fields include runtime bindings retained from the initialized owner. Uninterpreted fields and trailing extensions must remain intact during a lossless edit; they are not portable native pointers.

Pending animation request

The optional animation header stores the pending group as a signed little-endian word at header offset two and its retained speed byte at offset four. Minus one means no pending group. The speed byte remains independent when the pending group is cleared. It contains the accepted group speed plus the request modifier with byte wrapping. Replacing this request does not advance playback or alter its selected group, pose, command cursor, sound handle or other retained fields. Installed group membership is a receiver binding requirement, separate from packed record framing. See ordinary requests.

Retained actor spatial and controller state

Full object restoration copies the saved local, attached, previous and initial position and angle triples independently. Angles retain signed word values; reading the save does not wrap them or rebuild a transform. The stable-position validity byte and its stored Q8 coordinates are independent fields. A zero validity byte disables recovery without erasing those coordinates; any nonzero byte enables it. The separate water-rollback position is retained independently of the update-entry and stable positions. An ordinary update replaces it when the surface is not water or falling is active; otherwise it stays unchanged. See actor history properties.

The embedded model-instance translation and orientation matrix are retained single-precision values. They have a separate lifetime from logical position and angles. Translation uses map units; it must not be replaced by the current Q8 coordinates divided by 256. The saved matrix must not be regenerated from the current angle triple. The redundant trailing vector blocks remain part of the lossless record.

Spatial histories and the embedded model transform can be replaced independently of controller state, references, execution words and conditional tails. The stable position view must agree with the validity byte and stored coordinates. Replacing logical pose does not derive or refresh the retained model transform.

The actor’s property-backed controller state is retained with the body, including the movement counter, pending and accepted action words, motion and AI selectors, timers, hand/ledge vectors, collision marks and stable recovery state. The extinguished-torch timer is retained independently of the burning counter: dousing saves the counter and clears burning; lighting uses the saved counter, initializing it from the item configuration only when it is zero. Loading these values does not request an animation, enter a motion or invoke a native callback. Script writes can leave values outside the ordinary engine-produced ranges; semantic views preserve their stored widths.

SaveObject::replace_controller replaces the complete controller view after validating saved/runtime identity and conditional allocation framing. It preserves raw masks and signed words without normalizing motion or AI values. The controller Anchor and script-continuation Anchor name the same stored byte; consumers combining independent views must reconcile that shared value. Spatial history, model transforms, references, other execution fields and optional tails remain unchanged.

Parent, linked and supporting actors and the optional position-link owner use saved object identities. Minus one denotes no owner. A consumer binds these against its independently initialized actor allocations, preserving special player identities separately from runtime identity words. Missing, ambiguous or mismatched owners invalidate the complete binding population before native state is replaced. The optional position-link record retains its allocation even after its owner is cleared. Its signed owner word is followed by the Q8 offset triple, cached position triple and previous cached position triple. Detachment clears only the owner. The allocation, stored offset, both caches and remaining allocation bytes are retained. An owner identity replacement does not refresh either cache or derive a new offset. The owner and three triples occupy the first forty bytes of the sixty-byte allocation. Replacing these represented values preserves the remaining twenty bytes. Detachment does not remove this allocation, and attaching an already allocated record does not require new storage.

Selected and previous model frames

The actor body retains five signed little-endian two-byte fields separately from its optional animation header:

OffsetField
0x24FSelected model-frame index.
0x251Selected runtime model handle.
0x253Previous model-frame index.
0x255Previous runtime model handle.
0x257Stored default animation group.

Full object load copies these fields unchanged. A minus-one model handle means no selected model; the accompanying frame word can be stale. Positive handles bind to the initialized world’s model allocations, including distinct texture variants. They are not file-frame references. See save-load pose ownership.

Shell state

SMSH starts with a little-endian four-byte shell count. Each shell has a 186-byte body followed by a private variable array of four-byte words. The body’s word at 0x28 gives the array count. The first eight bytes identify the installed shell by name. Restoration clears the live shell list, constructs each saved shell from its installed named definition, and retains that fresh shell’s runtime binding and variable storage while copying saved state. The saved shell count must agree with the world’s retained shell count before reconstruction.

Code and shell script references remain offsets in saved data. Nonzero native hook references are rebased against the world’s native-hook base; nonzero script references are rebased against its script base. These offsets do not identify instructions in a different interpreter without an explicit mapping.

Global flags

The SVGF payload stores the flag values and state bytes in installed global flag order. Its payload length is 4 + 5 × count. Numeric fields are little-endian.

OffsetSizeTypeNameDescription
04u32countNumber of global flags.
44 × count[i32; count]valuesCurrent global flag values.
4 + 4 × countcount[u8; count]statesNative flag kind and latch state.

General state and clock

Version 1.31 uses a 1,542-byte SVGV payload. It concatenates the retained global fields without alignment padding. The clock fields below are four-byte little-endian words. Offsets are relative to the payload.

OffsetSizeTypeNameDescription
0x0944u32measurement_baselineLast FPS measurement baseline in BIOS ticks.
0x0984i32measurement_remainderBIOS ticks retained toward the next measurement window.
0x09C4u32measured_fpsMeasured frame rate.
0x0A04u32next_scaleNext movement scale, with eight fractional bits.
0x0A44u32nominal_incrementLast computed whole nominal-tick increment.
0x0A84u32fine_incrementLast computed finer-clock increment; eight units per nominal tick.
0x0AC4u32warmupRemaining startup invocations.
0x0B44u32bios_sampleLast sampled BIOS tick.
0x0B84u32measurement_framesFrames counted toward the next FPS measurement.
0x0C04u32smoothed_fpsRetained smoothed frame rate.
0x0C44u32frame_scaleCurrently exposed movement scale, with eight fractional bits.
0x0C84u32exposed_nominal_ticksCurrently exposed whole nominal-tick increment.
0x0CC4u32nominal_totalWhole nominal-tick accumulator.
0x0D04u32nominal_scaled_totalNominal-tick accumulator with eight fractional bits.
0x0D44u32nominal_scaled_incrementLast change in the scaled nominal accumulator.
0x0D84u32exposed_fine_ticksCurrently exposed finer-clock increment; eight units per nominal tick.
0x0DC4u32fine_totalWhole finer-clock accumulator.
0x0E04u32fine_scaled_totalFine-tick accumulator with five fractional bits.
0x0E44u32fine_scaled_incrementLast change in the scaled fine accumulator.
0x0E84u32min_frame_rateRetained minimum FPS setting.
0x0EC4u32max_frame_rateRetained maximum FPS setting.
0x0F04u32use_smooth_fpsRetained smoothed-FPS selection switch.
0x0F44u32use_smooth_divisorRetained movement-scale smoothing switch.
0x0F84u32normal_rate_scaledRetained normal frame rate multiplied by 256.

The global clock fields are restored before the saved actor lists are reconstructed. Observing saved clock values alone therefore does not establish that actor restoration has completed.

The two scaled totals advance by next_scale; their low eight and five bits retain the fractional remainders. Exposed timing can differ from the last computed timing. Save restoration copies these fields directly, then captures the partial clock checkpoint used during subsequent resource preparation. The saved clock therefore includes fields omitted by a menu checkpoint, including smoothed FPS, the measurement remainder and startup countdown. It also retains the FPS settings rather than storing only their derived scale. See FPS-derived frame scale for measurement and checkpoint behavior. Other SVGV fields are retained state and must be preserved when editing a save.

Rope jump latch

The selected player’s rope jump latch is a four-byte little-endian word at SVGV payload offset 0x06C. The global-state writer stores the latch directly, and the global-state reader copies the saved word back before restoring the per-world object and rope records. It is separate from the SMRP rope records. See rope control while attached for its input behavior.

SMOB restores an actor’s rope attachment by resolving the saved rope identity and constructing a fresh attachment. The actor receives that fresh pointer; the saved attachment pointer is not reused. The saved attachment node and motion word are then restored into the fresh attachment.

When restoring SMRP, the rope’s list references are resolved by rope identity. The current link-array and end-model pointers are retained. If the selected player has an attachment, the rope’s current attachment-list head is retained as well. If the selected player has no attachment, the current head is freed and the restored head is null. The rope jump latch is restored through SVGV independently of these attachment pointers.

Actor combat restoration

The optional 422-byte allocation framed as script_state by the lossless parser is the actor’s combat record. SOUP continuation, task words and authored locals have separate storage in the object body and SVRG.

Combat allocations are constructed from installed model and attribute data before saved combat state is applied. Loading retains the initialized model bindings, taunt-list storage, nine attack bindings and four defence bindings. It resolves the next combat-list reference by allocation index and the owner and target references by actor identity. The saved RTX-cache pointer is cleared, and flag 0x40 is cleared. Other dynamic combat values are copied.

The first retained selector addresses the nine installed attack bindings; the second addresses the four installed defence bindings. Current attack collision and motion queries use the first selector together with the current motion selector. The two selectors are independent: a populated first selector and an absent second selector describe an attack without a pending defence. Executor state one advances the nine-binding motion sequence; state two advances the four-binding sequence. Loading preserves these selector values and executor state rather than deriving them from the animation group or action selector.

All offsets below are relative to the combat allocation. Integer words are little-endian.

OffsetTypeMeaning
0x00u32Next combat allocation index; all-ones means absent.
0x04, 0x08i32Owner and target actor identities.
0x0Ci32Retained allocation index.
0x28[i32; 3]Retained target position in Q8 units.
0x38i32Combat action selector.
0x3C[i32; 3]Near, far and midpoint spacing ranges.
0x48, 0x4Ci32Attack and defence selectors.
0x58, 0x5Ci32Strength and armour.
0x60, 0x62i16, i32Contact vertex and Q8 radius.
0x139i32Aggression budget.
0x13Di32Death-default animation group.
0x141i32Consecutive close-distance decision passes.
0x145i32Attacker coordination selection state.
0x14Di32Attack/defence executor state.
0x151i32Current move-table selector.
0x159u32Combat cooldown.
0x161, 0x165, 0x169i32Attack pacing, defence pacing and defence counter.
0x179, 0x17Di32Taunt activity and dialogue-slot identity.
0x181u32RTX-cache pointer, cleared on load.
0x185, 0x189i32Taunt and spacing periods.
0x18Du8Combat flags.
0x18E, 0x192, 0x196i32, u32, i32Wall-avoidance side, mask and hold ticks.
0x19A, 0x19Ei32Lost-sight ticks and routed-pursuit flag.

Actor light and flat records

The optional 41-byte light record stores lock, enable and inactive-tick bytes at 0–2; three signed 16-bit offsets at 3; starting and current intensity at 9 and 11; starting and current radius at 13 and 15; three 16-bit flicker words at 17; three size-effect words at 23; current signed RGB strengths at 29; and starting signed RGB strengths at 35. Each modulation triple holds amplitude, phase and period. Loading copies these values without calling a light native.

The optional 20-byte flat sprite record stores enable and inactive-tick bytes at 0 and 1; three 16-bit offsets at 2; a texture identifier at 8; a native bitmap-cache slot at 10; last-frame, counter and current-frame words at 12, 14 and 16; and animation bytes at 18 and 19. Loading regenerates the cache slot from the saved texture identifier while retaining the playback words.

World spatial and family tables

SMGR starts with a little-endian u32 list count. Each entry contains a little-endian u32 spatial-list identity followed by a signed i32 actor identity for the first serialized actor in that list. The entries are followed by 16,384 little-endian u16 cell-to-list identities, occupying 32,768 bytes. Zero cells denote no list. The writer omits leading actors whose runtime identity is zero when choosing the saved head. It can clear cells belonging to an empty object-only list in the serialized copy without changing the live grid.

Full object load rebuilds ordinary spatial membership rather than retaining the serialized cell-list links. For each restored object whose runtime update exclusion byte is zero, it clears both list links and the cell-list identity, then prepends the object to its restored position cell. Objects are processed in SMOB record order. An attached object uses its restored attached position for this insertion while retaining its local position. A bound position-link cache takes precedence over that position during cell insertion. Consequently, actors restored into the same cell appear in reverse SMOB record order. Regional selection subsequently visits those cells in row-major order.

SMFM contains 256 consecutive 28-byte family slots. Each slot contains a signed little-endian actor identity followed by its accumulated group position in Q8 map units and accumulated group angles. Each vector has three signed little-endian 32-bit components. All vector words are copied on load, including vectors in slots with no actor. Actor identities zero and minus one resolve to no actor; minus two and minus three select the two player owners. Other identities resolve against initialized actors. These tables are independent of each actor’s linked-position record. Family updates overwrite entries for masters they visit; absent entries retain their vectors. FixSlaveAngle reads the retained group-angle entry directly, including a slot with no actor.

SMRP consists of 142-byte records: a four-byte rope identity followed by a 138-byte body. The first three words of the body are rope list references, resolved by rope identity. The saved body also contains pointer fields that must be replaced with initialized runtime owners as described under rope jump latch. The retained oscillator fields are current amplitude at body offset 0x56, phase at 0x6A, link step at 0x66, pending push at 0x62, direction byte at 0x38, and preceding link-step sum at 0x5E. All except direction are signed 32-bit little-endian words. Restoring the body copies these values without advancing the oscillator or invoking the amplitude service.

Actor navigation restoration

The object body retains the actor’s current walk-map identity and four signed node indices. The save writer replaces the live map pointer with the map’s runtime identity; all-ones means no map, and zero is a valid map identity. The reader resolves that identity against the initialized walk-map list before copying the object body. An unknown identity is an error. It does not choose a nearest map or node from the restored position.

Object-body offsetTypeMeaning
0x1E9u32Walk-map identity, or all-ones for no map.
0x1EDi32Held current node.
0x1F1i32Held next node.
0x1F5i32Previous-next node history.
0x1F9i32Final destination node.

The node indices are copied from the saved body, including minus-one sentinels and stale values. They are not replaced by initialized placement navigation. The navigation core performs its ordinary map/index validation when it runs. These fields are independent of the optional script-state allocation and of each task slot’s four native invocation words.

After full save restoration, the main load path clears every walk-node reservation byte. It does not reclaim reservations from the restored actors’ held indices. A retained next-node index can therefore coexist with an unowned node after load and on resumed walking updates. Later navigation assignments, releases and periodic maintenance apply the ordinary walk-map ownership rules.

Actor script-state ownership

SMOB retains the actor’s existing script-state pointer instead of restoring the saved pointer value. When that actor has script state, its saved script-state record is copied into the existing allocation. The main save reader restores object and rope records before inventory, then reads SVCB into the selected player’s existing script state. These records depend on initialized actor script owners; they do not allocate a replacement selected-player script owner.

The script-state copy preserves the live taunt-pointer array, all nine attack references and all four defence references. Saved pointer values do not replace these dependencies of the initialized owner.

Engine globals

The main save (SAVEGAME.SAV, not the per-world .TSG files) also writes an SVG2 chunk after SVGV. Its payload is a fixed 1,666-byte concatenation of retained engine globals without padding or per-field headers, in this order:

SizeContents
4Retained player health, copied into both player records at load.
4Compass display flag; nonzero draws the compass.
2Retained state word, written only by the save loader.
12Retained state block.
1600The journal tag table: 400 four-byte tags, zero marking an empty entry.
4Selected-player switch.
4 × 5Power-up slots: the two slots’ ShowBitmap IDs, their two retained atlas-frame indices (-1 empty), then the next slot (zero or one; see power-up slots).
4 × 4Four retained world-state words written when a world loads.
4Health-candle feedback countdown. Zero is inactive; 50 pins the display; positive values below 50 decrease after drawing by the elapsed nominal ticks, stopping at zero.

Inventory

SVIT contains 22-byte records in initialized item-list order, followed by a signed 32-bit selected-item ID. All numeric fields are little-endian. The payload contains neither an item count nor per-record IDs. Its length is 22 × saved_record_count + 4. The save reader and writer traverse one fewer record than item initialization creates. The reader leaves the final item unchanged; it has no record in SVIT. Loading into an existing item list therefore retains that item’s current values.

OffsetSizeTypeNameDescription
0x001u8hideCurrent item visibility field.
0x011u8pushedNonzero while a pushed value is retained.
0x024i32totalCurrent item total limit.
0x064i32player_maxCurrent player ownership limit.
0x0A4i32player_totalCurrent owned count.
0x0E4u32item_usedWrapping use count returned unchanged by ItemUsed.
0x124u32saved_player_totalCount saved by the first push and restored by a pop.

The pushed byte and saved count are restored directly, without normalizing the byte or replacing the saved count with the current count. The use count is also restored directly. A completed use increments it with 32-bit wrapping; refused attempts and torch dousing do not increment it. PushItem and PopItem use these fields: the first push saves the current count, later pushes retain that saved count, and a pop clears the pushed byte and restores the saved count.

The selected-item value -1 means no selection. Other values are looked up as full item IDs after the records have been restored. An absent ID leaves no selection. Restoration directly replaces the saved fields in initialized item records. It does not invoke acquisition, requirements, drop lists or pickup effects.

See ITEM.INI for the initialized limits and acquisition rules. These save records can replace limits as well as owned counts.

Save-slot directories

[SAVEGAME.NNN — slot directory]
  [SAVEGAME.SAV — current saved state]
  [Map-name.TSG files — other per-world snapshots]
  [LOGBOOK.TXT — journal content, when present]

The main save identifies the current world. The accompanying .TSG files retain state for other worlds. LOGBOOK.TXT contains game journal content; it is separate from the historical TXT tool reports described in Bundled support resources.

Actor task slots

The object body retains six SOUP task slots. Each slot combines the following parallel fields; slot order is allocation and execution order.

OffsetSizeTypeNameDescription
0x27F24[u32; 6]task callbacksSix little-endian callback references. Zero is empty; a nonzero reference names the byte after the task opcode.
0x29724[u32; 6]task variablesFirst native invocation word for each of the six slots.
0x2AF6[u8; 6]task statusBlocking-status bytes.
0x2B56[u8; 6]task pausePause bytes. Nonzero suspends invocation and timer advancement.
0x2BB12[u16; 6]task timersSix little-endian wrapping invocation counters.
0x2C724[u32; 6]task variables 2Second native invocation word for each slot.
0x2DF24[u32; 6]task variables 3Third native invocation word for each slot.
0x2F724[u32; 6]task variables 4Fourth native invocation word for each slot.

Callbacks retain the saved script-reference domain and require the initialized world’s script base. The counter is not elapsed game time: a task invocation computes elapsed input from its counter and the current frame scale as described in SOUP task execution. Optional private-variable tails contain signed little-endian 32-bit SOUP values separately from authored locals in SVRG. Playback, both local allocations, script cursors and task slots are independent parts of a saved continuation.

The receiver script-control byte retains the full mask, including unnamed bits. The independent rope-wait byte retains its full unsigned range separately from the last-rope reference. Replacing it does not advance the rope-grab countdown. SaveObject::replace_script_control changes only that byte after matching the saved object/runtime identity and validating packed framing. It does not alter script references, task fields, other controller values or conditional tails. Its stage-suppression semantics are described in SOUP.

The heading-change field is a complete signed sixteen-bit word, separate from logical angles and model matrices. Replacing it preserves the stored word without wrapping an angle or refreshing a model. See the heading change property.

The motion triple retains the complete signed move.vx, move.vy and move.vz words independently of pose and model state. Their interpretation depends on the active motion; packed replacement changes no motion selector, reference or tail and runs no movement service. See the motion triple properties.

Actor script continuation

The actor body retains script data, entry, cursor and return references at 0x260, 0x264, 0x268 and 0x26C. The current and saved script result bytes follow at 0x270 and 0x271. References retain the saved code domain and must be bound against the initialized world. Result bytes and all four invocation words of each task slot are retained without normalization, including empty and paused slots. Restoring a cursor without its task, authored-local and native invocation state does not restore the actor’s continuation.

SaveObject::replace_execution replaces these references, result bytes, Anchor and all six task slots for an explicitly matched saved actor/runtime identity. Ordinary actor Anchor and pause bytes are representable, including nonzero values. All unrelated body bytes and conditional tails remain unchanged. The operation validates packed framing before mutation; installed source, callback and authored-local compatibility remain world-binding obligations. It neither invokes callbacks nor advances timers.

Script reference domain

The script base is the start of the world’s RGM RASC payload. Saved script references and task callbacks are therefore RASC byte offsets: an actor’s script data reference equals its RAHD script_data_offset, and its cursors and callbacks add their position within that script. Saving subtracts the base from each nonzero reference; loading adds the base of the newly loaded world.

Loading does not compare these offsets with the installed scripts. It does not check that a data reference matches the actor’s RAHD entry or that a callback addresses a dispatch operand. A save written with a different RASC layout, for example after an earlier script in the same map changed length, binds every later reference to other bytes. A resumed task then dispatches whatever function index lies at the stale address and decodes operands from unrelated bytecode. Native handlers receive arbitrary arguments and can fault, as sRotateToAxis does with a duration of one.

A save slot is therefore bound to the exact RASC layout of each world it contains. The Unofficial Redguard Patch 1.01 lengthens the ISLAND scripts AVIK by 54 bytes and MARIAH by 9 bytes, shifting every later script in that map. Island state saved with the patched ISLAND.RGM, in SAVEGAME.SAV or ISLAND.TSG, misbinds when loaded with the original file, and the reverse also holds.

Authored script locals

SVRG stores the current world’s authored script-local storage as a flat array of little-endian signed 32-bit words. Its length is a multiple of four. The loader copies this array into the initialized world’s variable allocation; it does not reconstruct its ownership from adjacent saved objects.

Each SMOB body’s word at 0x276 is a byte offset into that array. The value 0xFFFFFFFF means no authored-local allocation; zero is a valid offset. Script variable indices address words relative to that actor’s offset. The range length comes from the matching initialized script definition, including its instance allocation, rather than the optional object-private count.

Authored-pool ownership is independent of live receiver dispatch. A definition’s allocated variable range remains part of SVRG when its executable context is a shell rather than a map actor. In particular, COMMON’s authored pool range and its shell-private continuation variables are separate storage. The complete pool also retains words outside the ranges bound to live receivers; rebuilding it by concatenating receiver variables discards those words.

The optional SMOB private-variable tail is a separate allocation, identified by the body pointer marker at 0x1C and byte count at 0x20. An empty private tail does not imply that the actor has no authored locals. Neither allocation is interchangeable with the four native invocation words per task slot.

SaveScriptLocals encodes the complete signed-word pool without normalization. Construction from words preserves their order; it does not derive actor offsets or replace missing live allocations with installed initial values. Encoding a local pool alone does not produce a complete original save slot.

parse_save_script_locals decodes the SVRG payload. bind_actor binds a bounded range to the saved object and runtime identities using the installed definition’s word count. Consumers must establish the matching initialized world and script definition before supplying that count; a name or adjacent actor offset alone is insufficient. Binding does not relocate code references, execute a callback, or advance a timer.

Code and shell continuations

Code owners and shells execute through a cleared temporary actor record. The persistent owner supplies the script references, result bytes, task callbacks, status, timers and four native invocation words. Updated fields are copied back after execution. Neither compact owner retains an Anchor byte or a task-pause array. Those fields start at zero for each temporary actor execution; they are not restored from an ordinary actor or a fresh-world baseline. Ordinary actors retain Anchor at body offset 0x25B and retain their own pause array.

SaveCodeOwner::replace_execution replaces the saved script continuation and all six task slots without changing owner identity, authored-local allocation, native-hook reference or other packed fields. References supplied to it remain in the saved world’s code-offset domain. Nonzero temporary Anchor or task-pause state is not representable and rejects before mutation. This record-level operation does not validate a complete world or save slot.

The following offsets are relative to each packed body. Arrays have six entries in slot order, with words stored little-endian.

FieldTypeCode ownerShell
Script data / entry / main / return[u32; 4]0x230x12
Current / saved result[u8; 2]0x330x22
Task callbacks[u32; 6]0x420x30
Invocation word one[u32; 6]0x5A0x48
Blocking status[u8; 6]0x720x60
Invocation timers[u16; 6]0x780x66
Invocation word two[u32; 6]0x840x72
Invocation word three[u32; 6]0x9C0x8A
Invocation word four[u32; 6]0xB40xA2

A code owner’s word at 0x3A is its authored-local byte offset in world SVRG, using the same all-ones absent sentinel as ordinary actors. The matching initialized script definition supplies the local count. Code-owner identity and installed source must both match before binding that range.

A shell owns its local allocation separately from SVRG. Its saved count at 0x28 determines the words following the 186-byte body. Loading reconstructs the shell by installed name, retains the new allocation pointer, and reads the saved words into that allocation. Consumers must validate the saved count against the matching installed definition. The pointer at 0x24 is not a portable binding. bind_locals returns signed words tied to the saved name only after count validation; bind_code_owner bounds a code owner’s world range and returns its identity with the words.

External References

Map-code allocation identity

The map-code owner counter starts at zero for a world load. Each type-two MPOB placement consumes its next value in installed placement order, independently of the editor object ID. The resulting identity is the SMCO owner ID. Cell linked-list insertion and save traversal order do not change that identity.

Type-six coloured-light placements allocate compact records but do not consume the type-two identity counter. Their compact records carry the light marker and are excluded when collecting SMCO save owners. They must not shift the saved code-owner binding for later type-two placements.

Spatial task continuation words

The first two words of a RotateByAxis slot retain its signed fixed-point target and accumulator. RotateToAxis retains its signed movement and accumulator in those words. MoveObjectAxis retains signed target and traveled distance. MoveByAxis retains its signed target in the first word. The remaining words of these handlers are zero. Loading these slots preserves the retained words; continuation must not run the initial callback to reconstruct them.

AmbientSound retains its sample slot in the first word, with all-ones meaning no sample. Its other three words are zero. A retained active sample index refers to the playback service owner, not to a new playback request.

Dialogue and animation task service ownership

An RTX slot retains its signed dialogue-record index in the first native word and its signed sample slot in the second. All-ones is the absent sample; the remaining two words are zero. These words do not serialize the dialogue record or audio payload. World-state loading clears the shared dialogue table and sample channels before restoring object tasks. A resumed RTX task observes the cleared record and completes without looking up or replaying its saved label.

PushAnimation and PushControlAnimation retain their started phase in the first native word, zero before starting and one afterward. Their other three words are zero. Playback belongs to the receiving actor’s saved animation record, not the task slot. Load restores that record separately, including its current and pending group, command cursor, countdown and loop count. The first resumed handler re-evaluates its group operand. A started task observes the receiver’s current group without repeating its request or resetting its loop count. An unstarted task follows ordinary request arbitration and sets its requested loop count only once the requested group is current.

Gameplay globals and full-load ownership

The following SVGV fields are little-endian. Offsets are relative to its 1,542-byte payload.

OffsetSizeTypeNameDescription
0x0104i32activation_consumed_useSuccessful activation retains action consumption until release.
0x0304i32hit_inhibitedSelected-player hit inhibition.
0x0344i32death_animation_overrideRequested death-animation group.
0x0384u32death_progressDeath-controller elapsed nominal ticks.
0x0404i32death_modeDeath-effect selector.
0x04812[i32; 3]death_positionCaptured local position in signed 24.8 map units.
0x05C4u32falling_elapsedWorld-loop falling timeout in nominal ticks.
0x0604u32action_ticksUnconditional player-controller preliminary countdown in nominal ticks.
0x0644i32lineup_resultShared lineup result and selected-player combat-entry inhibition.
0x0904u32world_loop_frameWorld-loop iteration counter.
0x10C4i32idle_counterOrdinary idle counter advanced by clock measurement windows.
0x1304u32body_response_contactsRetained body-response count used by the sliding-state test.
0x2242u16lockoutPlayer lockout word.
0x5EA4i32health_candle_levelRetained candle level used by health animation.
0x5EE4i32health_candle_frameRetained frame within the candle level.
0x5F28[i32; 2]health_candle_positionHealth-candle drawing coordinates.

Reading these fields and entering the world loop are separate operations. After a full load, world-loop entry clears hit inhibition, the death-animation override, death progress and the iteration counter. It also clears the dragon’s breath cooldown. Death mode, captured position, falling elapsed time, the saved action countdown, idle counter, lineup result and lockout retain their loaded values. The full-load finalizer clears the pending player-action flag before world-loop entry.

The secondary preliminary countdown and ledge-action inhibition are the same unsigned 32-bit global. The lineup result and selected-player combat-entry inhibition are likewise the same signed word, rather than independent state.

A full save does not serialize every gameplay global. The loader retains the running session’s maximum health, conditional preliminary countdown, secondary preliminary countdown, sound-maintenance inhibition, script-menu mode, potion counters, queued movie and selected-player ledge result. These values require an established prior session; a missing save field does not request a new player initializer. The standalone player initializer clears the preliminary countdowns and sound-maintenance inhibition and assigns maximum health 100.

The script menu’s existing entries are rebuilt during full load. Shared dialogue records and sample channels are cleared before actor task restoration; no active dialogue line is reconstructed from a saved RTX task. World-loop entry resets the sound-maintenance counter, while retaining its inhibition.

Full loading also retains the running session’s dialogue-mode word, item-viewer request, item-use latch and cached ground-prevalidation results. The item-viewer request includes its pending switch, no-text switch, item and two request words. The ordinary actor wrapper clears the prevalidation-used switch before its next query; that query replaces the cached rollback and sliding results. The item-use latch clears when the action input is released. The remembered topic-menu text clears when DialogBegin or LockoutPlayer runs.

The actor byte at body offset 0x237 is the runtime object-update exclusion. Zero admits ordinary updates; a nonzero byte suppresses the ordinary animation and main-script stages. The public controller view retains this raw byte in active; it is an exclusion flag rather than an inverted enable flag.

The final twenty bytes of the sixty-byte allocation retain a separate native command context. They are not padding and do not alias any of the six task slots. Three little-endian invocation words occupy allocation offsets 40, 44 and 48. The fourth invocation word occupies offset 52: its low sixteen bits are the command word, followed by the phase byte and counter byte. The separate elapsed or point value occupies offset 56. Every stored bit is retained independently.

Allocation initializes all sixty bytes to zero. Navigation can create this allocation without attaching an owner, clear its command context, load the context into shared native command state and save it back after a continuing point update. Clearing that context does not clear the owner, offset or position histories. Detachment retains the allocation and its command context. A complete allocation replacement therefore requires both current position-link values and the independent current command context; a prior allocation tail is not a substitute for that state. Removing serialized allocation storage is distinct from detaching its owner and requires lifecycle admission by the consumer.