feat(biology): genome schema 6 movement arrangement and derived handling
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m26s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 3m57s
Foundation / server-image (push) Successful in 4m2s

Schema 6 genomes carry the body's movement arrangement for mutations 001-010 as
reference-point indices (100 = founder): output, efficiency, burst, steering,
streamlining, braking, anchor, coasting and colony drive. It is encoded after the
capability records and covered by the digest; older schemas refuse it, so their
capability tables and mutation catalogs are unchanged. Development version 6 and
founder 5 serve rules 12.

derive_cellular_handling scales the tuned founder handling by the arrangement:
output scales thrust, braking reverse thrust, steering turning; streamlining lowers
forward drag and coasting both drags. Full-output costs follow the metabolic
budget's movement cost times output over efficiency. Shed output or a missing
movement capability leaves only passive drift. Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-21 16:39:09 -04:00
co-authored by Claude Opus 5.5
parent ab5df35c3f
commit 2bffbc2095
16 changed files with 285 additions and 20 deletions
+47
View File
@@ -1,5 +1,8 @@
#include "evo/biology/cellular_tuning.hpp"
#include "evo/accounting/rates.hpp"
#include <algorithm>
#include <array>
#include <optional>
@@ -245,4 +248,48 @@ CellularHandling founder_cellular_handling(const CellularTuning& tuning,
.thrust_cost = thrust_cost,
.reverse_cost = reverse_cost};
}
std::expected<CellularHandling, CellularHandlingError>
derive_cellular_handling(const Genome& genome, const MetabolicBudget& budget,
const CellularTuning& tuning) {
const auto& arrangement = genome.movement_arrangement();
if (!arrangement || genome.development_version() < 6)
return std::unexpected{CellularHandlingError::unsupported_genome};
if (budget.rate_microseconds != accounting::microseconds_per_second)
return std::unexpected{CellularHandlingError::unsupported_rate};
const auto full_cost = accounting::per_tick(
budget.movement.value, cellular_motion_tick_microseconds, accounting::Rounding::up);
if (!full_cost || *full_cost > std::uint64_t{1} << 40U)
return std::unexpected{CellularHandlingError::overflow};
const auto founder = founder_cellular_handling(tuning, {}, {});
const auto& a = *arrangement;
constexpr std::uint64_t reference = movement_reference_points;
const auto scale = [](std::uint64_t value, std::uint64_t index) {
return value * index / reference;
};
const auto cost = [&](std::uint64_t index) {
const auto product = *full_cost * index;
return accounting::Picojoules{product / a.efficiency +
(product % a.efficiency != 0 ? 1 : 0)};
};
constexpr std::uint64_t drag_limit = cellular_drag_ppm_limit - 1;
CellularHandling handling{};
handling.forward_drag_ppm = static_cast<std::uint32_t>(
std::min<std::uint64_t>(drag_limit, founder.forward_drag_ppm * reference * reference /
(std::uint64_t{a.streamlining} * a.coasting)));
handling.lateral_drag_ppm = static_cast<std::uint32_t>(
std::min<std::uint64_t>(drag_limit, founder.lateral_drag_ppm * reference / a.coasting));
if (!genome.carries(Capability::movement) || a.output == 0)
return handling;
constexpr std::uint64_t velocity_limit = cellular_velocity_limit_q10;
handling.thrust_q10 =
static_cast<std::uint32_t>(std::min(velocity_limit, scale(founder.thrust_q10, a.output)));
handling.reverse_thrust_q10 = static_cast<std::uint32_t>(
std::min(velocity_limit, scale(founder.reverse_thrust_q10, a.braking)));
handling.turn = static_cast<std::uint16_t>(
std::min<std::uint64_t>(cellular_heading_turn / 2, scale(founder.turn, a.steering)));
handling.thrust_cost = cost(a.output);
handling.reverse_cost = cost(a.braking);
return handling;
}
} // namespace evo::biology