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:
@@ -337,4 +337,70 @@ flowchart TD
|
||||
|
||||
---
|
||||
|
||||
## 11. Multiplayer Networking (Expanded)
|
||||
|
||||
### Replicated Variables (Existing + New)
|
||||
|
||||
| Variable | Type | Condition | Description |
|
||||
|----------|------|-----------|-------------|
|
||||
| `CurrentHealth` | `Float` | `Replicated Using OnRep_CurrentHealth` | Clients sync via OnRep → dispatcher |
|
||||
| `DeathState` | `E_DeathState` | `Replicated Using OnRep_DeathState` | Death state synced; OnRep triggers death effects |
|
||||
| `bIsInvincible` | `Boolean` | `Replicated` | Invincibility visible to other players |
|
||||
| `MaxHealth` | `Float` | `Replicated` | Synced for UI percentage calculations |
|
||||
|
||||
### Server RPCs
|
||||
|
||||
| RPC | Direction | Description |
|
||||
|-----|-----------|-------------|
|
||||
| `Server_ApplyDamage` | Client→Server | Client reports taking damage. Server validates source, range, damage type. |
|
||||
| `Server_ApplyHealing` | Client→Server | Client requests healing. Server validates heal source, applies. |
|
||||
| `Server_KillInstant` | Client→Server | Only accepted from authoritative sources (GM, traps). Client calls are rejected. |
|
||||
|
||||
### Authority Gates
|
||||
|
||||
```
|
||||
Function ApplyDamage(DamageEvent)
|
||||
Switch HasAuthority
|
||||
Authority:
|
||||
→ Calculate resistance, apply damage, fire dispatchers
|
||||
Remote:
|
||||
→ Return (clients never modify health directly)
|
||||
→ Server_ApplyDamage is called by damage source (weapon/trap), not victim
|
||||
|
||||
Function ApplyHealing(HealAmount)
|
||||
Switch HasAuthority
|
||||
Authority:
|
||||
→ Apply healing, fire dispatchers
|
||||
Remote:
|
||||
→ Return
|
||||
→ Consumable use calls Server_UseConsumable → server calls ApplyHealing
|
||||
```
|
||||
|
||||
### Client Prediction
|
||||
|
||||
- **Health bar:** Client predicts damage flash on hit; server-corrected value arrives via `OnRep_CurrentHealth`.
|
||||
- **Death:** No prediction. `OnRep_DeathState` triggers all death effects (screen fade, ragdoll).
|
||||
- **Healing:** Client shows green flash immediately + predicted health; server corrects within one RTT.
|
||||
- **Invincibility:** Visual effect (shield shimmer) is local cosmetic; state is replicated.
|
||||
|
||||
### OnRep Handlers
|
||||
|
||||
```
|
||||
OnRep_CurrentHealth()
|
||||
→ Broadcast OnHealthChanged(OldHealth, CurrentHealth, Delta)
|
||||
→ UI updates identically to single-player path
|
||||
|
||||
OnRep_DeathState()
|
||||
→ Broadcast OnDeathStateChanged(OldState, NewState)
|
||||
→ If Dead: play death animation, screen effects, notify GM
|
||||
```
|
||||
|
||||
### Anti-Cheat
|
||||
|
||||
- Server validates all `Server_ApplyDamage` calls: check instigator range, weapon fire rate, damage type validity.
|
||||
- Server never trusts `DamageEvent.BaseAmount` from client — always recalculates from weapon data.
|
||||
- `Server_KillInstant` is only callable from server-authoritative systems (traps, death zones, GM).
|
||||
|
||||
---
|
||||
|
||||
*Blueprint Spec: Health System. Conforms to TEMPLATE.md v1.0 — part of the UE5 Modular Game Framework.*
|
||||
Reference in New Issue
Block a user