Wire cellular playtest into engineering client
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 39s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (ecs) (push) Canceled after 42s
Foundation / checks (network) (push) Canceled after 12s
Foundation / checks (client) (push) Canceled after 52s

This commit is contained in:
dingo
2026-10-11 01:14:40 -04:00
parent 27778def2c
commit 1bba54ebd8
7 changed files with 259 additions and 13 deletions
+54 -5
View File
@@ -20,6 +20,7 @@
#include <optional>
#include <string_view>
#include <thread>
#include <utility>
#include <vector>
namespace {
@@ -32,7 +33,7 @@ constexpr std::uint32_t fixture_mask = (1U << 0) | (1U << 1) | (1U << 2) | (1U <
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;
constexpr std::size_t host_rectangles = 6 + evo::network::max_cellular_perceived_patches;
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
@@ -200,6 +201,18 @@ void marker_box(std::vector<evo::render::Rectangle>& 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<evo::render::Rectangle>& 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);
if (x1 > x0 && y1 > y0)
out.push_back({static_cast<float>(x0), static_cast<float>(y0), static_cast<float>(x1 - x0),
static_cast<float>(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}});
}
void outline(std::vector<evo::render::Rectangle>& out, double l, double t, double r, double b,
double width, double height) {
const auto rect = [&](double x0, double y0, double x1, double y1) {
@@ -237,6 +250,7 @@ int main(int argc, char** argv) try {
evo::render::EnvironmentDisplay display;
evo::client::ConnectForm form;
bool connect_now = false;
bool cellular_trial = false;
for (int i = 1; i < argc; ++i) {
const std::string_view arg{argv[i]};
if (arg == "--version") { // Build identity for tester reports (ADR-0086).
@@ -250,6 +264,8 @@ int main(int argc, char** argv) try {
config.hidden = true;
else if (arg == "--fixture")
start_fixture = true;
else if (arg == "--cellular")
cellular_trial = true;
else if (arg == "--connect" && i + 1 < argc) {
form.endpoint = argv[++i];
connect_now = true;
@@ -294,7 +310,7 @@ int main(int argc, char** argv) try {
std::fputs("usage: evo-client [--version] [--renderer NAME] [--hidden] "
"[--frames 1..100000] [--size W,H]\n"
" [--fixture | --connect HOST:PORT --server-name NAME "
"--ca FILE --grants FILE]\n"
"--ca FILE --grants FILE [--cellular]]\n"
" [--layer water|nitrogen|...|heat|moisture]\n"
" [--refresh-every 1..1000] [--pick X,Y] "
"[--screenshot FILE.bmp --frames N]\n"
@@ -304,7 +320,8 @@ int main(int argc, char** argv) try {
return 2;
}
}
if ((start_fixture && connect_now) || (!screenshot.empty() && frames == 0))
if ((start_fixture && connect_now) || (start_fixture && cellular_trial) ||
(!screenshot.empty() && frames == 0))
return 2;
// Launcher phase and remote session change together (fixture/live distinction).
evo::client::SessionHost<evo::client_app::RemoteSession> host;
@@ -318,6 +335,7 @@ int main(int argc, char** argv) try {
evo::client::EnvironmentLayer environment;
evo::client::OrganismLayer population;
std::optional<std::uint64_t> disconnect_dialog;
std::optional<std::pair<std::uint32_t, std::uint32_t>> cellular_feed_target;
// Validates the form and opens a fresh session; errors stay in the launcher.
const auto connect = [&](const evo::client::ConnectForm& f) {
form_error.reset();
@@ -330,7 +348,7 @@ int main(int argc, char** argv) try {
form_error = material.error();
return false;
}
auto opened = evo::client_app::RemoteSession::open(*material);
auto opened = evo::client_app::RemoteSession::open(*material, cellular_trial);
if (!opened) {
form_error = evo::client::LaunchError::endpoint;
return false;
@@ -347,6 +365,7 @@ int main(int argc, char** argv) try {
environment.reset();
population.reset();
selection.clear();
cellular_feed_target.reset();
host.enter_fixture(); // Ends any remote attempt: nothing runs behind the banner.
return true;
};
@@ -413,6 +432,7 @@ int main(int argc, char** argv) try {
view.launcher = &launcher;
view.form_error = form_error;
view.remote_available = evo::client_app::remote_available;
view.cellular_trial = cellular_trial;
view.environment = shown_environment();
view.organisms = shown_organisms();
view.selection = &selection;
@@ -420,6 +440,8 @@ int main(int argc, char** argv) try {
if (const auto* remote = host.session(); remote && view.mode == Mode::remote) {
view.remote = remote->status();
view.outcomes = &remote->outcomes();
view.cellular_perception = remote->cellular_perception();
view.cellular_feed_target = cellular_feed_target;
}
view.visible_organisms = drawn_organisms;
view.bindings = &(*app)->bindings();
@@ -445,11 +467,14 @@ int main(int argc, char** argv) try {
// Panel actions from the previous rendered frame.
if (actions.fixture && !enter_fixture())
return 1;
if (actions.cellular_trial)
cellular_trial = *actions.cellular_trial;
if ((actions.connect || actions.retry) && connect(buffers.form())) {
selection.clear();
}
if (actions.cancel || actions.back) {
host.cancel(); // Drops the connection; its unresolved outcomes are unknown.
cellular_feed_target.reset();
selection.clear();
}
if (actions.ask_disconnect && !disconnect_dialog)
@@ -461,12 +486,19 @@ int main(int argc, char** argv) try {
ui.close_dialog(*actions.confirm_dialog)) {
disconnect_dialog.reset();
host.cancel();
cellular_feed_target.reset();
selection.clear();
}
if (actions.cancel_dialog && ui.close_dialog(*actions.cancel_dialog))
disconnect_dialog.reset();
if (actions.dismiss_notice)
static_cast<void>(ui.dismiss(*actions.dismiss_notice));
if (actions.stop_feeding)
cellular_feed_target.reset();
if (actions.feed_patch)
cellular_feed_target = actions.feed_patch;
if (auto* remote = host.session(); remote && mode() == Mode::remote)
remote->set_cellular_feed_target(cellular_trial ? cellular_feed_target : std::nullopt);
controls.step(actions, **app, ui);
actions = {};
// The launcher and modal dialogs own input: no world movement or selection.
@@ -551,10 +583,27 @@ int main(int argc, char** argv) try {
return 1;
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())
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);
}
if (const auto* o = selection.organism(orgs)) {
const auto b = evo::render::organism_bounds(*o, *camera);
outline(boxes, b.left - 3, b.top - 3, b.right + 3, b.bottom + 3, width, height);