From 532f45b99a7625835ba5a83f9307b8d8cb1cb91b Mon Sep 17 00:00:00 2001 From: dingo Date: Tue, 13 Oct 2026 15:06:19 -0400 Subject: [PATCH] Frame and follow the own cell in the cellular client view The camera started at 0.05 px/mm, the metre-scale lineage default, so the whole 10 mm cellular arena drew inside half a pixel and the player could not find their cell. In the cellular trial, frame about 12 mm around the own cell (organism id == life identity) once, then keep it centred while keeping the player's zoom. Draw food patches as their true 1 mm footprint under the organisms, so contact with a patch is visible. Also refresh the dev session window (3 h). Co-Authored-By: Claude Opus 5.5 --- apps/evo-client/main.cpp | 98 ++++++++++++++----- .../region/dev-session-route/listener.yaml | 2 +- 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/apps/evo-client/main.cpp b/apps/evo-client/main.cpp index adece71..af7ee5f 100644 --- a/apps/evo-client/main.cpp +++ b/apps/evo-client/main.cpp @@ -34,6 +34,9 @@ constexpr unsigned frames_per_authority_tick = 60; // Frame composition: environment bound + organisms + 6 host rectangles (capture bar, // intention dot, 4-sided selection highlight). Text and panels are the toolkit overlay. constexpr std::size_t host_rectangles = 6 + evo::network::max_cellular_perceived_patches; +// M11.3: the cellular arena is millimetres across, far below the metre-scale default +// camera; the first view frames this much of it around the own cell. +constexpr double cellular_view_mm = 12; constexpr std::size_t organism_budget = evo::render::max_rectangles - evo::render::max_environment_rectangles - host_rectangles; // Local in-memory stand-in for authoritative region views until M9.7. It is never @@ -201,17 +204,27 @@ void marker_box(std::vector& out, double x, double y, bo : own ? evo::render::Color{250, 190, 40, 255} : evo::render::Color{90, 170, 250, 255}}); } -void patch_box(std::vector& out, double x, double y, bool stocked, - bool selected, double width, double height) { - const double half = selected ? 5 : 3; - const double x0 = std::max(x - half, 0.0), y0 = std::max(y - half, 0.0); - const double x1 = std::min(x + half, width), y1 = std::min(y + half, height); +// A cellular food patch over its true 1 mm footprint (contact means overlapping it), dim so +// the cell stays visible on top; zoomed far out it shrinks to a bright marker instead. +void patch_box(std::vector& out, evo::client::ScreenPoint low, + evo::client::ScreenPoint high, bool stocked, bool selected, double width, + double height) { + const double minimum = selected ? 5 : 3; + const double half_x = std::max((high.x - low.x) / 2, minimum); + const double half_y = std::max((low.y - high.y) / 2, minimum); + const bool footprint = half_x > 6 && half_y > 6; + const double x = (low.x + high.x) / 2, y = (low.y + high.y) / 2; + const double x0 = std::max(x - half_x, 0.0), y0 = std::max(y - half_y, 0.0); + const double x1 = std::min(x + half_x, width), y1 = std::min(y + half_y, height); if (x1 > x0 && y1 > y0) out.push_back({static_cast(x0), static_cast(y0), static_cast(x1 - x0), static_cast(y1 - y0), - selected ? evo::render::Color{250, 190, 40, 255} - : stocked ? evo::render::Color{80, 220, 130, 255} - : evo::render::Color{115, 125, 135, 255}}); + selected ? (footprint ? evo::render::Color{120, 92, 24, 255} + : evo::render::Color{250, 190, 40, 255}) + : stocked ? (footprint ? evo::render::Color{32, 100, 60, 255} + : evo::render::Color{80, 220, 130, 255}) + : footprint ? evo::render::Color{52, 58, 64, 255} + : evo::render::Color{115, 125, 135, 255}}); } void outline(std::vector& out, double l, double t, double r, double b, double width, double height) { @@ -336,6 +349,7 @@ int main(int argc, char** argv) try { evo::client::OrganismLayer population; std::optional disconnect_dialog; std::optional> cellular_feed_target; + bool cellular_framed = false; // The camera has been zoomed to the cellular arena. // Validates the form and opens a fresh session; errors stay in the launcher. const auto connect = [&](const evo::client::ConnectForm& f) { form_error.reset(); @@ -353,6 +367,7 @@ int main(int argc, char** argv) try { form_error = evo::client::LaunchError::endpoint; return false; } + cellular_framed = false; return host.connect(std::move(opened)); } }; @@ -555,6 +570,34 @@ int main(int argc, char** argv) try { if (!camera->resize({state.logical_width, state.logical_height, state.pixel_width, state.pixel_height})) return 1; + // M11.3: keep the own cell (organism id == life identity) centred, framing the + // arena once; the player's zoom is kept after that. + if (const auto* remote = host.session(); + remote && mode() == Mode::remote && cellular_trial && orgs != nullptr) + if (const auto* perception = remote->cellular_perception(); + perception && perception->life_identity != 0) { + const auto cells = orgs->cells(); + const auto own = std::ranges::find(cells, perception->life_identity, + &evo::client::OrganismCell::id); + if (own != cells.end()) { + const double pitch = evo::world::cell_pitch_mm; + const evo::client::WorldPoint centre{ + static_cast(own->voxel.x) * pitch + + static_cast(own->x.value) / 1000, + static_cast(own->voxel.y) * pitch + + static_cast(own->y.value) / 1000}; + const double scale = + cellular_framed ? camera->units_per_mm() + : static_cast(std::min(state.logical_width, + state.logical_height)) / + cellular_view_mm; + if (auto moved = + evo::client::Camera::create(camera->viewport(), centre, scale)) { + *camera = *moved; + cellular_framed = true; + } + } + } if (auto result = camera->pan({navigation.x * 400 * seconds, navigation.y * 400 * seconds}); !result && result.error() != evo::client::CameraError::out_of_range) @@ -576,30 +619,35 @@ int main(int argc, char** argv) try { boxes, env, env_layer ? env_layer->freshness() : evo::client::Freshness::none, *camera, display)) return 1; + const double width = state.logical_width, height = state.logical_height; + // Cellular patches under the organisms, so the own cell draws on top of them. + if (const auto* remote = host.session(); + remote && mode() == Mode::remote && cellular_trial) + if (const auto* perception = remote->cellular_perception()) + for (const auto& patch : perception->patches) { + const auto low = + camera->world_to_screen({static_cast(patch.x_um) / 1000, + static_cast(patch.y_um) / 1000}); + const auto high = camera->world_to_screen( + {(static_cast(patch.x_um) + 1000) / 1000, + (static_cast(patch.y_um) + 1000) / 1000}); + if (low && high) + patch_box(boxes, *low, *high, + patch.energy_pj != 0 || + std::ranges::any_of(patch.matter_fg, + [](auto v) { return v != 0; }), + cellular_feed_target && + cellular_feed_target->first == patch.x_um && + cellular_feed_target->second == patch.y_um, + width, height); + } const auto report = evo::render::append_organisms( boxes, organism_budget, orgs, org_layer ? org_layer->freshness() : evo::client::Freshness::none, *camera); if (!report) return 1; drawn_organisms = static_cast(report->drawn); - const double width = state.logical_width, height = state.logical_height; if (const auto* remote = host.session(); remote && mode() == Mode::remote) { - if (cellular_trial) - if (const auto* perception = remote->cellular_perception()) - for (const auto& patch : perception->patches) { - const auto at = camera->world_to_screen( - {(static_cast(patch.x_um) + 500) / 1000, - (static_cast(patch.y_um) + 500) / 1000}); - if (at) - patch_box(boxes, at->x, at->y, - patch.energy_pj != 0 || - std::ranges::any_of(patch.matter_fg, - [](auto v) { return v != 0; }), - cellular_feed_target && - cellular_feed_target->first == patch.x_um && - cellular_feed_target->second == patch.y_um, - width, height); - } for (const auto& m : remote->markers()) if (const auto at = camera->world_to_screen({m.x_mm, m.y_mm})) marker_box(boxes, at->x, at->y, m.own, m.stale, m.ghost, width, height); diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index b27dffb..d269e62 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -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-20261013T181510-37884:1791926110"} + - {name: REGION_SESSION_WINDOW, value: "dev-20261013T190618-44628:1791929178"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.