Show what a mutation costs and why an engulf failed
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (deploy) (push) Successful in 4m7s
Foundation / checks (tsan) (push) Successful in 9m49s
Foundation / checks (client) (push) Successful in 17m12s
Foundation / checks (network) (push) Successful in 19m34s
Foundation / checks (checks) (push) Successful in 43m5s
Foundation / checks (postgres) (push) Successful in 44m57s
Foundation / server-image (push) Successful in 31s
Foundation / postgres-tools (push) Successful in 1m13s
Foundation / image (push) Successful in 3m24s

After the first M11.9 playtest (ADR-0129 amendment): each offered candidate now
carries its funded cost to the cell, construction energy and matter per channel,
so the client can grey out what the reserve cannot pay; a candidate is affordable
by that cost exactly when the owner would fund it. A failed engulf now reports no
contact, prey too large, or membrane too thick. The v10 candidate record grows to
64 bytes, so v10 clients must be rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-14 15:39:35 -04:00
co-authored by Claude Opus 5.5
parent dba73a97f5
commit 7c16a13dd9
16 changed files with 172 additions and 41 deletions
+35 -7
View File
@@ -6,6 +6,7 @@
#include <algorithm>
#include <array>
#include <chrono>
#include <limits>
#include <utility>
namespace evo::server {
@@ -102,19 +103,46 @@ network::ActionOutcome action_outcome(const FinalCellularMutation& mutation) noe
mutation.tick, mutation.commit_sequence};
}
network::CellularMutationOffer offer_view(const CellularOwnedLife& life, std::uint64_t tick) {
network::CellularMutationOffer offer_view(const CellularLives& state, const CellularOwnedLife& life,
std::uint64_t tick) {
network::CellularMutationOffer view{tick, life.identity.life, 0, 0, {}};
const auto& offer = life.mutation.offer;
if (!offer)
return view;
view.event_index = life.mutation.event_index;
view.offer_tick = life.mutation.offer_tick;
for (const auto& candidate : offer->candidates)
if (view.candidates.size() < network::max_cellular_offered_candidates)
view.candidates.push_back(
{candidate.operator_id, static_cast<std::uint8_t>(candidate.target),
static_cast<std::uint8_t>(candidate.effect), candidate.parameter,
candidate.maintenance, candidate.total_mass});
const auto genome = state.archive().find(life.identity.genome);
// The cost does not depend on the reserve: fund against an ample one and read what it
// takes. The owner funds the real choice against the real reserve.
constexpr std::uint64_t ample = std::uint64_t{1} << 60U;
const accounting::Inventory unlimited{
{ample},
{accounting::Femtograms{ample}, accounting::Femtograms{ample},
accounting::Femtograms{ample}, accounting::Femtograms{ample}}};
constexpr auto probe_identity = std::numeric_limits<std::uint64_t>::max();
for (const auto& candidate : offer->candidates) {
if (view.candidates.size() >= network::max_cellular_offered_candidates)
break;
network::CellularOfferedCandidate shown{candidate.operator_id,
static_cast<std::uint8_t>(candidate.target),
static_cast<std::uint8_t>(candidate.effect),
candidate.parameter,
candidate.maintenance,
candidate.total_mass,
0,
{}};
if (genome) {
const auto funded =
biology::fund_mutation(*genome, offer->context, *offer, candidate.operator_id,
probe_identity, probe_identity, unlimited);
if (funded) {
shown.cost_energy_pj = funded->intake.energy.value;
for (std::size_t channel = 0; channel < shown.cost_matter_fg.size(); ++channel)
shown.cost_matter_fg[channel] = funded->intake.matter[channel].value;
}
}
view.candidates.push_back(shown);
}
std::ranges::sort(view.candidates, {}, &network::CellularOfferedCandidate::operator_id);
return view;
}