RevFramework – Sample Scene: 00_Economy_Quickstart_CurrencyOnly¶
Goal¶
Teach the smallest Economy flow:
Player owner → ICurrencyService → EconomyBootstrap → IValueLedger → 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 → ICurrencyService → EconomyBootstrap.BuildForPlayer → IValueLedger / IShopService / IRewardService → EcoOpResult
- Economy does not replace Currency
- Currency owns value mutation
- Economy coordinates higher-level flows over public services
IValueLedgerprovides money preflight and mutation supportIItemStoreis 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
nullby design -
Preflight
-
CanPayreads state only - Preflight does not mutate balances
LedgerPreflightModechanges 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.Buywithstore = null - Reward calls
IRewardService.Grantwithstore = 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
IValueLedgerusage - Money-only Buy flow
- Money-only Reward flow
- UX preflight using
CanPay EcoOpResultinspection- Source/correlation id generation using
EcoSource.Build - Clear blocking of item-dependent flows when no
IItemStoreexists
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¶
- Enter Play Mode.
- Open the
EconomyQuickstartPanel. -
Confirm the binding state:
-
Player is assigned
ICurrencyServiceis assigned- Ledger is built
- Use the Currency Basics panel or gameplay to seed money if needed.
- Check the Preflight section.
- Check watched balances.
- Press Buy to run a money-only shop purchase.
- Press Reward to grant a money-only payout.
- Observe the returned
EcoOpResultand balance changes. - Try Craft and confirm it is blocked because this panel has no
IItemStore. - 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
ICurrencyServiceis available from Currency Service Behaviour -
Fix: assign a MonoBehaviour that implements
ICurrencyService -
Economy Services Not Built
-
EconomyBootstrapdid 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
CanPayfailed -
Fix: add a money price, remove item costs for this panel, or adjust balance/policy/preflight mode
-
Craft unavailable
-
Craft needs
IItemStorefor 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 CodeMessage
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.