feat: WorldResyncAsync, to ask for a fresh baseline after frames go missing - #51
Closed
Taure wants to merge 1 commit into
Closed
feat: WorldResyncAsync, to ask for a fresh baseline after frames go missing#51Taure wants to merge 1 commit into
Taure wants to merge 1 commit into
Conversation
…issing asobi v0.89.0 stamps `zone`, `frame_seq` and `kf` on the world.tick payload. This SDK hands OnWorldTick the raw payload string and parses none of it, so all three already reach the game untouched - nothing was needed to expose them, and this SDK is better off than the typed ones for that reason. What was missing is the repair. Adds WorldResyncAsync(zoneX, zoneY), which asks the server to re-send one zone's complete baseline. One zone rather than the interest ring, which is nine zones at the default view radius, and the caller already knows which zone gapped because the sequence is per zone. No gap DETECTOR here, and that is a decision rather than an omission. asobi-godot got one, but its dispatcher already holds a parsed Dictionary; this one holds a string, and the only scanner available is JsonScan.ExtractField, which takes the first match in the whole document. An entity inside `updates` carrying a field named `zone`, `frame_seq` or `kf` would be read instead of the envelope's own, silently and with no way for the caller to notice. Adding a real JSON reader to support a detector costs far more than the detector is worth, and the game already parses the frame to use `updates` at all, so it is better placed to read the sequence than the SDK is. The XML doc on WorldResyncAsync explains all of that, plus the two things a caller must get right: key entities on `zone`, and adopt a `kf` frame even when its frame_seq is LOWER, because a zone restart resets the sequence while the zone's identity does not. The payload construction lives in WsFrame rather than AsobiRealtime, and that placement is the point. Tests/AsobiCore.NET compiles WsFrame.cs but NOT AsobiRealtime.cs, which references UnityEngine and cannot build outside the editor - so anything written there is invisible to CI. Putting the frame-building in WsFrame, beside WorldInputPayload where it belongs by symmetry, makes the part that can actually be wrong testable. What remains untested is a single delegating call. Formatted with the invariant culture, and tested for it: a long carries no decimal separator, but a culture that groups digits would splice a separator into the array and produce a frame the server rejects as malformed - a bug that only appears on someone else's machine. Tests: three cases covering an ordinary coordinate pair, zero and negative coordinates (zone [0,0] is a real zone and coordinates run negative either side of the origin), and de-DE culture invariance. Suite 132/132.
Contributor
Author
|
Closing: this branch was a stale local leftover. The work it carried is already on main (merged as an earlier PR), and I opened this without fetching origin/main first, so it read as unmerged. The binary-wire half has been rebased onto current main and reopened where applicable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
WorldResyncAsyncand per-zoneworld.tickhandling for the three fieldsasobi v0.89.0 added (ADR 0011).
zonecloses a live corruption path. A player is subscribed to an interest ringof several zones, each an independent server process, and messages are ordered
per sender only. Crossing a boundary emits
op:"r"from the zone you left andop:"a"from the zone you entered, from two different senders, so they canarrive in either order - and applied into one flat table the removal can land
last and delete an entity the client never hears about again.
frame_seqis contiguous per zone, so a gap in it means loss andWorldResyncrepairs it.
tickcannot do that job: it skips onbroadcast_intervaland issuppressed on a quiet tick.
Server side is already live on all four environments.