Add reproduction safety trial and resizable cellular panels
This commit is contained in:
+2
-1
@@ -525,7 +525,8 @@ if(BUILD_TESTING)
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/deploy/kubernetes/region/dev/tuning/cellular-revamp.tuning")
|
||||
if(EXISTS "${evo_dev_revamp_tuning}")
|
||||
add_test(NAME cellular-revamp-tuning-contracts
|
||||
COMMAND evo-cellular-revamp-tuning-tests "${evo_dev_revamp_tuning}")
|
||||
COMMAND evo-cellular-revamp-tuning-tests "${evo_dev_revamp_tuning}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/deploy/kubernetes/region/dev/tuning/cellular-reproduction-safety.tuning")
|
||||
else()
|
||||
add_test(NAME cellular-revamp-tuning-contracts COMMAND evo-cellular-revamp-tuning-tests)
|
||||
endif()
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Cellular body and maintenance plan
|
||||
|
||||
Amendment, 2026-10-26: [ADR-0181](docs/adr/0181-cellular-reproduction-safety.md)
|
||||
adds an opt-in growth fuel buffer. Automatic construction spends only what leaves
|
||||
the resulting body its declared survival reserve; tissue prices remain unchanged.
|
||||
|
||||
Status: planning draft, 2026-10-22. Records the maintainer's decisions on body size,
|
||||
body recipe, upkeep, density, growth and bud size. Part of the
|
||||
[Cellular gameplay plan](Cellular_gameplay_plan.md). Replaces the 031-050 notes in
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Cellular reproduction plan
|
||||
|
||||
Amendment, 2026-10-26: [ADR-0181](docs/adr/0181-cellular-reproduction-safety.md)
|
||||
adds an opt-in DEV safety revision: controlled-cell split allocation, retained bud
|
||||
provision and physical offspring separation. Historical declarations retain the
|
||||
baseline below. All allocation/launch values remain trial tuning.
|
||||
|
||||
Status: planning draft, 2026-10-22. Records the maintainer's decisions on the
|
||||
reproduction revamp. Companion to [Cellular_mutation_plan.md](Cellular_mutation_plan.md).
|
||||
Where this document conflicts with the earlier drafts or with the unimplemented
|
||||
|
||||
+45
-14
@@ -1170,10 +1170,21 @@ ImVec2 hud_position(ImVec2 position, ImVec2 size) {
|
||||
return {std::clamp(position.x, margin, std::max(margin, display.x - size.x - margin)),
|
||||
std::clamp(position.y, margin, std::max(margin, display.y - size.y - margin))};
|
||||
}
|
||||
void place_hud_panel(HudPanelPlacement& placement, ImVec2 fallback, ImVec2 size) {
|
||||
void place_hud_panel(HudPanelPlacement& placement, ImVec2 fallback, ImVec2 size, bool minimized) {
|
||||
const auto display = ImGui::GetIO().DisplaySize;
|
||||
ImGui::GetIO().ConfigWindowsResizeFromEdges = true;
|
||||
const ImVec2 minimum{std::min(size.x, px(260)), minimized ? size.y : px(120)};
|
||||
if (placement.size) {
|
||||
size.x = px(placement.size->first);
|
||||
if (!minimized)
|
||||
size.y = px(placement.size->second);
|
||||
}
|
||||
size.x = std::min(size.x, std::max(1.0F, display.x - 2 * px(8)));
|
||||
size.y = std::min(size.y, std::max(1.0F, display.y - 2 * px(8)));
|
||||
const ImVec2 maximum{std::max(1.0F, display.x - 2 * px(8)),
|
||||
minimized ? size.y : std::max(1.0F, display.y - 2 * px(8))};
|
||||
ImGui::SetNextWindowSizeConstraints(
|
||||
{std::min(minimum.x, maximum.x), std::min(minimum.y, maximum.y)}, maximum);
|
||||
auto position = fallback;
|
||||
if (placement.anchor)
|
||||
position = {placement.anchor->first * display.x, placement.anchor->second * display.y};
|
||||
@@ -1182,6 +1193,7 @@ void place_hud_panel(HudPanelPlacement& placement, ImVec2 fallback, ImVec2 size)
|
||||
placement.anchor = {position.x / display.x, position.y / display.y};
|
||||
ImGui::SetNextWindowPos(position, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(size, ImGuiCond_Always);
|
||||
placement.requested_size = {size.x, size.y};
|
||||
}
|
||||
float collapsed_height(bool energy = false) {
|
||||
return 2 * ImGui::GetStyle().WindowPadding.y + ImGui::GetFrameHeight() +
|
||||
@@ -1197,6 +1209,16 @@ void end_hud_body() {
|
||||
}
|
||||
// The heading stays outside the scrollable body. Only this handle moves a panel.
|
||||
void panel_heading(const char* title, bool& minimized, HudPanelPlacement& placement) {
|
||||
// Begin applies native edge/corner resizing after the requested layout. Retain only
|
||||
// deliberate edits, so untouched cards still follow the viewport's default layout.
|
||||
const auto size = ImGui::GetWindowSize();
|
||||
const auto resized_position = ImGui::GetWindowPos();
|
||||
if (!minimized && (std::abs(size.x - placement.requested_size.first) > 0.5F ||
|
||||
std::abs(size.y - placement.requested_size.second) > 0.5F)) {
|
||||
placement.size = {size.x / px(1), size.y / px(1)};
|
||||
const auto display = ImGui::GetIO().DisplaySize;
|
||||
placement.anchor = {resized_position.x / display.x, resized_position.y / display.y};
|
||||
}
|
||||
ImGui::PushID(title);
|
||||
const float right = ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x;
|
||||
ImGui::AlignTextToFramePadding();
|
||||
@@ -1221,9 +1243,12 @@ void panel_heading(const char* title, bool& minimized, HudPanelPlacement& placem
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeAll);
|
||||
ImGui::SetTooltip("Drag to place %s. Double-click to reset its position.", title);
|
||||
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
||||
ImGui::SetTooltip("Drag to place %s; drag an edge to resize. Double-click to reset.",
|
||||
title);
|
||||
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
|
||||
placement.anchor.reset();
|
||||
placement.size.reset();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosX(right - ImGui::CalcTextSize(" + ").x -
|
||||
@@ -1286,9 +1311,10 @@ void hud_vitals(const PanelView& v, FormBuffers& form, bool compact) {
|
||||
place_hud_panel(form.vitals_placement,
|
||||
compact ? ImVec2{px(12), px(64)}
|
||||
: ImVec2{clearance, io.DisplaySize.y - px(16) - height},
|
||||
{width, height});
|
||||
{width, height}, form.vitals_minimized);
|
||||
ImGui::Begin("Vitals", nullptr,
|
||||
hud_flags | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
(hud_flags & ~ImGuiWindowFlags_NoResize) | ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoScrollbar);
|
||||
panel_heading("Your cell", form.vitals_minimized, form.vitals_placement);
|
||||
if (form.vitals_minimized) {
|
||||
if (d)
|
||||
@@ -1323,7 +1349,9 @@ void hud_vitals(const PanelView& v, FormBuffers& form, bool compact) {
|
||||
ImGui::SetTooltip("Last second: +%s collected, -%s into growth.%s",
|
||||
energy_text(flows.collected[0]).c_str(),
|
||||
energy_text(flows.into_growth[0]).c_str(),
|
||||
d->growth_limit == 1 ? "\nEnergy is holding your growth back." : "");
|
||||
d->growth_limit == 1
|
||||
? "\nEnergy availability or the survival buffer is limiting growth."
|
||||
: "");
|
||||
}
|
||||
if (const auto& change = play->energy_change(); change && change->falling)
|
||||
disabled_wrapped("Energy is falling: feeding may not cover upkeep and movement.");
|
||||
@@ -1520,13 +1548,14 @@ void hud_notes(const PanelView& v, FormBuffers& form, PanelActions& a, bool comp
|
||||
return;
|
||||
const auto& io = ImGui::GetIO();
|
||||
const float clearance = eyepiece_clearance();
|
||||
place_hud_panel(
|
||||
form.notes_placement, {clearance, px(64)},
|
||||
{px(260), form.notes_minimized
|
||||
? collapsed_height()
|
||||
: std::min(px(260), std::max(px(120), io.DisplaySize.y * 0.41F))});
|
||||
place_hud_panel(form.notes_placement, {clearance, px(64)},
|
||||
{px(260), form.notes_minimized
|
||||
? collapsed_height()
|
||||
: std::min(px(260), std::max(px(120), io.DisplaySize.y * 0.41F))},
|
||||
form.notes_minimized);
|
||||
ImGui::Begin("Field notes", nullptr,
|
||||
hud_flags | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
(hud_flags & ~ImGuiWindowFlags_NoResize) | ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoScrollbar);
|
||||
panel_heading("Field notes", form.notes_minimized, form.notes_placement);
|
||||
if (form.notes_minimized) {
|
||||
ImGui::End();
|
||||
@@ -1974,9 +2003,11 @@ void hud_map(const PanelView& v, FormBuffers& form, bool compact) {
|
||||
{io.DisplaySize.x - (compact ? px(12) : eyepiece_clearance()) - width, px(126)},
|
||||
{width, form.map_minimized ? collapsed_height()
|
||||
: std::min(px(compact ? 192.0F : 300.0F),
|
||||
io.DisplaySize.y - px(200))});
|
||||
io.DisplaySize.y - px(200))},
|
||||
form.map_minimized);
|
||||
ImGui::Begin("Nearby", nullptr,
|
||||
hud_flags | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
(hud_flags & ~ImGuiWindowFlags_NoResize) | ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoScrollbar);
|
||||
panel_heading("Nearby", form.map_minimized, form.map_placement);
|
||||
if (form.map_minimized) {
|
||||
ImGui::End();
|
||||
|
||||
@@ -84,7 +84,10 @@ inline constexpr const char* notice_window_prefix = "##notice";
|
||||
// HUD positions are client-session preferences in normalized viewport coordinates.
|
||||
struct HudPanelPlacement {
|
||||
std::optional<std::pair<float, float>> anchor;
|
||||
// Expanded size in unscaled UI units; collapse never overwrites it.
|
||||
std::optional<std::pair<float, float>> size;
|
||||
std::pair<float, float> drag_origin{};
|
||||
std::pair<float, float> requested_size{};
|
||||
};
|
||||
// Connect form fields and presentation preferences; never persisted.
|
||||
struct FormBuffers {
|
||||
|
||||
@@ -12,7 +12,7 @@ spec:
|
||||
env:
|
||||
- {name: REGION_SESSION, value: "dev"}
|
||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261026T212818-5dcfde8e:1793064498"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261027T131324-ed040353:1793121204"}
|
||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
||||
ports:
|
||||
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# Reproduction safety trial (ADR-0181): NOT mounted by the active DEV overlay.
|
||||
# For a fresh opening with a build supporting safety revision 1, pass this file
|
||||
# as --revamp-tuning. Promote the server image before adopting it as mounted tuning.
|
||||
# Cellular revamp trial values (rules 13, ADR-0179; Cellular_Revamp_Build_Plan.md).
|
||||
# Same format as cellular.tuning: `key = value`, integers only, `_` may separate digits,
|
||||
# core keys required exactly once; playtest.* and mutation overrides are optional.
|
||||
# Use for new-region provisioning with the new image; existing regions retain recorded rules.
|
||||
tuning.version = 1
|
||||
|
||||
# DEV opening fixture only (ADR-0180). Zero disables seeding; never replenished on restart.
|
||||
# Requires an audited --playtest-wildlife-first-id range below --life-allocator-start.
|
||||
playtest.starting_wildlife_cells = 100
|
||||
|
||||
# Body (body and maintenance plan).
|
||||
body.essential_upkeep_per_mille = 250 # share of upkeep no upkeep-efficiency trait reduces
|
||||
body.reserve_load_per_mille = 1_000 # reserve matter carried as load (slower, costlier thrust)
|
||||
body.growth_per_tick_centi_mille = 625 # 6.25 per mille per tick; 25% faster for playtesting
|
||||
|
||||
# Energy (feeding and energy plan): what 1,000 fg of reserve matter stands in for when the
|
||||
# reserve's energy runs out. Bubbles carry ~17 pJ of energy per fg of matter, so 2 pJ per fg
|
||||
# makes burning matter the expensive way to stay alive (a founder burns a carbon bubble in
|
||||
# about 80 s of upkeep).
|
||||
energy.burn_carbon_pj_per_kfg = 2_000
|
||||
energy.burn_nitrogen_pj_per_kfg = 2_000
|
||||
energy.burn_phosphorus_pj_per_kfg = 2_000
|
||||
energy.burn_other_pj_per_kfg = 2_000
|
||||
|
||||
# Feeding: collection lost per membrane point above the founder's 100 (5 points: -1%).
|
||||
feeding.membrane_collection_per_mille_per_point = 2
|
||||
# Every collection limit, per cent of the body's own (optional; 100 when absent).
|
||||
feeding.collection_percent = 130
|
||||
# Matter from one source split evenly between the nutrients it holds (optional; 0 when
|
||||
# absent): a carbon-only bubble gives the whole matter limit to carbon, carbon and
|
||||
# phosphorus half each, all four a quarter each.
|
||||
feeding.split_evenly = 1
|
||||
|
||||
# Predation (predation and defense plan).
|
||||
predation.engulf_ratio_milli = 1_500 # a predator needs 1.5x the prey's engulf mass
|
||||
predation.engulf_reserve_percent = 100 # share of reserve matter in engulf mass
|
||||
predation.kill_bubble_per_mille = 500 # a kill's remainder left as bubbles; the rest is spent
|
||||
|
||||
# The spent pool drips back as bubbles at random spots.
|
||||
spent.drip_interval_ticks = 20 # once a second
|
||||
spent.drip_bubble_pj = 20_000_000 # largest energy bubble per drip
|
||||
spent.drip_bubble_fg = 1_000_000 # largest matter bubble per drip and channel
|
||||
|
||||
# Mutation offers (mutation plan section 3). Chances in parts per million.
|
||||
mutation.options = 3
|
||||
mutation.floor_ppm = 10 # 0.001%: anomalies always happen
|
||||
mutation.cap_ppm = 700_000 # 70%
|
||||
mutation.score_min = -1_000
|
||||
mutation.score_max = 1_000
|
||||
mutation.max_multiplier_per_mille = 10_000 # weight x10 at the top score
|
||||
mutation.min_multiplier_per_mille = 0 # weight x0 at the bottom (the floor still applies)
|
||||
mutation.offer_interval_ticks = 500 # an offer every 25 s of active play
|
||||
mutation.min_points = 25 # trait bounds in reference points (founder 100)
|
||||
mutation.max_points = 1_000
|
||||
mutation.recipe_min_share = 20 # per thousand of the body per channel
|
||||
mutation.max_offspring = 10 # per bud, so litter at most 900
|
||||
mutation.carbon_for_light_fg = 20_000_000 # carbon burned before photosynthesis is offered
|
||||
mutation.buds_for_adhesion = 5 # on-demand buds before Adhesion is offered
|
||||
|
||||
# Reproduction (reproduction plan).
|
||||
reproduction.split_share_per_mille = 800 # safety revision 1: controlled cell's share
|
||||
reproduction.split_min_growth_per_mille = 500 # a cell splits once half grown
|
||||
reproduction.safety_version = 1 # opt-in; historical snapshots retain revision 0
|
||||
reproduction.split_launch_um_per_s = 800 # outward launch, ordinary drag/braking afterward
|
||||
body.growth_reserve_seconds = 60 # growth preserves fuel for the resulting body
|
||||
reproduction.bud_fee_e_pj = 250_000 # extra fee above the offspring's tissue and provision
|
||||
reproduction.bud_fee_c_fg = 100_000
|
||||
reproduction.bud_fee_n_fg = 30_000
|
||||
reproduction.bud_fee_p_fg = 10_000
|
||||
reproduction.bud_fee_o_fg = 60_000
|
||||
reproduction.bud_fee_scale_percent = 50 # 0 disables the fee; 100 charges the listed amounts
|
||||
reproduction.organism_cap = 256 # births refused at this many lives (an organism counts once)
|
||||
|
||||
# Multicellular organisms (reproduction plan section 6).
|
||||
organism.load_per_mille = 500 # share of the extra members' mass loading one cell's thrust
|
||||
organism.emerge_members = 8 # Emerge needs at least this many cells,
|
||||
organism.emerge_mass_fg = 100_000_000 # this much body and reserve mass,
|
||||
organism.emerge_reserve_pj = 0 # and this much reserve energy
|
||||
|
||||
# Per-mutation overrides are optional: `mutation.<key>.<field> = value`, with 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 and
|
||||
# cost_scale_percent. Unset fields keep the catalog's defaults (costs 0). For example:
|
||||
# mutation.strong_propulsion.cost_e_pj = 1_000_000
|
||||
# mutation.strong_propulsion.cost_scale_percent = 50
|
||||
@@ -1,5 +1,18 @@
|
||||
# Project status and next steps
|
||||
|
||||
## Reproduction safety trial and resizable cards - 2026-10-27
|
||||
|
||||
[ADR-0181](adr/0181-cellular-reproduction-safety.md) declares opt-in safety
|
||||
revision 1 for future rules-13 openings: 80% of mutation body/resources follow
|
||||
control, the ordinary bud fee returns to the selected cell, mutation offspring
|
||||
separate with an outward launch, and automatic growth protects 60 seconds of fuel.
|
||||
Recorded revision 0 keeps historical simulation semantics and bytes. This is
|
||||
prepared trial tuning, not live retuning, image promotion or a deployed new region.
|
||||
|
||||
Field notes, Vitals and Nearby resize by native edge/corner dragging, retain their
|
||||
expanded sizes across collapse and clamp to the viewport. The heading reset gesture
|
||||
resets size and placement. See [validation](engineering/VALIDATION.md).
|
||||
|
||||
## Stable and movable cellular panels - 2026-10-26
|
||||
|
||||
The client HUD now uses stable card dimensions and scrolling content, keeping
|
||||
|
||||
@@ -146,3 +146,13 @@ headings and action buttons stay outside those bodies. Thus temporary text and
|
||||
scrollbar thresholds cannot resize/reposition the outer panels. This reuses the
|
||||
pinned toolkit and existing pointer-capture boundary; biological authority,
|
||||
protocols, dependencies and headless APIs are unchanged.
|
||||
|
||||
## Amendment (2026-10-26): cellular card edge resizing
|
||||
|
||||
The maintainer requested draggable panel edges. Field notes, Vitals and Nearby
|
||||
now use native toolkit edge/corner resizing within bounded minimum/viewport sizes.
|
||||
Client-owned expanded dimensions are stored in unscaled UI units for the session;
|
||||
collapse retains them, viewport changes clamp them and the heading's double-click
|
||||
resets both placement and size. Live text cannot change the chosen dimensions.
|
||||
The adapter owns the toolkit's border hit margin from the first pointer event,
|
||||
including presses just outside a panel. No simulation, wire or dependency changes.
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# ADR-0181: Opt-in cellular reproduction safety revision 1
|
||||
|
||||
Accepted scoped DEV experiment, 2026-10-26, from the maintainer's playtest review.
|
||||
Repeated starvation and predation prevented meaningful reproduction. The maintainer
|
||||
approved a controlled-cell 80/20 mutation split, retaining the bud fee in the selected
|
||||
cell, outward separation at mutation birth, and a growth survival buffer. These are
|
||||
trial rules, not locked balance or permission to modify World0.
|
||||
|
||||
## Decision
|
||||
|
||||
New rules-13 openings may declare `reproduction.safety_version = 1`. Missing/zero
|
||||
preserves the historical law, including existing snapshots and golden outputs.
|
||||
Revision 1 uses `reproduction.split_share_per_mille` as the controlled cell's share
|
||||
(trial 800), whether the player stays as the parent or becomes the offspring.
|
||||
Body matter and reserves divide channel by channel after mutation charges; the
|
||||
offspring alone expresses the mutation. The 50%-growth eligibility gate remains.
|
||||
Adhesion and whole-organism mutation retain their distinct behavior.
|
||||
|
||||
A mutation offspring is placed with a clear outward gap equal to one tick of its
|
||||
declared launch speed, then receives outward liquid-relative velocity in addition
|
||||
to inherited parent velocity, bounded by the existing velocity limit. Trial speed:
|
||||
800 micrometres/second. Placement checks the launch corridor, other cells and region
|
||||
boundaries, trying the existing eight deterministic directions. Failure leaves the
|
||||
offer and reproduction resources unchanged; ordinary tick actions still execute.
|
||||
There is no invulnerability or kinship exception: later predation, drag, currents
|
||||
and braking apply. Initial separation is an escape opportunity, not a guarantee
|
||||
against every surrounding predator.
|
||||
|
||||
The single-cell bud fee must still be affordable on top of tissue, construction
|
||||
and the newborn's existing 30-second full-demand provision. On successful budding
|
||||
the fee returns exactly once to the selected cell's reserve, instead of becoming
|
||||
environmental bubbles. Staying refunds the surcharge; becoming transfers it to the
|
||||
newborn. Wildlife has no selected player cell and retains environmental fee
|
||||
reclamation. Internal-cell organism budding retains its existing fee rule.
|
||||
Ordinary budding consumes no parent tissue and grants no extra resources.
|
||||
|
||||
For every active organism, wildlife included, automatic growth chooses the largest
|
||||
ordinary funded step leaving at least `body.growth_reserve_seconds` (trial 60) of
|
||||
the resulting body's full metabolic demand. Energy plus non-excluded burnable
|
||||
reserve matter count after construction intake and rounding releases. Tissue
|
||||
cannot count as fuel. This conservative buffer is checked, not paid: below it,
|
||||
growth waits without debt or free tissue. Existing energy-limited feedback also
|
||||
covers reserve protection, with no unnegotiated wire field.
|
||||
|
||||
## Recorded declaration and compatibility
|
||||
|
||||
Owner format 11 retains its byte length and bundle 15/raw trace 4. Three formerly
|
||||
zero u32 words now hold safety version (after growth rate), growth reserve seconds
|
||||
(after offer multipliers), and launch speed (after catalog bounds). Version 0
|
||||
requires both amounts zero. Version 1 requires positive, bounded amounts; unknown
|
||||
revisions are refused. Zero declarations encode exactly as before. Older readers
|
||||
reject nonzero reserved words rather than replay incorrect physics. Retain the
|
||||
writing build for new openings. This follows format 11's recorded collection-rate
|
||||
and even-splitting extensions: it is an explicit simulation-law revision although
|
||||
the outer bundle is unchanged. Recovery derives from the recorded declaration.
|
||||
|
||||
Git tuning affects future openings only. No live retune, reset, new DEV region,
|
||||
deployment or image promotion is part of this change.
|
||||
The prepared `cellular-reproduction-safety.tuning` profile lives beside the active
|
||||
`cellular-revamp.tuning`, but is deliberately absent from the active ConfigMap.
|
||||
The current provision image cannot parse these new keys. Test both profiles;
|
||||
adopt the safety profile only with a qualified new image and a fresh region.
|
||||
|
||||
## Alternatives and consequences
|
||||
|
||||
Free reserve grants break accounting. Globally cheaper growth changes more of the
|
||||
economy than protecting a buffer. Sibling immunity invents a hidden predation
|
||||
exemption; physical separation keeps ordinary rules. Environmental fees leave the
|
||||
selected newborn without additional provision.
|
||||
|
||||
The smaller sibling remains vulnerable later; the larger chosen body still costs
|
||||
more upkeep. Buffering may delay growth, buds and wildlife turnover. This trial
|
||||
needs aged-region playtests, not just a living population. Qualification covers
|
||||
both control choices, channel closure, refusal, launch and immediate engulf attempts,
|
||||
historical behavior, checkpoint restore and trace replay.
|
||||
@@ -1,5 +1,7 @@
|
||||
# Architecture decision records
|
||||
|
||||
- [ADR-0181: Reproduction safety revision 1](0181-cellular-reproduction-safety.md) - opt-in controlled-cell mutation share, retained budding provision, outward mutation launch and a protected growth fuel buffer; historical declarations unchanged.
|
||||
|
||||
- [ADR-0180: DEV starting wildlife](0180-dev-starting-wildlife.md) - opt-in, nursery-funded random-genome roots for disposable playtest openings, exact recovery and no restart replenishment; a scoped exception to player-origin biology.
|
||||
|
||||
- [ADR-0179: Cellular gameplay revamp](0179-cellular-gameplay-revamp.md) - maintainer-accepted direction for rules 13: a 49-mutation catalog with behaviour-weighted offers, mutation splits and stay-or-become reproduction, multicellular organisms and emergence, matter as energy with a region spent pool, per-channel collection, membrane points and heritable body traits; two locked-requirement questions open; implementation pending.
|
||||
|
||||
@@ -126,3 +126,8 @@ with reserved gutters prevent live text from feeding back into panel geometry.
|
||||
The action dock's button row stays outside its scrolling details. This state is
|
||||
presentation-only and is neither persisted nor sent to the server; see the
|
||||
[visual refresh controls](../engineering/CLIENT_VISUAL_REFRESH.md).
|
||||
|
||||
These three cards also resize by dragging any edge or corner. Expanded dimensions
|
||||
are client-session values in unscaled UI units; minimize/restore preserves them,
|
||||
viewport changes clamp them and the handle's double-click resets position and size.
|
||||
The pointer-capture boundary includes native resize border hit margins.
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# Cellular playtest opening controls
|
||||
|
||||
The reproduction safety trial is recorded as `reproduction.safety_version = 1`
|
||||
([ADR-0181](../adr/0181-cellular-reproduction-safety.md)). Its split share is the
|
||||
controlled cell's share (800/1000); mutation offspring launch at 800 um/s; growth
|
||||
preserves 60 seconds of the resulting body's full-demand fuel. Ordinary bud fees
|
||||
return to the selected player cell. Missing safety keys preserve historical rules.
|
||||
These declarations apply to future openings only, not an existing running region.
|
||||
The complete prepared profile is
|
||||
`deploy/kubernetes/region/dev/tuning/cellular-reproduction-safety.tuning`; it is not
|
||||
mounted by the active overlay. Use it as `--revamp-tuning` only with a build that
|
||||
supports safety revision 1 and a fresh opening. The currently mounted profile
|
||||
remains compatible with the currently promoted image. Image/region promotion is
|
||||
a separate operation; a Git push does not activate the gameplay trial.
|
||||
|
||||
These trial settings live in
|
||||
`deploy/kubernetes/region/dev/tuning/cellular-revamp.tuning`. They are read by
|
||||
`evo-world-clone provision --opening cellular-v10 --revamp-tuning FILE`; the owner
|
||||
|
||||
@@ -95,6 +95,12 @@ Proposed resolution, not an accepted protocol or biological rule:
|
||||
|
||||
## Validation
|
||||
|
||||
Field notes, Vitals and Nearby can be resized by dragging any edge or corner.
|
||||
Minimum dimensions keep controls readable, while larger content scrolls inside
|
||||
the chosen bounds. Sizes last for the client session, survive minimize/restore,
|
||||
and adapt to UI scale and viewport limits. Double-click the heading's drag handle
|
||||
to reset both size and position. Resizing captures input before world controls.
|
||||
|
||||
The native panel suite exercises multiple sizes, collapse/restore and input
|
||||
capture alongside existing mutation, affordability and action tests. See
|
||||
[VALIDATION](VALIDATION.md) for executed builds, screenshots and environmental
|
||||
|
||||
@@ -10345,3 +10345,62 @@ Gitea remote returned HTTP 500 during push. Two bounded read-only remote checks,
|
||||
including a delayed HTTP/1.1 check, returned the same server error. Publication
|
||||
remains pending remote recovery. No force push, credential-store change, server
|
||||
operation or deployment was attempted.
|
||||
|
||||
## 2026-10-27 - Reproduction safety revision 1 and resizable cellular cards
|
||||
|
||||
Scope: ADR-0181's explicitly recorded rules-13 safety revision, portable lifecycle
|
||||
funding/placement/growth, optional tuning and native card geometry/input capture.
|
||||
The active DEV tuning retains its previous contents; the complete safety profile
|
||||
is staged separately and is not mounted by the current overlay. No default world,
|
||||
manifest bundle, genome, wire version or golden was replaced. Older readers refuse
|
||||
the new nonzero reserved declarations instead of replaying the wrong law.
|
||||
|
||||
Executed:
|
||||
|
||||
- GCC 14.2.0 Release/NDEBUG, existing release-preset build/playtest-release:
|
||||
complete build and CTest passed 122/122. After separating the staged profile,
|
||||
rebuilt and reran the tuning and region-step contracts: 2/2 passed, including
|
||||
both the active historical file and new trial file in the tuning test.
|
||||
- MSVC 19.44.35217.0: tools/windows-check.ps1 -Preset client -Action check
|
||||
passed 10/10, including the final panel code. Headless Release built and passed
|
||||
107/108 initially; cli-file-integration could not create its build-local hard
|
||||
link under the restricted sandbox. The isolated test passed 1/1 when rerun with
|
||||
that filesystem permission. Thus all 108 headless tests passed across the full
|
||||
run and permission-corrected rerun. TMP/TEMP used build/playtest-windows-tmp.
|
||||
A pre-existing MSVC narrowing warning in the related revamp-step fixture was
|
||||
corrected with explicit casts of its fixed 3000x2000 coordinates; no test value
|
||||
or production rule changed.
|
||||
- Clang 19.1.1 analysis-preset build/playtest-analysis: rebuilt the production
|
||||
client/panels, lifecycle, owner/tuning regressions with clang-tidy and warnings
|
||||
as errors. The final separate-profile/portable-step test build passed as well.
|
||||
- Clang 19 ASan+UBSan, asan-preset build/client-asan: selected native panels,
|
||||
revamp region-step, tuning and owner CTests passed 4/4. Owner checks took
|
||||
221.59 s, within their existing 300 s timeout. The final separate-profile
|
||||
tuning/portable-step rebuild and focused sanitizer CTest passed 2/2 as well.
|
||||
- Repository format-check with clang-format 19 passed; git diff --check passed.
|
||||
- Both mutation control choices check exact body/reserve allocation against
|
||||
constant 800/200 shares, conserved resources, inherited plans and control,
|
||||
outward velocity, separated footprints, a next-tick engulf attempt, exact
|
||||
checkpoint restore and raw trace-4 replay. Unknown/inconsistent safety
|
||||
declarations are refused; missing optional keys preserve revision 0.
|
||||
- Both ordinary bud choices check the fee retained/transferred exactly once,
|
||||
unchanged parent tissue, unchanged environmental deposit count and full
|
||||
closure/restore. A finite, deliberately rich, high-collection fixture isolates
|
||||
allocation from navigation. Subsequent actual juvenile growth checks that
|
||||
every observed construction step leaves the new body's 60-second fuel buffer;
|
||||
the low-fuel mutation fixture checks deferred growth. This is not balance
|
||||
qualification or evidence that a live aged region has sufficient food.
|
||||
- Native SDL pointer events resize all three cards across horizontal and vertical
|
||||
edges, including top/left placement changes and the outer border hit margin.
|
||||
Tests verify no world clicks, retained sizes after minimize/restore, viewport
|
||||
clamping, reset and zero horizontal overflow, alongside stable live text and
|
||||
existing mutation/bud/restart controls at four viewport sizes.
|
||||
- Generated native BMPs with the software renderer in
|
||||
build/reproduction-safety-review and visually inspected resized.png (960x640).
|
||||
PNG conversion used Windows System.Drawing; no runtime dependency was added.
|
||||
|
||||
Limits: live SQL crash/recovery drills, hardware DPI/accessibility and aged-region
|
||||
ecological playtests were not run. This change does not promote an image, open or
|
||||
reset a region, deploy, prune or operate on World0. Unrelated drafts and untracked
|
||||
files remain untouched. The mandatory pre-push session-window refresh is desired
|
||||
Git configuration only, not a claim of live reachability.
|
||||
|
||||
@@ -57,6 +57,9 @@ struct CellularRevampTuning {
|
||||
// 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{};
|
||||
|
||||
@@ -50,6 +50,10 @@ struct CellularRevampRules {
|
||||
std::uint32_t organism_load_per_thousand{500};
|
||||
std::uint32_t emerge_members{8};
|
||||
std::uint64_t emerge_mass_fg{}, emerge_reserve_pj{};
|
||||
// ADR-0181: 0 preserves historical behavior. Revision 1 makes split_share
|
||||
// the controlled cell's share, returns bud fees to that cell, launches mutation
|
||||
// offspring, and protects a growth fuel buffer for every organism.
|
||||
std::uint32_t safety_version{}, growth_reserve_seconds{}, split_launch_um_per_s{};
|
||||
auto operator<=>(const CellularRevampRules&) const = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Cellular owner format 11: recorded revamp declarations
|
||||
|
||||
Authority: [ADR-0179](../docs/adr/0179-cellular-gameplay-revamp.md) and
|
||||
[ADR-0181](../docs/adr/0181-cellular-reproduction-safety.md). Magic `AEVCLV11`,
|
||||
rules 13, raw bundle 15 and trace 4. Format 10's light/liquid fields remain intact.
|
||||
The revamp header follows its liquid block at byte 444. Its rules and spent pool
|
||||
occupy 120 bytes; growth declaration, offers, catalog bounds, cadence, 49 mutation
|
||||
entries, reproduction and organism settings follow. The complete header is 4,644
|
||||
bytes before spawn sites and life records. Existing lengths, checksum and bounds
|
||||
remain authoritative in `cellular_lives.cpp`.
|
||||
|
||||
The reproduction-safety revision uses formerly reserved little-endian u32 words:
|
||||
|
||||
| Offset | Declaration | Accepted values |
|
||||
| ---: | --- | --- |
|
||||
| 568 | Safety simulation-law revision | 0 historical; 1 safety trial |
|
||||
| 600 | Protected growth fuel, seconds of resulting-body full demand | 0 for revision 0; 1–3,600 for revision 1 |
|
||||
| 624 | Mutation offspring launch speed, micrometres/second | 0 for revision 0; 1–10,000 for revision 1 |
|
||||
|
||||
Unknown revisions or inconsistent declarations are rejected. Revision 0 encodes
|
||||
the same zeros as historical files and preserves historical split/fee/growth
|
||||
semantics exactly. Revision 1 interprets the existing split-share field as the
|
||||
controlled cell's share and enables the behavior defined by ADR-0181. It does not
|
||||
alter genome schema, body construction prices, organism mutation or session bytes.
|
||||
Launch motion is stored in the existing per-life motion record; no transient
|
||||
immunity or unrecorded timer exists. Replay uses the stored declarations, never
|
||||
the current tuning file. Old readers reject revision-1 files at reserved words;
|
||||
retain the writing build. Opening upgrades retain their audited source and target.
|
||||
@@ -90,6 +90,11 @@ constexpr std::array fields{
|
||||
amount_limit},
|
||||
Field{"organism.emerge_reserve_pj", &CellularRevampTuning::organism_emerge_reserve_pj, 0,
|
||||
amount_limit},
|
||||
Field{"reproduction.safety_version", &CellularRevampTuning::reproduction_safety_version, 0, 1},
|
||||
Field{"body.growth_reserve_seconds", &CellularRevampTuning::body_growth_reserve_seconds, 0,
|
||||
3'600},
|
||||
Field{"reproduction.split_launch_um_per_s",
|
||||
&CellularRevampTuning::reproduction_split_launch_um_per_s, 0, 10'000},
|
||||
};
|
||||
|
||||
// A per-mutation field's bounds, in cellular_mutation_tuning_fields order.
|
||||
@@ -251,7 +256,10 @@ parse_cellular_revamp_tuning(std::string_view text) {
|
||||
for (std::size_t index = 0; index < fields.size(); ++index)
|
||||
if (!seen.at(index) && fields.at(index).key != "playtest.starting_wildlife_cells" &&
|
||||
fields.at(index).key != "feeding.collection_percent" &&
|
||||
fields.at(index).key != "feeding.split_evenly")
|
||||
fields.at(index).key != "feeding.split_evenly" &&
|
||||
fields.at(index).key != "reproduction.safety_version" &&
|
||||
fields.at(index).key != "body.growth_reserve_seconds" &&
|
||||
fields.at(index).key != "reproduction.split_launch_um_per_s")
|
||||
return std::unexpected{
|
||||
error(CellularTuningErrorKind::missing_key, 0, fields.at(index).key)};
|
||||
if (tuning.version != cellular_revamp_tuning_version)
|
||||
@@ -260,6 +268,14 @@ parse_cellular_revamp_tuning(std::string_view text) {
|
||||
if (tuning.playtest_starting_wildlife_cells >= tuning.reproduction_organism_cap)
|
||||
return std::unexpected{
|
||||
error(CellularTuningErrorKind::inconsistent, 0, "playtest.starting_wildlife_cells")};
|
||||
if ((tuning.reproduction_safety_version == 0 &&
|
||||
(tuning.body_growth_reserve_seconds != 0 ||
|
||||
tuning.reproduction_split_launch_um_per_s != 0)) ||
|
||||
(tuning.reproduction_safety_version == 1 &&
|
||||
(tuning.body_growth_reserve_seconds == 0 ||
|
||||
tuning.reproduction_split_launch_um_per_s == 0)))
|
||||
return std::unexpected{
|
||||
error(CellularTuningErrorKind::inconsistent, 0, "reproduction.safety_version")};
|
||||
if (tuning.mutation_floor_ppm > tuning.mutation_cap_ppm ||
|
||||
tuning.mutation_min_points >= tuning.mutation_max_points)
|
||||
return std::unexpected{
|
||||
|
||||
@@ -147,10 +147,16 @@ bool toolkit_window_at(float x, float y) {
|
||||
const ImGuiContext& g = *ImGui::GetCurrentContext();
|
||||
if (g.OpenPopupStack.Size > 0)
|
||||
return true;
|
||||
for (const ImGuiWindow* w : g.Windows)
|
||||
for (const ImGuiWindow* w : g.Windows) {
|
||||
auto bounds = w->OuterRectClipped;
|
||||
// Native edge resizing begins just outside a window. Own that hit area on
|
||||
// the very first press, before ImGui's next-frame capture flags update.
|
||||
if ((w->Flags & (ImGuiWindowFlags_NoResize | ImGuiWindowFlags_ChildWindow)) == 0)
|
||||
bounds.Expand(g.WindowsBorderHoverPadding);
|
||||
if (w->Active && !w->Hidden && (w->Flags & ImGuiWindowFlags_NoMouseInputs) == 0 &&
|
||||
w->OuterRectClipped.Contains(ImVec2{x, y}))
|
||||
bounds.Contains(ImVec2{x, y}))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
struct Runtime {
|
||||
|
||||
@@ -61,6 +61,8 @@ constexpr std::size_t cellular_life_motion_bytes = 20;
|
||||
// Then the growth rate and a reserved zero (8), the offer rules (seven 4-byte fields and a
|
||||
// reserved zero, 32), the catalog bounds (five 4-byte fields, a reserved zero and the carbon
|
||||
// gate, 32), the offer interval and a reserved zero (8), and 49 mutation tunables of 80 bytes.
|
||||
// ADR-0181 uses the growth/offer/bounds reserved words for safety revision,
|
||||
// growth fuel seconds and split launch speed; historical zeros retain their law.
|
||||
constexpr std::size_t cellular_revamp_mutation_bytes = 80;
|
||||
// Then the reproduction tunables: split share, split growth, organism cap, fee scale (16) and
|
||||
// the bud fee (40).
|
||||
@@ -217,7 +219,7 @@ std::optional<biology::CellularTriggerState> read_trigger(Reader& in) {
|
||||
}
|
||||
void write_revamp_offers(Writer& out, const CellularRevampRules& r) {
|
||||
out.put(r.growth_per_tick_centi_mille, 4);
|
||||
out.put(0, 4);
|
||||
out.put(r.safety_version, 4);
|
||||
const auto& o = r.offers;
|
||||
for (const auto value : {o.options, o.floor_ppm, o.cap_ppm})
|
||||
out.put(value, 4);
|
||||
@@ -225,12 +227,12 @@ void write_revamp_offers(Writer& out, const CellularRevampRules& r) {
|
||||
out.put(static_cast<std::uint32_t>(o.score_max), 4);
|
||||
out.put(o.max_multiplier_per_mille, 4);
|
||||
out.put(o.min_multiplier_per_mille, 4);
|
||||
out.put(0, 4);
|
||||
out.put(r.growth_reserve_seconds, 4);
|
||||
const auto& b = r.bounds;
|
||||
for (const auto value :
|
||||
{b.min_points, b.max_points, b.recipe_min_share, b.max_litter, b.buds_for_adhesion})
|
||||
out.put(value, 4);
|
||||
out.put(0, 4);
|
||||
out.put(r.split_launch_um_per_s, 4);
|
||||
out.put(b.carbon_for_light);
|
||||
out.put(r.offer_interval_ticks, 4);
|
||||
out.put(0, 4);
|
||||
@@ -261,7 +263,7 @@ bool read_revamp_offers(Reader& in, CellularRevampRules& r) {
|
||||
};
|
||||
bool zero = true;
|
||||
r.growth_per_tick_centi_mille = u32();
|
||||
zero = zero && in.get(4) == 0;
|
||||
r.safety_version = u32();
|
||||
auto& o = r.offers;
|
||||
o.options = u32();
|
||||
o.floor_ppm = u32();
|
||||
@@ -270,14 +272,14 @@ bool read_revamp_offers(Reader& in, CellularRevampRules& r) {
|
||||
o.score_max = i32();
|
||||
o.max_multiplier_per_mille = u32();
|
||||
o.min_multiplier_per_mille = u32();
|
||||
zero = zero && in.get(4) == 0;
|
||||
r.growth_reserve_seconds = u32();
|
||||
auto& b = r.bounds;
|
||||
b.min_points = u32();
|
||||
b.max_points = u32();
|
||||
b.recipe_min_share = u32();
|
||||
b.max_litter = u32();
|
||||
b.buds_for_adhesion = u32();
|
||||
zero = zero && in.get(4) == 0;
|
||||
r.split_launch_um_per_s = u32();
|
||||
b.carbon_for_light = in.get();
|
||||
r.offer_interval_ticks = u32();
|
||||
zero = zero && in.get(4) == 0;
|
||||
@@ -479,7 +481,7 @@ bool separated(std::uint64_t left, std::uint64_t right, std::uint32_t left_exten
|
||||
std::expected<std::optional<biology::CellularPosition>, CellularLivesError>
|
||||
bud_position(const CellularOwnedLife& parent, std::uint32_t parent_extent, std::uint32_t bud_extent,
|
||||
std::span<const CellularOwnedLife> lives, const biology::LineageArchive& archive,
|
||||
const CellularLivesConfig& config) {
|
||||
const CellularLivesConfig& config, std::uint32_t launch_gap = 0) {
|
||||
constexpr std::array<std::array<std::int64_t, 2>, 8> directions{
|
||||
{{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}}};
|
||||
if (bud_extent == 0 || bud_extent > config.area.width_um || bud_extent > config.area.height_um)
|
||||
@@ -490,10 +492,12 @@ bud_position(const CellularOwnedLife& parent, std::uint32_t parent_extent, std::
|
||||
const auto budget = budget_for(archive, living, config.ambient_temperature_millikelvin);
|
||||
if (!budget)
|
||||
return std::unexpected{budget.error()};
|
||||
extents.push_back(budget->phenotype.extent);
|
||||
extents.push_back(launch_gap != 0 && living.identity.life == parent.identity.life
|
||||
? parent_extent
|
||||
: budget->phenotype.extent);
|
||||
}
|
||||
// Doubled centre coordinates keep half extents exact.
|
||||
const auto step = std::int64_t{parent_extent} + bud_extent + 2;
|
||||
const auto step = std::int64_t{parent_extent} + bud_extent + 2 + 2 * std::int64_t{launch_gap};
|
||||
// Twice the bud's corner coordinate on one axis; negative is outside the area.
|
||||
const auto doubled_corner = [&](std::uint64_t parent_corner, std::int64_t direction) {
|
||||
return 2 * static_cast<std::int64_t>(parent_corner) + parent_extent + direction * step -
|
||||
@@ -511,10 +515,21 @@ bud_position(const CellularOwnedLife& parent, std::uint32_t parent_extent, std::
|
||||
const biology::CellularPosition candidate{static_cast<std::uint64_t>(x),
|
||||
static_cast<std::uint64_t>(y)};
|
||||
bool clear = true;
|
||||
for (std::size_t i = 0; i < lives.size() && clear; ++i)
|
||||
for (std::size_t i = 0; i < lives.size() && clear; ++i) {
|
||||
clear = lives[i].presence == CellularPresence::suspended ||
|
||||
separated(candidate.x_um, lives[i].position.x_um, bud_extent, extents[i]) ||
|
||||
separated(candidate.y_um, lives[i].position.y_um, bud_extent, extents[i]);
|
||||
if (clear && launch_gap != 0 && lives[i].presence != CellularPresence::suspended &&
|
||||
lives[i].identity.life != parent.identity.life) {
|
||||
// The short launch corridor must be clear too; no jumping through a cell.
|
||||
const auto begin_x = static_cast<std::uint64_t>(x - dx * launch_gap);
|
||||
const auto begin_y = static_cast<std::uint64_t>(y - dy * launch_gap);
|
||||
clear = separated(std::min(begin_x, candidate.x_um), lives[i].position.x_um,
|
||||
bud_extent + (dx == 0 ? 0 : launch_gap), extents[i]) ||
|
||||
separated(std::min(begin_y, candidate.y_um), lives[i].position.y_um,
|
||||
bud_extent + (dy == 0 ? 0 : launch_gap), extents[i]);
|
||||
}
|
||||
}
|
||||
if (clear)
|
||||
return std::optional{candidate};
|
||||
}
|
||||
@@ -2990,14 +3005,17 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
// offspring expresses the mutation, both plans carry it. Refused, spending nothing,
|
||||
// when the cell is too small, has no room beside it, or the region is full.
|
||||
const auto temperature = state_->config.ambient_temperature_millikelvin;
|
||||
const auto split =
|
||||
biology::split_cell(*expressed, *successor, found->growth, found->body, reserve,
|
||||
temperature, state_->revamp.split_share_per_thousand,
|
||||
state_->revamp.split_min_growth, state_->revamp.body);
|
||||
const auto child_share = state_->revamp.safety_version == 1 && !selection.become
|
||||
? 1'000 - state_->revamp.split_share_per_thousand
|
||||
: state_->revamp.split_share_per_thousand;
|
||||
const auto split = biology::split_cell(
|
||||
*expressed, *successor, found->growth, found->body, reserve, temperature,
|
||||
child_share, state_->revamp.split_min_growth, state_->revamp.body);
|
||||
if (!split && split.error() == biology::BuddingError::development)
|
||||
return std::unexpected{CellularLivesError::biology};
|
||||
const auto identity = cellular_bud_identity(state_->region, next_bud_sequence);
|
||||
std::optional<biology::CellularPosition> spot;
|
||||
std::uint16_t launch_heading{};
|
||||
if (split) {
|
||||
const auto shrunk = biology::metabolic_budget(
|
||||
*expressed, split->parent_growth, {temperature, {}}, 1000, state_->revamp.body);
|
||||
@@ -3005,12 +3023,21 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
*successor, split->child_growth, {temperature, {}}, 1000, state_->revamp.body);
|
||||
if (!shrunk || !born)
|
||||
return std::unexpected{CellularLivesError::biology};
|
||||
const auto position =
|
||||
bud_position(*found, shrunk->phenotype.extent, born->phenotype.extent,
|
||||
next_lives, next_archive, state_->config);
|
||||
const auto position = bud_position(
|
||||
*found, shrunk->phenotype.extent, born->phenotype.extent, next_lives,
|
||||
next_archive, state_->config, state_->revamp.split_launch_um_per_s / 20);
|
||||
if (!position)
|
||||
return std::unexpected{position.error()};
|
||||
spot = *position;
|
||||
if (spot && state_->revamp.safety_version == 1) {
|
||||
const auto dx = 2 * (static_cast<std::int64_t>(spot->x_um) -
|
||||
static_cast<std::int64_t>(found->position.x_um)) +
|
||||
std::int64_t{born->phenotype.extent} - shrunk->phenotype.extent;
|
||||
const auto dy = 2 * (static_cast<std::int64_t>(spot->y_um) -
|
||||
static_cast<std::int64_t>(found->position.y_um)) +
|
||||
std::int64_t{born->phenotype.extent} - shrunk->phenotype.extent;
|
||||
launch_heading = biology::cellular_heading_of(dx, dy);
|
||||
}
|
||||
}
|
||||
if (!split || !spot || identity == 0 ||
|
||||
next_lives.size() >= state_->revamp.organism_cap ||
|
||||
@@ -3037,6 +3064,24 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
child.position = *spot;
|
||||
child.body = split->child_body;
|
||||
child.reserve = split->child_reserve;
|
||||
if (state_->revamp.safety_version == 1) {
|
||||
// A liquid-relative launch, inherited by either control choice and persisted
|
||||
// as ordinary motion. Drag, braking and currents apply on the next tick.
|
||||
child.motion = found->motion;
|
||||
child.motion.heading = launch_heading;
|
||||
const auto impulse = std::int64_t{state_->revamp.split_launch_um_per_s} *
|
||||
biology::cellular_velocity_q10_per_um_s;
|
||||
const auto launched = [&](std::int32_t velocity, std::int32_t direction) {
|
||||
return static_cast<std::int32_t>(
|
||||
std::clamp(velocity + impulse * direction / biology::cellular_trig_one,
|
||||
-std::int64_t{biology::cellular_velocity_limit_q10},
|
||||
std::int64_t{biology::cellular_velocity_limit_q10}));
|
||||
};
|
||||
child.motion.velocity_x_q10 = launched(
|
||||
child.motion.velocity_x_q10, biology::cellular_cos_q14(child.motion.heading));
|
||||
child.motion.velocity_y_q10 = launched(
|
||||
child.motion.velocity_y_q10, biology::cellular_sin_q14(child.motion.heading));
|
||||
}
|
||||
child.parent_life = found->identity.life;
|
||||
child.offspring_genome = successor->id();
|
||||
child.revamp.affinity.score = found->revamp.affinity.score;
|
||||
@@ -3248,12 +3293,13 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
}();
|
||||
const auto copies = revamp_rules ? litter_count : (twins ? 2U : 1U);
|
||||
for (std::uint32_t copy = 0; copy < copies; ++copy) {
|
||||
if (copy == 1)
|
||||
if (copy != 0)
|
||||
// Inserting the first bud may have moved the parent; find it again.
|
||||
parent = std::ranges::lower_bound(
|
||||
next_lives, request.life_id, {},
|
||||
[](const CellularOwnedLife& value) { return value.identity.life; });
|
||||
const bool twin = copy == 1;
|
||||
const bool twin =
|
||||
revamp_rules && state_->revamp.safety_version == 1 ? copy != 0 : copy == 1;
|
||||
const auto temperature = state_->config.ambient_temperature_millikelvin;
|
||||
const auto genome = next_archive.find(cellular_offspring_genome(*parent));
|
||||
const auto expressed = next_archive.find(parent->identity.genome);
|
||||
@@ -3331,7 +3377,20 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
// Funding checked that the reserve still covers it.
|
||||
if (!subtract_inventory(parent->reserve, fee))
|
||||
return std::unexpected{CellularLivesError::conservation};
|
||||
reclaims.emplace_back(fee, parent->position);
|
||||
const auto asked = std::ranges::lower_bound(ordered, request.life_id, {},
|
||||
&CellularLifeIntent::life_id);
|
||||
if (state_->revamp.safety_version == 1 && parent->account != LifeAccount{}) {
|
||||
// The provision was funded in full above, then returned exactly once to
|
||||
// the selected cell. Construction and the ordinary bud provision remain.
|
||||
auto& recipient = asked != ordered.end() && asked->life_id == request.life_id &&
|
||||
asked->intent.become
|
||||
? transition->reserve
|
||||
: parent->reserve;
|
||||
if (!add_inventory(recipient, fee))
|
||||
return std::unexpected{CellularLivesError::overflow};
|
||||
} else {
|
||||
reclaims.emplace_back(fee, parent->position);
|
||||
}
|
||||
}
|
||||
CellularOwnedLife bud{};
|
||||
bud.identity = {identity, identity, genome->id(), identity, {proposal->end_tick}};
|
||||
@@ -3482,12 +3541,55 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
if (step == 0)
|
||||
continue;
|
||||
}
|
||||
const auto budget = biology::metabolic_budget(
|
||||
auto budget = biology::metabolic_budget(
|
||||
*genome, life.growth,
|
||||
{state_->config.ambient_temperature_millikelvin, life.reserve}, step,
|
||||
state_->revamp.body);
|
||||
if (!budget || budget->body != life.body)
|
||||
return std::unexpected(CellularLivesError::biology);
|
||||
if (revamp_rules && state_->revamp.safety_version == 1) {
|
||||
const auto burn = biology::cellular_burn(
|
||||
state_->revamp.burn_pj_per_kfg,
|
||||
traits ? traits->burn : std::array<std::uint16_t, 4>{100, 100, 100, 100},
|
||||
input->intent.exclude);
|
||||
// Narrow to the largest construction step that leaves the NEW body's
|
||||
// full-demand fuel buffer. This is an affordability check, never a payment
|
||||
// or resource grant. Matter consumed by construction no longer counts as fuel.
|
||||
bool protected_fuel = false;
|
||||
while (budget->construction.after.realized_per_thousand >
|
||||
life.growth.realized_per_thousand) {
|
||||
auto remaining = life.reserve;
|
||||
const auto& construction = budget->construction;
|
||||
if (!subtract_inventory(remaining, construction.intake) ||
|
||||
!add_inventory(remaining, construction.release))
|
||||
return std::unexpected{CellularLivesError::conservation};
|
||||
const auto target = biology::metabolic_budget(
|
||||
*genome, construction.after,
|
||||
{state_->config.ambient_temperature_millikelvin, {}}, 1000,
|
||||
state_->revamp.body);
|
||||
if (!target || target->rate_microseconds == 0)
|
||||
return std::unexpected{CellularLivesError::biology};
|
||||
const auto periods = std::uint64_t{state_->revamp.growth_reserve_seconds} *
|
||||
1'000'000 / target->rate_microseconds;
|
||||
const bool bounded =
|
||||
periods == 0 ||
|
||||
target->demand.value <= std::numeric_limits<std::uint64_t>::max() / periods;
|
||||
if (bounded && biology::cellular_payable_energy(remaining, burn, false) >=
|
||||
target->demand.value * periods)
|
||||
break;
|
||||
protected_fuel = true;
|
||||
const auto smaller = construction.after.realized_per_thousand -
|
||||
life.growth.realized_per_thousand - 1;
|
||||
budget = biology::metabolic_budget(
|
||||
*genome, life.growth,
|
||||
{state_->config.ambient_temperature_millikelvin, life.reserve}, smaller,
|
||||
state_->revamp.body);
|
||||
if (!budget)
|
||||
return std::unexpected{CellularLivesError::biology};
|
||||
}
|
||||
if (protected_fuel && life.account != LifeAccount{})
|
||||
growth_limits.emplace_back(life.identity.life, std::uint8_t{1});
|
||||
}
|
||||
const auto& move = budget->construction;
|
||||
// Rules 13: an owned life learns which nutrient (or energy) narrowed its step: the
|
||||
// one its reserve covers least of what an ample reserve's step needs.
|
||||
|
||||
@@ -36,6 +36,13 @@ bool cellular_revamp_offer_rules_valid(const CellularRevampRules& rules) noexcep
|
||||
bool cellular_revamp_valid(const CellularRevampRules& rules) noexcept {
|
||||
constexpr std::uint64_t most = 1'000'000'000'000'000ULL;
|
||||
const auto& step = rules.step;
|
||||
if (rules.safety_version > 1 || rules.growth_reserve_seconds > 3'600 ||
|
||||
rules.split_launch_um_per_s > 10'000 ||
|
||||
(rules.safety_version == 0 &&
|
||||
(rules.growth_reserve_seconds != 0 || rules.split_launch_um_per_s != 0)) ||
|
||||
(rules.safety_version == 1 &&
|
||||
(rules.growth_reserve_seconds == 0 || rules.split_launch_um_per_s == 0)))
|
||||
return false;
|
||||
for (const auto rate : rules.burn_pj_per_kfg)
|
||||
if (rate > 1'000'000'000'000ULL)
|
||||
return false;
|
||||
@@ -284,6 +291,9 @@ CellularRevampRules cellular_revamp_rules(const biology::CellularRevampTuning& t
|
||||
.organism_load_per_thousand = u32(t.organism_load_per_mille),
|
||||
.emerge_members = u32(t.organism_emerge_members),
|
||||
.emerge_mass_fg = u64(t.organism_emerge_mass_fg),
|
||||
.emerge_reserve_pj = u64(t.organism_emerge_reserve_pj)};
|
||||
.emerge_reserve_pj = u64(t.organism_emerge_reserve_pj),
|
||||
.safety_version = u32(t.reproduction_safety_version),
|
||||
.growth_reserve_seconds = u32(t.body_growth_reserve_seconds),
|
||||
.split_launch_um_per_s = u32(t.reproduction_split_launch_um_per_s)};
|
||||
}
|
||||
} // namespace evo::server
|
||||
|
||||
@@ -375,8 +375,16 @@ const CellularOwnedLife& life_of(const CellularLives& state, std::uint64_t id) {
|
||||
require(found != state.lives().end(), "life missing");
|
||||
return *found;
|
||||
}
|
||||
Owner offering_region(std::uint64_t cost_pj) {
|
||||
Owner offering_region(std::uint64_t cost_pj, bool safety = false) {
|
||||
auto rules = revamp();
|
||||
if (safety) {
|
||||
rules.safety_version = 1;
|
||||
rules.growth_reserve_seconds = 60;
|
||||
rules.split_launch_um_per_s = 800;
|
||||
rules.step.split_evenly = true;
|
||||
rules.split_share_per_thousand = 800;
|
||||
rules.split_min_growth = 500;
|
||||
}
|
||||
rules.offer_interval_ticks = 40;
|
||||
for (auto& m : rules.mutations) {
|
||||
m.cost.energy.value = cost_pj;
|
||||
@@ -576,15 +584,23 @@ void thrust_moves_affinity() {
|
||||
// Rules 13 (reproduction plan sections 6-7): Adhesion turns the cell into a two-member organism
|
||||
// that holds its whole body and reserve; the organism expresses later mutations as a whole,
|
||||
// buds add internal members, and at the threshold it emerges as a recorded export.
|
||||
Owner adhesion_region(std::uint64_t carbon_fee = 0) {
|
||||
Owner adhesion_region(std::uint64_t carbon_fee = 0, bool safety = false,
|
||||
std::uint32_t growth_rate = 0) {
|
||||
auto rules = revamp();
|
||||
if (safety) {
|
||||
rules.safety_version = 1;
|
||||
rules.growth_reserve_seconds = 60;
|
||||
rules.split_launch_um_per_s = 800;
|
||||
rules.step.split_evenly = true;
|
||||
rules.step.collection_percent = 1'000;
|
||||
}
|
||||
rules.bud_fee.matter[0].value = carbon_fee;
|
||||
rules.bud_fee_scale_percent = carbon_fee == 0 ? 0 : 100;
|
||||
rules.offer_interval_ticks = 40;
|
||||
rules.bounds.buds_for_adhesion = 0;
|
||||
rules.emerge_members = 3;
|
||||
rules.emerge_mass_fg = 0;
|
||||
rules.growth_per_tick_centi_mille = 0; // Collected matter stays in the reserve for buds.
|
||||
rules.growth_per_tick_centi_mille = growth_rate; // Zero keeps collected matter for buds.
|
||||
for (auto& m : rules.mutations)
|
||||
m.enabled = false;
|
||||
// Adhesion and five movement mutations: three options capped at 70% each need five.
|
||||
@@ -593,6 +609,29 @@ Owner adhesion_region(std::uint64_t carbon_fee = 0) {
|
||||
for (std::size_t i = 0; i < 5; ++i)
|
||||
rules.mutations.at(i).enabled = true;
|
||||
auto fresh = opening(7, true, 4, false); // A 6 mm region, rich motes at four sites.
|
||||
if (safety) {
|
||||
// Put finite food within reach of any seeded founder position. The test
|
||||
// isolates funding/allocation, rather than depending on the forager's search.
|
||||
auto habitat_config = fresh->habitat().config();
|
||||
for (auto& patch : habitat_config.patches)
|
||||
if (patch.kind == biology::CellularDepositKind::pool)
|
||||
patch.radius_um = biology::max_cellular_deposit_radius_um;
|
||||
auto habitat = checked(biology::CellularHabitat::create(std::move(habitat_config)),
|
||||
"safety funding habitat");
|
||||
auto nursery =
|
||||
checked(PrimitiveLives::create(
|
||||
{fresh->world(),
|
||||
fresh->region(),
|
||||
fresh->frame(),
|
||||
17,
|
||||
fresh->nursery(),
|
||||
{{1'000, 1'000}, {1'000, 4'000}, {4'000, 1'000}, {4'000, 4'000}}}),
|
||||
"safety funding nursery");
|
||||
fresh = checked(CellularLives::create(*nursery, std::move(habitat),
|
||||
{{6'000, 6'000}, 0, 293'150},
|
||||
CellularLivesProfile::foraging),
|
||||
"safety funding opening");
|
||||
}
|
||||
checked(fresh->advance_tick({}), "genesis tick");
|
||||
fresh = checked(fresh->migration_upgrade_candidate(), "boundary upgrade");
|
||||
fresh = checked(fresh->maturation_upgrade_candidate(), "maturation upgrade");
|
||||
@@ -834,9 +873,169 @@ void trace_replays() {
|
||||
!decoded.ticks.at(6).lives.front().intent.emerge,
|
||||
"Emerge did not survive the trace");
|
||||
}
|
||||
|
||||
// The safety revision preserves all five channels, follows both control choices,
|
||||
// separates eligible predator/prey siblings and replays their actual motion exactly.
|
||||
void safety_split(bool become) {
|
||||
auto state = offering_region(0, true);
|
||||
for (int tick = 0; tick < 40; ++tick)
|
||||
checked(state->advance_tick(swim(*state, {1'000, 0})), "earn safety offer");
|
||||
auto base = restore(*state);
|
||||
require(base->revamp_rules() == state->revamp_rules(), "safety settings lost on restore");
|
||||
auto invalid = state->revamp_rules();
|
||||
invalid.safety_version = 2;
|
||||
require(!cellular_revamp_valid(invalid), "an unknown safety revision was admitted");
|
||||
invalid.safety_version = 0;
|
||||
require(!cellular_revamp_valid(invalid), "historical rules accepted hidden safety amounts");
|
||||
auto unsplit = restore(*state);
|
||||
const auto intents = swim(*state, {});
|
||||
checked(unsplit->advance_tick(intents), "unsplit comparison");
|
||||
const auto pre = life_of(*unsplit, 101);
|
||||
auto choice = choose(*state, 101, life_of(*state, 101).revamp.offer.ids.at(0), 9'000);
|
||||
choice.front().become = become;
|
||||
const auto execution =
|
||||
checked(state->advance_tick_with_mutations(intents, choice), "safe split");
|
||||
require(execution.mutations.front().result == CellularMutationResult::split_applied,
|
||||
"safety split refused");
|
||||
const auto identity = cellular_bud_identity(state->region(), 1);
|
||||
const auto parent = life_of(*state, 101);
|
||||
const auto child = life_of(*state, identity);
|
||||
const auto expressed = state->archive().find(pre.identity.genome);
|
||||
const auto successor = state->archive().find(9'000);
|
||||
const auto expected =
|
||||
checked(biology::split_cell(*expressed, *successor, pre.growth, pre.body, pre.reserve,
|
||||
293'150, become ? 800 : 200, 500, state->revamp_rules().body),
|
||||
"expected safety shares");
|
||||
require(
|
||||
parent.body == expected.parent_body && child.body == expected.child_body &&
|
||||
parent.reserve == expected.parent_reserve && child.reserve == expected.child_reserve,
|
||||
"the controlled cell did not receive its 80 percent without growth spending the buffer");
|
||||
require(become ? child.account == account(2) : parent.account == account(2),
|
||||
"safety control went to the wrong cell");
|
||||
const auto parent_budget =
|
||||
checked(biology::metabolic_budget(*expressed, parent.growth, {293'150, {}}, 1000,
|
||||
state->revamp_rules().body),
|
||||
"parent budget");
|
||||
const auto child_budget =
|
||||
checked(biology::metabolic_budget(*successor, child.growth, {293'150, {}}, 1000,
|
||||
state->revamp_rules().body),
|
||||
"child budget");
|
||||
require(!biology::cellular_footprints_contact(parent.position, parent_budget.phenotype.extent,
|
||||
child.position, child_budget.phenotype.extent),
|
||||
"split siblings remained in engulf contact");
|
||||
const auto dx = static_cast<std::int64_t>(child.position.x_um) -
|
||||
static_cast<std::int64_t>(parent.position.x_um);
|
||||
const auto dy = static_cast<std::int64_t>(child.position.y_um) -
|
||||
static_cast<std::int64_t>(parent.position.y_um);
|
||||
require(dx * (std::int64_t{child.motion.velocity_x_q10} - parent.motion.velocity_x_q10) +
|
||||
dy *
|
||||
(std::int64_t{child.motion.velocity_y_q10} - parent.motion.velocity_y_q10) >
|
||||
0,
|
||||
"the newborn was not launched away");
|
||||
auto hunters = swim(*state, {});
|
||||
for (auto& input : hunters)
|
||||
input.intent.engulf = true;
|
||||
checked(state->advance_tick(hunters), "sibling engulf attempt");
|
||||
require(state->lives().size() == base->lives().size() + 1,
|
||||
"a sibling was immediately reclaimed");
|
||||
closed(*state);
|
||||
CellularBatch batch;
|
||||
batch.format_version = cellular_batch_inheritance_format;
|
||||
batch.header = {state->world(), state->region(), state->frame(), {}, {},
|
||||
base->tick(), state->tick()};
|
||||
batch.header.predecessor.fill(1);
|
||||
batch.header.predecessor_digest.fill(2);
|
||||
batch.ticks.push_back({intents, {}, choice});
|
||||
batch.ticks.push_back({hunters, {}, {}});
|
||||
const auto decoded =
|
||||
checked(decode_cellular_batch(checked(encode_cellular_batch(batch), "encode")), "decode");
|
||||
const auto replayed = checked(replay_cellular_batch(*base, decoded), "safety replay");
|
||||
require(replayed->snapshot() == state->snapshot() &&
|
||||
restore(*state)->snapshot() == state->snapshot(),
|
||||
"safety restore/replay diverged");
|
||||
}
|
||||
|
||||
void safe_bud_provision(bool become) {
|
||||
auto state = adhesion_region(100'000, true, 625);
|
||||
for (int tick = 0; tick < 4'000; ++tick) {
|
||||
const auto cost = state->budding_cost(101);
|
||||
if (!cost)
|
||||
throw std::runtime_error("safety fixture has no bud requirement");
|
||||
const auto& reserve = life_of(*state, 101).reserve;
|
||||
bool funded = reserve.energy.value >= cost->energy.value + cost->energy.value / 10;
|
||||
for (std::size_t c = 0; funded && c < reserve.matter.size(); ++c)
|
||||
funded = reserve.matter[c].value >= cost->matter[c].value + cost->matter[c].value / 10;
|
||||
if (funded)
|
||||
break;
|
||||
checked(state->advance_tick(swim(*state, {}, 0x0F)), "fund safe bud");
|
||||
}
|
||||
auto baseline = restore(*state);
|
||||
auto inputs = swim(*state, {});
|
||||
auto request = std::ranges::find(inputs, 101, &CellularLifeIntent::life_id);
|
||||
request->intent.bud = true;
|
||||
request->intent.become = become;
|
||||
auto idle = swim(*baseline, {});
|
||||
checked(baseline->advance_tick(idle), "pre-bud comparison");
|
||||
const auto pre = life_of(*baseline, 101);
|
||||
const auto genome = baseline->archive().find(pre.identity.genome);
|
||||
const auto expected =
|
||||
checked(biology::fund_offspring(*genome, *genome, pre.growth, pre.reserve, 293'150),
|
||||
"ordinary bud funding");
|
||||
const auto result = checked(state->advance_tick_with_mutations(inputs, {}), "safe bud");
|
||||
require(result.buds.size() == 1 && result.buds.front().result == CellularBudResult::budded,
|
||||
"safe bud not funded");
|
||||
const auto& parent = life_of(*state, 101);
|
||||
const auto& child = life_of(*state, result.buds.front().bud_life);
|
||||
require(parent.body == pre.body && child.body == expected.body,
|
||||
"safe budding consumed parent tissue");
|
||||
auto parent_reserve = expected.parent_reserve;
|
||||
auto child_reserve = expected.reserve;
|
||||
if (become) {
|
||||
parent_reserve.matter[0].value -= 100'000;
|
||||
child_reserve.matter[0].value += 100'000;
|
||||
}
|
||||
require(parent.reserve == parent_reserve && child.reserve == child_reserve &&
|
||||
(become ? child.account == account(2) : parent.account == account(2)),
|
||||
"bud provision did not follow control or was reclaimed instead");
|
||||
require(state->habitat().patches().size() == baseline->habitat().patches().size(),
|
||||
"the returned provision also became environmental bubbles");
|
||||
closed(*state);
|
||||
require(restore(*state)->snapshot() == state->snapshot(), "safe bud restore diverged");
|
||||
std::uint32_t growth_steps = 0;
|
||||
const auto child_id = child.identity.life;
|
||||
for (int tick = 0; tick < 800; ++tick) {
|
||||
checked(state->advance_tick(swim(*state, {})), "funded safe growth");
|
||||
const auto& growing = life_of(*state, child_id);
|
||||
const auto report = std::ranges::find(state->last_tick_feedback(), child_id,
|
||||
&CellularLifeTickFeedback::life_id);
|
||||
if (report != state->last_tick_feedback().end() &&
|
||||
report->into_growth != accounting::Inventory{}) {
|
||||
++growth_steps;
|
||||
const auto body_genome = state->archive().find(growing.identity.genome);
|
||||
const auto budget =
|
||||
checked(biology::metabolic_budget(*body_genome, growing.growth, {293'150, {}}, 1000,
|
||||
state->revamp_rules().body),
|
||||
"growing budget");
|
||||
const auto burn = biology::cellular_burn(
|
||||
state->revamp_rules().burn_pj_per_kfg,
|
||||
body_genome->cellular_traits().value_or(biology::founder_cellular_traits).burn, 0);
|
||||
require(biology::cellular_payable_energy(growing.reserve, burn, false) >=
|
||||
budget.demand.value * 60,
|
||||
"growth consumed the resulting body's protected fuel");
|
||||
}
|
||||
if (growing.growth.realized_per_thousand == 1000 || growth_steps == 16)
|
||||
break;
|
||||
}
|
||||
require(growth_steps != 0, "a well-fed juvenile never resumed safe growth");
|
||||
closed(*state);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() try {
|
||||
safety_split(false);
|
||||
safety_split(true);
|
||||
safe_bud_provision(false);
|
||||
safe_bud_provision(true);
|
||||
starting_wildlife_is_a_funded_opening();
|
||||
shown_bud_charge_includes_the_fee();
|
||||
the_bud_fee_is_paid_in_full_or_refused();
|
||||
|
||||
@@ -36,7 +36,12 @@ void add(Inventory& to, const Inventory& from) {
|
||||
|
||||
// One bubble at (100, 100), or none.
|
||||
std::unique_ptr<CellularHabitat> liquid_map(const Inventory& stock, bool bubble = true) {
|
||||
CellularHabitatConfig config{7, 9, 11, area.width_um, area.height_um, {}};
|
||||
CellularHabitatConfig config{7,
|
||||
9,
|
||||
11,
|
||||
static_cast<std::uint32_t>(area.width_um),
|
||||
static_cast<std::uint32_t>(area.height_um),
|
||||
{}};
|
||||
config.format = cellular_habitat_liquid_format;
|
||||
config.next_deposit = 2;
|
||||
if (bubble) {
|
||||
|
||||
@@ -17,7 +17,7 @@ void check(bool condition, std::source_location at = std::source_location::curre
|
||||
}
|
||||
#define CHECK(expression) check(static_cast<bool>(expression))
|
||||
|
||||
CellularRevampTuning trial() {
|
||||
CellularRevampTuning trial(bool safety = true) {
|
||||
CellularRevampTuning t{.version = 1,
|
||||
.playtest_starting_wildlife_cells = 100,
|
||||
.feeding_collection_percent = 130,
|
||||
@@ -50,7 +50,7 @@ CellularRevampTuning trial() {
|
||||
.mutation_max_offspring = 10,
|
||||
.mutation_carbon_for_light_fg = 20'000'000,
|
||||
.mutation_buds_for_adhesion = 5,
|
||||
.reproduction_split_share_per_mille = 500,
|
||||
.reproduction_split_share_per_mille = 800,
|
||||
.reproduction_split_min_growth_per_mille = 500,
|
||||
.reproduction_bud_fee_e_pj = 250'000,
|
||||
.reproduction_bud_fee_c_fg = 100'000,
|
||||
@@ -62,10 +62,19 @@ CellularRevampTuning trial() {
|
||||
.organism_load_per_mille = 500,
|
||||
.organism_emerge_members = 8,
|
||||
.organism_emerge_mass_fg = 100'000'000,
|
||||
.organism_emerge_reserve_pj = 0};
|
||||
.organism_emerge_reserve_pj = 0,
|
||||
.reproduction_safety_version = 1,
|
||||
.body_growth_reserve_seconds = 60,
|
||||
.reproduction_split_launch_um_per_s = 800};
|
||||
const auto catalog = cellular_catalog();
|
||||
for (std::size_t i = 0; i < catalog.size(); ++i)
|
||||
t.mutations.at(i) = cellular_default_tuning(catalog[i]);
|
||||
if (!safety) {
|
||||
t.reproduction_split_share_per_mille = 500;
|
||||
t.reproduction_safety_version = 0;
|
||||
t.body_growth_reserve_seconds = 0;
|
||||
t.reproduction_split_launch_um_per_s = 0;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -133,6 +142,19 @@ void canonical_round_trip() {
|
||||
|
||||
void refusals() {
|
||||
const auto base = encode_cellular_revamp_tuning(trial());
|
||||
CHECK(error_of(with(base, "reproduction.safety_version", "2")) ==
|
||||
CellularTuningErrorKind::out_of_range);
|
||||
CHECK(error_of(with(base, "reproduction.safety_version", "0")) ==
|
||||
CellularTuningErrorKind::inconsistent);
|
||||
CHECK(error_of(with(base, "body.growth_reserve_seconds", "0")) ==
|
||||
CellularTuningErrorKind::inconsistent);
|
||||
auto historical = base;
|
||||
for (const auto* key : {"reproduction.safety_version", "body.growth_reserve_seconds",
|
||||
"reproduction.split_launch_um_per_s"}) {
|
||||
const auto at = historical.find(key);
|
||||
historical.erase(at, historical.find('\n', at) - at + 1);
|
||||
}
|
||||
CHECK(parse_cellular_revamp_tuning(historical)->reproduction_safety_version == 0);
|
||||
CHECK(error_of(with(base, "playtest.starting_wildlife_cells", "256")) ==
|
||||
CellularTuningErrorKind::out_of_range);
|
||||
CHECK(error_of(with(base, "playtest.starting_wildlife_cells", "-1")) ==
|
||||
@@ -166,7 +188,7 @@ void refusals() {
|
||||
}
|
||||
|
||||
// The checked-in DEV revamp tuning file must parse; CTest passes its path when it is present.
|
||||
void repository_file(const char* path) {
|
||||
void repository_file(const char* path, bool safety) {
|
||||
std::ifstream file(path, std::ios::binary);
|
||||
CHECK(file.good());
|
||||
const std::string text{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
|
||||
@@ -175,7 +197,7 @@ void repository_file(const char* path) {
|
||||
std::fprintf(stderr, "%s: line %zu %s: %s\n", path, parsed.error().line,
|
||||
parsed.error().key.c_str(),
|
||||
std::string{describe(parsed.error().kind)}.c_str());
|
||||
CHECK(parsed && *parsed == trial());
|
||||
CHECK(parsed && *parsed == trial(safety));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -185,7 +207,9 @@ int main(int argc, char** argv) {
|
||||
refusals();
|
||||
mutation_overrides();
|
||||
if (argc > 1)
|
||||
repository_file(argv[1]);
|
||||
repository_file(argv[1], false);
|
||||
if (argc > 2)
|
||||
repository_file(argv[2], true);
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "%s\n", error.what());
|
||||
return 1;
|
||||
|
||||
+42
-1
@@ -677,6 +677,44 @@ void cellular_panels(const std::filesystem::path& review) {
|
||||
CHECK(vitals->Pos.x == anchored.x && vitals->Pos.y == anchored.y);
|
||||
drag("Field notes", form.notes_placement, 30, 10);
|
||||
drag("Nearby", form.map_placement, -35, 20);
|
||||
const auto resize_edge = [&](const char* name, HudPanelPlacement& placement, int edge,
|
||||
float delta) {
|
||||
auto* panel = ImGui::FindWindowByName(name);
|
||||
CHECK(panel);
|
||||
const auto before = panel->Size;
|
||||
ImVec2 start{panel->Pos.x + panel->Size.x / 2, panel->Pos.y + panel->Size.y / 2};
|
||||
if (edge == 0 || edge == 2)
|
||||
start.x = panel->Pos.x + (edge == 0 ? panel->Size.x + 1 : -1);
|
||||
else
|
||||
start.y = panel->Pos.y + (edge == 1 ? panel->Size.y + 1 : -1);
|
||||
const ImVec2 end{start.x + (edge % 2 == 0 ? delta : 0),
|
||||
start.y + (edge % 2 != 0 ? delta : 0)};
|
||||
mouse(id, SDL_EVENT_MOUSE_MOTION, start.x, start.y);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
draw();
|
||||
mouse(id, SDL_EVENT_MOUSE_BUTTON_DOWN, start.x, start.y);
|
||||
draw();
|
||||
CHECK(!app->take_navigation().click);
|
||||
mouse(id, SDL_EVENT_MOUSE_MOTION, end.x, end.y);
|
||||
draw();
|
||||
mouse(id, SDL_EVENT_MOUSE_BUTTON_UP, end.x, end.y);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
draw();
|
||||
CHECK(placement.size && placement.anchor && fits(panel));
|
||||
CHECK(edge % 2 == 0 ? panel->Size.x != before.x : panel->Size.y != before.y);
|
||||
CHECK(!app->take_navigation().click);
|
||||
const auto retained = panel->Size;
|
||||
toggle(name, edge == 0 && std::string{name} == "Vitals" ? form.vitals_minimized
|
||||
: std::string{name} == "Field notes" ? form.notes_minimized
|
||||
: form.map_minimized);
|
||||
CHECK(panel->Size.x == retained.x && panel->Size.y == retained.y);
|
||||
CHECK(panel->DC.ChildWindows[0]->ScrollMax.x == 0);
|
||||
};
|
||||
drag("Vitals", form.vitals_placement, 0, 30);
|
||||
resize_edge("Vitals", form.vitals_placement, 0, 35);
|
||||
resize_edge("Field notes", form.notes_placement, 1, 25);
|
||||
resize_edge("Nearby", form.map_placement, 2, -25);
|
||||
resize_edge("Nearby", form.map_placement, 3, -20);
|
||||
if (!review.empty()) {
|
||||
mouse(id, SDL_EVENT_MOUSE_MOTION, 5, 5);
|
||||
draw();
|
||||
@@ -706,9 +744,12 @@ void cellular_panels(const std::filesystem::path& review) {
|
||||
mouse(id, SDL_EVENT_MOUSE_BUTTON_UP, reset_at.x, reset_at.y);
|
||||
draw();
|
||||
}
|
||||
CHECK(!form.map_placement.anchor && !app->take_navigation().click);
|
||||
CHECK(!form.map_placement.anchor && !form.map_placement.size &&
|
||||
!app->take_navigation().click);
|
||||
form.vitals_placement.anchor.reset();
|
||||
form.notes_placement.anchor.reset();
|
||||
form.vitals_placement.size.reset();
|
||||
form.notes_placement.size.reset();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
draw();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user