Skip to content

Add ContinuousChannel field to NetworkAnimator for split-channel sync (events stay reliable, continuous values opt-in unreliable)#1039

Open
isaiahgrant wants to merge 1 commit intoFirstGearGames:mainfrom
isaiahgrant:feature/networkanimator-split-channel
Open

Add ContinuousChannel field to NetworkAnimator for split-channel sync (events stay reliable, continuous values opt-in unreliable)#1039
isaiahgrant wants to merge 1 commit intoFirstGearGames:mainfrom
isaiahgrant:feature/networkanimator-split-channel

Conversation

@isaiahgrant
Copy link
Copy Markdown
Contributor

Problem

In games with many concurrent NetworkAnimators (zombie hordes, large-scale RTS, etc.), continuous parameter sync (floats, layer weights, speed) generates steady reliable-channel pressure on every tick. With enough instances this saturates the reliable lane on lossy transports — in our case we hit Steam P2P send-buffer overflow during high-density frames, eventually causing connections to drop.

Our take: The reliable channel isn't the right fit for continuous interpolated values: a missed packet doesn't matter, the next tick supersedes it. But triggers and state changes are one-shots that do need to arrive.

Solution

Add a per-instance ContinuousChannel field on NetworkAnimator that lets you opt continuous values onto Unreliable while keeping triggers, state changes, and crossfades on Reliable.

  • Continuous values (bool/float/int parameters, layer weights, speed) → _continuousChannel
  • Events (triggers, STATE, CROSSFADE) → always Reliable

Default is Channel.Reliable, which routes through the original code path bit-for-bit unchanged. Existing projects see no behavior change. The split-channel path is only entered when an instance opts in.

ContinuousChannel is exposed as a public property and can be flipped at runtime — useful for distance-based importance (Reliable when close to a player, Unreliable when far).

Implementation notes

  • New AnimatorUpdatedSplit writes to two pooled writers in parallel — same logic as AnimatorUpdated, just routed by category.
  • Two new TargetRpcs and two new ServerRpcs carry the streams. Receive logic is shared with the existing path via
    ReceiveTargetAnimatorPayload / ReceiveServerAnimatorPayload, so deserialization stays identical.
  • No changes to wire format on the existing path. No changes to existing public API.

Testing

Tested in a 4-player co-op zombie game with up to 300 concurrent NetworkAnimators per host. Reliable-lane pressure on the host's outbound traffic dropped substantially with ContinuousChannel = Unreliable, and Steam P2P disconnects during burst spawns stopped reproducing. Triggers (hit reactions, attack states) still arrive reliably.

… (events stay reliable, continuous values opt-in unreliable).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant