Skip to content

RevFramework – Sample Scene: 00_Economy_Quickstart_CurrencyOnly

Goal

Teach the smallest Economy flow:

Player owner → ICurrencyServiceEconomyBootstrapIValueLedger → Shop / Reward execution.

This scene is currency-only by design.


What This Scene Demonstrates

This scene shows Economy orchestrating currency services without an item store.

The flow is:

Player → ICurrencyServiceEconomyBootstrap.BuildForPlayerIValueLedger / IShopService / IRewardServiceEcoOpResult

  • Economy does not replace Currency
  • Currency owns value mutation
  • Economy coordinates higher-level flows over public services
  • IValueLedger provides money preflight and mutation support
  • IItemStore is intentionally absent
  • Money-only Buy and Reward flows are valid
  • Craft is intentionally blocked because result delivery needs an item store

Preflight is UX guidance.

Execution result is truth.


What To Look For

Use the EconomyQuickstartPanel to understand the currency-only Economy boundary.

  • Binding State

  • Player is the wallet owner

  • Currency is the assigned ICurrencyService
  • Ledger shows whether Economy services were built
  • Store is null by design

  • Preflight

  • CanPay reads state only

  • Preflight does not mutate balances
  • LedgerPreflightMode changes how policy-adjusted debits are treated
  • The ledger is rebuilt when mode or policy changes

  • Balances

  • Displays configured watch currency ids

  • Reads balances from the currency service
  • Shows whether Buy / Reward changed state

  • Actions

  • Buy calls IShopService.Buy with store = null

  • Reward calls IRewardService.Grant with store = null
  • Craft is unavailable in this currency-only panel
  • Disabled action messages explain the boundary directly

  • Log

  • Shows panel-level actions, correlation ids, and result summaries

  • This is teaching/debug readout, not a production logging pipeline

Sample Scope

This scene covers:

  • Building Economy services from a player and ICurrencyService
  • Currency-only IValueLedger usage
  • Money-only Buy flow
  • Money-only Reward flow
  • UX preflight using CanPay
  • EcoOpResult inspection
  • Source/correlation id generation using EcoSource.Build
  • Clear blocking of item-dependent flows when no IItemStore exists

This scene does NOT cover:

  • Inventory-backed item costs
  • Item rewards or item delivery
  • Full crafting result delivery
  • Sell flows
  • Rollback around item store operations
  • Multiplayer replication or networking

Those belong in inventory-enabled Economy scenes.


Authority Note

This scene may include a permissive sample authority setup so it runs without additional configuration.


Networking Reminder

RevFramework does not include networking.

For multiplayer projects, Economy actions must be validated and executed through your own authority and networking layer. Preflight is not authority.


How To Use

  1. Enter Play Mode.
  2. Open the EconomyQuickstartPanel.
  3. Confirm the binding state:

  4. Player is assigned

  5. ICurrencyService is assigned
  6. Ledger is built
  7. Use the Currency Basics panel or gameplay to seed money if needed.
  8. Check the Preflight section.
  9. Check watched balances.
  10. Press Buy to run a money-only shop purchase.
  11. Press Reward to grant a money-only payout.
  12. Observe the returned EcoOpResult and balance changes.
  13. Try Craft and confirm it is blocked because this panel has no IItemStore.
  14. Check the Log for result summaries and source/correlation output.

Failure Behaviour

Failures are shown through dependency guards, disabled action reasons, toast messages, logs, or EcoOpResult summaries.

Common causes:

  • Play Mode required

  • The panel reads live services and wallet state

  • Fix: enter Play Mode

  • Missing Player Owner

  • No wallet owner is assigned

  • Fix: assign Player or tag the player GameObject as Player

  • Missing Currency Service

  • No ICurrencyService is available from Currency Service Behaviour

  • Fix: assign a MonoBehaviour that implements ICurrencyService

  • Economy Services Not Built

  • EconomyBootstrap did not produce the required public services

  • Fix: check Player, ICurrencyService, policy, and preflight mode bindings

  • Buy unavailable

  • Buy has no money price, includes item lines, or CanPay failed

  • Fix: add a money price, remove item costs for this panel, or adjust balance/policy/preflight mode

  • Craft unavailable

  • Craft needs IItemStore for result delivery

  • Fix: use an inventory-enabled Economy teachable

  • Reward unavailable

  • Reward has no money payout or includes item payouts

  • Fix: add a money payout or use an inventory-enabled Economy teachable for item rewards

  • Preflight passes but execution fails

  • The live service rejected the authoritative mutation

  • Fix: trust the EcoOpResult; inspect balance, policy, currency service rules, authority, and service composition

Behind The Scenes

The panel uses public Economy and Currency APIs:

  • EconomyBootstrap.BuildForPlayer

  • builds public Economy services for the selected player and currency service

  • IValueLedger

  • provides money preflight and mutation support

  • IShopService

  • Buy

  • IRewardService

  • Grant

  • ICraftingService

  • built but intentionally not used for execution in this currency-only panel

  • ICurrencyService

  • owns the actual balance mutations

  • CurrencyPolicy

  • optionally affects preflight and effective debits

  • LedgerPreflightMode

  • changes preflight behaviour

  • EcoSource.Build

  • builds stable source/correlation ids

  • EcoOpResult

  • Success

  • Code
  • Message

The panel supplies store = null.

That is the point of the scene.

Money-only flows work. Item-dependent flows are blocked.


Key Takeaway

Economy orchestrates.

Currency mutates balances.

This quickstart teaches the currency-only boundary: Buy and Reward can run, Craft waits for an item store.