RevFramework — Inventory System¶
Overview¶
The Inventory module is a scene-scoped, result-first inventory and equipment pipeline designed for production projects — not prototypes.
It provides predictable behaviour, clean APIs, and modular integration points across RevFramework (Currency, Crafting, Pickups, etc.).
Key design goals¶
- Service-first:
SceneInventoryServiceorchestrates container resolution, mutations, and event publication. - Result-first: Every mutation returns
InvOpResultwith clear success/failure codes. - Extensible: Plug in custom filters, authority binders, search/sort strategies, and UI layers.
- No lock-in to our implementations: All runtime behaviour is driven by public interfaces and replaceable seams.
What's included¶
Core Runtime¶
- SceneInventoryService → Default Unity host and orchestration layer
- CharacterInventory → Player/actor inventory access + debugging
- CharacterEquipment → Equipment slots + filters + events
- ItemUseSystem → Item consumption + effect execution
Data & Definitions¶
- ItemDefinition / ItemDatabase → Authorable item data + lookup
- EquipmentFilter → Slot acceptance rules
Internal Runtime (not public API)¶
- Slot-based container system (merge, split, move, resize, sort, search)
(Implementation detail — not part of supported API surface)
Optional Systems¶
- Snapshots → JSON-based inventory + equipment capture/restore
- Authority binders → Example authority policies (single-player / custom setups)
Samples & Tooling¶
- UI examples (event-driven bindings)
- Debug panels
- Teachable panels
Hook-up summary¶
1️⃣ Add the service¶
GameObject → RevFramework → Inventory → SceneInventoryService
Assign an ItemDatabase and optionally a ContainerSizePolicy.
2️⃣ Give your player an inventory¶
Attach CharacterInventory.
- Default container:
Backpack - Default size: 24 (configurable)
- Automatically handles lifecycle cleanup
3️⃣ (Optional) Add equipment¶
Attach CharacterEquipment and define slot layout.
Optionally add EquipmentVisualAttacher for model spawning.
4️⃣ (Optional) Add item use¶
Attach ItemUseSystem
- Mark items as usable
- Assign
IUseEffectimplementations or bridge integrations
5️⃣ Wire a UI¶
Use provided samples or build your own UI:
- Subscribe to
OnContainerChanged - Render slots based on container state
No polling required.
6️⃣ Test & debug¶
Enter Play mode and use debug tools:
- Give items
- Split, merge, swap
- Equip and use items
- Save/load snapshots
- Sort & search
Integration with other RevFramework modules¶
| Module | Interaction |
|---|---|
| Currency & Economy | Uses inventory for buy/sell flows via adapters |
| Crafting | Consumes items from service-managed containers |
| Pickups | Integrates via optional bridges |
| Status / Health | Use-effects can target gameplay systems |
| Netcode | Authority binders enforce permission — replication is external |
🧩 Multiplayer Note¶
RevFramework provides authority gating, not replication.
- Authority binders handle permission checks only
- You must implement:
- replication
- prediction
- rollback / reconciliation
SceneInventoryService remains netcode-agnostic by design.
🗝️ We give you the rules — your netcode drives the simulation.
Extension points¶
IInventoryAuthority→ mutation permission rulesIInventoryService→ replace the default host/orchestrationIInventorySearch/IInventorySorter→ custom search/sort logicIItemDatabase→ custom item sourcesIUseEffect→ custom item behaviour
These seams allow full customisation without modifying internal code.
Typical usage¶
svc.GiveExact(player, new ItemStack { def = potionDef, quantity = 1 }, (ContainerId)"Backpack");
Where to learn¶
- MkDocs Site:
/inventory/ - Videos: Quickstart, Items & Stacks, Slots & Restrictions, Search & Sort, Snapshots
- In-Editor Panels: DebugPanel and Teachable Panels for live inspection