Frame and follow the own cell in the cellular client view
Foundation / checks (ecs) (push) Successful in 2m22s
Foundation / checks (deploy) (push) Successful in 4m1s
Foundation / checks (tsan) (push) Successful in 9m43s
Foundation / checks (client) (push) Successful in 16m51s
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 18m3s
Foundation / checks (network) (push) Canceled after 18m2s
Foundation / checks (postgres) (push) Canceled after 18m9s

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 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 15:06:19 -04:00
co-authored by Claude Opus 5.5
parent 2a93d875a7
commit 532f45b99a
2 changed files with 74 additions and 26 deletions
+73 -25
View File
@@ -34,6 +34,9 @@ constexpr unsigned frames_per_authority_tick = 60;
// Frame composition: environment bound + organisms + 6 host rectangles (capture bar, // Frame composition: environment bound + organisms + 6 host rectangles (capture bar,
// intention dot, 4-sided selection highlight). Text and panels are the toolkit overlay. // 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; 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 = constexpr std::size_t organism_budget =
evo::render::max_rectangles - evo::render::max_environment_rectangles - host_rectangles; 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 // Local in-memory stand-in for authoritative region views until M9.7. It is never
@@ -201,17 +204,27 @@ void marker_box(std::vector<evo::render::Rectangle>& out, double x, double y, bo
: own ? evo::render::Color{250, 190, 40, 255} : own ? evo::render::Color{250, 190, 40, 255}
: evo::render::Color{90, 170, 250, 255}}); : evo::render::Color{90, 170, 250, 255}});
} }
void patch_box(std::vector<evo::render::Rectangle>& out, double x, double y, bool stocked, // A cellular food patch over its true 1 mm footprint (contact means overlapping it), dim so
bool selected, double width, double height) { // the cell stays visible on top; zoomed far out it shrinks to a bright marker instead.
const double half = selected ? 5 : 3; void patch_box(std::vector<evo::render::Rectangle>& out, evo::client::ScreenPoint low,
const double x0 = std::max(x - half, 0.0), y0 = std::max(y - half, 0.0); evo::client::ScreenPoint high, bool stocked, bool selected, double width,
const double x1 = std::min(x + half, width), y1 = std::min(y + half, height); 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) if (x1 > x0 && y1 > y0)
out.push_back({static_cast<float>(x0), static_cast<float>(y0), static_cast<float>(x1 - x0), out.push_back({static_cast<float>(x0), static_cast<float>(y0), static_cast<float>(x1 - x0),
static_cast<float>(y1 - y0), static_cast<float>(y1 - y0),
selected ? evo::render::Color{250, 190, 40, 255} selected ? (footprint ? evo::render::Color{120, 92, 24, 255}
: stocked ? evo::render::Color{80, 220, 130, 255} : evo::render::Color{250, 190, 40, 255})
: evo::render::Color{115, 125, 135, 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<evo::render::Rectangle>& out, double l, double t, double r, double b, void outline(std::vector<evo::render::Rectangle>& out, double l, double t, double r, double b,
double width, double height) { double width, double height) {
@@ -336,6 +349,7 @@ int main(int argc, char** argv) try {
evo::client::OrganismLayer population; evo::client::OrganismLayer population;
std::optional<std::uint64_t> disconnect_dialog; std::optional<std::uint64_t> disconnect_dialog;
std::optional<std::pair<std::uint32_t, std::uint32_t>> cellular_feed_target; std::optional<std::pair<std::uint32_t, std::uint32_t>> 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. // Validates the form and opens a fresh session; errors stay in the launcher.
const auto connect = [&](const evo::client::ConnectForm& f) { const auto connect = [&](const evo::client::ConnectForm& f) {
form_error.reset(); form_error.reset();
@@ -353,6 +367,7 @@ int main(int argc, char** argv) try {
form_error = evo::client::LaunchError::endpoint; form_error = evo::client::LaunchError::endpoint;
return false; return false;
} }
cellular_framed = false;
return host.connect(std::move(opened)); 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, if (!camera->resize({state.logical_width, state.logical_height, state.pixel_width,
state.pixel_height})) state.pixel_height}))
return 1; 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<double>(own->voxel.x) * pitch +
static_cast<double>(own->x.value) / 1000,
static_cast<double>(own->voxel.y) * pitch +
static_cast<double>(own->y.value) / 1000};
const double scale =
cellular_framed ? camera->units_per_mm()
: static_cast<double>(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 = if (auto result =
camera->pan({navigation.x * 400 * seconds, navigation.y * 400 * seconds}); camera->pan({navigation.x * 400 * seconds, navigation.y * 400 * seconds});
!result && result.error() != evo::client::CameraError::out_of_range) !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, boxes, env, env_layer ? env_layer->freshness() : evo::client::Freshness::none,
*camera, display)) *camera, display))
return 1; 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<double>(patch.x_um) / 1000,
static_cast<double>(patch.y_um) / 1000});
const auto high = camera->world_to_screen(
{(static_cast<double>(patch.x_um) + 1000) / 1000,
(static_cast<double>(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( const auto report = evo::render::append_organisms(
boxes, organism_budget, orgs, boxes, organism_budget, orgs,
org_layer ? org_layer->freshness() : evo::client::Freshness::none, *camera); org_layer ? org_layer->freshness() : evo::client::Freshness::none, *camera);
if (!report) if (!report)
return 1; return 1;
drawn_organisms = static_cast<int>(report->drawn); drawn_organisms = static_cast<int>(report->drawn);
const double width = state.logical_width, height = state.logical_height;
if (const auto* remote = host.session(); remote && mode() == Mode::remote) { 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<double>(patch.x_um) + 500) / 1000,
(static_cast<double>(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()) for (const auto& m : remote->markers())
if (const auto at = camera->world_to_screen({m.x_mm, m.y_mm})) 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); marker_box(boxes, at->x, at->y, m.own, m.stale, m.ghost, width, height);
@@ -12,7 +12,7 @@ spec:
env: env:
- {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION, value: "dev"}
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - {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"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
ports: ports:
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.