Wire M10.8c-1 region handoff: protocol v4, durable probes, crossing, ghosts
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s
ADR-0096. Session protocol v4 (v3 is deployed and frozen) adds HandoffOffer, SessionRedirect, close reasons handed_off and moved, and ghost marker records. Sessions use the durable probe record: logins open it where it was saved (redirected when it lives elsewhere), and session ends save it. A marker crossing into a neighbour's area is frozen, prepared, its control released and a signed ticket offered; uncommitted transfers are aborted after the ticket's lifetime. The destination shows arriving probes as ghosts (schema v13 incoming_probe_transfers) and opens the marker where it crossed. Refreshes the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -105,7 +105,8 @@ std::vector<PresentedMarker> MarkerInterpolator::at(double render_tick) {
|
||||
const auto& newest = snapshots_.back();
|
||||
const auto show = [&](const Snapshot& s) {
|
||||
for (const auto& m : s.markers)
|
||||
out.push_back({m.id, static_cast<double>(m.state.x), static_cast<double>(m.state.y)});
|
||||
out.push_back({m.id, static_cast<double>(m.state.x), static_cast<double>(m.state.y),
|
||||
false, false, m.ghost});
|
||||
};
|
||||
if (render_tick >= static_cast<double>(newest.tick)) {
|
||||
// Beyond the newest snapshot: continue the held vector briefly, then freeze (stale).
|
||||
@@ -116,7 +117,7 @@ std::vector<PresentedMarker> MarkerInterpolator::at(double render_tick) {
|
||||
out.push_back({m.id,
|
||||
static_cast<double>(m.state.x) + motion_um(m.state.vector.x, ticks),
|
||||
static_cast<double>(m.state.y) + motion_um(m.state.vector.y, ticks),
|
||||
ticks > 0, stale});
|
||||
ticks > 0, stale, m.ghost});
|
||||
stats_.extrapolated_frames += ticks > 0 ? 1 : 0;
|
||||
stats_.stale_frames += stale ? 1 : 0;
|
||||
return out;
|
||||
@@ -142,14 +143,16 @@ std::vector<PresentedMarker> MarkerInterpolator::at(double render_tick) {
|
||||
const auto next = std::ranges::lower_bound(b->markers, m.id, {}, &RemoteMarker::id);
|
||||
if (next == b->markers.end() || next->id != m.id) {
|
||||
// Removed by b: shown where it was until b's tick, never moved toward a removal.
|
||||
out.push_back({m.id, static_cast<double>(m.state.x), static_cast<double>(m.state.y)});
|
||||
out.push_back({m.id, static_cast<double>(m.state.x), static_cast<double>(m.state.y),
|
||||
false, false, m.ghost});
|
||||
continue;
|
||||
}
|
||||
const auto lerp = [t](std::int64_t from, std::int64_t to) {
|
||||
return static_cast<double>(from) +
|
||||
((static_cast<double>(to) - static_cast<double>(from)) * t);
|
||||
};
|
||||
out.push_back({m.id, lerp(m.state.x, next->state.x), lerp(m.state.y, next->state.y)});
|
||||
out.push_back({m.id, lerp(m.state.x, next->state.x), lerp(m.state.y, next->state.y), false,
|
||||
false, next->ghost});
|
||||
}
|
||||
return out; // Markers new in b appear from b's tick.
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ struct RegionSessionClient::Impl {
|
||||
std::vector<network::ActionOutcome> action_outcomes;
|
||||
std::optional<network::SnapshotAssembler> snapshots;
|
||||
std::uint64_t snapshot_chunks{}, snapshot_bytes{};
|
||||
static constexpr std::size_t max_kept = 1024; // Per kind, until taken; oldest dropped.
|
||||
std::optional<network::HandoffOffer> handoff; // v4: continue at another region.
|
||||
std::optional<network::RegionAddress> redirect; // v4: the probe is owned elsewhere.
|
||||
static constexpr std::size_t max_kept = 1024; // Per kind, until taken; oldest dropped.
|
||||
|
||||
template <typename T> static void keep(std::vector<T>& list, const T& item) {
|
||||
if (list.size() >= max_kept)
|
||||
@@ -95,6 +97,10 @@ struct RegionSessionClient::Impl {
|
||||
if (const auto* m = std::get_if<network::SessionClose>(&*decoded))
|
||||
return end(m->reason, false);
|
||||
if (state == RegionSessionState::awaiting_welcome) {
|
||||
if (const auto* m = std::get_if<network::SessionRedirect>(&*decoded)) {
|
||||
redirect = m->owner; // A Close (moved) follows.
|
||||
return;
|
||||
}
|
||||
if (const auto* m = std::get_if<network::SessionWelcome>(&*decoded)) {
|
||||
welcome = *m;
|
||||
snapshots.emplace(world::WorldIdentity{m->world, m->frame}, m->epoch);
|
||||
@@ -115,6 +121,10 @@ struct RegionSessionClient::Impl {
|
||||
}
|
||||
if (const auto* m = std::get_if<network::ActionOutcome>(&*decoded))
|
||||
return keep(action_outcomes, *m);
|
||||
if (const auto* m = std::get_if<network::HandoffOffer>(&*decoded)) {
|
||||
handoff = *m; // A Close (handed_off) follows.
|
||||
return;
|
||||
}
|
||||
}
|
||||
end(SessionCloseReason::protocol, true);
|
||||
}
|
||||
@@ -258,6 +268,14 @@ std::uint64_t RegionSessionClient::snapshot_bytes() const noexcept {
|
||||
return impl_->snapshot_bytes;
|
||||
}
|
||||
|
||||
std::optional<network::HandoffOffer> RegionSessionClient::take_handoff() {
|
||||
return std::exchange(impl_->handoff, std::nullopt);
|
||||
}
|
||||
|
||||
const std::optional<network::RegionAddress>& RegionSessionClient::redirect() const noexcept {
|
||||
return impl_->redirect;
|
||||
}
|
||||
|
||||
RegionSessionState RegionSessionClient::state() const noexcept {
|
||||
return impl_->state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user