feat(client): add liquid presentation and clearer cellular HUD
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m32s
Foundation / postgres-tools (push) Successful in 26s
Foundation / server-image (push) Successful in 4m11s
Foundation / image (push) Successful in 4m36s

This commit is contained in:
dingo
2026-10-22 09:08:03 -04:00
parent c43a3b0837
commit 8ce609d344
12 changed files with 596 additions and 94 deletions
+15 -6
View File
@@ -758,6 +758,8 @@ int main(int argc, char** argv) try {
const bool microscope = cellular_remote && mode() == Mode::remote && cellular_trial;
if (microscope) {
const bool fresh = cellular_remote->cellular_play().fresh();
scene.camera_centre = camera->centre();
scene.stale = !fresh;
if (const auto* perception = cellular_remote->cellular_perception())
for (const auto& patch : perception->patches) {
const auto low =
@@ -803,12 +805,18 @@ int main(int argc, char** argv) try {
const auto low = camera->screen_to_world({0, height});
const auto high = camera->screen_to_world({width, 0});
if (flow_field && low && high) {
const double span = std::max(high->x_mm - low->x_mm, 0.001);
const double span =
std::max({high->x_mm - low->x_mm, high->y_mm - low->y_mm, 0.001});
const double step = std::max(0.4, span / 28);
for (double y = std::floor(low->y_mm / step) * step; y <= high->y_mm;
y += step)
for (double x = std::floor(low->x_mm / step) * step; x <= high->x_mm;
x += step) {
const double first_x = std::floor(low->x_mm / step) * step;
const double first_y = std::floor(low->y_mm / step) * step;
const int columns =
std::clamp(static_cast<int>((high->x_mm - first_x) / step) + 1, 1, 30);
const int rows =
std::clamp(static_cast<int>((high->y_mm - first_y) / step) + 1, 1, 30);
for (int row = 0; row < rows; ++row)
for (int column = 0; column < columns; ++column) {
const double x = first_x + column * step, y = first_y + row * step;
const auto flow =
flow_field->sample(static_cast<std::int64_t>(x * 1000),
static_cast<std::int64_t>(y * 1000));
@@ -829,7 +837,8 @@ int main(int argc, char** argv) try {
static_cast<float>(sx / norm * length),
static_cast<float>(sy / norm * length),
static_cast<float>(std::min(speed, 300.0) / 300),
static_cast<std::uint32_t>(x * 7919 + y * 104729)});
static_cast<std::uint32_t>(
static_cast<std::int64_t>(x * 7919 + y * 104729))});
}
}
}
+289 -63
View File
@@ -716,6 +716,50 @@ ImVec2 add(ImVec2 a, ImVec2 b) noexcept {
ImVec2 times(ImVec2 a, float k) noexcept {
return {a.x * k, a.y * k};
}
ImU32 opacity(ImU32 c, unsigned alpha) {
return (c & ~IM_COL32_A_MASK) | (alpha << IM_COL32_A_SHIFT);
}
// Shared nutrient silhouettes at every scale: lipid-like energy lobes, carbon facets,
// nitrogen vesicles, phosphorus rosettes and angular detritus. These are visual symbols,
// not a claim about chemical species. Zero stock never emits a glyph.
void draw_food(ImDrawList& list, ImVec2 at, float r, std::size_t channel, bool stale,
std::uint64_t seed) {
const auto c = nutrient_colors.at(channel);
const unsigned alpha = stale ? 90U : 225U;
if (r < 3.5F) {
list.AddNgonFilled(at, r, opacity(c, alpha), channel == 1 || channel == 4 ? 4 : 6);
return;
}
list.AddCircleFilled(at, r * 1.35F, opacity(c, stale ? 8U : 18U), 16);
if (channel == 0 || channel == 2) {
const int count = channel == 0 ? 3 : 4;
for (int i = 0; i < count; ++i) {
const float a = static_cast<float>(i) * 6.2832F / static_cast<float>(count);
const auto p = add(at, {std::cos(a) * r * 0.38F, std::sin(a) * r * 0.38F});
list.AddCircleFilled(p, r * 0.6F, opacity(c, alpha / 2), 12);
list.AddCircle(p, r * 0.6F, opacity(c, alpha), 12, 1.0F);
}
} else {
const int count = channel == 3 ? 10 : 6;
const float angle = unit_of(seed) * 6.2832F;
std::array<ImVec2, 10> points{};
for (int i = 0; i < count; ++i) {
const float a = angle + static_cast<float>(i) * 6.2832F / static_cast<float>(count);
const float radius = r * (channel == 3 && i % 2 != 0 ? 0.65F : 1.0F);
points.at(static_cast<std::size_t>(i)) =
add(at, {std::cos(a) * radius, std::sin(a) * radius});
}
// A triangle fan also handles the concave rosette correctly.
for (int i = 0; i < count; ++i)
list.AddTriangleFilled(at, points.at(static_cast<std::size_t>(i)),
points.at(static_cast<std::size_t>((i + 1) % count)),
opacity(c, alpha / 2));
list.AddPolyline(points.data(), count, opacity(c, alpha), ImDrawFlags_Closed, 1.0F);
list.AddLine(points[0], points[3], opacity(c, alpha / 2), 1.0F);
}
list.AddCircleFilled({at.x - r * 0.23F, at.y - r * 0.26F}, std::max(0.8F, r * 0.15F),
IM_COL32(240, 253, 255, stale ? 60 : 210), 8);
}
// One cell: an ellipse membrane (thicker wall for more membrane), flagella waving behind
// the long axis (one per movement step), coral organelles and a nucleus. Dead cells show a
// torn membrane. Nothing here is a player/NPC label: every cell is drawn by biology alone;
@@ -728,10 +772,9 @@ void draw_cell(ImDrawList& list, const SceneCell& c, float time) {
const ImVec2 centre{c.x, c.y};
const ImVec2 radius{r * 1.25F, r * 0.82F};
const auto alpha = static_cast<int>(c.stale ? 120 : 255);
const ImU32 wall = c.dead ? IM_COL32(138, 132, 176, alpha * 2 / 3)
: c.own ? IM_COL32(201, 212, 255, alpha)
: IM_COL32(150, 144, 190, alpha * 9 / 10);
const ImU32 body = c.own ? IM_COL32(170, 185, 255, 38) : IM_COL32(170, 160, 220, 28);
const ImU32 wall =
c.dead ? IM_COL32(138, 132, 176, alpha * 2 / 3) : IM_COL32(157, 226, 241, alpha);
const ImU32 body = IM_COL32(67, 154, 182, alpha / 4);
if (!c.dead) {
for (int i = 0; i < c.flagella; ++i) {
const float spread =
@@ -762,13 +805,31 @@ void draw_cell(ImDrawList& list, const SceneCell& c, float time) {
return;
}
list.AddEllipse(centre, radius, wall, angle, 0, std::max(1.0F, c.membrane));
const ImU32 organelle = c.own ? IM_COL32(255, 122, 102, 235) : IM_COL32(184, 90, 76, 220);
list.AddEllipse(centre, times(radius, 0.87F), IM_COL32(116, 174, 238, alpha / 2), angle, 0,
1.0F);
// Interior highlights give the cytoplasm depth without introducing extra capabilities.
if (r >= 12) {
list.AddEllipseFilled(add(centre, times(normal, -r * 0.26F)), {r * 0.65F, r * 0.19F},
IM_COL32(186, 246, 239, alpha / 8), angle);
for (int k = 0; k < 9; ++k) {
const auto key = c.seed * 19U + static_cast<std::uint64_t>(k);
const auto at = add(add(centre, times(axis, (unit_of(key) - 0.5F) * r * 1.7F)),
times(normal, (unit_of(key + 3) - 0.5F) * r));
list.AddCircleFilled(at, std::max(0.7F, r * 0.025F), IM_COL32(180, 240, 245, alpha / 2),
6);
}
}
const ImU32 organelle = IM_COL32(255, 176, 94, alpha);
for (int k = 0; k < c.organelles; ++k) {
const auto key = c.seed * 31U + static_cast<std::uint64_t>(k);
const float u = unit_of(key) - 0.55F, v = unit_of(key + 7U) - 0.5F;
list.AddCircleFilled(
add(add(centre, times(axis, u * radius.x * 1.1F)), times(normal, v * radius.y * 0.9F)),
std::max(1.5F, r * 0.16F), organelle);
const auto at =
add(add(centre, times(axis, u * radius.x * 1.1F)), times(normal, v * radius.y * 0.9F));
list.AddEllipseFilled(at, {std::max(1.5F, r * 0.19F), std::max(1.0F, r * 0.12F)}, organelle,
angle);
if (r >= 18)
list.AddLine(add(at, times(axis, -r * 0.1F)), add(at, times(axis, r * 0.1F)),
IM_COL32(124, 75, 62, alpha), 1.0F);
}
// Producers (ADR-0176): chloroplasts, more of them for more efficient cells.
for (int k = 0; k < c.chloroplasts; ++k) {
@@ -776,12 +837,13 @@ void draw_cell(ImDrawList& list, const SceneCell& c, float time) {
const float u = unit_of(key) - 0.55F, v = unit_of(key + 5U) - 0.5F;
const ImVec2 at =
add(add(centre, times(axis, u * radius.x * 1.1F)), times(normal, v * radius.y * 0.9F));
list.AddCircleFilled(at, std::max(1.8F, r * 0.18F), IM_COL32(64, 168, 84, 230));
list.AddCircleFilled(at, std::max(0.8F, r * 0.08F), IM_COL32(150, 222, 128, 230));
list.AddCircleFilled(at, std::max(1.8F, r * 0.18F), IM_COL32(64, 168, 84, alpha));
list.AddCircleFilled(at, std::max(0.8F, r * 0.08F), IM_COL32(150, 222, 128, alpha));
}
const ImVec2 nucleus = add(centre, times(axis, radius.x * 0.42F));
list.AddCircleFilled(nucleus, std::max(2.0F, r * 0.3F), IM_COL32(224, 86, 63, 220));
list.AddCircleFilled(nucleus, std::max(1.0F, r * 0.14F), IM_COL32(255, 156, 134, 235));
list.AddCircleFilled(nucleus, std::max(2.0F, r * 0.35F), IM_COL32(166, 100, 217, alpha / 2));
list.AddCircle(nucleus, std::max(2.0F, r * 0.3F), IM_COL32(222, 175, 250, alpha), 20, 1.0F);
list.AddCircleFilled(nucleus, std::max(1.0F, r * 0.14F), IM_COL32(245, 190, 245, alpha));
if (c.own)
list.AddEllipse(centre, {radius.x * 1.2F + 4.0F, radius.y * 1.2F + 4.0F},
IM_COL32(169, 155, 255, 110), angle, 0, 2.0F);
@@ -804,11 +866,8 @@ void draw_patch(ImDrawList& list, const ScenePatch& p) {
for (int i = 0; i < count; ++i) {
const auto key = p.seed * 131U + channel * 977U + static_cast<std::uint64_t>(i);
const float a = unit_of(key) * 6.2832F, d = std::sqrt(unit_of(key + 3U)) * half * 0.85F;
auto color = nutrient_colors.at(channel);
if (p.stale)
color = (color & 0x00FFFFFFU) | (110U << IM_COL32_A_SHIFT);
list.AddCircleFilled({p.x + std::cos(a) * d, p.y + std::sin(a) * d},
grain * (0.7F + 0.6F * unit_of(key + 5U)), color);
draw_food(list, {p.x + std::cos(a) * d, p.y + std::sin(a) * d},
grain * (0.7F + 0.6F * unit_of(key + 5U)), channel, p.stale, key);
}
}
}
@@ -839,47 +898,36 @@ void draw_bubble(ImDrawList& list, const SceneDeposit& d, float time) {
(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));
list.AddCircleFilled({d.x - r * 0.35F, d.y - r * 0.35F}, std::max(0.8F, r * 0.22F),
IM_COL32(255, 255, 255, d.stale ? 40 : 110));
if (d.stock.at(channel) != 0)
draw_food(list, {d.x, d.y}, r, channel, d.stale, d.seed);
}
// A pool is a puddle: a seeded, wobbling outline around its contact disc, granules inside
// in its nutrients' colours, fewer as it drains.
// A thin enclosing membrane follows the contact disc. Its contents are the same nutrient
// glyphs as free food, never extra resource identities or additional collision shapes.
void draw_pool(ImDrawList& list, const SceneDeposit& d, float time) {
const float r = std::max(d.radius, 8.0F);
constexpr int points = 28;
for (int i = 0; i < points; ++i) {
const float a = 6.2832F * static_cast<float>(i) / points;
const auto key = d.seed * 7919U + static_cast<std::uint64_t>(i);
const float wobble = 0.82F + 0.3F * unit_of(key) + 0.04F * std::sin(time * 0.7F + a * 3);
list.PathLineTo({d.x + std::cos(a) * r * wobble, d.y + std::sin(a) * r * wobble});
}
list.PathFillConvex(IM_COL32(52, 40, 58, d.stale ? 50 : 110));
for (int i = 0; i < points; ++i) {
const float a = 6.2832F * static_cast<float>(i) / points;
const auto key = d.seed * 7919U + static_cast<std::uint64_t>(i);
const float wobble = 0.82F + 0.3F * unit_of(key) + 0.04F * std::sin(time * 0.7F + a * 3);
list.PathLineTo({d.x + std::cos(a) * r * wobble, d.y + std::sin(a) * r * wobble});
}
list.PathStroke(IM_COL32(120, 96, 130, d.drained ? 220 : 140), ImDrawFlags_Closed, 1.5F);
const float grain = std::clamp(r * 0.05F, 1.5F, 5.0F);
const ImVec2 centre{d.x, d.y};
const int alpha = d.stale ? 65 : 170;
list.AddCircleFilled(centre, r, IM_COL32(84, 177, 163, d.stale ? 12 : 25), 64);
list.AddCircle(centre, r, IM_COL32(166, 220, 199, alpha), 64, 1.25F);
list.AddCircle(centre, r - 3, IM_COL32(116, 190, 188, alpha / 3), 64, 1.0F);
list.PathArcTo(centre, r - 1, 3.5F, 4.8F, 16);
list.PathStroke(IM_COL32(220, 249, 219, alpha), 0, 2.0F);
if (d.drained && !d.stale)
list.AddCircle(centre, r + 2,
IM_COL32(178, 240, 218, static_cast<int>(50 + 30 * std::sin(time * 6))), 64,
2.0F);
const float grain = std::clamp(r * 0.09F, 2.0F, 11.0F);
for (std::size_t channel = 0; channel < d.stock.size(); ++channel) {
const auto amount = d.stock.at(channel);
if (amount == 0)
continue;
const auto count = std::clamp(
static_cast<int>(2.0 + 3.0 * std::log10(static_cast<double>(amount) / 1.0e5)), 1, 40);
static_cast<int>(2.0 + 3.0 * std::log10(static_cast<double>(amount) / 1.0e5)), 1, 18);
for (int i = 0; i < count; ++i) {
const auto key = d.seed * 131U + channel * 977U + static_cast<std::uint64_t>(i);
const float a = unit_of(key) * 6.2832F, dist = std::sqrt(unit_of(key + 3U)) * r * 0.75F;
auto color = nutrient_colors.at(channel);
if (d.stale)
color = (color & 0x00FFFFFFU) | (110U << IM_COL32_A_SHIFT);
list.AddCircleFilled({d.x + std::cos(a) * dist, d.y + std::sin(a) * dist},
grain * (0.7F + 0.6F * unit_of(key + 5U)), color);
draw_food(list, {d.x + std::cos(a) * dist, d.y + std::sin(a) * dist},
grain * (0.7F + 0.6F * unit_of(key + 5U)), channel, d.stale, key);
}
}
}
@@ -939,8 +987,29 @@ void inspect_cell(ImDrawList& list, const SceneCell& c) {
}
ImGui::EndTooltip();
}
// Rules 12: currents as faint drifting streaks under the food, so the flow is readable before
// a cell commits to it. Specks are thin lines, never discs, so they never read as food.
// Optical depth and caustics: decorative illumination, never temperature or hidden food.
// The fixed 24 x 16 mesh bounds cost independently of resolution and camera zoom.
void draw_liquid(ImDrawList& list, ImVec2 size, float time) {
constexpr int columns = 24, rows = 16;
const auto tint = [&](int x, int y) {
const float u = static_cast<float>(x) / columns, v = static_cast<float>(y) / rows;
const float wave = 0.5F + 0.5F * std::sin(u * 8 + v * 5 + std::sin(v * 9 + time * 0.08F));
const float light = std::pow(wave, 7.0F);
return IM_COL32(static_cast<int>(12 + 9 * wave),
static_cast<int>(37 + 24 * wave + 10 * light),
static_cast<int>(55 + 23 * wave + 14 * light), 255);
};
for (int y = 0; y < rows; ++y)
for (int x = 0; x < columns; ++x) {
list.AddRectFilledMultiColor(
{static_cast<float>(x) * size.x / columns, static_cast<float>(y) * size.y / rows},
{static_cast<float>(x + 1) * size.x / columns,
static_cast<float>(y + 1) * size.y / rows},
tint(x, y), tint(x + 1, y), tint(x + 1, y + 1), tint(x, y + 1));
}
}
// Rules 12: translucent ribbons follow the sampled local current. Their travelling
// highlights move along that direction; width/brightness encode speed, never temperature.
void draw_flows(ImDrawList& list, const std::vector<SceneFlow>& flows, float time) {
for (const auto& f : flows) {
const float phase = std::fmod(time * 0.5F + static_cast<float>(f.seed % 97U) / 97.0F, 1.0F);
@@ -948,22 +1017,37 @@ void draw_flows(ImDrawList& list, const std::vector<SceneFlow>& flows, float tim
const auto alpha = static_cast<unsigned>((24.0F + 80.0F * f.strength) * fade);
const ImVec2 from{f.x + f.dx * (phase - 0.5F), f.y + f.dy * (phase - 0.5F)};
const ImVec2 to{from.x + f.dx * 0.6F, from.y + f.dy * 0.6F};
list.AddLine(from, to, IM_COL32(140, 200, 235, alpha), 1.4F);
const ImVec2 start{f.x - f.dx, f.y - f.dy}, end{f.x + f.dx, f.y + f.dy};
const ImVec2 bend{-f.dy * 0.16F, f.dx * 0.16F};
const ImVec2 middle{f.x, f.y};
list.AddTriangleFilled(start, add(middle, bend), add(middle, times(bend, -1)),
IM_COL32(67, 180, 217, 8));
list.AddTriangleFilled(end, add(middle, bend), add(middle, times(bend, -1)),
IM_COL32(67, 180, 217, 8));
list.AddLine(from, to, IM_COL32(125, 213, 239, alpha / 3), 5.0F);
list.AddLine(from, to, IM_COL32(172, 234, 248, alpha), 1.2F);
}
}
void draw_scene(const PanelView& v) {
if (!v.cellular_scene)
return;
auto& list = *ImGui::GetBackgroundDrawList();
const auto time = static_cast<float>(ImGui::GetTime());
const auto time = v.cellular_scene->stale ? 0.0F : static_cast<float>(ImGui::GetTime());
draw_liquid(list, ImGui::GetIO().DisplaySize, time);
draw_flows(list, v.cellular_scene->flows, time);
for (const auto& patch : v.cellular_scene->patches)
draw_patch(list, patch);
const auto visible = [&](const SceneDeposit& d) {
const float reach = std::max(d.radius * 3, 12.0F);
const auto size = ImGui::GetIO().DisplaySize;
return d.x + reach >= 0 && d.y + reach >= 0 && d.x - reach <= size.x &&
d.y - reach <= size.y;
};
for (const auto& deposit : v.cellular_scene->deposits)
if (deposit.pool)
if (deposit.pool && visible(deposit))
draw_pool(list, deposit, time);
for (const auto& deposit : v.cellular_scene->deposits)
if (!deposit.pool)
if (!deposit.pool && visible(deposit))
draw_bubble(list, deposit, time);
for (const auto& pop : v.cellular_scene->pops)
draw_pop(list, pop);
@@ -1009,6 +1093,34 @@ bool bud_known(const network::CellularLifeDiagnostics& d) {
return d.bud_cost_energy_pj != 0 ||
std::ranges::any_of(d.bud_cost_matter_fg, [](std::uint64_t x) { return x != 0; });
}
// One control standard: rounded, bordered, full label, visible hover/pressed/disabled.
// Accent denotes action family, never funding or whether the server accepted it.
bool action_button(const char* label, ImVec2 size, ImVec4 accent) {
ImGui::PushStyleColor(ImGuiCol_Button,
{accent.x * 0.23F, accent.y * 0.23F, accent.z * 0.23F, 1});
ImGui::PushStyleColor(ImGuiCol_ButtonHovered,
{accent.x * 0.38F, accent.y * 0.38F, accent.z * 0.38F, 1});
ImGui::PushStyleColor(ImGuiCol_ButtonActive,
{accent.x * 0.5F, accent.y * 0.5F, accent.z * 0.5F, 1});
ImGui::PushStyleColor(ImGuiCol_Border, {accent.x, accent.y, accent.z, 0.7F});
const bool pressed = ImGui::Button(label, size);
ImGui::PopStyleColor(4);
return pressed;
}
void panel_heading(const char* title, bool& minimized) {
ImGui::PushID(title);
const float right = ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x;
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted(title);
ImGui::SameLine();
ImGui::SetCursorPosX(right - ImGui::CalcTextSize(" + ").x -
2 * ImGui::GetStyle().FramePadding.x);
if (ImGui::SmallButton(minimized ? " + " : " - "))
minimized = !minimized;
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s %s", minimized ? "Expand" : "Minimize", title);
ImGui::PopID();
}
// Status pill at the top: region, phase, tick, and the two always-available actions.
void hud_status(const PanelView& v, PanelActions& a) {
const auto& io = ImGui::GetIO();
@@ -1047,7 +1159,7 @@ void hud_status(const PanelView& v, PanelActions& a) {
}
// Lower left: energy in readable units, its trend, and the matter reserve. When the bud
// cost is known, each bar is progress toward the next bud on that nutrient.
void hud_vitals(const PanelView& v, bool compact) {
void hud_vitals(const PanelView& v, FormBuffers& form, bool compact) {
const auto& io = ImGui::GetIO();
const float clearance = eyepiece_clearance();
const float width = std::min(px(300), io.DisplaySize.x - 2 * px(12));
@@ -1059,9 +1171,18 @@ void hud_vitals(const PanelView& v, bool compact) {
const auto* d = diagnostics(v);
if (!play || play->life() == 0)
return; // The life window speaks for a cell that is not alive.
ImGui::SetNextWindowSizeConstraints({width, 0}, {width, io.DisplaySize.y});
const float max_height =
compact ? std::max(px(120), io.DisplaySize.y - px(220)) : io.DisplaySize.y * 0.43F;
ImGui::SetNextWindowSizeConstraints({width, 0}, {width, max_height});
ImGui::Begin("Vitals", nullptr,
hud_flags | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize);
panel_heading("Your cell", form.vitals_minimized);
if (form.vitals_minimized) {
if (d)
ImGui::Text("Energy %s", energy_text(d->reserve_energy_pj).c_str());
ImGui::End();
return;
}
if (!play->fresh())
ImGui::TextColored(amber, "Waiting for a fresh server view");
if (!d) {
@@ -1069,6 +1190,10 @@ void hud_vitals(const PanelView& v, bool compact) {
ImGui::End();
return;
}
ImGui::TextDisabled("Body -- Water --");
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Temperatures are not reported by this session.\nThermal gradients are "
"not yet available.");
section("ENERGY");
if (const auto& change = play->energy_change(); change) {
ImGui::SameLine();
@@ -1141,16 +1266,16 @@ void hud_dock(const PanelView& v, FormBuffers& form, PanelActions& a, bool compa
(ImGui::GetContentRegionAvail().x - 2 * ImGui::GetStyle().ItemSpacing.x) / 3.0F;
const bool active = play && play->fresh() && play->life() != 0;
ImGui::BeginDisabled(!active);
if (ImGui::Button(form.cellular_controls.auto_feed ? "Feed: auto" : "Feed: manual",
{each, px(44)}))
if (action_button(form.cellular_controls.auto_feed ? "Feed: auto" : "Feed: manual",
{each, px(44)}, {0.32F, 0.90F, 0.73F, 1}))
form.cellular_controls.auto_feed = !form.cellular_controls.auto_feed;
ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(!play || !play->can_act());
if (ImGui::Button("Engulf", {each, px(44)}))
if (action_button("Engulf", {each, px(44)}, {0.38F, 0.68F, 1.0F, 1}))
a.cell_action = CellAction::engulf;
ImGui::SameLine();
if (ImGui::Button("Bud", {each, px(44)}))
if (action_button("Bud", {each, px(44)}, {0.82F, 0.53F, 0.96F, 1}))
a.cell_action = CellAction::bud;
ImGui::EndDisabled();
// What a bud needs, by nutrient (ADR-0129 amendment).
@@ -1196,10 +1321,20 @@ void hud_notes(const PanelView& v, FormBuffers& form, PanelActions& a, bool comp
const float clearance = eyepiece_clearance();
ImGui::SetNextWindowPos({clearance, px(64)}, ImGuiCond_Always);
ImGui::SetNextWindowSizeConstraints({px(260), 0},
{px(260), std::max(px(120), io.DisplaySize.y * 0.45F)});
ImGui::Begin("Field notes", nullptr, hud_flags | ImGuiWindowFlags_AlwaysAutoResize);
{px(260), std::max(px(120), io.DisplaySize.y * 0.41F)});
ImGui::Begin("Field notes", nullptr,
hud_flags | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize);
panel_heading("Field notes", form.notes_minimized);
if (form.notes_minimized) {
ImGui::End();
return;
}
for (std::size_t i = 0; i < nutrient_names.size(); ++i) {
dot(nutrient_colors.at(i));
const float glyph_size = ImGui::GetTextLineHeight();
const auto at = ImGui::GetCursorScreenPos();
draw_food(*ImGui::GetWindowDrawList(), {at.x + glyph_size / 2, at.y + glyph_size / 2},
glyph_size * 0.36F, i, false, i);
ImGui::Dummy({glyph_size, glyph_size});
ImGui::SameLine(0, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::TextUnformatted(nutrient_names.at(i));
if (i % 2 == 0 && i + 1 < nutrient_names.size())
@@ -1502,6 +1637,96 @@ void evolution_window(const PanelView& v, FormBuffers& form, PanelActions& a, bo
form.evolution_open = false;
ImGui::End();
}
void hud_map(const PanelView& v, FormBuffers& form, bool compact) {
if (!v.cellular_scene)
return;
const auto& scene = *v.cellular_scene;
const auto& io = ImGui::GetIO();
const float width = px(compact ? 184.0F : 210.0F);
ImGui::SetNextWindowPos({io.DisplaySize.x - (compact ? px(12) : eyepiece_clearance()), px(126)},
ImGuiCond_Always, {1, 0});
ImGui::SetNextWindowSizeConstraints({width, 0}, {width, io.DisplaySize.y - px(200)});
ImGui::Begin("Nearby", nullptr,
hud_flags | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize);
panel_heading("Nearby", form.map_minimized);
if (form.map_minimized) {
ImGui::End();
return;
}
auto at = ImGui::GetCursorScreenPos();
const float available = ImGui::GetContentRegionAvail().x;
const float side = std::min(available, px(compact ? 96.0F : 178.0F));
at.x += (available - side) / 2;
const ImVec2 centre{at.x + side / 2, at.y + side / 2};
const float r = side * 0.39F;
auto& list = *ImGui::GetWindowDrawList();
list.AddCircleFilled(centre, r, IM_COL32(13, 39, 48, 255), 48);
list.AddCircle(centre, r, IM_COL32(110, 180, 192, 180), 48, 1.0F);
list.AddCircle(centre, r / 2, IM_COL32(110, 180, 192, 35), 32, 1.0F);
list.AddLine({centre.x - r, centre.y}, {centre.x + r, centre.y}, IM_COL32(110, 180, 192, 35));
list.AddLine({centre.x, centre.y - r}, {centre.x, centre.y + r}, IM_COL32(110, 180, 192, 35));
const auto label = [&](ImVec2 p, const char* text) {
const auto size = ImGui::CalcTextSize(text);
list.AddText({p.x - size.x / 2, p.y - size.y / 2}, IM_COL32(196, 224, 238, 255), text);
};
label({centre.x, at.y + px(6)}, "+Y");
label({centre.x, at.y + side - px(6)}, "-Y");
label({at.x + px(7), centre.y}, "-X");
label({at.x + side - px(7), centre.y}, "+X");
// Fixed six millimetre radius, camera centred. Only replicated observations enter.
const auto marker = [&](double x, double y, ImU32 color, bool pool, bool cell, bool own) {
const float dx = static_cast<float>((x - scene.camera_centre.x_mm) / 6.0);
const float dy = static_cast<float>((scene.camera_centre.y_mm - y) / 6.0);
if (dx * dx + dy * dy > 0.94F * 0.94F)
return;
const ImVec2 p{centre.x + dx * r, centre.y + dy * r};
if (scene.stale)
color = opacity(color, 85);
if (pool)
list.AddCircle(p, px(4), color, 12, 1.0F);
else if (cell)
list.AddTriangleFilled({p.x, p.y - px(3)}, {p.x - px(3), p.y + px(3)},
{p.x + px(3), p.y + px(3)}, color);
else
list.AddCircleFilled(p, px(1.6F), color, 6);
if (own)
list.AddCircle(p, px(6), color, 12, 1.0F);
};
if (const auto* seen = v.cellular_perception) {
for (const auto& d : seen->deposits) {
const auto channel = static_cast<std::size_t>(
std::distance(d.amount_codes.begin(),
std::max_element(d.amount_codes.begin(), d.amount_codes.end())));
if (d.amount_codes.at(channel) != 0)
marker(d.x_um / 1000.0, d.y_um / 1000.0, nutrient_colors.at(channel),
d.shape == network::CellularDepositShape::pool, false, false);
}
for (const auto& p : seen->patches)
if (p.energy_pj != 0 ||
std::ranges::any_of(p.matter_fg, [](auto amount) { return amount != 0; }))
marker(p.x_um / 1000.0 + 0.5, p.y_um / 1000.0 + 0.5, nutrient_colors[0], true,
false, false);
}
if (v.organisms && v.organisms->current())
for (const auto& cell : v.organisms->current()->cells())
marker(static_cast<double>(cell.voxel.x) * static_cast<double>(world::cell_pitch_mm) +
static_cast<double>(cell.x.value) / 1000.0,
static_cast<double>(cell.voxel.y) * static_cast<double>(world::cell_pitch_mm) +
static_cast<double>(cell.y.value) / 1000.0,
IM_COL32(181, 232, 242, 255), false, true,
v.cellular_play && cell.id == v.cellular_play->life());
ImGui::Dummy({side, side});
disabled_wrapped(compact ? "6 mm / local axes" : "6 mm radius / local axes");
if (scene.stale)
ImGui::TextColored(amber, "Last observation - stale");
else
disabled_wrapped(compact ? "Received view" : "Observed food and cells");
if (ImGui::IsWindowHovered())
ImGui::SetTooltip(
"Camera-centred local map. Unseen space is unknown.\nRings: pools. Dots: nutrients. "
"Triangles: cells.\nLocal +Y is up; planetary north is not defined.");
ImGui::End();
}
void cellular(const PanelView& v, FormBuffers& form, PanelActions& a) {
const auto& io = ImGui::GetIO();
const bool compact = io.DisplaySize.x < px(880);
@@ -1514,7 +1739,8 @@ void cellular(const PanelView& v, FormBuffers& form, PanelActions& a) {
}
hud_status(v, a);
hud_notes(v, form, a, compact);
hud_vitals(v, compact);
hud_vitals(v, form, compact);
hud_map(v, form, compact);
hud_dock(v, form, a, compact);
hud_callout(v, form);
evolution_window(v, form, a, compact);
+5
View File
@@ -4,6 +4,7 @@
// pair and the platform adapter use the toolkit.
#include "evo/client/auth.hpp"
#include "evo/client/bindings.hpp"
#include "evo/client/camera.hpp"
#include "evo/client/environment_view.hpp"
#include "evo/client/launcher.hpp"
#include "evo/client/organism_view.hpp"
@@ -67,6 +68,9 @@ struct CellularScene {
std::vector<SceneDeposit> deposits;
std::vector<ScenePop> pops;
std::vector<SceneCell> cells;
// Camera mapping for the local observation map; no undiscovered world state.
client::WorldPoint camera_centre{};
bool stale{};
};
// Notice layout (logical pixels); the window name is the prefix plus the notice id.
inline constexpr float notice_width = 320, notice_close_width = 22;
@@ -75,6 +79,7 @@ inline constexpr const char* notice_window_prefix = "##notice";
struct FormBuffers {
bool engineering{};
bool evolution_open{}; // The mutation window (E or the callout opens it).
bool notes_minimized{}, vitals_minimized{}, map_minimized{};
CellularControls cellular_controls;
std::array<char, client::max_field_bytes> endpoint{}, server_name{}, authority{}, grants{};
void load(const client::ConnectForm& form);
@@ -12,7 +12,7 @@ spec:
env:
- {name: REGION_SESSION, value: "dev"}
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
- {name: REGION_SESSION_WINDOW, value: "dev-20261022T125200-c1e6e708:1792687920"}
- {name: REGION_SESSION_WINDOW, value: "ui-20261022T130803-a1d37601:1792688883"}
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
ports:
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
+10
View File
@@ -70,3 +70,13 @@ add labels outside these APIs; review must keep debug overlays out of player UI.
## Consequences
M9.7 builds `OrganismPresentation` from server views. Any new visual parameter
must derive from biology and update this ADR, tests and ORGANISM_RENDERING.md.
## Presentation amendment, 2026-10-22
The native microscope now layers translucent cyan membranes and cytoplasm, amber
metabolic organelles and a violet centre. Existing phenotype mappings for extent,
wall thickness, flagella, conversion and producer chloroplasts remain in force.
Identical biology receives the same palette; the controlled cell differs only by
its existing focus ring. Dead outlines remain broken and stale opacity is applied
to organelles as well as the membrane. No new biological parameter is introduced.
See [the visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md).
@@ -187,3 +187,12 @@ Existing regions keep their rules versions and are never migrated in place
- **ADR-0120:** in the new rules version, square patches and the intake target become
pools, bubbles and contact feeding.
- **ADR-0124:** detritus becomes bubbles.
## Presentation amendment, 2026-10-22
The maintainer requested nutrient silhouettes, a thin enclosing pool membrane and
a more colorful liquid scene. The native client now uses nutrient-specific glyphs
inside the unchanged contact discs, with a zero-stock channel absent. These are
presentation symbols, not new chemical species, resource identities or membrane
physics. The existing single-channel deposit and contact-feeding contracts remain
unchanged. See [the scoped visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md).
+7
View File
@@ -104,3 +104,10 @@ markers and stock cards use copied sensor data only. A final birth refusal permi
an explicit new request even before a perception arrives; pending/unknown requests
retain their ID and an existing-life result waits for that life. These are app
presentation/control policies, not biological rules.
The [2026-10-22 visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md) stays
inside the existing native app/toolkit boundary. Its local map consumes replicated
observations only; optical liquid shading is not a thermal field. Body temperature,
ambient temperature and directional heat guidance remain pending authoritative
phase-3 state and a negotiated perception contract. Existing public library and
wire interfaces are unchanged.
+11 -1
View File
@@ -88,7 +88,7 @@ provision a region.
Sent/admitted are distinct from committed. A committed engulf/bud intention
does not itself prove biological success; the tick feedback reports its effect.
The dark teal UI uses the existing embedded scalable font. At narrow sizes the
The blue-green UI uses the existing embedded scalable font. At narrow sizes the
Evolution panel becomes the **Life** tab; panels remain within the viewport and
scroll vertically. Existing Ctrl+= / Ctrl+- scaling and rebindable movement apply.
Food patches have a thin contact boundary and a stock marker, with amber for the
@@ -212,3 +212,13 @@ unload behavior and qualification evidence are documented in VALIDATION.md.
Headless defaults keep both `EVO_BUILD_CLIENT` and `EVO_BUILD_CLIENT_PROBE` OFF.
No prepared SDL sources, display or client runtime are needed for `evo-sim` or
server tests. No Kubernetes deployment change belongs to this desktop gate.
## 2026-10-22 liquid presentation
[The native visual refresh](CLIENT_VISUAL_REFRESH.md) adds blue-green optical
texture, flowing current ribbons, nutrient silhouettes, thin pool membranes,
a shared brighter cell palette and colored action buttons. Field notes, Vitals
and Nearby can minimize and restore. Nearby is a camera-centred map of received
observations with a local-axis compass; it never reveals hidden food. Temperature
readouts remain explicitly unavailable until phase 3 and a session contract carry
real body/ambient observations. No simulation or protocol version changes.
+84
View File
@@ -0,0 +1,84 @@
# Cellular liquid presentation refresh
Scope: native client presentation, 2026-10-22, requested by the maintainer using
the screenshots, two recordings and visual references in `Aevolution-Client-SS`.
This is a procedural first pass using the existing SDL3/ImGui renderer, not the
photorealistic lighting of the reference images. No asset or runtime dependency
is added. Headless libraries, biological rules, persistence and wire formats are
unchanged.
## Visual language
- Blue-green liquid illumination replaces the black eyepiece interior. A fixed
caustic mesh gives optical texture; it carries no environmental measurement.
Current ribbons and travelling highlights follow the replicated flow field.
A maximum 30 by 30 sample grid bounds cost even in a tall viewport.
- Nutrients keep their established colors and gain distinct silhouettes: gold
lobes for energy, umber facets for carbon, blue vesicles for nitrogen, rose
rosettes for phosphorus, pale angular fragments for other matter. These are
readable symbols, not asserted chemical structures. At very small sizes they
simplify to solid marks. The legend uses the same shapes.
- Pools have a thin circular membrane on their contact disc, containing those
same nutrient symbols. A zero channel emits no shapes. Entire deposits remain
owned and removed by the server; the client does not consume or split them.
The decorative membrane neither blocks a cell nor changes collision geometry.
- All living cells share cyan membranes, translucent cytoplasm, amber metabolic
organelles and a violet centre. Wall thickness, motility, conversion and green
producer organelles retain their existing phenotype mappings. The viewer's
own cell has only its existing focus ring, not a different biological palette.
Dead cells keep their broken outline; stale scenes freeze cosmetic motion and
dim observed objects.
## Controls and navigation
Buttons share a rounded, bordered treatment with distinct hover, pressed and
disabled states. The action dock uses mint for feeding, blue for engulfing and
violet for budding. Labels and authoritative enable/disable logic remain intact;
color alone does not communicate affordability or success. Existing bindings
remain authoritative; decorative shortcut numbers are not invented.
Field notes, Vitals and Nearby have explicit minus/plus buttons. Collapsing
Vitals retains energy. State lasts for the client session; it is not saved.
The responsive compact layout keeps the dock and map within the viewport.
Nearby is a camera-centred observation map with a fixed six-millimetre radius.
It reads the received food and organism views only, including observations
outside the viewport. Empty space means unknown, not confirmed empty. Rings
denote pools, dots nutrients and triangles cells; the controlled cell has a ring.
The compass labels local +Y/-Y and +X/-X, consistent with the camera. Planetary
north and a global explored-world map have not been defined by this gate.
Disconnected data is explicitly stale. The map is read-only and cannot issue
movement or reveal unobserved resources.
## Temperature contract gap and proposed follow-up
Inspection found an architectural dependency: session v13 has reserves, motion,
currents and observed food, but no body or ambient temperature observations.
[ADR-0178](../adr/0178-durable-liquid-region.md) and phase 3 of the
[region/movement plan](../../Cellular_Region_Movement_Plan.md) explicitly leave
the thermal field and per-cell thermal state pending. A client-only gradient
or body temperature would fabricate game state. Implementation of that affected
feature stops here.
Vitals reserves a `Body -- / Water --` readout with an explanation on hover.
No heat colors, danger thresholds or warmer/colder arrows are emitted.
Proposed resolution, not an accepted protocol or biological rule:
1. Complete phase 3's authoritative body/ambient model and its versioned
persistence/replay contract.
2. Add bounded, perception-filtered body and local ambient temperatures with
units, freshness and availability to a new negotiated session version.
3. Define the spatial sampling distance and visible-neighbour coverage for
warmer/colder guidance. No client extrapolation into hidden regions.
4. Render measured body/water values and a separate thermal overlay. A direction
arrow requires sufficient current samples; equal, missing or stale samples
suppress it. Comfort and harm use observed phenotype limits, not UI constants.
## Validation
The native panel suite exercises multiple sizes, collapse/restore and input
capture alongside existing mutation, affordability and action tests. See
[VALIDATION](VALIDATION.md) for executed builds, screenshots and environmental
limits. The supplied reference art is design input, not a runtime asset or a
claim of achieved photorealism.
+51
View File
@@ -10127,3 +10127,54 @@ changes; CMake/CTest, clang-format, clang-tidy, and sanitizers are not applicabl
to this prose addition and were not run. Design viability and balance remain
unqualified. The AGENTS.md-required pre-push window update is desired Git
configuration only, not a deployment.
## 2026-10-22 - Native liquid UI refresh
Scope: `apps/evo-client` scene/HUD, the private platform theme, and native panel
regressions. See [visual design and the thermal contract gap](CLIENT_VISUAL_REFRESH.md).
No biological, persistence or wire version changed. Existing unrelated drafts and
server work were preserved.
Executed:
- MSVC 19.44 / toolset 14.44, Release with NDEBUG: configured/built `client` and
`client-network` through `tools/windows-check.ps1`. Client CTest 10/10; final
`client-network` CTest 18/18 with local loopback access outside the sandbox.
- Ubuntu/WSL Clang 19: configured from the `client` preset in `build/m12-ui-clang`
with `EVO_ENABLE_TIDY=ON`, built all client preset targets, CTest client label
10/10. Changed production sources and panel tests passed clang-tidy with warnings
as errors. Xvfb/X11 lifecycle executable exited 0.
- `asan` preset in `build/client-asan`, client enabled: rebuilt client, panel and
lifecycle targets; ASan+UBSan panel, lifecycle and smoke CTests 3/3.
- clang-format-19 dry-run with `--Werror` passed for the five changed C++ files.
- Production panel renderer exercised at 640x480, 960x640 and 1280x800: window
bounds, non-overlap with the action dock, minimize/restore with input capture,
and existing hover/mutation/affordability/bud/restart paths. World draw-list
checks verify each nutrient disappears independently at zero and stale food
retains dimmed silhouettes. No golden or simulation version was changed.
- Native BMP review frames (including Evolution and death) were generated in
ignored `build/ui-review/final` and visually inspected. The final fixture cell
was moved clear of HUD panels and its pool stocked to inspect the new shapes;
the panel suite was rerun after that fixture-only adjustment. These images
are local fixtures, not a live DEV session or performance benchmark.
Environmental limits and initial failures:
- Windows tests initially could not save bindings in the sandbox's default temp
directory. Setting TMP and TEMP to `build/ui-review/tmp` resolved both bindings
and control-save checks.
- The sandboxed network run was 13/18: five loopback connection tests could not
establish sessions. The same final production build passed all 18 outside the
sandbox. No production endpoint or World0 was contacted by those checks.
- Physical DPI, GPU rendering, motion comfort, accessibility and low-spec frame
cost still require interactive hardware review. This procedural rendering does
not implement the photographic lighting/blur of the supplied concept images.
- Two local MP4s were reviewed through sampled frame sheets. An imageio-ffmpeg
decoder was installed only in ignored `build/ui-review-tools` for that analysis;
it is not a repository or client dependency.
- Body/ambient readings and thermal direction remain unavailable because session
v13 carries neither. The UI shows dashes and explains the missing observations;
the proposed phase-3 follow-up is documented rather than fabricated client state.
The AGENTS.md-required pre-push session-window refresh is desired Git configuration
only. No deployment, live reachability, World0 mutation or world reset is claimed.
+20 -19
View File
@@ -51,33 +51,34 @@ struct Toolkit {
auto& style = ImGui::GetStyle();
style.WindowRounding = 12;
style.ChildRounding = 8;
style.FrameRounding = 6;
style.FrameRounding = 10;
style.FrameBorderSize = 1;
style.PopupRounding = 8;
style.GrabRounding = 6;
style.WindowPadding = {16, 14};
style.FramePadding = {10, 6};
style.ItemSpacing = {8, 9};
auto* colors = style.Colors;
colors[ImGuiCol_WindowBg] = {0.090F, 0.078F, 0.114F, 0.94F}; // Ink (2026-10-16 palette).
colors[ImGuiCol_ChildBg] = {0.114F, 0.098F, 0.141F, 0.9F};
colors[ImGuiCol_PopupBg] = {0.090F, 0.078F, 0.114F, 1.0F};
colors[ImGuiCol_Border] = {0.165F, 0.141F, 0.200F, 0.9F};
colors[ImGuiCol_Text] = {0.945F, 0.925F, 0.902F, 1.0F};
colors[ImGuiCol_TextDisabled] = {0.678F, 0.643F, 0.722F, 1.0F};
colors[ImGuiCol_FrameBg] = {0.125F, 0.106F, 0.157F, 1.0F};
colors[ImGuiCol_FrameBgHovered] = {0.165F, 0.141F, 0.200F, 1.0F};
colors[ImGuiCol_FrameBgActive] = {0.227F, 0.196F, 0.271F, 1.0F};
colors[ImGuiCol_Button] = {0.165F, 0.137F, 0.278F, 1.0F};
colors[ImGuiCol_ButtonHovered] = {0.239F, 0.204F, 0.400F, 1.0F};
colors[ImGuiCol_ButtonActive] = {0.294F, 0.247F, 0.561F, 1.0F};
colors[ImGuiCol_Header] = {0.165F, 0.137F, 0.278F, 1.0F};
colors[ImGuiCol_WindowBg] = {0.038F, 0.075F, 0.125F, 0.96F};
colors[ImGuiCol_ChildBg] = {0.055F, 0.100F, 0.157F, 0.94F};
colors[ImGuiCol_PopupBg] = {0.045F, 0.080F, 0.137F, 0.98F};
colors[ImGuiCol_Border] = {0.34F, 0.46F, 0.60F, 0.75F};
colors[ImGuiCol_Text] = {0.92F, 0.97F, 0.98F, 1.0F};
colors[ImGuiCol_TextDisabled] = {0.64F, 0.76F, 0.82F, 1.0F};
colors[ImGuiCol_FrameBg] = {0.075F, 0.15F, 0.21F, 1.0F};
colors[ImGuiCol_FrameBgHovered] = {0.12F, 0.25F, 0.32F, 1.0F};
colors[ImGuiCol_FrameBgActive] = {0.16F, 0.33F, 0.40F, 1.0F};
colors[ImGuiCol_Button] = {0.14F, 0.22F, 0.36F, 1.0F};
colors[ImGuiCol_ButtonHovered] = {0.23F, 0.36F, 0.52F, 1.0F};
colors[ImGuiCol_ButtonActive] = {0.28F, 0.43F, 0.60F, 1.0F};
colors[ImGuiCol_Header] = {0.12F, 0.20F, 0.30F, 1.0F};
colors[ImGuiCol_HeaderHovered] = colors[ImGuiCol_ButtonHovered];
colors[ImGuiCol_HeaderActive] = colors[ImGuiCol_ButtonActive];
colors[ImGuiCol_TitleBg] = {0.078F, 0.067F, 0.098F, 1.0F};
colors[ImGuiCol_TitleBgActive] = {0.125F, 0.106F, 0.157F, 1.0F};
colors[ImGuiCol_CheckMark] = {0.663F, 0.608F, 1.0F, 1.0F};
colors[ImGuiCol_Tab] = {0.114F, 0.098F, 0.141F, 1.0F};
colors[ImGuiCol_TabSelected] = {0.165F, 0.137F, 0.278F, 1.0F};
colors[ImGuiCol_TitleBg] = {0.045F, 0.09F, 0.15F, 1.0F};
colors[ImGuiCol_TitleBgActive] = {0.075F, 0.15F, 0.23F, 1.0F};
colors[ImGuiCol_CheckMark] = {0.36F, 0.89F, 0.78F, 1.0F};
colors[ImGuiCol_Tab] = {0.075F, 0.14F, 0.21F, 1.0F};
colors[ImGuiCol_TabSelected] = {0.14F, 0.25F, 0.35F, 1.0F};
colors[ImGuiCol_TabHovered] = colors[ImGuiCol_ButtonHovered];
base_style = ImGui::GetStyle();
platform = ImGui_ImplSDL3_InitForSDLRenderer(window, target);
+94 -4
View File
@@ -405,6 +405,7 @@ void cellular_panels(const std::filesystem::path& review) {
EnvironmentLayer environment;
OrganismLayer organisms;
CellularPlay play;
CHECK(organisms.accept(*population));
play.initialize(100);
play.connected();
network::CellularLifeDiagnostics diagnostics;
@@ -449,13 +450,24 @@ void cellular_panels(const std::filesystem::path& review) {
view.remote->region = 4;
// 2026-10-16 microscope view: patches as granules and cells, drawn under the HUD.
CellularScene scene;
scene.camera_centre = camera->centre();
for (int y = 100; y < height; y += 50)
for (int x = 40; x < width; x += 55)
scene.flows.push_back({static_cast<float>(x), static_cast<float>(y), 22, -10, 0.7F,
static_cast<std::uint32_t>(x + y)});
scene.patches.push_back({200, 200, 60, {50000, 100, 20, 10, 40}, false, false, 1});
scene.patches.push_back({400, 260, 60, {0, 90, 0, 8, 0}, true, false, 2});
scene.cells.push_back({300, 300, 24, 2.5F, 2, 3, true, false, false, 901});
scene.cells.push_back({440, 350, 34, 2.5F, 2, 3, true, false, false, 901});
scene.cells.push_back({500, 220, 14, 4.0F, 0, 2, false, true, false, 77});
// ADR-0136: a pool, a draining bubble, a still one and a pop draw under the HUD.
scene.deposits.push_back(
{620, 320, 50, {90000, 4000, 900, 300, 1200}, true, false, false, 5});
scene.deposits.push_back({600,
350,
65,
{90000000, 40000000, 9000000, 3000000, 12000000},
true,
false,
false,
5});
scene.deposits.push_back({360, 330, 4, {0, 52000, 0, 0, 0}, false, true, false, 6});
scene.deposits.push_back({380, 360, 4, {2000000, 0, 0, 0, 0}, false, false, false, 7});
scene.pops.push_back({400, 300, 4, 0.4F, 3});
@@ -477,8 +489,84 @@ void cellular_panels(const std::filesystem::path& review) {
auto* dock = ImGui::FindWindowByName("Actions");
CHECK(fits(vitals) && fits(dock) && fits(ImGui::FindWindowByName("##mode")));
CHECK(fits(ImGui::FindWindowByName("##mutation"))); // The offer callout.
CHECK(fits(ImGui::FindWindowByName("Nearby")));
const auto disjoint = [](const ImGuiWindow* a, const ImGuiWindow* b) {
return a->Pos.x + a->Size.x <= b->Pos.x || b->Pos.x + b->Size.x <= a->Pos.x ||
a->Pos.y + a->Size.y <= b->Pos.y || b->Pos.y + b->Size.y <= a->Pos.y;
};
CHECK(disjoint(vitals, dock) && disjoint(ImGui::FindWindowByName("Nearby"), dock));
if (width >= 880)
CHECK(fits(ImGui::FindWindowByName("Field notes")));
CHECK(fits(ImGui::FindWindowByName("Field notes")) &&
disjoint(vitals, ImGui::FindWindowByName("Field notes")));
// Minimize/restore stays local to the panel, including a same-batch click.
const auto toggle = [&](const char* name, bool& minimized) {
const auto* panel = ImGui::FindWindowByName(name);
CHECK(panel);
const float expanded = panel->Size.y;
const auto click_heading = [&] {
const float x =
panel->Pos.x + panel->Size.x - ImGui::GetStyle().WindowPadding.x - 20;
const float y =
panel->Pos.y + ImGui::GetStyle().WindowPadding.y + ImGui::GetFrameHeight() / 2;
mouse(id, SDL_EVENT_MOUSE_MOTION, x, y);
mouse(id, SDL_EVENT_MOUSE_BUTTON_DOWN, x, y);
mouse(id, SDL_EVENT_MOUSE_BUTTON_UP, x, y);
CHECK(app->poll_events() && !app->take_navigation().click);
for (int i = 0; i < 3; ++i)
draw();
};
click_heading();
CHECK(minimized && panel->Size.y < expanded && fits(panel));
click_heading();
CHECK(!minimized && fits(panel));
};
toggle("Vitals", form.vitals_minimized);
toggle("Nearby", form.map_minimized);
if (width >= 880)
toggle("Field notes", form.notes_minimized);
mouse(id, SDL_EVENT_MOUSE_MOTION, 5, 5);
// A depleted channel vanishes independently. Stale observations retain the food
// silhouettes but never their fresh opacity. Inspect the world draw list, not HUD.
if (width == 960) {
const auto saved_scene = scene;
scene = {};
scene.deposits.push_back({450,
300,
70,
{10000000, 10000000, 10000000, 10000000, 10000000},
true,
false,
false,
5});
constexpr std::array colors{IM_COL32(255, 214, 107, 225), IM_COL32(201, 138, 91, 225),
IM_COL32(111, 183, 255, 225), IM_COL32(255, 127, 178, 225),
IM_COL32(184, 178, 196, 225)};
const auto has_color = [&](ImU32 color) {
const auto& vertices = ImGui::GetBackgroundDrawList()->VtxBuffer;
return std::any_of(vertices.begin(), vertices.end(),
[&](const ImDrawVert& vertex) { return vertex.col == color; });
};
draw();
for (auto color : colors)
CHECK(has_color(color));
for (std::size_t channel = 0; channel < colors.size(); ++channel) {
scene.deposits[0].stock[channel] = 0;
draw();
CHECK(!has_color(colors[channel]));
for (std::size_t remaining = channel + 1; remaining < colors.size(); ++remaining)
CHECK(has_color(colors[remaining]));
}
scene.deposits[0].stock.fill(10000000);
scene.deposits[0].stale = true;
scene.stale = true;
draw();
for (auto color : colors) {
CHECK(!has_color(color));
CHECK(has_color((color & ~IM_COL32_A_MASK) | (90U << IM_COL32_A_SHIFT)));
}
scene = saved_scene;
draw();
}
if (!review.empty()) {
std::filesystem::create_directories(review);
auto later = perception;
@@ -486,6 +574,8 @@ void cellular_panels(const std::filesystem::path& review) {
later.diagnostics->reserve_energy_pj -= 50;
play.observe(later);
view.cellular_feed_target = {{2000, 3000}};
for (int i = 0; i < 3; ++i)
draw();
CHECK(app->request_screenshot(
(review / ("cellular-" + std::to_string(width) + ".bmp")).string()));
draw();