Files
aevolution/include/evo/biology/cellular_revamp_tuning.hpp
dingoandClaude Opus 5.5 757304437e
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 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m34s
Foundation / postgres-tools (push) Successful in 26s
Foundation / server-image (push) Successful in 4m30s
Foundation / image (push) Successful in 5m46s
feat(admin): take reserve, cull wildlife, wildlife cap, fresh bud costs (schema 67)
ADR-0182 section 16, from playtesting region 16 at its 256-life cap.

- Bud costs: the region host's cache of each genome's bud cost was keyed
  by genome only, so after a tuning adoption the client kept the old cost
  (or "cannot bud"). It now clears when the rules' encoding changes.
- Wildlife cap: reproduction.wildlife_cap (optional, 0..organism cap,
  0 = the organism cap) refuses buds of parents without an account at that
  many lives, keeping the slots above it for players. Bits 17-31 of the
  energy-cycle word, so older rules keep their bytes. DEV file: 200.
- Schema 67: admin command kinds take_reserve (8: up to the amounts from a
  life's reserve to the spent pool) and remove_wildlife (9: every life
  without an account, as remove_cell).
- Region view: caps; the portal shows lives against the cap.
- Portal: Take reserve in the inspector, Remove all wildlife, and marking
  cells on the map (shift+click, shift+drag) for bulk removal; the guided
  editor lists optional keys the base revision lacks.
- Client: a refused bud says the region may be full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:06:56 -04:00

83 lines
4.7 KiB
C++

#pragma once
#include "evo/biology/cellular_catalog.hpp"
#include "evo/biology/cellular_tuning.hpp"
#include <array>
#include <compare>
#include <cstddef>
#include <cstdint>
#include <expected>
#include <string>
#include <string_view>
// Git-managed trial values for the cellular revamp (rules 13, ADR-0179), in their own file
// beside the rules-12 tuning file so older images never meet keys they do not know. Same
// format: plain `key = value` integer lines, range-checked; core keys required once,
// per-mutation overrides and the zero-default DEV opening count optional.
namespace evo::biology {
inline constexpr std::int64_t cellular_revamp_tuning_version = 1;
inline constexpr std::size_t max_cellular_revamp_tuning_bytes = std::size_t{256} * 1'024;
struct CellularRevampTuning {
std::int64_t version{};
// Optional DEV opening fixture; zero preserves unseeded, player-origin worlds.
std::int64_t playtest_starting_wildlife_cells{};
// Optional feeding keys: every collection limit per cent, and the even split.
std::int64_t feeding_collection_percent{100}, feeding_split_evenly{};
// Body: the share of upkeep no upkeep-efficiency trait reduces.
std::int64_t body_essential_upkeep_per_mille{};
// Body: share of reserve matter carried as load on handling and thrust costs.
std::int64_t body_reserve_load_per_mille{};
// Body: growth per tick at growth speed 100, in hundredths of a per mille.
std::int64_t body_growth_per_tick_centi_mille{};
// Energy: picojoules 1,000 fg of each matter channel stand in for (burn efficiency 100).
std::int64_t energy_burn_carbon_pj_per_kfg{}, energy_burn_nitrogen_pj_per_kfg{},
energy_burn_phosphorus_pj_per_kfg{}, energy_burn_other_pj_per_kfg{};
// Feeding: per mille of collection lost per membrane point above the founder's 100.
std::int64_t feeding_membrane_collection_per_mille_per_point{};
// Predation.
std::int64_t predation_engulf_ratio_milli{}, predation_engulf_reserve_percent{},
predation_kill_bubble_per_mille{};
// The spent pool's drip back into the region.
std::int64_t spent_drip_interval_ticks{}, spent_drip_bubble_pj{}, spent_drip_bubble_fg{};
// Optional energy cycle (ADR-0182 section 14): the share of the region's heat returned to
// the spent pool each tick, and whether a drip at the deposit limit joins an existing bubble.
std::int64_t spent_heat_recycle_per_mille{}, spent_drip_absorb{};
// Mutation offers (Cellular_mutation_plan.md section 3).
std::int64_t mutation_options{}, mutation_floor_ppm{}, mutation_cap_ppm{};
std::int64_t mutation_score_min{}, mutation_score_max{};
std::int64_t mutation_max_multiplier_per_mille{}, mutation_min_multiplier_per_mille{};
std::int64_t mutation_offer_interval_ticks{};
std::int64_t mutation_min_points{}, mutation_max_points{}, mutation_recipe_min_share{};
std::int64_t mutation_max_offspring{}, mutation_carbon_for_light_fg{},
mutation_buds_for_adhesion{};
// Reproduction (Cellular_reproduction_plan.md).
std::int64_t reproduction_split_share_per_mille{}, reproduction_split_min_growth_per_mille{};
std::int64_t reproduction_bud_fee_e_pj{}, reproduction_bud_fee_c_fg{},
reproduction_bud_fee_n_fg{}, reproduction_bud_fee_p_fg{}, reproduction_bud_fee_o_fg{};
std::int64_t reproduction_bud_fee_scale_percent{}, reproduction_organism_cap{};
std::int64_t reproduction_wildlife_cap{}; // Optional; 0 is the organism cap.
// Multicellular organisms.
std::int64_t organism_load_per_mille{}, organism_emerge_members{}, organism_emerge_mass_fg{},
organism_emerge_reserve_pj{};
// Optional, explicitly versioned reproduction-safety trial (ADR-0181).
std::int64_t reproduction_safety_version{}, body_growth_reserve_seconds{},
reproduction_split_launch_um_per_s{};
// Each catalog mutation's tunables, in catalog order. Optional keys
// `mutation.<key>.<field>` override the defaults from its spec.
std::array<CellularMutationTuning, cellular_catalog_size> mutations{};
auto operator<=>(const CellularRevampTuning&) const = default;
};
// A mutation's tunables as the file names them.
inline constexpr std::array<std::string_view, 15> cellular_mutation_tuning_fields{
"enabled", "base_weight", "increase_points", "decrease_points", "primary_step",
"paired_step", "spread_step", "increase_ticks", "decrease_ticks", "cost_e_pj",
"cost_c_fg", "cost_n_fg", "cost_p_fg", "cost_o_fg", "cost_scale_percent"};
[[nodiscard]] std::expected<CellularRevampTuning, CellularTuningError>
parse_cellular_revamp_tuning(std::string_view text);
// Canonical text: every key once, in schema order.
[[nodiscard]] std::string encode_cellular_revamp_tuning(const CellularRevampTuning& tuning);
} // namespace evo::biology