Cellular rules 7: percentage mutations, skilled budding, hunting wildlife (ADR-0137)
Foundation / checks (ecs) (push) Successful in 3m21s
Foundation / checks (deploy) (push) Successful in 5m39s
Foundation / checks (tsan) (push) Successful in 11m43s
Foundation / checks (network) (push) Successful in 22m3s
Foundation / checks (client) (push) Successful in 22m35s
Foundation / checks (checks) (push) Successful in 46m53s
Foundation / checks (postgres) (push) Successful in 48m22s
Foundation / postgres-tools (push) Successful in 1m17s
Foundation / image (push) Successful in 3m31s
Foundation / server-image (push) Successful in 6m7s

The region 6 playtest found a speed mutation adding 6,667 um/s (1/300 of the range,
33x a founder), so buds seemed to teleport; reproduction made buds bigger and dearer;
and wildlife never hunted. Rules 7:

- genome schema 4: a step is a tenth of the current value (at least 1); an acquired
  capability starts at the founder's value instead of a minimum it could never grow from;
- development 4: a bud is always half the body, and reproduction takes value/2000 off
  its construction energy (founders save a quarter; matter is never discounted);
- twins: a seeded roll (reproduction/2 per thousand) splits one affordable bud's
  investment into two quarter-size buds;
- wildlife engulfs a touching cell the region step lets it take, players' included.

Founder 3, owner format 6 (no new state), bundle v8 and schema v42; the cellular-v6
opening provisions it. The client's mutation callout shrinks to a "Mutation [E]" pill and
its candidate texts describe the new steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-16 22:41:55 -04:00
co-authored by Claude Opus 5.5
parent feac7aac4e
commit 86ee800f32
33 changed files with 786 additions and 137 deletions
+45 -1
View File
@@ -1,11 +1,13 @@
#include "evo/server/lifecycle/wildlife_controller.hpp"
#include "evo/biology/budding.hpp"
#include "evo/biology/cellular_motion.hpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <optional>
namespace evo::server {
@@ -20,6 +22,16 @@ std::uint64_t mix(std::uint64_t life, std::uint64_t phase) noexcept {
return value;
}
// The region step's engulf test (ADR-0124), without overflow: hunter * 1000 must reach
// prey * 1500 per micrometre of the prey's membrane.
bool can_engulf(std::uint64_t hunter, std::uint64_t prey, std::uint32_t membrane_um) noexcept {
const auto factor = biology::cellular_engulf_ratio_milli_per_membrane_um * membrane_um;
constexpr auto most = std::numeric_limits<std::uint64_t>::max();
if (factor != 0 && prey > most / factor)
return false;
return hunter <= most / 1000 ? hunter * 1000 >= prey * factor : true;
}
bool overlaps(std::uint64_t start, std::uint32_t extent, std::uint32_t patch) noexcept {
return start < std::uint64_t{patch} + biology::cellular_patch_pitch_um &&
start + extent > patch;
@@ -72,10 +84,42 @@ wildlife_intents(const CellularLives& state, std::uint64_t tick) {
intents.push_back({life.identity.life, intent});
continue;
}
const auto extent = budget->phenotype.extent;
// Rules 7 (ADR-0137): engulf a touching cell the region step would let it take
// (ADR-0124: mass at least 1.5 x the prey's per micrometre of prey membrane),
// players' cells included; otherwise feed.
if (state.rules_version() >= cellular_lives_reproduction_rules) {
bool prey = false;
for (const auto& other : state.lives()) {
if (other.identity.life == life.identity.life ||
other.presence == CellularPresence::suspended)
continue;
const auto other_genome = state.archive().find(other.identity.genome);
if (!other_genome)
return std::unexpected{CellularLivesError::archive};
const auto other_budget =
biology::metabolic_budget(*other_genome, other.growth, {temperature, {}});
const auto membrane = other_genome->parameter(biology::Capability::membrane);
if (!other_budget || !membrane)
return std::unexpected{CellularLivesError::biology};
if (!biology::cellular_footprints_contact(life.position, extent, other.position,
other_budget->phenotype.extent))
continue;
if (can_engulf(budget->phenotype.total_mass, other_budget->phenotype.total_mass,
*membrane)) {
prey = true;
break;
}
}
if (prey) {
intent.engulf = true;
intents.push_back({life.identity.life, intent});
continue;
}
}
const auto perceived = state.perceive(life.identity.life);
if (!perceived)
return std::unexpected{perceived.error()};
const auto extent = budget->phenotype.extent;
const auto centre_x = static_cast<std::int64_t>(life.position.x_um) + extent / 2;
const auto centre_y = static_cast<std::int64_t>(life.position.y_um) + extent / 2;
std::optional<biology::CellularPatchAddress> nearest;