Files
aevolution/include/evo/server/lifecycle/cellular_liquid.hpp
T
dingoandClaude Opus 5.5 3f82795c18
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
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 4m23s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m10s
Foundation / image (push) Successful in 4m31s
feat(lifecycle): rules 12 liquid owner on format 10 with brake traces
The cellular owner gains rules 12 on owner format 10: an explicit no-tick
format-9/rules-11 upgrade declares the region's liquid rules (current
configuration, founder handling and deposit motion, from the tuning file and a
seed when the region opens), converts the habitat to format 3 and starts lives at
rest. Founders born afterwards are founder 5 (genome schema 6).

Each tick derives every life's handling from its genome and the declared founder
handling, samples the current at its footprint and steps the shared liquid
motion; afterwards bubbles move with the current and the drift moving cells
induce, and touching bubbles merge. Format 10 persists the rules and each life's
motion state; restore regenerates the identical current field.

Brake is a new step intent, valid only under rules 12, carried in trace 4 as flag
bit 1 (SQL never parses that byte; player action records keep it zero). Tests
cover the upgrade, exact restore, swimming and braking, moving food with fixed
pools, restore continuing a live run, and brake traces replaying exactly. Genomes
from before schema 6 handle as founders. Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 17:28:58 -04:00

35 lines
1.8 KiB
C++

#pragma once
#include "evo/biology/cellular_currents.hpp"
#include "evo/biology/cellular_deposit_motion.hpp"
#include "evo/biology/cellular_tuning.hpp"
#include <compare>
#include <cstdint>
#include <expected>
// Rules 12 (Cellular_Region_Movement_Plan.md, ADR-0177): the liquid region a cellular owner
// declares when it upgrades to owner format 10. Taken from the Git tuning file and a seed when
// the region opens and persisted with the owner, so replay and restore never read the file.
namespace evo::server {
struct CellularLiquidRules {
biology::CellularCurrentConfig currents{}; // Its area is the owner's area.
biology::CellularHandling founder{}; // Per-tick founder handling; costs unused.
biology::CellularDepositMotionRules deposits{};
auto operator<=>(const CellularLiquidRules&) const = default;
};
// Every field is within the kinematic, current and deposit bounds for `area`.
[[nodiscard]] bool cellular_liquid_valid(const CellularLiquidRules& rules,
biology::CellularArea area) noexcept;
// Rules for a region of `area` from the tuning file and a current seed.
[[nodiscard]] CellularLiquidRules cellular_liquid_rules(const biology::CellularTuning& tuning,
biology::CellularArea area,
std::uint64_t seed);
// An organism's handling: its genome's arrangement scaled from the declared founder handling,
// with full-output costs from its metabolic budget.
[[nodiscard]] std::expected<biology::CellularHandling, biology::CellularHandlingError>
cellular_liquid_handling(const biology::Genome& genome, const biology::MetabolicBudget& budget,
const CellularLiquidRules& rules);
} // namespace evo::server