Cellular microscope UI: living cells, nutrient food, HUD and evolution cards
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (deploy) (push) Successful in 4m12s
Foundation / checks (tsan) (push) Successful in 11m26s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 17m48s
Foundation / checks (postgres) (push) Canceled after 17m48s
Foundation / checks (checks) (push) Canceled after 17m53s
Foundation / checks (client) (push) Canceled after 17m58s

From the maintainer's design review. In cellular play the world sits in a rounded
eyepiece with a vignette:
- Cells are drawn from their phenotype: the membrane wall thickens with membrane
  mass, flagella follow speed, organelles follow energy conversion, and a dead
  cell's membrane is torn.
- Food patches are granules coloured by nutrient, so a nutrient that runs out
  loses its colour.

The side panels become a HUD:
- a status pill and Field notes;
- Vitals in readable units (nJ, ng) with bars toward the next bud;
- an action dock with the last result explained;
- a "Mutation ready [E]" callout opening an evolution window of cards with
  before/after drawings and per-nutrient costs, which also handles the end of a
  life.

New ink, lavender and amber palette. Client only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-16 08:53:55 -04:00
co-authored by Claude Opus 5.5
parent ab5c29227c
commit 28629e1001
8 changed files with 883 additions and 392 deletions
+51 -41
View File
@@ -447,6 +447,13 @@ void cellular_panels(const std::filesystem::path& review) {
view.remote->cellular_trial = true;
view.remote->server_tick = 102;
view.remote->region = 4;
// 2026-10-16 microscope view: patches as granules and cells, drawn under the HUD.
CellularScene scene;
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({500, 220, 14, 4.0F, 0, 2, false, true, false, 77});
view.cellular_scene = &scene;
PanelActions action;
app->set_overlay([&] { action = draw_panels(view, form, display); });
const auto draw = [&] {
@@ -454,11 +461,18 @@ void cellular_panels(const std::filesystem::path& review) {
};
for (int i = 0; i < 3; ++i)
draw();
auto* journal = ImGui::FindWindowByName("Cellular field journal");
CHECK(journal && journal->Active && journal->ScrollMax.x == 0);
CHECK(journal->Pos.x >= 0 && journal->Pos.y >= 0 &&
journal->Pos.x + journal->Size.x <= static_cast<float>(width) &&
journal->Pos.y + journal->Size.y <= static_cast<float>(height));
// Every HUD window fits the viewport without sideways scrolling.
const auto fits = [&](const ImGuiWindow* w) {
return w && w->Active && w->ScrollMax.x == 0 && w->Pos.x >= 0 && w->Pos.y >= 0 &&
w->Pos.x + w->Size.x <= static_cast<float>(width) &&
w->Pos.y + w->Size.y <= static_cast<float>(height);
};
auto* vitals = ImGui::FindWindowByName("Vitals");
auto* dock = ImGui::FindWindowByName("Actions");
CHECK(fits(vitals) && fits(dock) && fits(ImGui::FindWindowByName("##mode")));
CHECK(fits(ImGui::FindWindowByName("##mutation"))); // The offer callout.
if (width >= 880)
CHECK(fits(ImGui::FindWindowByName("Field notes")));
if (!review.empty()) {
std::filesystem::create_directories(review);
auto later = perception;
@@ -469,31 +483,6 @@ void cellular_panels(const std::filesystem::path& review) {
CHECK(app->request_screenshot(
(review / ("cellular-" + std::to_string(width) + ".bmp")).string()));
draw();
auto* tabs = GImGui->TabBars.GetByKey(journal->GetID("cell-tabs"));
CHECK(tabs);
const auto choose_tab = [&](const char* name) {
for (auto& tab : tabs->Tabs)
if (std::string_view{ImGui::TabBarGetTabName(tabs, &tab)} == name) {
const float x = tabs->BarRect.Min.x + tab.Offset + tab.Width / 2;
const float y = tabs->BarRect.GetCenter().y;
mouse(id, SDL_EVENT_MOUSE_MOTION, x, y);
draw();
mouse(id, SDL_EVENT_MOUSE_BUTTON_DOWN, x, y);
draw();
mouse(id, SDL_EVENT_MOUSE_BUTTON_UP, x, y);
for (int i = 0; i < 3; ++i)
draw();
CHECK(tabs->SelectedTabId == tab.ID);
return;
}
CHECK(false);
};
choose_tab("Food");
CHECK(journal->ScrollMax.x == 0);
CHECK(app->request_screenshot(
(review / ("cellular-food-" + std::to_string(width) + ".bmp")).string()));
draw();
choose_tab("Cell");
const auto saved_offer = play.offer();
play.disconnected();
play.connected();
@@ -506,17 +495,35 @@ void cellular_panels(const std::filesystem::path& review) {
}
if (width != 960)
continue;
// E opens the mutation window over the world.
SDL_Event e_key{};
e_key.type = SDL_EVENT_KEY_DOWN;
e_key.key.windowID = id;
e_key.key.scancode = SDL_SCANCODE_E;
e_key.key.key = SDLK_E;
e_key.key.down = true;
CHECK(SDL_PushEvent(&e_key));
draw();
auto e_up = e_key;
e_up.type = SDL_EVENT_KEY_UP;
e_up.key.down = false;
CHECK(SDL_PushEvent(&e_up));
for (int i = 0; i < 3; ++i)
draw();
CHECK(form.evolution_open);
const auto* evolution = ImGui::FindWindowByName("Evolution");
CHECK(evolution && evolution->Active && evolution->ScrollMax.x == 0);
CHECK(evolution->Pos.x >= journal->Pos.x + journal->Size.x &&
evolution->Pos.x + evolution->Size.x <= static_cast<float>(width));
CHECK(fits(evolution));
if (!review.empty()) {
CHECK(app->request_screenshot((review / "cellular-evolution.bmp").string()));
draw();
}
// Click the first production choice. Pointer ownership prevents world selection.
const auto probe = [&](const ImGuiWindow* panel, float x_fraction, const auto& done) {
const float x = panel->Pos.x + panel->Size.x * x_fraction;
// Every button is at least a frame high. Half-frame spacing still hits
// each button, including disabled ones, without rendering every five pixels.
const int stride = std::max(1, static_cast<int>(ImGui::GetFrameHeight() / 2));
for (int offset = 90; static_cast<float>(offset) < panel->Size.y - 10;
for (int offset = 8; static_cast<float>(offset) < panel->Size.y - 10;
offset += stride) {
const float y = panel->Pos.y + static_cast<float>(offset);
mouse(id, SDL_EVENT_MOUSE_MOTION, x, y);
@@ -539,22 +546,25 @@ void cellular_panels(const std::filesystem::path& review) {
const auto chose_candidate = [&] {
return action.mutation.has_value() && action.mutation->operator_id != 0;
};
CHECK(!probe(evolution, 0.5F, chose_candidate));
CHECK(!probe(evolution, 0.17F, chose_candidate));
action.mutation.reset();
CHECK(probe(evolution, 0.5F, [&] { return action.mutation.has_value(); }));
CHECK(probe(evolution, 0.17F, [&] { return action.mutation.has_value(); }));
CHECK(action.mutation == MutationChoice{901, 1, 100, 0});
action.mutation.reset();
perception.diagnostics = diagnostics;
draw();
CHECK(probe(evolution, 0.5F, chose_candidate));
CHECK(probe(evolution, 0.17F, chose_candidate));
CHECK(action.mutation == MutationChoice{901, 1, 100, 3});
CHECK(play.queue(CellAction::mutation, 102, required(action.mutation)));
const auto mutation_id = required(play.pending()).id;
draw();
CHECK(!probe(evolution, 0.5F, [&] { return action.mutation.has_value(); }));
CHECK(!probe(evolution, 0.17F, [&] { return action.mutation.has_value(); }));
play.outcome({mutation_id, network::ActionResult::committed, 103, 5});
draw();
CHECK(probe(journal, 0.75F, [&] { return action.cell_action == CellAction::bud; }));
bool budded = false;
for (float fraction = 0.1F; fraction < 1.0F && !budded; fraction += 0.1F)
budded = probe(dock, fraction, [&] { return action.cell_action == CellAction::bud; });
CHECK(budded);
play.observe_end({104, 901, network::CellularDeathReason::engulfed});
perception = {104, 0, {}, {}};
play.observe(perception);
@@ -563,10 +573,10 @@ void cellular_panels(const std::filesystem::path& review) {
CHECK(app->request_screenshot((review / "cellular-death.bmp").string()));
draw();
}
CHECK(probe(evolution, 0.5F, [&] { return action.restart_life; }));
CHECK(probe(evolution, 0.17F, [&] { return action.restart_life; }));
CHECK(play.restart());
draw();
CHECK(!probe(evolution, 0.5F, [&] { return action.restart_life; }));
CHECK(!probe(evolution, 0.17F, [&] { return action.restart_life; }));
}
}
} // namespace