Stop the cell vanishing for a frame; eating glows instead of pulsing
Foundation / checks (deploy) (push) Successful in 26s
Foundation / checks (network) (push) Successful in 29s
Foundation / checks (ecs) (push) Successful in 53s
Foundation / checks (client) (push) Successful in 57s
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 5m32s
Foundation / checks (tsan) (push) Canceled after 5m8s
Foundation / checks (postgres) (push) Canceled after 5m33s

Every tick the server sent each cellular session an empty view and then the owner's
real view. When the two landed in different client frames the client saw no cell:
steering stopped, the "no active cell" panel popped up, and every visible bubble
"vanished" at once and played its pop, a wave across the screen at random moments
(likelier with v11's larger views).

- Server: a session given a view this tick is no longer cleared in the same tick; the
  clear now follows every owner's view and reaches only sessions that got none.
- Client: an empty view never replaces a real one of the same tick (older servers).
- Only a bubble that was being eaten when last seen fades when it disappears; leaving
  the view or an empty view draws nothing.
- Eating is a soft glow in the bubble's colour, fading in and out about 1.5 times a
  second, instead of a size pulse; a finished bubble's glow shrinks and fades.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-17 10:56:27 -04:00
co-authored by Claude Opus 5.5
parent 43113e6c35
commit fcc6c57320
7 changed files with 65 additions and 22 deletions
+13 -6
View File
@@ -476,6 +476,7 @@ int main(int argc, char** argv) try {
double x_mm{}, y_mm{};
std::uint32_t radius_um{};
int channel{};
bool drained{}, bubble{};
};
struct LivePop {
SeenDeposit at;
@@ -785,8 +786,12 @@ int main(int argc, char** argv) try {
if (stock.at(c) > stock.at(static_cast<std::size_t>(channel)))
channel = static_cast<int>(c);
const SeenDeposit seen{static_cast<double>(d.x_um) / 1000,
static_cast<double>(d.y_um) / 1000, d.radius_um,
channel};
static_cast<double>(d.y_um) / 1000,
d.radius_um,
channel,
d.drained,
d.shape ==
evo::network::CellularDepositShape::bubble};
current[d.id] = seen;
const auto centre = camera->world_to_screen({seen.x_mm, seen.y_mm});
const auto edge = camera->world_to_screen(
@@ -804,11 +809,13 @@ int main(int argc, char** argv) try {
drawn.seed = d.id;
scene.deposits.push_back(drawn);
}
// A bubble absent from a newer view while its old spot is still in
// sight ran out (or left the sensor's edge, which a pop also suits).
if (perception->tick != seen_deposit_tick) {
// A bubble that was being eaten and is gone from a newer view of the
// same life ran out: it fades. Anything else that leaves the view (out
// of range, or an empty view) just stops being drawn.
if (perception->tick != seen_deposit_tick && perception->life_identity != 0) {
for (const auto& [id, old] : seen_deposits)
if (!current.contains(id) && live_pops.size() < 256)
if (old.bubble && old.drained && !current.contains(id) &&
live_pops.size() < 64)
live_pops.push_back({old, now_pop});
seen_deposits = std::move(current);
seen_deposit_tick = perception->tick;
+21 -12
View File
@@ -782,18 +782,25 @@ std::size_t dominant_channel(const std::array<std::uint64_t, 5>& stock) {
return best;
}
// ADR-0136: a bubble is a translucent circle in its nutrient's colour, sized by what it
// holds (never below its contact disc), and pulsing while something drains it.
// holds (never below its contact disc). While something eats it, a soft glow of its own
// colour fades in and out around it; the bubble itself keeps its size.
void draw_bubble(ImDrawList& list, const SceneDeposit& d, float time) {
const auto channel = dominant_channel(d.stock);
const auto total = static_cast<double>(std::max<std::uint64_t>(1, d.stock.at(channel)));
const float scale =
std::clamp(0.7F + 0.12F * static_cast<float>(std::log10(total)), 0.8F, 2.2F);
float r = std::max(d.radius * scale * 0.5F, 2.5F);
if (d.drained)
r *=
1.0F + 0.25F * (0.5F + 0.5F * std::sin(time * 18.0F + static_cast<float>(d.seed % 7U)));
const float r = std::max(d.radius * scale * 0.5F, 2.5F);
auto color = nutrient_colors.at(channel);
const auto alpha = static_cast<unsigned>(d.stale ? 90 : (d.drained ? 255 : 200));
if (d.drained && !d.stale) {
// About 1.5 glows a second, eased: a breathing light, not a shock wave.
const float phase = 0.5F - 0.5F * std::cos(time * 9.0F + static_cast<float>(d.seed % 7U));
for (int ring = 3; ring >= 1; --ring) {
const auto glow = static_cast<unsigned>(phase * 34.0F / static_cast<float>(ring));
list.AddCircleFilled({d.x, d.y}, r * (1.0F + 0.45F * static_cast<float>(ring)),
(color & 0x00FFFFFFU) | (glow << IM_COL32_A_SHIFT));
}
}
const auto alpha = static_cast<unsigned>(d.stale ? 90 : 210);
color = (color & 0x00FFFFFFU) | (alpha << IM_COL32_A_SHIFT);
list.AddCircleFilled({d.x, d.y}, r, (color & 0x00FFFFFFU) | ((alpha / 3) << IM_COL32_A_SHIFT));
list.AddCircle({d.x, d.y}, r, color, 0, std::max(1.0F, r * 0.18F));
@@ -837,14 +844,16 @@ void draw_pool(ImDrawList& list, const SceneDeposit& d, float time) {
}
}
}
// A bubble that ran out: its glow shrinks and fades away where it was.
void draw_pop(ImDrawList& list, const ScenePop& p) {
const float t = std::clamp(p.age, 0.0F, 1.0F);
const auto alpha = static_cast<unsigned>(220.0F * (1.0F - t));
const auto color =
(nutrient_colors.at(static_cast<std::size_t>(std::clamp(p.channel, 0, 4))) & 0x00FFFFFFU) |
(alpha << IM_COL32_A_SHIFT);
list.AddCircle({p.x, p.y}, std::max(p.radius, 3.0F) * (0.6F + 1.6F * t), color, 0,
1.5F * (1.0F - t) + 0.5F);
const auto base =
nutrient_colors.at(static_cast<std::size_t>(std::clamp(p.channel, 0, 4))) & 0x00FFFFFFU;
const float r = std::max(p.radius * 0.5F, 2.5F) * (1.0F - 0.7F * t);
list.AddCircleFilled({p.x, p.y}, r * 1.6F,
base | (static_cast<unsigned>(40.0F * (1.0F - t)) << IM_COL32_A_SHIFT));
list.AddCircleFilled({p.x, p.y}, r,
base | (static_cast<unsigned>(160.0F * (1.0F - t)) << IM_COL32_A_SHIFT));
}
// The eyepiece: everything outside a rounded viewport is masked (a thick rounded stroke
// covers the corners) and a vignette darkens toward the rim. Zooming out of the cellular