Wire M10.6b probe markers through sessions, evo-server, probe and client
Foundation / checks (checks) (push) Successful in 32m33s
Foundation / checks (client) (push) Successful in 12m28s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (network) (push) Successful in 12m8s
Foundation / checks (postgres) (push) Successful in 40m38s
Foundation / checks (tsan) (push) Successful in 8m4s
Foundation / postgres-tools (push) Successful in 1m36s
Foundation / image (push) Successful in 2m33s
Foundation / server-image (push) Successful in 3m53s

EXPERIMENT (ADR-0094). RegionSessions owns the probe markers: admitted
intentions schedule them, each poll advances them to the simulated tick, and
snapshots carry them. evo-server sets the motion area from the region's
habitat sites; the probe prints its own marker.

The engineering client predicts its marker with the adaptive input lead,
rebases on each snapshot, resends a lost or refused intention, smooths
corrections, draws markers and follows its own with camera and interest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-06 16:07:34 -04:00
co-authored by Claude Opus 5.5
parent ab7e26c02e
commit 96237ca10a
17 changed files with 334 additions and 27 deletions
+1
View File
@@ -65,6 +65,7 @@ void ProbeMarkers::close(std::uint64_t session) {
void ProbeMarkers::clear() noexcept {
entries_.clear();
markers_.clear();
tick_ = 0;
}
std::expected<void, MarkerError> ProbeMarkers::schedule(std::uint64_t session,
+39 -3
View File
@@ -65,7 +65,8 @@ struct RegionSessions::Impl {
network::GrantVerifier v, network::SessionControl s, network::IntentAdmission i,
network::ReplicationServer r)
: config{std::move(c)}, endpoint{std::move(e)}, verifier{std::move(v)},
control{std::move(s)}, intents{std::move(i)}, replication{std::move(r)} {}
control{std::move(s)}, intents{std::move(i)}, replication{std::move(r)},
markers{config.control.max_sessions} {}
RegionSessionsConfig config;
std::unique_ptr<network::quic::Endpoint> endpoint;
@@ -73,6 +74,7 @@ struct RegionSessions::Impl {
network::SessionControl control;
network::IntentAdmission intents;
network::ReplicationServer replication;
network::motion::ProbeMarkers markers; // Ephemeral probe markers (ADR-0094).
std::optional<network::SessionInterest> default_interest;
HostFacts facts;
std::vector<Connection> connections;
@@ -116,6 +118,7 @@ struct RegionSessions::Impl {
if (c.state == State::established) {
intents.close(c.session);
replication.close(c.session);
markers.close(c.session);
}
if (c.session != 0) // May already be released (superseded, expired, epoch).
(void)control.close(c.session).has_value();
@@ -194,6 +197,8 @@ struct RegionSessions::Impl {
}
if (default_interest)
(void)replication.set_interest(c.session, *default_interest).has_value();
if (markers.area()) // Full or refused: the session simply has no marker.
(void)markers.open(c.session).has_value();
c.state = State::established;
c.welcome.server_tick = facts.simulated_tick;
send(c, c.welcome);
@@ -262,7 +267,11 @@ struct RegionSessions::Impl {
const auto* m = std::get_if<network::SessionIntention>(&*decoded);
if (!m)
return close(c, SessionCloseReason::protocol, now);
send_datagram(c, intents.intention(c.session, *m, admission()));
const auto receipt = intents.intention(c.session, *m, admission());
if (receipt.status == network::AdmitStatus::admitted) // Moves the session's marker.
(void)markers.schedule(c.session, m->sequence, m->tick, {m->move_x, m->move_y})
.has_value();
send_datagram(c, receipt);
}
void deliver(const std::vector<network::AccountOutcome>& outcomes) {
@@ -369,7 +378,11 @@ void RegionSessions::poll(const HostFacts& facts, std::uint64_t now_seconds,
if (auto* c = m.by_session(session))
m.close(*c, SessionCloseReason::stale_epoch, now);
(void)m.intents.abandon(); // Kept for queries; no session is left to tell.
m.markers.clear(); // The new epoch may restart at an earlier tick.
}
// Markers reach the simulated tick before this poll's intentions are admitted.
if (facts.ready)
m.markers.advance(facts.simulated_tick);
for (auto& e : m.endpoint->poll()) {
using network::quic::EventKind;
if (e.kind == EventKind::connected) {
@@ -388,6 +401,7 @@ void RegionSessions::poll(const HostFacts& facts, std::uint64_t now_seconds,
if (it->state == Impl::State::established) {
m.intents.close(it->session);
m.replication.close(it->session);
m.markers.close(it->session);
}
if (it->state == Impl::State::pending) {
(void)m.control.close(it->session).has_value();
@@ -459,7 +473,14 @@ void RegionSessions::replicate(
const auto* c = m.by_session(session);
return c && c->state == Impl::State::established ? m.endpoint->datagram_limit(c->id) : 0;
};
for (const auto& [session, chunks] : m.replication.tick(tick, source, perceives, payload))
// The host's state plus the probe markers (all of them; filtered per session).
const auto with_markers = [&](const network::SessionInterest& in) {
auto s = source(in);
s.markers = m.markers.markers();
s.marker_area = m.markers.area();
return s;
};
for (const auto& [session, chunks] : m.replication.tick(tick, with_markers, perceives, payload))
if (const auto* c = m.by_session(session); c && c->state == Impl::State::established)
for (const auto& chunk : chunks)
m.send_datagram(*c, chunk); // A refused chunk leaves the snapshot unacknowledged.
@@ -469,6 +490,21 @@ network::ReplicationStats RegionSessions::replication_stats() const {
return impl_->replication.stats();
}
bool RegionSessions::set_motion_area(const network::motion::Area& area, std::int64_t spawn_x,
std::int64_t spawn_y) {
auto& m = *impl_;
if (!m.markers.set_area(area, spawn_x, spawn_y))
return false;
for (const auto& c : m.connections)
if (c.state == Impl::State::established && !m.markers.of(c.session))
(void)m.markers.open(c.session).has_value();
return true;
}
const network::motion::ProbeMarkers& RegionSessions::markers() const noexcept {
return impl_->markers;
}
void RegionSessions::shutdown(Clock::time_point now) {
for (auto& c : impl_->connections)
impl_->close(c, SessionCloseReason::shutdown, now);