feat: Add multiplayer networking architecture and documentation updates

- Updated Master Blueprint Index to include Multiplayer Networking support.
- Added detailed Multiplayer Networking sections across all developer documentation (01-11).
- Introduced authority maps, key patterns, and RPC guidelines for each system.
- Established a comprehensive multiplayer networking architecture document outlining core principles, replication strategies, and anti-cheat considerations.
- Enhanced UI documentation to clarify local-only behavior and binding to replicated dispatchers.
- Implemented client prediction strategies and RPC naming conventions for consistency across the framework.
This commit is contained in:
Lefteris Notas
2026-05-19 17:15:57 +03:00
parent b2b6e1e7c7
commit 8bc731e5ae
35 changed files with 1259 additions and 11 deletions

View File

@@ -292,4 +292,96 @@
---
## Multiplayer Networking Patterns
### Pattern 11: Server Authority Gate
**When to Use:** Every function that modifies replicated state.
**Blueprint Implementation:**
```
[Function: ApplyDamage(DamageEvent)]
Switch HasAuthority
Authority:
→ Execute authoritative logic (damage calc, health modification)
→ Fire dispatchers
Remote:
→ Return (client cannot modify replicated state directly)
→ Client calls Server_ RPC to request the change
```
**Key Rule:** Never modify a replicated variable without `HasAuthority()` check.
### Pattern 12: Server RPC Wrapper
**When to Use:** Client needs to request a state change from the server.
**Blueprint Implementation:**
```
[Client Event Graph — Input: Interact pressed]
→ Call Server_Interact(TargetActor) // RPC: Run on Server, Reliable
[Server RPC: Server_Interact(TargetActor)]
Switch HasAuthority
Authority:
→ Validate distance, conditions
→ Call I_Interactable.Execute_OnInteract(TargetActor, Instigator)
→ State changes replicate automatically
```
**Naming:** All Server RPCs prefixed with `Server_`.
### Pattern 13: OnRep Dispatcher Relay
**When to Use:** Any replicated variable that should trigger the same effects as single-player.
**Blueprint Implementation:**
```
[Variable: CurrentHealth]
Replication: Replicated Using OnRep_CurrentHealth
[Function: OnRep_CurrentHealth]
→ Broadcast OnHealthChanged(OldHealth, CurrentHealth, Delta)
→ UI, audio, effects react exactly as in single-player path
→ No multiplayer-specific code in consumer systems
```
**Key Rule:** `OnRep_` fires the SAME dispatcher the SP mutation code fires. Zero consumer changes needed.
### Pattern 14: Client Prediction with Correction
**When to Use:** Actions that need instant feedback (firing, using items, interacting).
**Blueprint Implementation:**
```
[Client: Input → Fire pressed]
→ Client prediction: play fire animation, muzzle flash, reduce ammo display
→ Call Server_StartFire()
[Server: Server_StartFire()]
→ Validate weapon state, ammo, cooldown
→ If valid: execute authoritative fire logic, consume ammo
→ If invalid: log warning, return (client will be corrected via OnRep)
[Client: OnRep_Ammo]
→ If server count matches client prediction: no visible change
→ If different: correct ammo display, stop fire animation
```
### Pattern 15: Multicast for Cosmetic Events
**When to Use:** Server needs to trigger a cosmetic-only event on all clients.
**Blueprint Implementation:**
```
[Server: Explosion triggered]
→ Multicast_PlayExplosionFX(Location, Radius)
→ All clients play VFX, SFX, camera shake locally
→ No replication of individual particles
```
**Key Rule:** Multicast is for **cosmetic only** — never use for state changes. State changes replicate via variable RepNotify.
---
*Implementation Patterns v1.0 — Reference when building blueprint specs into UE5 Blueprint assets.*