NetworkTransform: half-float base update dropped as out of order when UseUnreliableDeltas is on, so later deltas decode ~2 m off
Maintainer antworten meist innerhalb von 3 Tagen
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 57/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- networking
Rechercherichtung
Start in NetworkTransform.cs at the out-of-order check in OnNetworkStateChanged (around line 3326 in 2.13.3) and the serialization logic around lines 739–747 that marks half-float base updates reliable. Trace how SynchronizeBaseHalfFloat updates NetworkDeltaPosition when a late state arrives. Done when a late base is retained or applied so subsequent deltas decode against it; verify with the described jitter and packet-loss reproduction.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
With UseHalfFloatPrecision and UseUnreliableDeltas both on, a non-authority NetworkTransform can lose a half-float base update and then decode every following delta against the old base. The object is drawn about 2 m off (one MaxDeltaBeforeAdjustment step) until the next unreliable frame sync, up to a second later.
How it happens (line numbers from 2.13.3; the same code is in develop-3.x.x today):
- When an axis's delta reaches
NetworkDeltaPosition.MaxDeltaBeforeAdjustment(2 m), the delta collapses into a new base. That state is flaggedSynchronizeBaseHalfFloatand sent reliably (NetworkTransformState.NetworkSerialize,NetworkTransform.cs:739-747:UseHalfFloatPrecision && NetworkDeltaPosition.CollapsedDeltaIntoBase→ReliableSequenced = true). - The deltas that follow go unreliably. Under jitter or a lost packet, a newer unreliable delta can arrive before the reliable base update.
- When the base update then arrives, it has an older tick than the state already applied.
OnNetworkStateChangeddrops it (NetworkTransform.cs:3326):
Teleports and frame syncs are exempt, but a base sync isn't.if (UseUnreliableDeltas && oldState.NetworkTick > newState.NetworkTick && !newState.FlagStates.IsTeleportingNextFrame && !newState.FlagStates.UnreliableFrameSync) { return; } - The non-authority's
NetworkDeltaPositionkeeps the old base, so every later half-float delta decodes about 2 m off until a frame sync corrects it.
Reproduce Steps
- A player prefab with an owner-authoritative
NetworkTransform:UseHalfFloatPrecisionon,UseUnreliableDeltason, position synced on all axes, interpolation on. - Host + 1 client (client-server). Simulate a poor connection on the host: about 75 ms delay with ±20 ms jitter and 2% packet loss (Unity Transport's simulator pipeline, or the Multiplayer Tools network simulator).
- The client walks in a straight line at about 4.5 m/s for 20–30 s.
- On the host, compare its copy of the client's player with the client's real position (log both every frame).
Actual Outcome
The host's copy usually trails by about 0.6 m, but every few seconds it jumps 2 m or more off for up to a second. In our measurements it was 2.5–4.6 m behind during those stretches. Logging NetworkDeltaPosition on both sides during one of them: the host's base on the walking axis was 4.17 m while the client's was 6.25 m (one 2 m step plus the delta).
Expected Outcome
A late base update is still applied (at least its base), so later deltas decode against the right base. Two possible fixes:
- exempt
SynchronizeBaseHalfFloatstates from the out-of-order rule, as teleports and frame syncs are; - or apply the base of a dropped state to
NetworkDeltaPositioneven when its position is ignored.
Screenshots
None. The numbers above come from per-frame logs.
Environment
- OS: Windows 11 Pro
- Unity Version: 6000.3.27f1
- Netcode Version: 2.13.3 (also present in
develop-3.x.xand 3.2.0: the same check is atNetworkTransform.cs:3345there) - Netcode Commit: the v2.13.3 release
- Netcode Topology: Client-Server (host)
Additional Context
- Unity Transport 2.7.4.
- With full-precision positions (half floats off, unreliable deltas kept) the host's copy stays within 0.82 m over the same walk, so the drops come from the base sync.
- Our workaround: never combine half floats with unreliable deltas on a
NetworkTransform. - Earlier half-float fixes (#2791, #2922) don't cover this ordering case, as far as we can tell.
- Vorherrschende Sprache
- C#
- Sterne
- 2.3k
- Forks
- 465
- Ø Merge
- 3 T. 12 Std.
- Gemergte PRs (30 T.)
- 39
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Unity-Technologies/com.unity.netcode.gameobjects
-
TimeSyncMessage is sent reliably, so a late one resets the client clock backwards and stalls its NetworkTransformsEvtl. vergeben @reginaldalfret hat das vor 7 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
Unity-Technologies/com.unity.netcode.gameobjects#4249 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Tracking type:feature-2.x
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Tracking type:feature
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
priority:medium stat:imported type:feature type:feature-2.x
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
Unity-Technologies/com.unity.netcode.gameobjects#3706 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Client NetworkObjects experience Awake, Start, OnEnable, and TriggerEnter, CollisionEnter at world 0,0,0 upon instantiationEvtl. wieder frei @NoelStephensUnity hat das vor 492 Tagen übernommen, und es ist kein Pull Request offen. Offenpriority:medium stat:imported type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3553 · 3 Kommentare · 2 Reaktionen · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in Unity-Technologies/com.unity.netcode.gameobjects
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
umbraco/Umbraco.Automate#612 ·
Maintainer antworten meist innerhalb von 1 Tag
-
崩溃日志只按 CRLF 分行Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
PCL-Community/PCL-CE#3872 ·
Maintainer antworten meist innerhalb von 1 Tag
-
type:task ux
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
elsa-workflows/elsa-foundation#5253 ·
Maintainer antworten meist innerhalb von 1 Tag