feat(cellular): session v14, bundle 15 and rules-13 wildlife
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s
Session v14 carries the rules-13 revamp: a body block in the owner's view (members, emergence threshold, exclusions, Emerge open, payable energy, mass and the 20 traits), become, emerge and channel exclusions on actions, become on mutation choices, catalog offers (id, chance, cost) and the emerged ending. Older sessions never see a v14 field. The client shows Stay / Become offspring offers named from the shared catalog, continuing as a bud, the organism and its Emerge button, kept channels, the body and the emerged end screen. Bundle 15 (rules 13 on owner format 11) is durable: schema 60 admits it raw-only, stores become as bit 15 of the choice's operator, widens the action input and mutation results, and publishes the 14 -> 15 revamp profile migration. evo-world-clone opens cellular-v10 (cellular-v9 plus the revamp upgrade from --revamp-tuning), resumable and recoverable. Wildlife counts reserve matter as energy, waits for the bud fee, grows organisms one short of emerging, and hunts by the region step's rules-13 engulf test. The play summary adds organisms, offers and the spent pool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -110,9 +110,9 @@ class CellularBridge {
|
||||
config.select_cellular_mutation = [&host](const network::AccountId& account,
|
||||
std::uint64_t generation,
|
||||
const network::CellularMutationAction& m) {
|
||||
const auto reply =
|
||||
host.select_mutation(account.bytes, generation, m.action_id,
|
||||
{m.life_identity, m.event_index, m.offer_tick, m.operator_id});
|
||||
const auto reply = host.select_mutation(
|
||||
account.bytes, generation, m.action_id,
|
||||
{m.life_identity, m.event_index, m.offer_tick, m.operator_id, m.become});
|
||||
server::CellularMutationAnswer answer{
|
||||
server::admit_status(reply.status), reply.tick, {}};
|
||||
if (reply.outcome)
|
||||
@@ -284,6 +284,40 @@ class CellularBridge {
|
||||
c.min_speed_um_per_s,
|
||||
c.max_speed_um_per_s};
|
||||
}
|
||||
// Rules 13 (v14): the body block. Older sessions never see it.
|
||||
diagnostics.members = life.revamp.members;
|
||||
if (const auto genome = state.archive().find(life.identity.genome)) {
|
||||
const auto& traits = genome->cellular_traits();
|
||||
const auto t = traits.value_or(biology::CellularTraits{});
|
||||
const std::array<std::uint16_t, 20> fields{
|
||||
t.density, t.upkeep_efficiency, t.growth_speed, t.collection[0],
|
||||
t.collection[1], t.collection[2], t.collection[3], t.collection[4],
|
||||
t.burn[0], t.burn[1], t.burn[2], t.burn[3],
|
||||
t.engulf_capacity, t.kill_absorption, t.litter, t.recipe[0],
|
||||
t.recipe[1], t.recipe[2], t.recipe[3], t.adhesion};
|
||||
if (traits)
|
||||
diagnostics.traits = fields;
|
||||
if (state.rules_version() >= server::cellular_lives_revamp_rules) {
|
||||
const auto& rules = state.revamp_rules();
|
||||
diagnostics.emerge_members = static_cast<std::uint16_t>(
|
||||
std::min<std::uint32_t>(rules.emerge_members, 0xFFFF));
|
||||
diagnostics.can_emerge = server::cellular_can_emerge(life, rules);
|
||||
if (feedback != state.last_tick_feedback().end() &&
|
||||
feedback->life_id == life.identity.life && feedback->tick == tick)
|
||||
diagnostics.exclude = feedback->exclude;
|
||||
const auto burn = biology::cellular_burn(
|
||||
rules.burn_pj_per_kfg,
|
||||
traits ? t.burn : std::array<std::uint16_t, 4>{100, 100, 100, 100},
|
||||
diagnostics.exclude);
|
||||
diagnostics.payable_energy_pj =
|
||||
biology::cellular_payable_energy(life.reserve, burn, false);
|
||||
} else {
|
||||
diagnostics.payable_energy_pj = life.reserve.energy.value;
|
||||
}
|
||||
}
|
||||
for (std::size_t c = 0; c < life.body.matter.size(); ++c)
|
||||
diagnostics.total_mass_fg +=
|
||||
life.body.matter[c].value + life.reserve.matter[c].value;
|
||||
view.diagnostics = diagnostics;
|
||||
view.patches.reserve(perceived->size());
|
||||
// ADR-0136 (rules 8): pools and bubbles go out as v11 deposits, the nearest 512 to
|
||||
@@ -462,6 +496,8 @@ class CellularBridge {
|
||||
? network::CellularDeathReason::starved
|
||||
: corpse->cause == biology::CellularDeathCause::engulfed
|
||||
? network::CellularDeathReason::engulfed
|
||||
: corpse->cause == biology::CellularDeathCause::emerged
|
||||
? network::CellularDeathReason::emerged
|
||||
: network::CellularDeathReason::unrecorded;
|
||||
static_cast<void>(sessions_->send_life_ended(network::AccountId{account},
|
||||
{corpse->died_tick, life_id, cause}));
|
||||
@@ -510,17 +546,23 @@ class CellularBridge {
|
||||
std::uint64_t tick) {
|
||||
const network::AccountId account{life.account};
|
||||
const auto session = sessions_->holder(account);
|
||||
const auto& progress = life.mutation;
|
||||
// Rules 13 offers are catalog offers (v14 only); earlier rules use the operator offer.
|
||||
const bool named = state.rules_version() >= server::cellular_lives_revamp_rules;
|
||||
const bool pending = named ? life.revamp.offer.count != 0 : life.mutation.offer.has_value();
|
||||
const SentOffer current{life.account, session.value_or(0), life.identity.life,
|
||||
progress.offer ? progress.event_index : 0,
|
||||
progress.offer ? progress.offer_tick : 0};
|
||||
!pending ? 0
|
||||
: named ? life.revamp.offer.event_index
|
||||
: life.mutation.event_index,
|
||||
!pending ? 0
|
||||
: named ? life.revamp.offer.offer_tick
|
||||
: life.mutation.offer_tick};
|
||||
auto sent = std::ranges::find(offers_, life.account, &SentOffer::account);
|
||||
if (sent != offers_.end() && *sent == current)
|
||||
return;
|
||||
if (!session || (!progress.offer && sent == offers_.end()))
|
||||
if (!session || (!pending && sent == offers_.end()))
|
||||
return; // Nothing to show, or no one to show it to.
|
||||
if (!sessions_->send_mutation_offer(account, server::offer_view(state, life, tick)))
|
||||
return; // Not a v10 owner (or the stream refused): retried on a later tick.
|
||||
if (!sessions_->send_mutation_offer(account, server::offer_view(state, life, tick), named))
|
||||
return; // Not a v10 (v14) owner (or the stream refused): retried on a later tick.
|
||||
if (sent != offers_.end())
|
||||
*sent = current;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user