Time Crystal

Crystal Save - Time Machine

Before You Start

  1. Import Crystal Save

  2. Make sure there are no compiler errors

  3. Check the Demo Scenes in the folder Demo and GC2 Demo (Game Creator 2)

Step 1 — Place the GameObject Time Machine

  1. In your scene, create an empty GameObject (for example, TimeMachineManager).

  2. Add the GameObject Time Machine component (Component → Crystal Save → Time Machine → GameObject Time Machine).

  3. Leave this object in every scene that needs rewind support, or keep it in a bootstrap scene loaded at startup. The component exposes recording, branching, and ghost‑mode settings if you want to tweak defaults later.

Step 2 — Add Recorders to Track Objects

  1. Select each GameObject you want to record.

  2. Add the Time Machine Recorder component (Component → Crystal Save → Time Machine → Time Machine Recorder) if you don't plan to make snapshots persistent and if you only want to record transform data.

  3. Press Play—recording starts automatically thanks to the recorder’s autoStartRecording flag. The component also exposes interval capture, per-object snapshot caps, and optional event tags

You can trigger recordings and rewinds from code if needed:

var recorder = GetComponent<TimeMachineRecorder>();
recorder.RecordCurrentState("PlayerHit");   // Tag a key moment
recorder.RewindToTime(12.0f);                // Jump back to 12 seconds

The recorder is just a thin API wrapper—actual capture is performed by the shared manager so every tracked object stays in sync.

Step 3 — Capture Gameplay

Hit Play. As soon as the Time Machine initializes, every object with a recorder begins streaming snapshots into the active timeline. Out of the box the recorder takes snapshots on a 0.1s interval and stores up to 500 frames per object, but you can adjust these values per object through the Inspector or globally in the Crystal Save Settings.

What the Recorder Stores

Each snapshot bundles everything needed to reconstruct the object later on:

  • Transform & hierarchy via SaveablePrefabData (position, rotation, scale, parent, prefab info).

  • All Saveable/Remember components collected by the ComponentManager, so custom gameplay state is preserved alongside transforms.

  • Active state, timestamps, frame counts, and metadata tags to help you annotate and filter moments on the timeline.

Step 4 — Rewind and Replay

Open Tools → Crystal Save → Time Machine → Open Time Machine Player while the game is running. The editor window gives you object selection, branch visualisation, scrubbing, and playback controls so you can quickly check the recorded history.

Common controls:

  • Play from the start – call GameObjectTimeMachine.Instance.StartTimelinePlayback() or press Play in the window to run the timeline forward.

  • Change playback speed – adjust the speed slider in the window or invoke SetGlobalPlaybackSpeed(0.5f) / SetGlobalPlaybackSpeed(2f) for slow motion and fast-forward.

  • Reverse playback – toggle the reverse button in the window or call ToggleGlobalReversePlayback() to scrub backwards through time.

  • Stop & resume recording – the manager automatically pauses recording during playback and resumes based on the selected resume mode, so you can branch, overwrite, or continue timelines without losing data.

For scripted control you can combine the API calls, for example:

var timeMachine = GameObjectTimeMachine.Instance;
timeMachine.StartTimelinePlayback(startTime: 3f, playbackSpeed: 1.5f);
timeMachine.SetGlobalReversePlayback(false); // ensure forward motion
timeMachine.SetGlobalPlaybackSpeed(0.5f);    // shift into slow-mo

Next Steps

  • Open the Demo Scenes (Assets/Plugins/CrystalSave/Modules/TimeMachine/Demo/)

  • Fine-tune memory usage by adjusting per-object snapshot caps or the global SnapshotRecorderSettings on the manager if you need longer timelines or more aggressive pruning.

  • Tag critical events via TimeMachineRecorder.TagCurrentState("BossDefeated") so they show up clearly in the player window and exported timelines.

  • Experiment with branching using the playback resume and auto-branch options on the manager to build Braid-style alternative timelines without overwriting your main recording.

With these pieces in place you can record gameplay, scrub to any moment, replay it forward or backward at any speed, and layer in more advanced Time Machine features as your project grows.

Last updated