RevFramework — Crafting System¶
Overview¶
The Crafting module is a scene-scoped, job-based execution system that turns recipes into scheduled work at runtime.
It is designed for production projects, with predictable behaviour, clear extension points, and strong integration with other RevFramework systems.
Crafting supports two execution semantics:
- Best-effort execution (default) — fast, forgiving, suitable for most gameplay systems
- Escrow execution (opt-in) — stronger execution guarantees when reservation/hold adapters honour their contracts
Both modes share the same service, pipeline, and extension points. Only the execution guarantees and failure behaviour differ.
Key design goals¶
- Service-first:
CraftingServiceruns all logic — preflight, acceptance, scheduling, delivery, and events. - Result-first: Most operations return structured results (
CraftCheck,CraftProbe,CraftJob) for clarity and debugging. - Extensible: Plug in custom
ICraftingValidator,ICraftingModifier, or routing components. - Deterministic: Supports deterministic RNG for testing, replay, and server verification.
- Pipeline-agnostic: Works with or without Inventory/Currency modules; behaviour adapts to available capabilities.
💾 Persistence responsibility¶
The service exposes APIs for saving and restoring active crafting jobs:
SaveActiveJobs(...)RestoreJobs(...)
These APIs define:
- what data to persist (active jobs)
- how jobs resume and progress (including offline behaviour)
They do not provide a persistence system.
Crafting defines the job model and lifecycle — your game defines persistence. Integrating this with your save system is the developer’s responsibility.
Crafting does not implement:
- save files
- cloud sync
- cross-session storage
You decide:
- when to save
- where to store data
- when to restore
🗝️ We define the job model and lifecycle — you own persistence.
What’s included¶
| Category | Purpose |
|---|---|
| CraftingService | Main runtime service — orchestrates jobs, scheduling, delivery, and events. |
| RecipeCore / RecipeDefinition | Defines inputs, outputs, cost, and time. Designer-friendly definitions convert to runtime data. |
| ICraftingInventoryAdapter / ICraftingCurrencyAdapter | Bridges Crafting to Inventory and Currency systems. |
| ICraftingInventoryReservationAdapter | Enables escrow execution via inventory reservations. |
| ICraftingCurrencyHoldAdapter | Enables escrow execution via currency holds. |
| ICraftingValidator | Gate crafts (e.g., cooldowns, requirements). |
| ICraftingModifier | Modify duration, cost, or outputs. |
| ICraftingOutputRouter | Determines output destination containers. |
| IWallClockProvider / ITimeProvider | Drives runtime and offline time behaviour. |
| Teaching Panels | In-editor panels that visualize crafting features live. |
| Fake Adapters | Standalone test adapters for inventory and currency. |
Hook-up summary¶
Minimal setup requires only a CraftingService in the scene.
1️⃣ Add the service¶
GameObject → RevFramework → Crafting → CraftingService
- Optionally assign adapters:
InventoryCraftingAdapter→ connects toSceneInventoryServiceCurrencyCraftingAdapter→ connects toSceneCurrencyService- Optionally assign a
WallClockComponentfor offline progress tracking.
If escrow execution is required, provide adapters that implement reservation and hold capabilities.
2️⃣ Create recipes¶
- Use RecipeCore (data-only) or RecipeDefinition (designer asset).
- Define inputs, outputs, cost, craft time, and station tag.
3️⃣ Link to gameplay¶
- Add Validators (e.g., cooldowns, requirements).
- Add Modifiers (e.g., bonuses, chance outputs).
- Optional workbenches provide trigger-based crafting interactions.
4️⃣ Test with a Teaching Panel¶
Press Play and open a panel from the Crafting → Teaching menu
or add a Crafting*Panel component to a GameObject.
| Scene | Panel | Focus |
|---|---|---|
00_Crafting_Quickstart |
CraftingQuickstartPanel |
Basics: inputs, outputs, progress |
02_Routing_Space_Currency |
CraftingRoutingSpaceCurrencyPanel |
Space checks, routing, currency costs |
03_Validators_And_Modifiers |
CraftingValidatorsModifiersPanel |
Buffs, cooldowns, restrictions |
04_Offline_Progress_Persistence |
CraftingOfflineProgressPanel |
Save/load jobs, simulate offline |
See the Samples → Crafting → Scenes section for the full set of demo scenes.¶
Integration with other RevFramework modules¶
| Module | Interaction |
|---|---|
| Inventory | Items are consumed and produced via adapters. |
| Currency & Economy | Costs and escrow behaviour integrate via currency adapters. |
| Pickups | Crafted items can be converted into world pickups using gameplay logic. |
| Status / Health | Validators or modifiers can apply effects on completion. |
| Netcode | Deterministic execution supports server validation and replay. |
🧩 Multiplayer Note¶
RevFramework Crafting is netcode-agnostic but deterministic.
- Consistent results with identical seeds and inputs (when deterministic RNG is used)
- Adapters enforce authority; replication is up to your netcode
- Jobs can be serialized and replayed server-side
🗝️ We define the execution rules — you define authority and replication.
Extension points¶
- Implement
ICraftingValidatorfor custom rules - Implement
ICraftingModifierfor dynamic behaviour - Implement
ICraftingOutputRouterfor routing - Implement reservation/hold adapters for escrow
- Extend Teaching Panels for debugging or tooling
Typical one-liner usage¶
var req = new CraftRequest(player, recipe, 1, "Backpack", "Forge");
crafting.Enqueue(req);
Where to learn¶
- Docs: See the Crafting section of this site
- Videos: Quickstart, Offline Progress, Routing & Space, Validators & Modifiers, Kitchen Sink
- In-Editor Panels: Add any
Crafting*Panelcomponent to test live
✅ TL;DR¶
CraftingService turns recipes into scheduled jobs.
Adapters connect it to Inventory and Currency.
Validators and Modifiers define the rules.
Execution semantics are explicit: best-effort by default, escrow when required.
Deterministic, modular, and production-ready — with explicit integration responsibility.