Skip to content

🌐 Netcode Samples (Example Only)

⚠️ Important Disclaimer
These files are illustrative only — they show the minimal authority-gating pattern for popular netcode stacks.
They are not a drop-in multiplayer inventory system.
You are responsible for replication, prediction, reconciliation, and game-specific rules.

🧩 InventorySystem is netcode-agnostic.
It does not depend on NGO, Mirror, or Fusion.


Purpose

Provide minimal examples of how to integrate the Inventory system’s authority model (IInventoryAuthority)
with different multiplayer frameworks — without introducing any hard dependencies.


Contents

Stack Files Description
NGO InventoryAuthorityBinder_NGO.cs, NgoInventoryServerProxy.cs Uses ServerRpc / ClientRpc patterns.
Mirror InventoryAuthorityBinder_Mirror.cs, MirrorInventoryServerProxy.cs Uses Command / ClientRpc patterns.
Fusion InventoryAuthorityBinder_Fusion.cs, FusionInventoryServerProxy.cs Uses Fusion RPCs between Input/State authority.

Folder layout:

Demos/
  NetcodeSamples/
    NGO/
    Mirror/
    Fusion/

Each folder is self-contained and can be dropped into a project that already uses that netcode.


🧠 What These Samples Cover

Do: - Implement authority gating via IInventoryAuthority binders.
- Demonstrate server-authoritative inventory flows using minimal “ServerProxy” examples.
- Show where to attach the binder (same GameObject as your NetworkObject / NetworkIdentity).

🚫 Don’t: - Handle inventory replication or rollback.
- Provide prediction or reconciliation.
- Replace your game’s own inventory rules.


⚙️ Enabling the Samples (Scripting Define Symbols)

Add the appropriate define in Project Settings → Player → Other Settings → Scripting Define Symbols.

Stack Define
NGO REV_USE_NGO
Mirror REV_USE_MIRROR
Fusion REV_USE_FUSION

If a define is missing, the scripts for that stack will not compile — this is intentional.


🧩 Authority Quick Start

Single-player / local testing:
- Use the default InventoryAuthorityBinder (always true). Done.

Authoritative multiplayer:

  1. Add exactly one binder that implements IInventoryAuthority on the same GameObject as the inventory owner.
  2. NGO → InventoryAuthorityBinder_NGO
  3. Mirror → InventoryAuthorityBinder_Mirror
  4. Fusion → InventoryAuthorityBinder_Fusion
  5. In your UI/client code, send inventory mutations through the server proxy RPCs (or an equivalent server-authoritative path).
  6. (Optional) Send lightweight RPCs back to clients for HUD/SFX updates.

If no binder is found, service-level mutations will be denied and logged once.


🔁 Typical Flow (All Stacks)

  1. Client requests an inventory change via RPC.
  2. Server validates authority using your binder.
  3. Server applies the mutation via SceneInventoryService (GiveExact, RemoveByGuid, etc.).
  4. (Optional) Server notifies clients for UI or feedback.
  5. Replication of container contents is handled by your netcode stack.

🧱 Per-Stack Notes

NGO (Netcode for GameObjects)

  • Use a NetworkVariable<InventoryDTO> or similar to replicate data.
  • Client → Server RPC for operations.
  • Optional Server → Client RPC for UI sync.
  • Binder: InventoryAuthorityBinder_NGO.

Mirror

  • Use [SyncVar] or custom messages for replication.
  • [Command] → server mutation; [ClientRpc] optional feedback.
  • Binder: InventoryAuthorityBinder_Mirror.

Fusion

  • Use [Networked] or server-broadcast RPCs for replication.
  • RpcSources.InputAuthority → RpcTargets.StateAuthority for mutation requests.
  • Binder: InventoryAuthorityBinder_Fusion.

⚠️ Gotchas

  • No binder → mutations denied (InvOpCode.NoAuthority).
  • Multiple binders → resolver only uses the first one it finds.
  • Authority ≠ replication → binder gates only; it doesn’t replicate data.
  • Defines → must include the correct REV_USE_* or samples won’t compile.
  • ServiceMissing → still requires SceneInventoryService + ItemDatabase in scene.

  • Authority → how authority is resolved
  • Services → where inventory operations are applied
  • Snapshots → capturing state for replication payloads

🧰 Troubleshooting

Issue Likely Cause Fix
“NoAuthority” results Missing or inactive binder Add correct binder or use always-true binder for SP.
No replication on clients You must replicate state manually Use SyncVar / NetworkVariable / [Networked].
Prediction/lag issues Out of scope Follow your chosen stack’s docs.
Compilation errors Missing REV_USE_* define Add correct define in Project Settings.

Support Stance

These examples are educational only.
RevFramework does not provide replication, rollback, or reconciliation.

  • Single-player: use the local always-true binder.
  • Multiplayer: implement your own replication and rules via your netcode stack.

Multiplayer functionality is explicitly out of scope for RevFramework.