Skip to content

05 — Real Adapters (Inventory + Currency)

Goal:
Understand how the Crafting system integrates with real inventory data and, optionally, real currency services in a sample scene.


🎓 What This Scene Demonstrates

This scene transitions from the fake in-memory adapters used in earlier demos to real gameplay integrations — showing how Crafting connects to your actual data services.

By default, the scene demonstrates inventory-backed crafting.
Currency integration is optional and is enabled only when the Currency & Economy module is installed.

You’ll see how to:

  • Connect Crafting to a real inventory backend via InventoryCraftingAdapter
  • Optionally connect Crafting to a live currency system via CurrencyCraftingAdapter
  • Bind a real Item Database for item definitions and GUID resolution
  • Observe how adapter calls map directly to real containers and balances
  • See preflight, space checks, and consumption operate against live data

This scene demonstrates integration behaviour — it does not define networking, authority, or economic guarantees.


Scope Reminder
RevFramework does not implement networking, replication, prediction, rollback, or reconciliation.
These samples demonstrate authority-gating and integration patterns only — all networking and cross-system synchronisation behaviour is your responsibility.


⚠️ Authority Note

No Authority Binder is assigned in this scene.

Leaving the Authority Binder field on CraftingServiceCore unassigned allows crafting to be tested locally without authority checks.

To enforce authority, you must explicitly assign an Authority Binder to the service.
Adding the component alone does not enable enforcement.


🧩 How to Use

  1. Assign an InventoryCraftingAdapter to CraftingServiceCore (required).
  2. Assign a CurrencyCraftingAdapter (optional, only if the Currency module is installed).
  3. Ensure the inventory adapter has a bound Item Database
    (via its field or automatically through GameServicesProvider).
  4. Open the Real Adapters panel and confirm detected adapters.
  5. Use Add, Remove, and Count / Space to test live inventory operations.
  6. If currency is present, credit funds and observe balance updates.
  7. Use CanCraft?, Craft 1, Craft N, or Craft Max to enqueue real jobs.
  8. Observe real item consumption, space validation, and currency debits driven entirely by your live backend.

⚙️ Behind the Scenes

  • InventoryCraftingAdapter bridges Crafting to SceneInventoryService and IItemDatabase.
  • CurrencyCraftingAdapter (when present) bridges Crafting to ICurrencyService.
  • The same CraftingServiceCore logic is used for both fake and real adapters.
  • No Crafting code changes are required when switching adapter implementations.
  • All adapter calls (TryGetContainer, TryConsumeExact, TryDebit) are forwarded directly to your runtime systems.

💡 Key Takeaway

This scene demonstrates how Crafting integrates with real gameplay data:

  • InventoryCraftingAdapter connects item storage, lookup, and transactions
  • CurrencyCraftingAdapter connects player balances and debits (when installed)
  • CraftingServiceCore remains unchanged — adapters abstract all backend differences

Adapters make the Crafting system backend-agnostic, allowing integration with inventory, economy, or MMO-style services without rewriting Crafting logic.


Panel: CraftingRealAdaptersPanel
Scene Path:
Assets/RevFramework/Samples/Crafting/Scenes/05_Real_Adapters_With_InventoryCurrency/