Runtime world architecture

DCC Runtime Object and Instance Architecture Guide

Direct answer: Use Game Instance for state that must survive map changes, Level Instance for reusable authored world sections, and Time Scale only for intentionally scoped simulation or presentation control. Define lifetime, ownership, replication, save behavior, and reset conditions before connecting these systems, then test travel and reload paths rather than only the current scene.

Game InstanceLevel InstanceTime Scale

1. Assign lifetime before writing logic

Classify every variable by lifetime: application session, save slot, world, streamed level, match, actor, or frame. A Game Instance can own account selection, matchmaking handoff, and session-wide services, but should not become a dump for mutable level state. A Level Instance owns reusable spatial content, not global progression. Write an ownership table with creator, reset event, serialization rule, network authority, and teardown callback before building references.

2. Keep application state independent of worlds

Initialize Game Instance services without assuming that a playable world already exists. Store stable identifiers rather than raw object pointers to actors that disappear during travel. Register world-bound listeners when a world loads and remove them during teardown. If seamless travel or editor play modes differ, test both. Session data should survive intentional travel, while transient combat, checkpoints, and spawned objects should reset according to match or level policy.

3. Design reusable Level Instance boundaries

Give each Level Instance a documented pivot, bounds, data-layer policy, lighting responsibility, collision perimeter, and external interface. Avoid hidden references to actors outside the instance; expose named connectors, gameplay tags, or soft references instead. Decide whether nested instances are permitted and how edits propagate. Validate duplication, rotation, streaming in and out, and source-level updates. Reusability fails when an instance depends on one particular parent map’s names or initialization order.

4. Control time as a hierarchy

Define global Time Scale separately from local dilation, animation playback rate, particle age, audio pitch, UI clocks, and network time. Pausing gameplay should not freeze menus, save confirmation, or telemetry flushes. Physics solvers may become unstable at extreme scale values, while fixed-step subsystems can ignore presentation speed. Clamp supported ranges, name the authoritative owner, and document which systems use scaled delta, unscaled delta, fixed timestep, or server clock. Instrument monotonic wall-clock samples, accumulator remainder, solver substep count, animation phase, particle lifetime, audio DSP position, cooldown expiry, replay tick, sequencer frame, and watchdog deadline. During a slow-motion capture, graph these channels together; plateaus, discontinuities, or divergent slopes identify the clock domain that violated policy.

5. Make initialization order observable

Emit structured events for service creation, world begin play, Level Instance load, actor registration, and ready state. Gate dependent systems on explicit readiness rather than arbitrary delay nodes. A streamed encounter should not start because geometry became visible if navigation, replicated state, or save restoration is incomplete. Record instance asset identifier and runtime instance identifier separately; multiple copies of one source need unique diagnostics and deterministic cleanup.

6. Define save and replication boundaries

Save durable values through versioned data records, not live runtime objects. Let the server own authoritative Time Scale changes in network play and replicate an approved state or command. For Level Instance content, choose whether spawned changes persist by source asset, placement instance, or unique world key. Test reconnect, host migration if supported, late join, autosave during streaming, and loading a save after the source instance has changed schema.

7. Work a pause-and-travel decision

A co-op dungeon uses two copies of a reusable room. The Game Instance retains party membership and selected difficulty; each Level Instance owns encounter completion under a unique placement key. A tactical pause request is server-authorized at Time Scale 0.1, while UI and network timeout clocks remain unscaled. Raw enemy pointers never enter session state. This division permits world travel, two room copies, and reconnect without stale references or duplicated rewards.

8. Trace symptoms to ownership mistakes

A value resets on travel when world state was mistaken for session state. A room awards twice when two Level Instance placements share one persistence key. Menus stop responding when UI uses scaled delta during pause. Physics explodes after slow motion when timestep and solver substeps are unconstrained. Clients diverge when each writes Time Scale locally. Intermittent null references usually indicate hidden initialization order or retained pointers across world teardown.

9. Prove lifecycle behavior

Run cold start, map reload, seamless travel, disconnect, late join, pause, resume, slow-motion, duplicate-instance, and stream-out tests. Capture lifecycle logs, save diffs, network authority, instance keys, frame timing, and cleanup counts. Approval requires zero orphan listeners, deterministic reset behavior, no cross-instance state leakage, and defined clock use for every critical subsystem. Keep the matrix beside architecture diagrams so future features inherit the same boundaries.

Multilingual production vocabulary

zhenjaproduction meaning
游戏实例Game Instanceゲームインスタンスapplication-lifetime state
关卡实例Level Instanceレベルインスタンスreusable streamed world unit
时间缩放Time Scaleタイムスケールsimulation-rate multiplier

DCC Runtime Object and Instance Architecture Guide FAQ

What belongs in a Game Instance?

Only application-lifetime services and session data with explicit reset and serialization rules. Level actors, transient combat state, and raw world-object pointers belong elsewhere.

Is a Level Instance the same as a spawned actor?

No. It is a reusable level-content boundary with streaming, editing, bounds, and reference constraints; runtime actors inside it still have their own lifecycles.

Should UI obey global Time Scale?

Usually no. Menus, confirmations, and accessibility UI generally require unscaled time even when gameplay simulation is paused or slowed.

How do we prevent duplicated instance progress?

Persist progress under a stable source identifier plus a unique placement or runtime key, and test two simultaneous copies as well as stream-out and reload.