Skip to content

Crafting — UnityIntegration / Persistence

Folder Overview

This page documents the persistence and offline progression system used by Crafting.

Persistence is handled by CraftingJobPersistence and the service integration layer.


What Lives Here

  • job save and restore logic
  • offline progression handling
  • snapshot conversion and reconstruction

Purpose

Persistence provides a way to:

  • save active crafting jobs
  • restore jobs after reload
  • apply offline progress
  • reconcile job completion on load

It ensures crafting continues across sessions and application restarts.


Usage Guidance

Save

  • use SaveActiveJobs to collect job snapshots
  • caller is responsible for serialization and storage

Restore

  • use RestoreJobs to rebuild runtime jobs
  • jobs are resolved, reconstructed, and scheduled

Offline Progress

  • elapsed time is calculated from stored timestamps
  • jobs may complete immediately if duration has elapsed
  • paused jobs do not progress offline
  • completion is idempotent: each job carries a stable completion id, so restoring the same snapshot set again does not deliver its outputs (or refunds) twice (in-session guard; see the Crafting system README for the cross-restart contract)

Important Notes

  • only active jobs are persisted
  • inputs and currency are not re-applied on restore
  • behaviour depends on adapter implementations
  • failure during delivery may result in partial recovery

Not for Production Use

Persistence does not handle:

  • scheduling logic
  • crafting rules or validation
  • modifier execution

These remain in the Crafting service.


  • Crafting Core (job lifecycle and execution)
  • Crafting Contracts (job snapshots and data structures)

Design Notes

  • separates persistence from runtime orchestration
  • uses snapshot-based reconstruction

Given the same snapshots and adapter behaviour, restore produces consistent results.