Skip to content

04 — Offline Progress and Persistence

Goal:
Understand how crafting jobs can be saved, restored, and advanced using real-world time in a sample setup.


🎓 What This Scene Demonstrates

This scene shows how the Crafting system can persist active jobs across sessions and apply offline progress when those jobs are restored.

You’ll see how to:

  • Enable and configure offline progress on CraftingServiceCore
  • Save active jobs using SaveActiveJobs()
  • Restore jobs using RestoreJobs()
  • Apply wall‑clock time (UTC) to advance job timers on restore
  • Simulate elapsed time using the Advance (secs) controls in the panel
  • Observe how completion caps affect offline advancement

This scene demonstrates behaviour and persistence patterns — it does not define guaranteed timing, ordering, or completion semantics.


🧩 How to Use

  1. Enter Play Mode and open the Offline Progress panel.
  2. Start one or more crafting jobs and let them run briefly.
  3. Toggle Offline Progress on or off to compare behaviours.
  4. Click Save Active to export queued/running jobs to JSON.
  5. Stop and restart Play Mode — or simulate downtime using Advance (secs).
  6. Paste the saved JSON back into the text field.
  7. Click Restore or Advance + Restore.
  8. Observe how jobs resume, complete immediately, or continue running based on elapsed wall‑clock time and configured caps.

Scope Reminder
RevFramework does not implement networking, replication, prediction, rollback, or reconciliation.
These samples demonstrate authority‑gating and persistence patterns only — all networking and cross‑device sync behaviour is your responsibility.


⚙️ Behind the Scenes

  • Uses FakeInventoryAdapter and FakeCurrencyAdapter for a self‑contained demo.
  • Each job snapshot stores an acceptedAtUtc timestamp (Unix epoch seconds).
  • On restore, the service compares stored timestamps with the current wall clock.
  • Elapsed time may:
  • Advance the job timer
  • Complete the job immediately
  • Be clamped by the configured offline completion cap
  • All advancement is driven by the service’s IWallClockProvider.

💡 Key Takeaway

Offline progress is based on real time, not simulation time.

When a player returns: - Jobs may have partially progressed
- Jobs may have completed
- Jobs may still be running

depending on elapsed wall‑clock time and configuration.

This pattern is well suited for idle, survival, and progression‑driven crafting loops where time continues to matter outside active play.


Panel: CraftingOfflineProgressPanel
Scene Path:
Assets/RevFramework/Samples/Crafting/Scenes/04_Offline_Progress_Persistence/