ADR 0127
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
This commit is contained in:
@@ -38,6 +38,7 @@ steer_cellular(const CellularControls& controls, client::Intention intention,
|
||||
const double y =
|
||||
static_cast<double>(own->voxel.y) * 1'000'000 + static_cast<double>(own->y.value);
|
||||
const double extent = static_cast<double>(own->phenotype.extent);
|
||||
bool target_has_energy = false;
|
||||
for (const auto& p : perception->patches) {
|
||||
if (p.energy_pj == 0 &&
|
||||
std::ranges::all_of(p.matter_fg, [](auto v) { return v == 0; }))
|
||||
@@ -46,8 +47,11 @@ steer_cellular(const CellularControls& controls, client::Intention intention,
|
||||
std::max({static_cast<double>(p.x_um) - x - extent, x - p.x_um - 1000, 0.0});
|
||||
const double dy =
|
||||
std::max({static_cast<double>(p.y_um) - y - extent, y - p.y_um - 1000, 0.0});
|
||||
if (controls.auto_feed && !result.patch && dx == 0 && dy == 0)
|
||||
if (controls.auto_feed && dx == 0 && dy == 0 &&
|
||||
(!result.patch || (!target_has_energy && p.energy_pj != 0))) {
|
||||
result.patch = {p.x_um, p.y_um};
|
||||
target_has_energy = p.energy_pj != 0;
|
||||
}
|
||||
// Presentation preference: approach food at at most 500 um/s (25 um/tick).
|
||||
// Recomputed from the current phenotype after every mutation. Authority
|
||||
// still determines displacement, contact, funding and intake.
|
||||
|
||||
@@ -33,6 +33,10 @@ struct CellActionRecord {
|
||||
MutationChoice choice{};
|
||||
network::AdmitStatus refusal{network::AdmitStatus::admitted};
|
||||
};
|
||||
struct CellEnergyChange {
|
||||
std::uint64_t from_tick{}, to_tick{}, amount{};
|
||||
bool falling{};
|
||||
};
|
||||
|
||||
class CellularPlay {
|
||||
public:
|
||||
@@ -54,6 +58,8 @@ class CellularPlay {
|
||||
void disconnected() {
|
||||
connected_ = false;
|
||||
fresh_ = false;
|
||||
energy_sample_.reset();
|
||||
energy_change_.reset();
|
||||
offer_.reset();
|
||||
if (pending_) {
|
||||
if (pending_->state == CellActionState::queued) {
|
||||
@@ -71,6 +77,20 @@ class CellularPlay {
|
||||
fresh_ = true;
|
||||
if (ended_ && view.life_identity == ended_->life_identity)
|
||||
return; // A retained pre-death view must never revive this identity.
|
||||
if (view.life_identity != 0 && view.diagnostics) {
|
||||
const auto energy = view.diagnostics->reserve_energy_pj;
|
||||
if (energy_sample_ && energy_sample_->life == view.life_identity) {
|
||||
if (view.tick > energy_sample_->tick)
|
||||
energy_change_ = CellEnergyChange{energy_sample_->tick, view.tick,
|
||||
energy < energy_sample_->energy
|
||||
? energy_sample_->energy - energy
|
||||
: energy - energy_sample_->energy,
|
||||
energy < energy_sample_->energy};
|
||||
} else {
|
||||
energy_change_.reset();
|
||||
}
|
||||
energy_sample_ = EnergySample{view.life_identity, view.tick, energy};
|
||||
}
|
||||
// Never replay an intention onto a later life. Keep its uncertain result visible.
|
||||
if (life_ != view.life_identity) {
|
||||
offer_.reset();
|
||||
@@ -95,6 +115,7 @@ class CellularPlay {
|
||||
}
|
||||
if (life_ != 0) {
|
||||
birth_pending_ = false;
|
||||
birth_result_ = network::PrimitiveLifeResult::born;
|
||||
if (ended_ && ended_->life_identity != life_)
|
||||
ended_.reset();
|
||||
}
|
||||
@@ -201,7 +222,11 @@ class CellularPlay {
|
||||
finish();
|
||||
}
|
||||
[[nodiscard]] bool can_restart() const {
|
||||
return connected_ && fresh_ && life_ == 0 && !birth_pending_;
|
||||
const bool refused = birth_result_ == network::PrimitiveLifeResult::insufficient_funding ||
|
||||
birth_result_ == network::PrimitiveLifeResult::no_placement ||
|
||||
birth_result_ == network::PrimitiveLifeResult::cancelled;
|
||||
return connected_ && (fresh_ || refused) && life_ == 0 && !birth_pending_ &&
|
||||
(birth_result_ != network::PrimitiveLifeResult::existing_life || ended_);
|
||||
}
|
||||
[[nodiscard]] bool restart() {
|
||||
if (!can_restart())
|
||||
@@ -211,6 +236,7 @@ class CellularPlay {
|
||||
return false;
|
||||
birth_request_ = id;
|
||||
birth_pending_ = true;
|
||||
birth_result_ = network::PrimitiveLifeResult::pending;
|
||||
return true;
|
||||
}
|
||||
void birth(const network::PrimitiveLifeOutcome& result) {
|
||||
@@ -258,6 +284,9 @@ class CellularPlay {
|
||||
[[nodiscard]] const auto& bud_feedback() const {
|
||||
return bud_feedback_;
|
||||
}
|
||||
[[nodiscard]] const auto& energy_change() const {
|
||||
return energy_change_;
|
||||
}
|
||||
|
||||
private:
|
||||
void finish() {
|
||||
@@ -277,5 +306,10 @@ class CellularPlay {
|
||||
std::deque<CellActionRecord> history_;
|
||||
std::optional<std::pair<std::uint64_t, network::CellularEngulfResult>> engulf_feedback_;
|
||||
std::optional<std::pair<std::uint64_t, network::CellularBudOutcome>> bud_feedback_;
|
||||
struct EnergySample {
|
||||
std::uint64_t life{}, tick{}, energy{};
|
||||
};
|
||||
std::optional<EnergySample> energy_sample_;
|
||||
std::optional<CellEnergyChange> energy_change_;
|
||||
};
|
||||
} // namespace evo::client_app
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include <vector>
|
||||
|
||||
namespace evo::client_app {
|
||||
inline constexpr std::size_t patch_rectangles = 3;
|
||||
inline constexpr std::size_t patch_rectangles = 11;
|
||||
// The border keeps the 1 mm contact footprint readable; the inset is decorative.
|
||||
// No stock percentage is invented: the centre mark means some stock remains.
|
||||
// E (gold) and M (teal) identify energy and matter stock, without invented percentages.
|
||||
inline void patch_box(std::vector<render::Rectangle>& out, client::ScreenPoint low,
|
||||
client::ScreenPoint high, bool stocked, bool selected, double width,
|
||||
double height, bool stale = false) {
|
||||
client::ScreenPoint high, bool energy, bool matter, bool selected,
|
||||
double width, double height, bool stale = false) {
|
||||
const double minimum = selected ? 5 : 3;
|
||||
const double hx = std::max((high.x - low.x) / 2, minimum);
|
||||
const double hy = std::max((low.y - high.y) / 2, minimum);
|
||||
@@ -30,18 +30,34 @@ inline void patch_box(std::vector<render::Rectangle>& out, client::ScreenPoint l
|
||||
static_cast<float>(b - t), color});
|
||||
};
|
||||
rect(x - hx, y - hy, x + hx, y + hy,
|
||||
selected ? render::Color{233, 182, 85, 255}
|
||||
: stocked ? render::Color{49, 112, 105, 255}
|
||||
: render::Color{58, 69, 77, 255});
|
||||
selected ? render::Color{233, 182, 85, 255}
|
||||
: energy ? render::Color{155, 117, 45, 255}
|
||||
: matter ? render::Color{49, 112, 105, 255}
|
||||
: render::Color{58, 69, 77, 255});
|
||||
if (hx <= 6 || hy <= 6)
|
||||
return;
|
||||
const double border = selected ? 2 : 1;
|
||||
rect(x - hx + border, y - hy + border, x + hx - border, y + hy - border,
|
||||
selected ? render::Color{53, 49, 31, 255} : render::Color{17, 40, 43, 255});
|
||||
if (stocked) {
|
||||
const double mark = std::clamp(std::min(hx, hy) * 0.08, 2.0, 5.0);
|
||||
rect(x - mark, y - mark, x + mark, y + mark,
|
||||
selected ? render::Color{233, 182, 85, 255} : render::Color{90, 185, 150, 255});
|
||||
if (hx >= 16 && hy >= 16) {
|
||||
const double top = y - hy + 7;
|
||||
if (energy) {
|
||||
const double left = matter ? x - 12 : x - 4;
|
||||
const render::Color gold{233, 182, 85, 255};
|
||||
rect(left, top, left + 2, top + 12, gold);
|
||||
rect(left + 2, top, left + 8, top + 2, gold);
|
||||
rect(left + 2, top + 5, left + 7, top + 7, gold);
|
||||
rect(left + 2, top + 10, left + 8, top + 12, gold);
|
||||
}
|
||||
if (matter) {
|
||||
const double left = energy ? x + 3 : x - 5;
|
||||
const render::Color teal{90, 185, 150, 255};
|
||||
rect(left, top, left + 2, top + 12, teal);
|
||||
rect(left + 8, top, left + 10, top + 12, teal);
|
||||
rect(left + 2, top + 2, left + 4, top + 5, teal);
|
||||
rect(left + 6, top + 2, left + 8, top + 5, teal);
|
||||
rect(left + 4, top + 4, left + 6, top + 7, teal);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace evo::client_app
|
||||
|
||||
@@ -642,10 +642,8 @@ int main(int argc, char** argv) try {
|
||||
(static_cast<double>(patch.y_um) + 1000) / 1000});
|
||||
if (low && high)
|
||||
evo::client_app::patch_box(
|
||||
boxes, *low, *high,
|
||||
patch.energy_pj != 0 ||
|
||||
std::ranges::any_of(patch.matter_fg,
|
||||
[](auto v) { return v != 0; }),
|
||||
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, !remote->cellular_play().fresh());
|
||||
|
||||
@@ -568,6 +568,23 @@ void cell_vitals(const PanelView& v) {
|
||||
ImGui::PushFont(nullptr, 24);
|
||||
ImGui::TextWrapped("%llu pJ", static_cast<unsigned long long>(d.reserve_energy_pj));
|
||||
ImGui::PopFont();
|
||||
if (const auto& change = play->energy_change(); change) {
|
||||
ImGui::TextColored(change->falling ? amber : green, "%s%llu pJ net",
|
||||
change->falling ? "-" : "+",
|
||||
static_cast<unsigned long long>(change->amount));
|
||||
ImGui::TextDisabled("Across %llu observed ticks",
|
||||
static_cast<unsigned long long>(change->to_tick - change->from_tick));
|
||||
if (change->falling)
|
||||
disabled_wrapped(
|
||||
"Energy is falling. Feeding may not cover upkeep, movement or actions.");
|
||||
}
|
||||
if (v.cellular_feed_target) {
|
||||
const auto patch = std::ranges::find_if(p->patches, [&](const auto& candidate) {
|
||||
return v.cellular_feed_target == std::pair{candidate.x_um, candidate.y_um};
|
||||
});
|
||||
if (patch != p->patches.end() && patch->energy_pj == 0)
|
||||
ImGui::TextWrapped("FEED TARGET HAS NO ENERGY. Check Food for another patch.");
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginTable("matter", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
constexpr std::array names{"Carbon", "Nitrogen", "Phosphorus", "Other matter"};
|
||||
@@ -588,8 +605,8 @@ void cell_vitals(const PanelView& v) {
|
||||
static_cast<unsigned long long>(d.movement_cost_pj));
|
||||
constexpr std::array movement{"Unavailable", "Resting", "Moving", "Movement blocked",
|
||||
"Not enough energy to move"};
|
||||
constexpr std::array intake{"Unavailable", "Not feeding", "Food absorbed", "Food patch missing",
|
||||
"Move into contact to feed"};
|
||||
constexpr std::array intake{"Unavailable", "Not feeding", "Feeding attempt processed",
|
||||
"Food patch missing", "Move into contact to feed"};
|
||||
constexpr std::array engulf{"Unavailable",
|
||||
"Not requested",
|
||||
"Prey engulfed",
|
||||
@@ -606,6 +623,8 @@ void cell_vitals(const PanelView& v) {
|
||||
"No space for a bud"};
|
||||
ImGui::TextWrapped("%s", movement.at(static_cast<std::size_t>(d.movement)));
|
||||
ImGui::TextWrapped("%s", intake.at(static_cast<std::size_t>(d.intake)));
|
||||
if (d.intake == network::CellularIntakeResult::acquired)
|
||||
disabled_wrapped("A feeding attempt can yield zero energy. Watch the reserve change.");
|
||||
if (const auto& feedback = play->engulf_feedback(); feedback)
|
||||
ImGui::TextWrapped("%s (tick %llu)", engulf.at(static_cast<std::size_t>(feedback->second)),
|
||||
static_cast<unsigned long long>(feedback->first));
|
||||
@@ -620,8 +639,12 @@ void cell_food(const PanelView& v, PanelActions& a, FormBuffers& form) {
|
||||
ImGui::Checkbox("Precision steering (20%)", &form.cellular_controls.precision);
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::SliderInt("##speed", &form.cellular_controls.speed_percent, 1, 100, "Speed: %d%%");
|
||||
disabled_wrapped("Steer onto food. Automatic feeding targets a stocked patch touching your "
|
||||
"cell. Choose a patch below to switch to manual feeding.");
|
||||
disabled_wrapped(
|
||||
"Map key: gold E = energy, teal M = matter; no letters = empty (zoom in to "
|
||||
"see letters). Auto feed prefers energy in contact. Choose a patch for manual feeding.");
|
||||
disabled_wrapped("Patch stock is finite and shared. Matter does not replenish energy. Uptake "
|
||||
"is limited by your cell; stock is not a promise of gain each tick. Upkeep is "
|
||||
"paid before feeding.");
|
||||
const bool active = v.cellular_play && v.cellular_play->fresh() && v.cellular_play->life() != 0;
|
||||
ImGui::BeginDisabled(!active);
|
||||
if (v.cellular_feed_target && ImGui::Button("Stop feeding", {-1, 0}))
|
||||
@@ -634,7 +657,13 @@ void cell_food(const PanelView& v, PanelActions& a, FormBuffers& form) {
|
||||
ImGui::PushID(static_cast<int>(patch.y_um));
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Patch %u / %u um", patch.x_um, patch.y_um);
|
||||
ImGui::Text("%llu pJ", static_cast<unsigned long long>(patch.energy_pj));
|
||||
const bool has_matter =
|
||||
std::ranges::any_of(patch.matter_fg, [](auto amount) { return amount != 0; });
|
||||
ImGui::TextColored(patch.energy_pj != 0 ? amber : green, "%s",
|
||||
patch.energy_pj != 0 ? "E ENERGY AVAILABLE"
|
||||
: has_matter ? "M MATTER ONLY / NO ENERGY"
|
||||
: "EMPTY / DEPLETED");
|
||||
ImGui::Text("Energy stock: %llu pJ", static_cast<unsigned long long>(patch.energy_pj));
|
||||
ImGui::TextWrapped("C %llu / N %llu / P %llu / other %llu fg",
|
||||
static_cast<unsigned long long>(patch.matter_fg[0]),
|
||||
static_cast<unsigned long long>(patch.matter_fg[1]),
|
||||
@@ -693,6 +722,10 @@ void cell_evolution(const PanelView& v, PanelActions& a) {
|
||||
: cause == network::CellularDeathReason::engulfed
|
||||
? "Your cell was engulfed."
|
||||
: "The cause was not recorded.");
|
||||
if (cause == network::CellularDeathReason::starved)
|
||||
disabled_wrapped("Your reserve could not pay upkeep before feeding. A patch can "
|
||||
"still hold matter after its energy runs out; intake can also be "
|
||||
"slower than your energy spending.");
|
||||
ImGui::TextWrapped("Its history and descendants remain. Your next life begins as a new "
|
||||
"primitive cell.");
|
||||
} else {
|
||||
@@ -705,6 +738,10 @@ void cell_evolution(const PanelView& v, PanelActions& a) {
|
||||
if (ImGui::Button("Start new life", {-1, px(38)}))
|
||||
a.restart_life = true;
|
||||
ImGui::EndDisabled();
|
||||
if (play->birth_pending())
|
||||
disabled_wrapped(
|
||||
"Waiting for the server. Rechecking this same birth request every "
|
||||
"2 seconds. Reconnecting or creating an account cannot refill a nursery.");
|
||||
if (v.remote && !v.remote->cellular_action.empty())
|
||||
ImGui::TextWrapped("%s", v.remote->cellular_action.c_str());
|
||||
return;
|
||||
|
||||
@@ -235,6 +235,7 @@ class RemoteSession {
|
||||
return false;
|
||||
cellular_feed_target_.reset();
|
||||
birth_check_at_ = {};
|
||||
cellular_action_status_ = "New life requested; waiting for the server";
|
||||
return true;
|
||||
}
|
||||
void keep_cellular_unknown() {
|
||||
@@ -620,7 +621,8 @@ class RemoteSession {
|
||||
"Cell founded (life " + std::to_string(outcome.life_identity) + ")";
|
||||
break;
|
||||
case network::PrimitiveLifeResult::insufficient_funding:
|
||||
cellular_action_status_ = "Birth refused: nursery funding is insufficient";
|
||||
cellular_action_status_ = "Birth refused: the region nursery lacks resources. "
|
||||
"A new account cannot restore them.";
|
||||
break;
|
||||
case network::PrimitiveLifeResult::no_placement:
|
||||
cellular_action_status_ = "Birth refused: no open spawn site";
|
||||
@@ -632,7 +634,8 @@ class RemoteSession {
|
||||
cellular_action_status_ = "Birth request cancelled";
|
||||
break;
|
||||
case network::PrimitiveLifeResult::pending:
|
||||
cellular_action_status_ = "Cell birth is being committed";
|
||||
cellular_action_status_ =
|
||||
"Birth is pending on the server; no new cell confirmed yet";
|
||||
break;
|
||||
case network::PrimitiveLifeResult::unknown:
|
||||
cellular_action_status_ = "Birth outcome is unknown; retrying exact request";
|
||||
|
||||
Reference in New Issue
Block a user