Keep the cell through a lone empty view (no-cell panel blinking)
Foundation / checks (ecs) (push) Successful in 2m22s
Foundation / checks (deploy) (push) Successful in 4m17s
Foundation / checks (network) (push) Successful in 21m4s
Foundation / checks (client) (push) Successful in 22m10s
Foundation / checks (tsan) (push) Successful in 28m58s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 42m32s
Foundation / checks (checks) (push) Canceled after 42m39s

The DEV server still runs a build that sends every session an empty view each tick
around the owner's real one. fcc6c57's client guard covered only an empty view after
the real one of the same tick; the next tick's empty view arriving first still made the
cell vanish for a frame, so the no-cell panel blinked a few times a minute.

While a cell is shown, the client now counts empty views only after 20 ticks (one
second) with no real view. A death is unaffected: it arrives as CellularLifeEnded. The
session test covers both orders and the grace running out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-19 11:14:36 -04:00
co-authored by Claude Opus 5.5
parent 5e168d67c3
commit ae2a2d78ba
3 changed files with 50 additions and 16 deletions
+15 -4
View File
@@ -29,6 +29,8 @@ struct RegionSessionClient::Impl {
std::vector<network::PrimitiveLifeOutcome> primitive_life_outcomes;
std::optional<network::SnapshotAssembler> snapshots;
std::optional<network::CellularPerception> cellular_perception;
// First tick of a run of empty views while a cell was shown (0: none). See message().
std::uint64_t empty_since{};
std::optional<network::CellularMutationOffer> mutation_offer;
std::optional<network::CellularLifeEnded> life_ended;
std::uint64_t snapshot_chunks{}, snapshot_bytes{};
@@ -145,11 +147,20 @@ struct RegionSessionClient::Impl {
return keep(action_outcomes, *m);
if (const auto* m = std::get_if<network::CellularPerception>(&*decoded)) {
seen_tick(m->tick);
// An empty view never replaces a real one of the same tick: older servers
// sent both, and the cell vanished for a frame (input stopped, panels opened).
// Older servers send every session an empty view each tick around the real
// one, in either order, so a lone empty view made the cell vanish for a frame
// (input stopped, the no-cell panel blinked). While a cell is shown, empty
// views count only after a second of ticks with no real view; a death still
// arrives at once as CellularLifeEnded.
constexpr std::uint64_t empty_grace_ticks = 20;
if (m->life_identity == 0 && cellular_perception &&
cellular_perception->tick == m->tick && cellular_perception->life_identity != 0)
return;
cellular_perception->life_identity != 0) {
if (empty_since == 0)
empty_since = m->tick;
if (m->tick < empty_since + empty_grace_ticks)
return;
}
empty_since = 0;
cellular_perception = *m;
return;
}