🌐 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:
- Add exactly one binder that implements
IInventoryAuthorityon the same GameObject as the inventory owner. - NGO →
InventoryAuthorityBinder_NGO - Mirror →
InventoryAuthorityBinder_Mirror - Fusion →
InventoryAuthorityBinder_Fusion - In your UI/client code, send inventory mutations through the server proxy RPCs (or an equivalent server-authoritative path).
- (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)¶
- Client requests an inventory change via RPC.
- Server validates authority using your binder.
- Server applies the mutation via
SceneInventoryService(GiveExact,RemoveByGuid, etc.). - (Optional) Server notifies clients for UI or feedback.
- 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.StateAuthorityfor 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+ItemDatabasein scene.
🧩 Related¶
- 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.