Compare commits
102
Commits
6a9af9c514
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d9cc122aa | ||
|
|
9de55e352d | ||
|
|
2ce8c3afb1 | ||
|
|
6de2b7b1ca | ||
|
|
8085392122 | ||
|
|
3c753970c8 | ||
|
|
8005e7c4ae | ||
|
|
757304437e | ||
|
|
51aa08446d | ||
|
|
9b854e6960 | ||
|
|
e0f9512567 | ||
|
|
23ea24080e | ||
|
|
8dedde454d | ||
|
|
cc2eaf2e05 | ||
|
|
944f6719cf | ||
|
|
c481a7fe5e | ||
|
|
2fc50df26c | ||
|
|
6338cc9142 | ||
|
|
68f2567253 | ||
|
|
7273b157d6 | ||
|
|
7041c947a9 | ||
|
|
018b4b1817 | ||
|
|
2485a028bb | ||
|
|
070c458dc5 | ||
|
|
b3eca78549 | ||
|
|
b1cc3b121b | ||
|
|
b075198040 | ||
|
|
46c106409e | ||
|
|
510ecaee80 | ||
|
|
4adcc7b638 | ||
|
|
d851717b7b | ||
|
|
bc1eeb970b | ||
|
|
54beceb823 | ||
|
|
46e5ea6c5d | ||
|
|
f047cd8833 | ||
|
|
477ea8980b | ||
|
|
d46de25bef | ||
|
|
d0e0e2cf87 | ||
|
|
5416590f9e | ||
|
|
7ca5f74f03 | ||
|
|
82d21e65b2 | ||
|
|
51f979a664 | ||
|
|
054e48579c | ||
|
|
d057374148 | ||
|
|
840816c541 | ||
|
|
736bf98aaa | ||
|
|
5dab8e4018 | ||
|
|
8a48e405fd | ||
|
|
467402e404 | ||
|
|
ff121c3ed1 | ||
|
|
18a64a29cd | ||
|
|
15b4342934 | ||
|
|
6988cf39b2 | ||
|
|
131ed5f254 | ||
|
|
e2da92768c | ||
|
|
542cefafce | ||
|
|
5b69c3d4ec | ||
|
|
4bc5d5eee7 | ||
|
|
f454e038a1 | ||
|
|
9f117c9545 | ||
|
|
7e5775b6f7 | ||
|
|
732d008aa1 | ||
|
|
76d21b4815 | ||
|
|
c7b4846901 | ||
|
|
c183021fd5 | ||
|
|
0a5cf3e6bd | ||
|
|
628721dff4 | ||
|
|
39ac0bf31f | ||
|
|
71d195d4e8 | ||
|
|
8a7e944942 | ||
|
|
d06c781819 | ||
|
|
8ce609d344 | ||
|
|
c43a3b0837 | ||
|
|
ff333d97c2 | ||
|
|
4112bef52c | ||
|
|
409ec5a31a | ||
|
|
af32af36ee | ||
|
|
c94eca7d4e | ||
|
|
10be45ec55 | ||
|
|
e8c9f1fe17 | ||
|
|
556d5164fb | ||
|
|
6dda25324b | ||
|
|
10aba324db | ||
|
|
4921231311 | ||
|
|
1222e8bcf4 | ||
|
|
d2f603b582 | ||
|
|
3f82795c18 | ||
|
|
190a66ad5e | ||
|
|
40dc2b12ad | ||
|
|
2bffbc2095 | ||
|
|
ab5df35c3f | ||
|
|
816c83d68f | ||
|
|
34f544942f | ||
|
|
9adaf6515b | ||
|
|
0bbe650265 | ||
|
|
6b1e5b1ad4 | ||
|
|
bed069e91c | ||
|
|
3498da4130 | ||
|
|
c0835c04a3 | ||
|
|
b154774e18 | ||
|
|
212bf87508 | ||
|
|
88dd1beb82 |
@@ -5,10 +5,14 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
# The full check matrix runs nightly; pushes only gate on the deploy policy suite.
|
||||||
|
schedule:
|
||||||
|
- cron: '0 9 * * *'
|
||||||
|
|
||||||
# Do not spend a full build on obsolete commits when pushes arrive quickly.
|
# Do not spend a full build on obsolete commits when pushes arrive quickly. Nightly runs
|
||||||
|
# use their own group so a push does not cancel them.
|
||||||
concurrency:
|
concurrency:
|
||||||
group: foundation-${{ gitea.ref || github.ref }}
|
group: foundation-${{ github.event_name }}-${{ gitea.ref || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -49,6 +53,12 @@ jobs:
|
|||||||
CHECK_SUITE: ${{ matrix.suite }}
|
CHECK_SUITE: ${{ matrix.suite }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
|
# Gameplay iteration (2026-10-21): a push publishes images after the deploy policy
|
||||||
|
# suite alone. The full matrix runs nightly, on pull requests and on dispatch.
|
||||||
|
if [ "$CI_EVENT" = push ] && [ "$CHECK_SUITE" != deploy ]; then
|
||||||
|
echo "Push build: $CHECK_SUITE runs nightly or on dispatch; gate skipped."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
# The selector's own regression runs first, so a broken selector cannot
|
# The selector's own regression runs first, so a broken selector cannot
|
||||||
# silently skip the suites.
|
# silently skip the suites.
|
||||||
if [ "$CHECK_SUITE" = deploy ]; then bash tools/ci/ci-paths-check.sh; fi
|
if [ "$CHECK_SUITE" = deploy ]; then bash tools/ci/ci-paths-check.sh; fi
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ limits in docs/engineering/VALIDATION.md. Preserve uncommitted work by others.
|
|||||||
|
|
||||||
After each completed and validated gate segment, commit its scoped changes and push
|
After each completed and validated gate segment, commit its scoped changes and push
|
||||||
to the configured Git remote. Preserve unrelated untracked work; never stage secrets.
|
to the configured Git remote. Preserve unrelated untracked work; never stage secrets.
|
||||||
Immediately before each push, refresh REGION_SESSION_WINDOW in
|
The dev session window lives in SQL and is opened from the admin portal (ADR-0087
|
||||||
deploy/kubernetes/region/dev-session-route/listener.yaml with a unique activation
|
amendment of 2026-10-27); Git carries no window. Do not deploy or claim live
|
||||||
and absolute UTC expiry four hours ahead (ADR-0087). Include it in that push;
|
reachability from a Git update alone.
|
||||||
do not deploy or claim live reachability from a Git update alone.
|
|
||||||
|
|||||||
+96
-3
@@ -75,7 +75,13 @@ evo_owned_target(evo_accounting)
|
|||||||
add_library(evo_biology STATIC
|
add_library(evo_biology STATIC
|
||||||
src/biology/genome.cpp src/biology/development.cpp src/biology/metabolism.cpp
|
src/biology/genome.cpp src/biology/development.cpp src/biology/metabolism.cpp
|
||||||
src/biology/mutation.cpp src/biology/lineage.cpp src/biology/founder.cpp
|
src/biology/mutation.cpp src/biology/lineage.cpp src/biology/founder.cpp
|
||||||
src/biology/cellular_motion.cpp src/biology/cellular_uptake.cpp
|
src/biology/cellular_motion.cpp src/biology/cellular_kinematics.cpp
|
||||||
|
src/biology/cellular_tuning.cpp src/biology/cellular_revamp_tuning.cpp
|
||||||
|
src/biology/cellular_burn.cpp src/biology/cellular_catalog.cpp
|
||||||
|
src/biology/cellular_triggers.cpp src/biology/cellular_offers.cpp
|
||||||
|
src/biology/cellular_currents.cpp
|
||||||
|
src/biology/cellular_deposit_motion.cpp
|
||||||
|
src/biology/cellular_uptake.cpp
|
||||||
src/biology/cellular_habitat.cpp src/biology/cellular_step.cpp
|
src/biology/cellular_habitat.cpp src/biology/cellular_step.cpp
|
||||||
src/biology/cellular_region_step.cpp src/biology/budding.cpp)
|
src/biology/cellular_region_step.cpp src/biology/budding.cpp)
|
||||||
add_library(evo::biology ALIAS evo_biology)
|
add_library(evo::biology ALIAS evo_biology)
|
||||||
@@ -96,7 +102,8 @@ add_library(evo_lifecycle STATIC src/server/lifecycle/primitive_lives.cpp
|
|||||||
src/server/lifecycle/cellular_population_codec.cpp src/server/lifecycle/cellular_population_policy.cpp
|
src/server/lifecycle/cellular_population_codec.cpp src/server/lifecycle/cellular_population_policy.cpp
|
||||||
src/server/lifecycle/cellular_schedule.cpp src/server/lifecycle/cellular_population_batch.cpp
|
src/server/lifecycle/cellular_schedule.cpp src/server/lifecycle/cellular_population_batch.cpp
|
||||||
src/server/lifecycle/cellular_environment.cpp src/server/lifecycle/cellular_environment_batch.cpp
|
src/server/lifecycle/cellular_environment.cpp src/server/lifecycle/cellular_environment_batch.cpp
|
||||||
src/server/lifecycle/cellular_light.cpp)
|
src/server/lifecycle/cellular_light.cpp src/server/lifecycle/cellular_liquid.cpp
|
||||||
|
src/server/lifecycle/cellular_revamp.cpp src/server/lifecycle/cellular_admin_view.cpp)
|
||||||
add_library(evo::lifecycle ALIAS evo_lifecycle)
|
add_library(evo::lifecycle ALIAS evo_lifecycle)
|
||||||
target_link_libraries(evo_lifecycle PUBLIC evo::biology evo::world)
|
target_link_libraries(evo_lifecycle PUBLIC evo::biology evo::world)
|
||||||
evo_owned_target(evo_lifecycle)
|
evo_owned_target(evo_lifecycle)
|
||||||
@@ -304,6 +311,16 @@ if(EVO_BUILD_POSTGRES)
|
|||||||
add_executable(evo-grant-broker apps/evo-grant-broker/main.cpp)
|
add_executable(evo-grant-broker apps/evo-grant-broker/main.cpp)
|
||||||
target_link_libraries(evo-grant-broker PRIVATE evo_grant_broker)
|
target_link_libraries(evo-grant-broker PRIVATE evo_grant_broker)
|
||||||
evo_owned_target(evo-grant-broker)
|
evo_owned_target(evo-grant-broker)
|
||||||
|
# ADR-0182 read-only admin API and portal host (schema v61).
|
||||||
|
# Section 15: its HTTPS client to Gitea and Argo CD (OpenSSL libssl) and the region switch.
|
||||||
|
find_package(OpenSSL 3 REQUIRED COMPONENTS Crypto SSL)
|
||||||
|
add_library(evo_admin_api STATIC src/server/admin/admin_api.cpp
|
||||||
|
src/server/admin/https_client.cpp src/server/admin/region_switch.cpp)
|
||||||
|
target_link_libraries(evo_admin_api PUBLIC evo_grant_broker PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
evo_owned_target(evo_admin_api)
|
||||||
|
add_executable(evo-admin-api apps/evo-admin-api/main.cpp)
|
||||||
|
target_link_libraries(evo-admin-api PRIVATE evo_admin_api)
|
||||||
|
evo_owned_target(evo-admin-api)
|
||||||
endif()
|
endif()
|
||||||
# M7.9 clone and history audit tool (ADR-0067).
|
# M7.9 clone and history audit tool (ADR-0067).
|
||||||
add_executable(evo-world-clone apps/evo-world-clone/main.cpp)
|
add_executable(evo-world-clone apps/evo-world-clone/main.cpp)
|
||||||
@@ -330,7 +347,7 @@ if(EVO_BUILD_POSTGRES)
|
|||||||
target_sources(evo-postgres-tests PRIVATE tests/region_session_tests.cpp
|
target_sources(evo-postgres-tests PRIVATE tests/region_session_tests.cpp
|
||||||
tests/grant_broker_tests.cpp)
|
tests/grant_broker_tests.cpp)
|
||||||
target_link_libraries(evo-postgres-tests PRIVATE evo_network_session evo_control_ledger_postgres
|
target_link_libraries(evo-postgres-tests PRIVATE evo_network_session evo_control_ledger_postgres
|
||||||
evo_grant_broker OpenSSL::Crypto)
|
evo_grant_broker evo_admin_api OpenSSL::Crypto)
|
||||||
target_compile_definitions(evo-postgres-tests PRIVATE EVO_POSTGRES_SESSIONS=1)
|
target_compile_definitions(evo-postgres-tests PRIVATE EVO_POSTGRES_SESSIONS=1)
|
||||||
endif()
|
endif()
|
||||||
if(EVO_BUILD_QUIC)
|
if(EVO_BUILD_QUIC)
|
||||||
@@ -480,6 +497,65 @@ if(BUILD_TESTING)
|
|||||||
evo_owned_target(evo-cellular-motion-tests)
|
evo_owned_target(evo-cellular-motion-tests)
|
||||||
add_test(NAME cellular-motion-contracts COMMAND evo-cellular-motion-tests)
|
add_test(NAME cellular-motion-contracts COMMAND evo-cellular-motion-tests)
|
||||||
set_tests_properties(cellular-motion-contracts PROPERTIES TIMEOUT 60)
|
set_tests_properties(cellular-motion-contracts PROPERTIES TIMEOUT 60)
|
||||||
|
add_executable(evo-cellular-kinematics-tests tests/cellular_kinematics_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-kinematics-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-kinematics-tests)
|
||||||
|
add_test(NAME cellular-kinematics-contracts COMMAND evo-cellular-kinematics-tests)
|
||||||
|
set_tests_properties(cellular-kinematics-contracts PROPERTIES TIMEOUT 60)
|
||||||
|
add_executable(evo-cellular-tuning-tests tests/cellular_tuning_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-tuning-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-tuning-tests)
|
||||||
|
# The DEV tuning file is absent from native CI images, which copy no deploy/ tree.
|
||||||
|
set(evo_dev_tuning "${CMAKE_CURRENT_SOURCE_DIR}/deploy/kubernetes/region/dev/tuning/cellular.tuning")
|
||||||
|
if(EXISTS "${evo_dev_tuning}")
|
||||||
|
add_test(NAME cellular-tuning-contracts COMMAND evo-cellular-tuning-tests "${evo_dev_tuning}")
|
||||||
|
else()
|
||||||
|
add_test(NAME cellular-tuning-contracts COMMAND evo-cellular-tuning-tests)
|
||||||
|
endif()
|
||||||
|
add_executable(evo-cellular-revamp-step-tests tests/cellular_revamp_step_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-revamp-step-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-revamp-step-tests)
|
||||||
|
add_test(NAME cellular-revamp-step-contracts COMMAND evo-cellular-revamp-step-tests)
|
||||||
|
add_executable(evo-cellular-offers-tests tests/cellular_offers_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-offers-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-offers-tests)
|
||||||
|
add_test(NAME cellular-offers-contracts COMMAND evo-cellular-offers-tests)
|
||||||
|
add_executable(evo-cellular-catalog-tests tests/cellular_catalog_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-catalog-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-catalog-tests)
|
||||||
|
add_test(NAME cellular-catalog-contracts COMMAND evo-cellular-catalog-tests)
|
||||||
|
add_executable(evo-cellular-burn-tests tests/cellular_burn_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-burn-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-burn-tests)
|
||||||
|
add_test(NAME cellular-burn-contracts COMMAND evo-cellular-burn-tests)
|
||||||
|
add_executable(evo-cellular-revamp-tuning-tests tests/cellular_revamp_tuning_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-revamp-tuning-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-revamp-tuning-tests)
|
||||||
|
set(evo_dev_revamp_tuning
|
||||||
|
"${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}"
|
||||||
|
"${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()
|
||||||
|
set_tests_properties(cellular-tuning-contracts PROPERTIES TIMEOUT 60)
|
||||||
|
add_executable(evo-cellular-currents-tests tests/cellular_currents_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-currents-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-currents-tests)
|
||||||
|
add_test(NAME cellular-currents-contracts COMMAND evo-cellular-currents-tests)
|
||||||
|
set_tests_properties(cellular-currents-contracts PROPERTIES TIMEOUT 120)
|
||||||
|
add_executable(evo-cellular-deposit-motion-tests tests/cellular_deposit_motion_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-deposit-motion-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-deposit-motion-tests)
|
||||||
|
add_test(NAME cellular-deposit-motion-contracts COMMAND evo-cellular-deposit-motion-tests)
|
||||||
|
set_tests_properties(cellular-deposit-motion-contracts PROPERTIES TIMEOUT 120)
|
||||||
|
add_executable(evo-cellular-liquid-step-tests tests/cellular_liquid_step_tests.cpp)
|
||||||
|
target_link_libraries(evo-cellular-liquid-step-tests PRIVATE evo::biology)
|
||||||
|
evo_owned_target(evo-cellular-liquid-step-tests)
|
||||||
|
add_test(NAME cellular-liquid-step-contracts COMMAND evo-cellular-liquid-step-tests)
|
||||||
|
set_tests_properties(cellular-liquid-step-contracts PROPERTIES TIMEOUT 60)
|
||||||
add_executable(evo-cellular-uptake-tests tests/cellular_uptake_tests.cpp)
|
add_executable(evo-cellular-uptake-tests tests/cellular_uptake_tests.cpp)
|
||||||
target_link_libraries(evo-cellular-uptake-tests PRIVATE evo::biology)
|
target_link_libraries(evo-cellular-uptake-tests PRIVATE evo::biology)
|
||||||
evo_owned_target(evo-cellular-uptake-tests)
|
evo_owned_target(evo-cellular-uptake-tests)
|
||||||
@@ -709,6 +785,23 @@ if(BUILD_TESTING)
|
|||||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
|
||||||
set_tests_properties(cellular-retained-plan-population cellular-retained-plan-population-restart
|
set_tests_properties(cellular-retained-plan-population cellular-retained-plan-population-restart
|
||||||
PROPERTIES TIMEOUT ${evo_cohort_timeout})
|
PROPERTIES TIMEOUT ${evo_cohort_timeout})
|
||||||
|
add_executable(evo-cellular-liquid-owner-tests tests/cellular_liquid_owner_tests.cpp)
|
||||||
|
target_include_directories(evo-cellular-liquid-owner-tests PRIVATE tests)
|
||||||
|
target_link_libraries(evo-cellular-liquid-owner-tests PRIVATE evo::lifecycle)
|
||||||
|
evo_owned_target(evo-cellular-liquid-owner-tests)
|
||||||
|
add_test(NAME cellular-liquid-owner-contracts COMMAND evo-cellular-liquid-owner-tests)
|
||||||
|
set_tests_properties(cellular-liquid-owner-contracts PROPERTIES TIMEOUT 300)
|
||||||
|
add_executable(evo-cellular-revamp-owner-tests tests/cellular_revamp_owner_tests.cpp)
|
||||||
|
target_include_directories(evo-cellular-revamp-owner-tests PRIVATE tests)
|
||||||
|
target_link_libraries(evo-cellular-revamp-owner-tests PRIVATE evo::lifecycle)
|
||||||
|
evo_owned_target(evo-cellular-revamp-owner-tests)
|
||||||
|
add_test(NAME cellular-revamp-owner-contracts COMMAND evo-cellular-revamp-owner-tests)
|
||||||
|
set_tests_properties(cellular-revamp-owner-contracts PROPERTIES TIMEOUT 300)
|
||||||
|
add_executable(evo-cellular-admin-view-tests tests/cellular_admin_view_tests.cpp)
|
||||||
|
target_include_directories(evo-cellular-admin-view-tests PRIVATE tests)
|
||||||
|
target_link_libraries(evo-cellular-admin-view-tests PRIVATE evo::lifecycle)
|
||||||
|
evo_owned_target(evo-cellular-admin-view-tests)
|
||||||
|
add_test(NAME cellular-admin-view-contracts COMMAND evo-cellular-admin-view-tests)
|
||||||
add_executable(evo-photosynthesis-tests tests/photosynthesis_tests.cpp)
|
add_executable(evo-photosynthesis-tests tests/photosynthesis_tests.cpp)
|
||||||
target_link_libraries(evo-photosynthesis-tests PRIVATE evo::lifecycle)
|
target_link_libraries(evo-photosynthesis-tests PRIVATE evo::lifecycle)
|
||||||
evo_owned_target(evo-photosynthesis-tests)
|
evo_owned_target(evo-photosynthesis-tests)
|
||||||
|
|||||||
@@ -0,0 +1,660 @@
|
|||||||
|
# Cellular region changes
|
||||||
|
|
||||||
|
Status: discussion draft, 2026-10-21. Companion to
|
||||||
|
[Cellular_mutation_draft.md](Cellular_mutation_draft.md) and
|
||||||
|
[Cellular_movement_draft.md](Cellular_movement_draft.md). This document proposes
|
||||||
|
region changes needed for liquid movement, circulating food, and meaningful
|
||||||
|
thermal adaptations. It changes no runtime rules, public APIs, schema versions,
|
||||||
|
live worlds, or milestone status. No commit, push, or deployment is authorized
|
||||||
|
while the maintainer reviews these drafts.
|
||||||
|
|
||||||
|
## Purpose and scope
|
||||||
|
|
||||||
|
Make the early cellular habitat a readable, interactive liquid environment.
|
||||||
|
Regions should support useful travel, feeding routes, reproduction, and early
|
||||||
|
colonies rather than rewarding long periods of waiting on a pool.
|
||||||
|
|
||||||
|
The discussion establishes the following design direction:
|
||||||
|
|
||||||
|
- Cells propel themselves through liquid; food and cells also respond to flow.
|
||||||
|
- Quiet areas and stronger currents coexist. Main currents can circulate around
|
||||||
|
a region instead of carrying everything into one boundary.
|
||||||
|
- Generate each region procedurally with 2-n currents, each with its own direction
|
||||||
|
and speed. Currents can intersect; the maximum count and speed ranges need trials.
|
||||||
|
- Movement needs acceleration, passive deceleration, active braking, and turning.
|
||||||
|
- Generate a regional thermal map. The cell has its own temperature, and the UI
|
||||||
|
provides a compass, temperature gauge, and heat-map-style environmental colors.
|
||||||
|
- Thermal mismatch increases survival E use exponentially; cells can acclimate or
|
||||||
|
evolve cold, heat, and overall thermal adaptations. Extreme freezing/boiling
|
||||||
|
exposure can cause immediate death. Current cell temperature, preferred cell
|
||||||
|
temperature, and environmental temperature all contribute; the equation and
|
||||||
|
numeric thresholds remain open for balancing.
|
||||||
|
- Passing cells disturb nearby food bubbles in their direction of travel, with
|
||||||
|
distance falloff and decay of the induced drift.
|
||||||
|
- Ordinary active founders should be able to fund their first birth in about
|
||||||
|
three minutes. The intended solitary-cell stage is roughly 30-60 minutes,
|
||||||
|
without making a multicellular transition mandatory for every strategy.
|
||||||
|
|
||||||
|
Specific field layouts, temperatures, response curves, costs, representations,
|
||||||
|
phase ordering, and implementation stages below remain **proposals**. This is a
|
||||||
|
gameplay model to tune for useful choices, not a requirement for full fluid or
|
||||||
|
biochemical simulation. Presentation can be expressive without expanding the
|
||||||
|
authoritative simulation beyond what gameplay needs.
|
||||||
|
|
||||||
|
The scope is cellular 2D habitat behavior and its environmental ownership. No
|
||||||
|
macroscopic renderer, shared 2D/3D collision model, automatic World0 upgrade,
|
||||||
|
prebuilt wildlife, or new third-party dependency is introduced.
|
||||||
|
|
||||||
|
### Maintainer responses to the original ten questions
|
||||||
|
|
||||||
|
Recorded from the region review on 2026-10-21. These establish draft gameplay
|
||||||
|
direction, not runtime admission or a replacement for existing architecture.
|
||||||
|
|
||||||
|
| Original question | Recorded direction | Remaining scope |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 1. Motion/current values | Trial and error; include currents of different speeds. | Tune founder handling and current ranges in playtests. |
|
||||||
|
| 2. Current generation | Procedural regions with 2-n currents; determine direction per current; intersections allowed. | Bounded count, generation, intersection composition, and representation. |
|
||||||
|
| 3. Boundaries/contact | N/A for this gameplay discussion. | Retain technical ownership/contact constraints; do not reopen as a required player-facing feature. |
|
||||||
|
| 4. Thermal model/UI | Procedural thermal map; compass and temperature gauge; cells have an actual temperature and a preferred temperature. | Field accounting/response and readable presentation of all three temperatures. |
|
||||||
|
| 5. Thermal effects | Current cell, preferred cell, and environmental temperatures all matter. Drastic changes require more E; mismatch from preference keeps costs elevated after adjustment. Mutations modify cold, heat, or overall handling; extreme exposure can kill immediately. | Balance the combined exponential response, acclimation rates, protection costs, and death thresholds. |
|
||||||
|
| 6. Flow and speed | With the flow is faster; against it is slower; outside flow is baseline. | Relative-vector behavior, braking/reversing controls, and numeric tuning. |
|
||||||
|
| 7. Visible cues | Cellular mechanics have visual cues; terrain resembles a thermal heat map. | Readable palette, compass/gauge details, and local perception integration. |
|
||||||
|
| 8. Offline/lifecycle | Logout takes effect after a delay, then the cell is anchored, protected from engulfment, and frozen. See the follow-up decisions below. | Delay duration and resume behavior. |
|
||||||
|
| 9. Colony roles | Requires playtesting. | Viable support roles and whether distinct propulsion adaptations add value. |
|
||||||
|
| 10. Unattended feeding | Lower priority; expected to be slower and risky because other cells can engulf the player. | Verify in playtests; no separate anti-AFK layer proposed. |
|
||||||
|
|
||||||
|
### Maintainer follow-up decisions
|
||||||
|
|
||||||
|
Recorded 2026-10-21 and documented as accepted direction in
|
||||||
|
[ADR-0177](docs/adr/0177-cellular-regions-world-linkage.md), which amends
|
||||||
|
ADR-0172 and ADR-0173 for new cellular rules.
|
||||||
|
|
||||||
|
| Topic | Decision | Still open |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Current energy | Currents are a fixed environmental condition. No mechanical energy accounting; drifting never credits usable E. | None for playtests. |
|
||||||
|
| Thermal backing | A static maintained thermal map, not owned thermal energy. | Owned thermal energy only if gameplay later needs changing temperatures. |
|
||||||
|
| Versions and worlds | New rules start in new, disposable DEV worlds; no migration of existing DEV worlds. | None. |
|
||||||
|
| Habitat size and world link | A region is linked to an area of its world, not to one voxel. Its thermal map is that area's world thermal map scaled down. | Mapping scale and region dimensions. |
|
||||||
|
| Region capacity | Regions do not grow. Each has a hard organism cap; the world adds regions. Births are refused at the cap. Engulfment and death reopen slots. Operators can cull wildlife through an admin interface when a capped region has had no players for extended days. | Cap value; equation for adding a region to the world versus attaching it to a new world. |
|
||||||
|
| Region choice | A fresh cell is offered a choice of region when it begins. | Selection presentation. |
|
||||||
|
| Emergence exchange | Matter that emerges is lost to the cellular region (a recorded export). The organism enters the world scaled to world values. | Conversion scale, after regions per world and matter per region are known. |
|
||||||
|
| Emergence target | Rank several candidates in the region's mapped world area closest to the preferred temperature with needed nutrients; choose one at random. Finite resources self-penalize crowding. | Candidate count and ranking weights. |
|
||||||
|
| Group emergence | The emerging organism chooses individual or bulk. Bulk joins a selection queue; organisms emerging together with the same or close biology share one target pick. | Queue timing and similarity threshold. |
|
||||||
|
| Logout | A logout delay keeps the cell in play and vulnerable; logging out while about to be engulfed does not save it. Afterwards the cell is anchored, cannot be engulfed, is not moved by flow, and its metabolism and thermal response stop. | Delay duration. |
|
||||||
|
|
||||||
|
## Existing architecture and the changes needed
|
||||||
|
|
||||||
|
Read this proposal against:
|
||||||
|
|
||||||
|
- [Project vision](docs/PROJECT_VISION.md).
|
||||||
|
- [World architecture](docs/architecture/WORLD_ARCHITECTURE.md).
|
||||||
|
- [Environmental units and compartments](docs/world/ENVIRONMENTAL_UNITS.md).
|
||||||
|
- [Existing optional environmental fields](docs/world/ENVIRONMENTAL_FIELDS.md).
|
||||||
|
- [Energy and matter accounting](docs/biology/ENERGY_MODEL.md).
|
||||||
|
- [Bounded cellular motion trial](docs/adr/0102-cellular-spatial-trial.md).
|
||||||
|
- [Open energy, food bubbles, and pools proposal](docs/adr/0136-open-energy-and-scattered-nutrients.md).
|
||||||
|
- [Cellular environmental ownership](docs/adr/0172-cellular-environment-ownership.md).
|
||||||
|
- [Joint environmental batch](docs/adr/0173-cellular-environment-batch.md).
|
||||||
|
- [Local environmental scheduling](docs/architecture/ENVIRONMENTAL_SCHEDULING.md).
|
||||||
|
- [Photosynthesis producers](docs/adr/0175-photosynthesis-producers.md).
|
||||||
|
|
||||||
|
| Existing boundary | Required extension or decision |
|
||||||
|
| --- | --- |
|
||||||
|
| The spatial trial resolves phenotype-limited movement intentions and contact. | Add explicit velocity/response semantics for propulsion, turning, slowing, currents, and anchoring. Do not reinterpret old movement records. |
|
||||||
|
| The cellular environment owns tagged water, dissolved nutrients, and nested organic inventories. | Add currents and the thermal map as seeded environmental conditions under the same spatial authority. They are not stock and not a second resource store. |
|
||||||
|
| Waste heat and radiative export have accounting meanings. | Keep them unchanged. The thermal map is a maintained condition derived from the world, not accumulated waste heat. Specify the biological response. |
|
||||||
|
| The habitat sits inside one environmental voxel (ADR-0172). | Link the region to a world area instead, with a hard organism cap (ADR-0177). |
|
||||||
|
| Optional M6 fields and processes are scoped experiments. | Their existence does not automatically provide live cellular flow, temperature, feeding conversions, or damage. |
|
||||||
|
| Existing environmental intervals have explicit tick and replay boundaries. | Any new coupled process needs its own documented ordering, bounds, persistence, and restored continuation. |
|
||||||
|
| Presentation consumes immutable environmental/biological views. | Publish readable flow and temperature information without moving simulation authority into the client. |
|
||||||
|
|
||||||
|
These are design gaps to resolve before implementation, not permission to silently
|
||||||
|
extend an accepted ADR. New motion, thermal, and durability behavior need scoped
|
||||||
|
decisions and explicit versions. New rules start in new DEV worlds; existing DEV
|
||||||
|
worlds are disposable and are not migrated.
|
||||||
|
|
||||||
|
## Region layout and geometry
|
||||||
|
|
||||||
|
Keep the distinction between a logical region, its cellular habitat, environmental
|
||||||
|
field resolution, and any underlying world voxel/chunk. A current does not need
|
||||||
|
to follow server partitions, and a visual river-like path is not a new ownership
|
||||||
|
boundary or a solid corridor.
|
||||||
|
|
||||||
|
The habitat remains a bounded 2D area with a declared effective depth. Changing its
|
||||||
|
area, depth, or sampling resolution does not create water, nutrients, energy, or
|
||||||
|
extra organisms. Under ADR-0177 the habitat is no longer tied to one world voxel:
|
||||||
|
it is linked to an area of its world and can be as large as currents, quiet
|
||||||
|
pockets, and eddies need. Its size grows only by design, not with population; a
|
||||||
|
hard organism cap bounds each region and the world adds regions instead.
|
||||||
|
|
||||||
|
Proposed features within one habitat:
|
||||||
|
|
||||||
|
| Feature | Gameplay purpose | Design constraint |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Quiet pockets | Learn steering, collect initial food, and reproduce. | Still provide useful exits and resources; do not become the universally best AFK location. |
|
||||||
|
| Main circulating route | Carry food and provide a recognizable travel route. | Allow crossing/exiting; avoid a forced one-way ride. |
|
||||||
|
| Rejoining branches | Offer shortcuts, interception routes, and different risks. | Communicate where routes lead within perception limits. |
|
||||||
|
| Local eddies | Create recurring encounters and food gathering areas. | Do not trap all food permanently or manufacture replenishment. |
|
||||||
|
| Anchoring | Support anchored and stationary colony strategies. | The 007 anchor is player-triggered and holds where it hits; no prepared surface is needed. |
|
||||||
|
| Thermal gradients | Make habitat choice and thermal specialization useful. | Readable transitions and reachable alternatives; no hidden lethal line at a field boundary. |
|
||||||
|
|
||||||
|
Do not make every quiet area cold, every fast current hot, or every rich food site
|
||||||
|
hazardous. Independent combinations allow several viable strategies. Reproduction
|
||||||
|
needs enough physical space for resulting organisms, including when the parent
|
||||||
|
and offspring are being carried by a current.
|
||||||
|
|
||||||
|
## Flows
|
||||||
|
|
||||||
|
### Local velocity and circulation
|
||||||
|
|
||||||
|
Define local flow as a velocity vector sampled at an authoritative position and
|
||||||
|
tick, in the same spatial frame and compatible units as cell movement. Distinguish:
|
||||||
|
|
||||||
|
`world velocity = local liquid velocity + swimming velocity relative to liquid`
|
||||||
|
|
||||||
|
This decomposition does not mean adding current repeatedly as unlimited swimming
|
||||||
|
acceleration. Coupling to changing flow, response time, sampling, interpolation,
|
||||||
|
rounding, and motion limits need a defined model. Ordinary cells and loose bubbles
|
||||||
|
already drift; a mutation must add something beyond that baseline to be useful.
|
||||||
|
|
||||||
|
Generate 2-n current routes/areas per region from explicit procedural configuration
|
||||||
|
and seed, with an individually determined direction and speed for each. Evaluate
|
||||||
|
several speeds through trial and error rather than selecting one universal current
|
||||||
|
speed. The maximum n, route width, speed distribution, and quiet-area coverage remain
|
||||||
|
tunable and bounded before implementation. Seeded generation does not grant infinite
|
||||||
|
water, nutrients, or energy.
|
||||||
|
|
||||||
|
Currents may intersect. Cells and food must experience one consistent resulting
|
||||||
|
local flow at an intersection, not whichever current happens to be processed last.
|
||||||
|
Vector composition with bounded magnitudes is a candidate, not a selected rule;
|
||||||
|
opposing cancellation, crossing deflection, and limit handling need trials.
|
||||||
|
Use the same field/sample semantics for affected objects, subject to their explicit
|
||||||
|
response and attachment rules.
|
||||||
|
|
||||||
|
A bounded seeded velocity field is a possible representation; full computational
|
||||||
|
fluid dynamics is not required. Keep transitions readable and compatible with
|
||||||
|
boundaries. A static field means unchanging flow directions/strengths, not stationary
|
||||||
|
water. Whether currents later vary over time remains open and must preserve replay.
|
||||||
|
|
||||||
|
Main routes can loop inside the habitat, with slow pockets and rejoining branches.
|
||||||
|
This is a proposed initial layout, not a requirement that every future region be
|
||||||
|
hydrologically closed. There is no edge wrap or teleport returning a bubble to
|
||||||
|
the opposite side. Avoid outward flow that is merely clamped at a wall, producing
|
||||||
|
an artificial pile of every cell and food item.
|
||||||
|
|
||||||
|
At solid boundaries, the chosen flow/motion representation needs consistent
|
||||||
|
nonpenetration and no unintended stock loss. Future open boundaries need actual
|
||||||
|
handoff of organisms and material, not despawn-at-source/spawn-at-destination.
|
||||||
|
Cross-region flow belongs to a later explicitly qualified ownership contract.
|
||||||
|
|
||||||
|
### Propulsion and slowing
|
||||||
|
|
||||||
|
At the same supported propulsion output and body state, travelling with the current
|
||||||
|
increases progress through the region; travelling against it reduces progress.
|
||||||
|
Outside a current, ambient flow is zero and ordinary swimming is at the cell's
|
||||||
|
baseline for those conditions. Acceleration/braking transients still apply. Cross-flow
|
||||||
|
deflects world movement according to the eventual vector model; this is not a
|
||||||
|
universal scalar speed bonus. A sufficiently strong opposing current can prevent
|
||||||
|
upstream progress without reducing the cell's swimming capacity relative to water.
|
||||||
|
|
||||||
|
Do not separately add a matching speed buff/debuff after applying flow. Equal
|
||||||
|
output may have the same propulsion E/time while the time and E needed to reach a
|
||||||
|
fixed world destination differ. Station keeping still requires funded opposing work.
|
||||||
|
|
||||||
|
| Action/state | Required behavior | Cost meaning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Propelling | Accelerate relative to liquid within available output and steering limits. | Fund applied output; do not charge maximum propulsion at every nonzero speed. |
|
||||||
|
| Releasing propulsion | Lose relative swimming speed through passive resistance while continuing to drift. | No active propulsion expenditure; dissipation is not usable cellular energy. |
|
||||||
|
| Active braking/reversing | Use opposing propulsion to slow or reverse faster. | Pay for actual opposing output. |
|
||||||
|
| Station keeping | Swim against flow to hold a position in the region. | Continuous funded work, not the default meaning of no input. |
|
||||||
|
| Anchored (007) | The player drops the anchor; the cell holds at the point it hits. | Construction, drop/release, load, and holding-capacity rules must be explicit. |
|
||||||
|
| Attached colony | Combine useful propulsion with total arrangement load/resistance. | No automatic speed multiplier from member count; no duplicate charge for shared work. |
|
||||||
|
|
||||||
|
Use the [movement draft's](Cellular_movement_draft.md) calculated profile:
|
||||||
|
propulsion and steering machinery, body shape, mass, and resistance produce speed, acceleration, passive
|
||||||
|
slowing, active braking, turning, and operating cost. Founder reference displays
|
||||||
|
can read 100% under fixed reference conditions; actual values still need tuning.
|
||||||
|
Zero/absent capabilities are not 100%, and account age confers no movement bonus.
|
||||||
|
|
||||||
|
Exact control behavior remains open: automatic versus deliberate braking,
|
||||||
|
reverse-thrust controls, how heading changes at different speeds, and how an
|
||||||
|
energy-starved cell passively drifts. Start with responsive founder handling;
|
||||||
|
extended uncontrollable coasting should not be required to learn the game.
|
||||||
|
|
||||||
|
### Environmental driving and energy
|
||||||
|
|
||||||
|
Decided: currents are a fixed environmental condition, like incident light. They
|
||||||
|
are not stock and carry no mechanical energy accounting; no driving source,
|
||||||
|
entitlement, or work/dissipation ledger is needed. Forces against an anchor or
|
||||||
|
attached body are likewise mechanical rules, not energy transfers.
|
||||||
|
|
||||||
|
Drifting never credits a cell's usable E reserve, and no process harvests flow
|
||||||
|
energy. Propulsion expenditure still transfers reserve E to heat as today.
|
||||||
|
|
||||||
|
## Food and material transport
|
||||||
|
|
||||||
|
| Material/object | Proposed behavior | Accounting requirement |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Loose nutrient/energy bubbles | Move with local flow under a stated response model; retain identity and finite stock. | Movement changes position, not amount or channel. |
|
||||||
|
| Finite resource pools | Can remain fixed where explicitly declared. | No replenishment from an animation or passing current; any resupply needs a source debit/import. |
|
||||||
|
| Living cells | Drift plus their funded relative swimming, subject to contact/attachment. | Existing bodies/reserves remain the same owned inventory while moving. |
|
||||||
|
| Corpses/detritus | Use explicit mobility/attachment rules, or the supported corpse-to-bubble process. | Conversion occurs once; no spendable corpse and duplicate bubbles. |
|
||||||
|
| Dissolved compartments | Only move/convert through defined conservative processes. | Bubble advection does not automatically implement dissolved transport or make dissolved stocks edible. |
|
||||||
|
| Visual particles/trails | Illustrate flow without being collectible resource objects. | Must not appear as edible stock or create a second food system. |
|
||||||
|
|
||||||
|
### Drift caused by passing cells
|
||||||
|
|
||||||
|
In addition to ambient currents, a passing cell disturbs nearby food bubbles so
|
||||||
|
they drift somewhat in the direction the cell was travelling. This is part of
|
||||||
|
the recorded gameplay direction, not just a client animation. The influence
|
||||||
|
decreases with distance from the passing cell, and the extra bubble drift speed
|
||||||
|
falls off over time, returning toward ordinary local-current drift.
|
||||||
|
|
||||||
|
Separate base flow from the temporary induced motion:
|
||||||
|
|
||||||
|
`bubble world velocity = ambient flow response + temporary cell-induced drift`
|
||||||
|
|
||||||
|
This is a conceptual decomposition, not a selected numerical solver. Influence
|
||||||
|
radius, near/far falloff, decay time, maximum induced speed, and dependence on cell
|
||||||
|
speed, size, or propulsion output need playtesting. Specify whether the disturbance
|
||||||
|
uses world travel or swimming relative to water; do not silently settle that choice.
|
||||||
|
Use a bounded deterministic combination when several cells pass the same bubble,
|
||||||
|
without dependence on connection or iteration order.
|
||||||
|
|
||||||
|
The disturbance changes position/motion, not nutrient identity or amount. It can
|
||||||
|
occur outside a main current too. It must not pull distant food through other cells,
|
||||||
|
grant unlimited extra collection range, or stack permanent velocity on every pass.
|
||||||
|
Like currents, it has no energy accounting and is never a source of usable cellular
|
||||||
|
E. Persist or deterministically reconstruct
|
||||||
|
any temporary bubble motion needed for identical restored continuation.
|
||||||
|
|
||||||
|
Equal drift does not make a cell catch a nearby bubble. Players still need useful
|
||||||
|
relative motion or contact. Active play can involve intercepting a cluster,
|
||||||
|
matching its drift while feeding, then exiting toward a quiet reproduction site.
|
||||||
|
Collecting a bubble should not automatically impose a generic speed penalty.
|
||||||
|
|
||||||
|
High flow or propulsion must not skip contact with food or pass through cells.
|
||||||
|
Choose swept contact or bounded motion subdivisions with explicit work limits;
|
||||||
|
do not change the biological tick duration or skip feeding costs to hide tunneling.
|
||||||
|
Contention and transfer order must remain stable and independent of connection
|
||||||
|
order. Collisions, sticking, pushing, and engulfment need their own supported
|
||||||
|
rules rather than one generic "speed through other cells" percentage.
|
||||||
|
|
||||||
|
Decided 2026-10-21: bubbles that touch merge into one bubble holding both
|
||||||
|
inventories, keeping the lower id, with radius from total stock. A tunable size cap
|
||||||
|
stops further merging. Merges resolve in id order. Each update carries a tunable
|
||||||
|
number of moving bubbles, nearest first; the client advances the rest with the
|
||||||
|
shared flow field. See the [implementation plan](Cellular_Region_Movement_Plan.md).
|
||||||
|
|
||||||
|
## Thermal conditions
|
||||||
|
|
||||||
|
### What temperature means
|
||||||
|
|
||||||
|
The selected draft direction is a **procedurally generated thermal map**, plus an
|
||||||
|
actual temperature state for each cell. Use explicit seed/configuration and
|
||||||
|
continuous/readable spatial differences. The map describes local environmental
|
||||||
|
temperature; it is not the cell's own temperature and is not a new edible resource.
|
||||||
|
The UI must expose a compass and temperature gauge for navigation and make thermal
|
||||||
|
differences visible in the habitat rather than rendering flat-color terrain.
|
||||||
|
|
||||||
|
Temperature is an environmental condition, not usable E or an amount of food.
|
||||||
|
The existing heat sink does not by itself define local temperature: we need an
|
||||||
|
explicit thermal reference, heat capacity, spatial ownership, and exchange model.
|
||||||
|
Stored units should follow the repository's dimensional conventions; a Celsius
|
||||||
|
display can be derived for readability. No gameplay temperature values are selected
|
||||||
|
by this draft, and missing thermal state is not zero kelvin or a safe default.
|
||||||
|
|
||||||
|
Decided backing: the region's thermal map is the thermal map of its linked world
|
||||||
|
area, scaled down to the habitat (ADR-0177). It is a static maintained condition,
|
||||||
|
not owned thermal energy, and needs no energy exchange accounting. Owned thermal
|
||||||
|
energy with heat capacity is deferred until gameplay needs temperatures that
|
||||||
|
change, for example colonies warming their surroundings. Waste heat is never
|
||||||
|
recovered into usable cell E.
|
||||||
|
|
||||||
|
### Layout, sources, and transport
|
||||||
|
|
||||||
|
Use broad, readable differences rather than a random checkerboard of lethal cells.
|
||||||
|
A founder-accessible comfortable area can border cooler/warmer opportunities with
|
||||||
|
gradual transitions. Extreme areas should initially be optional routes, not the
|
||||||
|
only source of a nutrient every founder needs to reproduce.
|
||||||
|
|
||||||
|
Because the map is maintained, currents do not carry heat and gradients stay
|
||||||
|
fixed. A warm vent illustration is presentation, not an energy source. Existing
|
||||||
|
radiative exports must not also be counted as heating local liquid.
|
||||||
|
|
||||||
|
Thermal map resolution may differ from flow or food resolution. Sampling,
|
||||||
|
organism footprint overlap, and boundary continuity need explicit semantics.
|
||||||
|
|
||||||
|
### Effects on organisms
|
||||||
|
|
||||||
|
The maintainer clarified that **all three temperatures contribute**, rather than
|
||||||
|
choosing a single reference:
|
||||||
|
|
||||||
|
| Temperature | Meaning | Role in the response |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Environmental temperature | The local liquid temperature experienced by the cell. | Determines current exposure and the conditions the body is adjusting to. |
|
||||||
|
| Current cell temperature | The cell's actual present temperature. | Responds over time; its difference from the environment contributes to the difficulty of handling a transition. |
|
||||||
|
| Preferred cell temperature | The cell's favored operating temperature, distinct from its actual temperature. | Keeps off-preference living more costly even after actual temperature approaches the environment. |
|
||||||
|
|
||||||
|
There are two connected cost behaviors to preserve when choosing an equation:
|
||||||
|
|
||||||
|
- **Transition/handling cost:** drastic changes between the current body state and
|
||||||
|
surrounding temperature require more E to handle. Rapidly entering a very different
|
||||||
|
environment can be especially demanding. This component can diminish as the cell
|
||||||
|
adjusts, depending on its acclimation and mutations.
|
||||||
|
- **Persistent off-preference cost:** settling toward the environmental temperature
|
||||||
|
does not automatically restore baseline. If the resulting conditions remain far
|
||||||
|
from the preferred temperature, survival still costs more than living near preference.
|
||||||
|
|
||||||
|
The overall thermal penalty should increase exponentially with relevant unsupported
|
||||||
|
mismatch, subject to balancing. Do not select an exponent, coefficient, comfort width,
|
||||||
|
or cap simply to fill this draft. Whether the terms add, multiply, share one response
|
||||||
|
curve, or use another relationship remains open. Avoid counting the same sustained
|
||||||
|
stress twice just because both body-to-preference and environment-to-preference
|
||||||
|
differences can describe it.
|
||||||
|
|
||||||
|
Use `survival E/time = baseline survival E/time * thermal multiplier` only as a
|
||||||
|
conceptual placeholder. The multiplier depends on all three temperatures, the cell's
|
||||||
|
acclimation state, and relevant mutations. It approaches 1 when conditions are well
|
||||||
|
handled and near preference; a supported adaptation can reduce or remove extra
|
||||||
|
thermal cost over its useful range. Ordinary movement, construction, and other
|
||||||
|
activity costs remain separate; do not indiscriminately multiply every resource
|
||||||
|
cost by a thermal factor.
|
||||||
|
|
||||||
|
Cells can **acclimate** over time or acquire **mutations** that change how well
|
||||||
|
they handle temperature. Actual temperature adjustment must not automatically
|
||||||
|
overwrite preferred temperature to equal the surroundings. Acclimation is
|
||||||
|
physiological adjustment, distinct from selecting structural offspring adaptations
|
||||||
|
or automatically rewriting the inherited genome. Its range/rate, whether it can
|
||||||
|
shift a preferred operating range within limits, and inheritance behavior need
|
||||||
|
balancing and explicit rules. Neither adjustment nor acclimation instantly erases
|
||||||
|
all extremes.
|
||||||
|
|
||||||
|
Example behavior, without choosing temperatures or coefficients: a cell leaves
|
||||||
|
its preferred environment for a much hotter area. It initially pays a high handling
|
||||||
|
cost. Its actual temperature then rises and its handling cost can decrease, but
|
||||||
|
remaining in that hot area still has an off-preference cost. A heat-adapted descendant
|
||||||
|
can reduce that burden; a cold specialist need not receive the same benefit.
|
||||||
|
|
||||||
|
| State relative to the organism's supported range | Proposed gameplay response | Decision still needed |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Current body and environment near preference | Survival E use approaches ordinary baseline. | Comfort band, baseline calibration, and the combined equation. |
|
||||||
|
| Abrupt transition away from current body temperature | Increased handling E demand while the cell responds. | Response rate, acclimation limits, mutation effects, and how abruptness enters the equation. |
|
||||||
|
| Body adjusted but environment/body still off preference | Extra survival cost persists despite a smaller body/environment difference. | Sustained stress curve and specialist/generalist tolerance. |
|
||||||
|
| Extreme freezing/boiling exposure | Can cause immediate permanent death, including rapid entry into an extreme area. | Organism-specific lethal thresholds and whether ambient or actual cell temperature triggers the event. |
|
||||||
|
|
||||||
|
This explicitly revises the earlier suggestion that thermal boundary crossings
|
||||||
|
should never kill instantly. Extreme areas may be immediately lethal; do not
|
||||||
|
silently grant a universal exposure grace period. Communicate danger before entry
|
||||||
|
through visible thermal cues, the gauge, and navigation. Ordinary gradients and
|
||||||
|
founder routes should remain usable without requiring entry into those extremes.
|
||||||
|
No universal 0/100-degree thresholds are adopted; temperature values and environmental
|
||||||
|
conditions must be explicitly chosen. Body-temperature change, acclimation, exposure,
|
||||||
|
and lethal thresholds are related but distinct. Partial footprint exposure still
|
||||||
|
needs defined treatment.
|
||||||
|
|
||||||
|
Thermal protection must occupy actual tissue or require actual operating resources
|
||||||
|
if shedding it is to save anything. A specialist can give up breadth for better
|
||||||
|
local performance only through a specified response/recipe. The current tolerance
|
||||||
|
parameter must not silently acquire new low/high/optimum meanings under old schemas.
|
||||||
|
|
||||||
|
Provide cold-specific, heat-specific, and overall thermal adaptation options.
|
||||||
|
Heat and cold handling may differ in the same cell. A broader adaptation may handle
|
||||||
|
both well enough to leave no extra thermal penalty across the supported practical
|
||||||
|
range. That does not silently grant immunity to every lethal threshold or eliminate
|
||||||
|
the actual construction/upkeep cost of the adaptation. Specify any such protection
|
||||||
|
explicitly; useful traits still need the catalog's meaningful tradeoffs.
|
||||||
|
The exact effects on handling cost, persistent cost, acclimation, preferred range,
|
||||||
|
and lethal limits need later review against the balanced equation. Do not revise
|
||||||
|
the 150 mutation entries incidentally while the maintainer reviews other groups.
|
||||||
|
|
||||||
|
Do not apply new temperature effects to food spoilage, nutrient conversion,
|
||||||
|
reproduction, mutation rates, or photosynthesis merely because a field now exists.
|
||||||
|
Each coupling needs a defined benefit, drawback, accounting treatment, and version.
|
||||||
|
|
||||||
|
## Mutation opportunities supported by the region
|
||||||
|
|
||||||
|
The mutation catalog remains the source for individual tradeoffs; this document
|
||||||
|
lists what the environment must provide for those offers to mean anything.
|
||||||
|
|
||||||
|
| Draft IDs | Environmental requirement | Offer/context treatment |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 001-005 propulsion/steering | Useful routes, readable resistance, acceleration/braking, and actual output costs. | Productive travel/interception/crossing can raise weights; inputs alone do not farm offers. |
|
||||||
|
| 006 active braking propulsion, proposed replacement | Funded opposing propulsion with useful capacity beyond ordinary founder braking. | Stop/reverse demands weight the option; old Current sail stays archived pending a distinct benefit. |
|
||||||
|
| 007, 099 anchoring | Currents that make holding position useful; paid anchor construction, drop, and release. | Costly station keeping/dislodging is relevant context; no need to suffer injury first. |
|
||||||
|
| 008 coasting-biased body, proposed replacement | Stored relative velocity and a body-resistance change distinct from 005 streamlining. | Useful open coasting can favor it; overshooting/precise-stop demands can reduce weight. Former food sensing is reclassified for later review. |
|
||||||
|
| 104 flow sensing | A useful information benefit beyond the visible current cues promised to all cells. | Sensing is information, not swimming speed; do not require it to see basic flow. |
|
||||||
|
| 009 shed propulsion | Real ongoing stationary supply or supported carried role. | Photosynthesis/pool proximity alone is insufficient; nutrient access must work. |
|
||||||
|
| 010 specialized colony propulsion | Attached movement/load and machinery beyond ordinary member propulsion. | Does not require 009; ordinary attached movement is not gated on 010. |
|
||||||
|
| 024-025, 100 light adaptation/sensing | Meaningful, perceivable spatial light differences. | Light is separate from temperature; shade is not automatically cold. |
|
||||||
|
| 091-095 thermal specialization | Real temperature-dependent benefits and disadvantages, plus reachable habitat choices. | Observed useful thermal conditions/transitions weight offers; dangerous exposure is not a prerequisite. |
|
||||||
|
| 097 shed thermal protection | Existing costly protection and functional thermal gameplay. | Stable safe conditions can favor shedding; no offer when there is no actual saved cost. |
|
||||||
|
| 098 protective rest | Supported hazards, funded protection, finite survival, and reactivation. | Optional specialization, not an enforced inactive opening. |
|
||||||
|
|
||||||
|
A region with thermal effects disabled offers no thermal adaptations. A thermal
|
||||||
|
map with only decorative color is still disabled for this purpose. Hard availability
|
||||||
|
comes before behavior/context weights; merely discovering an area does not create
|
||||||
|
the missing environmental mechanics.
|
||||||
|
|
||||||
|
## Readability and controls
|
||||||
|
|
||||||
|
- Flow cues should communicate direction and strength before the cell is committed.
|
||||||
|
Use trails, suspended specks, and actual food motion without making every visual
|
||||||
|
speck look collectible.
|
||||||
|
- Render terrain/habitat colors as a thermal heat map with readable cold-to-hot
|
||||||
|
differences instead of a flat background. Basic cellular conditions and interactions
|
||||||
|
have visible indicators/cues; their readability does not require a sensory mutation.
|
||||||
|
- Provide a compass and temperature gauge for navigating the cell. Distinguish local
|
||||||
|
ambient temperature, actual cell temperature, and preferred temperature/range.
|
||||||
|
Final gauge layout remains open, but it should explain why E demand stays high
|
||||||
|
after a cell's actual temperature has adjusted to an off-preference location.
|
||||||
|
- Distinguish comfortable, stressful, and dangerous conditions for the controlled
|
||||||
|
organism using contours/patterns and labels as well as color. Food channel colors
|
||||||
|
must remain distinguishable; visible heat must not hide current direction.
|
||||||
|
- Show whether the cell is swimming, drifting, actively braking, holding position,
|
||||||
|
or anchored. A world-space speed readout alone can conceal propulsion expenditure.
|
||||||
|
- Explain a changing budget: for example, station keeping uses E while passive
|
||||||
|
drift does not use propulsion E; basal maintenance remains separate.
|
||||||
|
- Respect perception/interest limits. A readable local current/thermal view does
|
||||||
|
not grant an exact global map or reveal out-of-range food.
|
||||||
|
- Any later sensory adaptation needs a benefit beyond these baseline visual cues;
|
||||||
|
it cannot merely restore information already promised to every cellular player.
|
||||||
|
- Show biological state under shared presentation rules for NPCs and players;
|
||||||
|
do not add account/owner labels to make flow or thermal behavior understandable.
|
||||||
|
|
||||||
|
The renderer consumes immutable views with frame, tick, revision, and field presence.
|
||||||
|
It can interpolate presentation, but client animation cannot move authoritative
|
||||||
|
food/cells, determine temperature injury, or alter collection outcomes.
|
||||||
|
|
||||||
|
## Ownership, lifecycle, and persistence
|
||||||
|
|
||||||
|
Keep one authoritative owner per patch of space, including cells and their local
|
||||||
|
environment. Several regions scale the world; one global fluid owner is not implied.
|
||||||
|
Environmental fields, organic stock, corpses, independent descendants, and transfer
|
||||||
|
escrow must remain disjoint resource representations.
|
||||||
|
|
||||||
|
Before a coupled implementation, specify and persist or deterministically derive:
|
||||||
|
|
||||||
|
- Field definitions, units, frame/mapping, immutable seed/configuration, and rules.
|
||||||
|
- The linked world area and scaling used for the thermal map, so it reconstructs
|
||||||
|
exactly; currents and the map have no time-dependent stock or entitlement.
|
||||||
|
- Actual movement state needed for acceleration, braking, and restored continuation.
|
||||||
|
- Attachment state, loads, member identities, and valid release/breakage outcomes.
|
||||||
|
- Temperature/exposure state needed by the chosen organism response model.
|
||||||
|
- Atomic flow/thermal/resource/movement outcomes and their recorded replay inputs.
|
||||||
|
|
||||||
|
Choose one explicit tick order for environmental exchange, motion/contact, feeding,
|
||||||
|
metabolism, thermal response, reproduction, and terminal transfers. The list here
|
||||||
|
does not select that order. Restore, recorded replay, and differently partitioned
|
||||||
|
batches must produce the same authoritative outcomes under the chosen rules.
|
||||||
|
No database write per simulation tick is required by this proposal.
|
||||||
|
|
||||||
|
Cross-region transport needs paired conservation and durable authority handoff.
|
||||||
|
It must include the relevant organism motion/thermal state and any in-transit stock;
|
||||||
|
an adjacent field's read-only view cannot authorize spending its inventory. The
|
||||||
|
initial closed circulation experiment can defer open transport without declaring
|
||||||
|
future regional boundaries impermeable world walls.
|
||||||
|
|
||||||
|
Offline controlled organisms still cannot move, feed, reproduce, mutate, or progress
|
||||||
|
passively. Logout takes effect after a delay; during it the cell stays in play and
|
||||||
|
vulnerable, so logging out while about to be engulfed does not prevent it. After
|
||||||
|
the delay the cell is anchored in place, cannot be engulfed, is not moved by
|
||||||
|
currents, and its metabolism and thermal response are frozen. There is no offline
|
||||||
|
catch-up on return. Independent NPC relatives continue under ordinary active-world
|
||||||
|
rules. Resume restores the cell's frozen velocity and temperature state; its
|
||||||
|
surroundings may have changed.
|
||||||
|
|
||||||
|
## Region capacity and world linkage
|
||||||
|
|
||||||
|
Each region maps to an area of its world and takes its thermal map from that area.
|
||||||
|
Regions do not grow with population. A hard organism cap bounds each region:
|
||||||
|
|
||||||
|
- At the cap, births are refused. Engulfment and death return matter to the region
|
||||||
|
and reopen slots for players and wildlife alike.
|
||||||
|
- If a capped region has had no players for extended days, an operator can cull
|
||||||
|
wildlife through an admin interface. Culling is a recorded operator action, not
|
||||||
|
automatic despawning presented as selection.
|
||||||
|
- The world adds regions as demand requires. A later equation decides whether a
|
||||||
|
new region joins the same world or a region attaches to a new world.
|
||||||
|
- A fresh cell is offered a choice of region when it begins, so friends can share one.
|
||||||
|
|
||||||
|
A new region starts without life under player-origin biology; its founders shape it.
|
||||||
|
|
||||||
|
## Emergence into the world
|
||||||
|
|
||||||
|
When an organism evolves out of the 2D stage, it leaves its cellular region:
|
||||||
|
|
||||||
|
- Its matter is a recorded export and is lost to the cellular scale. The organism
|
||||||
|
enters the world scaled to world values. The conversion scale is selected once
|
||||||
|
the number of regions per world and the matter per region are known.
|
||||||
|
- Target selection uses the region's mapped world area. Rank several candidates
|
||||||
|
closest to the organism's preferred temperature with the nutrients it needs and
|
||||||
|
choose one at random. Finite world resources penalize crowded sites; no separate
|
||||||
|
spreading rule is added.
|
||||||
|
- The emerging organism chooses individual or bulk emergence. Bulk joins a
|
||||||
|
selection queue; organisms emerging together with the same or close biology share
|
||||||
|
one target pick. Because players and wildlife look alike by design, this does not
|
||||||
|
depend on knowing who is a player.
|
||||||
|
|
||||||
|
Thermal adaptation in the cellular stage therefore shapes where an organism starts
|
||||||
|
in the world.
|
||||||
|
|
||||||
|
## Pacing and ecological checks
|
||||||
|
|
||||||
|
All fresh primitive lives receive equivalent starting biology. Starting locations
|
||||||
|
need useful reachable food, a tolerable thermal setting, and sufficient control
|
||||||
|
to follow more than one viable route. This does not require permanent protected
|
||||||
|
zones or invulnerable founders.
|
||||||
|
|
||||||
|
Evaluate net E and each material channel over actual routes, including propulsion,
|
||||||
|
maintenance, flow encounters, and newborn investment. Faster E collection alone
|
||||||
|
does not satisfy the three-minute first-birth target if P or another material
|
||||||
|
creates a long wait. Thermal protection must not become a required prerequisite
|
||||||
|
for every founder's ordinary reproduction route.
|
||||||
|
|
||||||
|
The maintainer expects unattended feeding to be slower than active gathering and
|
||||||
|
risky because other organisms can engulf an unattended cell. Treat a separate
|
||||||
|
anti-AFK system as low priority; do not add input challenges, forced movement,
|
||||||
|
unattended-play timers, or new surveillance mechanics for this draft. Verify the
|
||||||
|
assumption through playtesting rather than claiming predation guarantees it in
|
||||||
|
every population. The mutation draft's proposed activity-credit rules remain a
|
||||||
|
separate review item, not a new anti-AFK feature approved by this decision.
|
||||||
|
|
||||||
|
Compare active collection with fixed-pool camping and passive drifting in trials.
|
||||||
|
If a circuit or pool outperforms active routes, tune food, flow, intake, and costs
|
||||||
|
before adding an anti-idle layer. Viable stationary producers still need useful
|
||||||
|
interactions and births without meaningless movement/input requirements.
|
||||||
|
|
||||||
|
Observe whether offspring establish, compete, feed, die, recycle, and form supported
|
||||||
|
groups. Flow must not sweep every newborn away before attachment is possible or
|
||||||
|
concentrate all life into one dominant trap. Finite resource depletion and deaths
|
||||||
|
remain ecological outcomes; do not conceal failures by automatically spawning food
|
||||||
|
or wildlife. Adjust documented openings/inflows and trial parameters instead.
|
||||||
|
|
||||||
|
## Proposed implementation segments, after design review
|
||||||
|
|
||||||
|
These are possible bounded segments for later work, not authorization to code,
|
||||||
|
commit, push, migrate, or deploy during this document review.
|
||||||
|
|
||||||
|
| Segment | Concrete result | Qualification needed before broadening |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Design contracts | Agree motion/flow, thermal accounting/response, boundaries, and rule-version scope. | Reconcile existing ADRs, resource owners, public contracts, and lifecycle behavior. |
|
||||||
|
| Portable flow and propulsion | Deterministic fields, funded motion/braking, loose-food movement, and conservative contact. | Bounds, conservation, no tunneling, no free station keeping, replay/restore. |
|
||||||
|
| Portable thermal model | Explicit thermal sources/capacity/exchange and one readable biological response. | Energy accounting, gradients, warning time, supported adaptation tradeoffs. |
|
||||||
|
| Coupled region integration | One-owner joint outcomes, durable state, publication, recovery, and supported attachments. | Atomicity, crash/retry safety, batch equivalence, offline policy, version admission. |
|
||||||
|
| Client presentation | Readable local flow/thermal cues and movement/energy feedback. | Matches authority and perception; founder handling evaluated interactively. |
|
||||||
|
| Controlled pacing experiment | New disposable/versioned test region with ordinary founding and births. | First-birth distributions, active-vs-passive feeding, adaptation usefulness, colony opportunity timing. |
|
||||||
|
|
||||||
|
Keep the headless simulation independent of graphics, networking, storage, Steam,
|
||||||
|
and Kubernetes. Specialized dependencies need the repository's evidence/ADR process;
|
||||||
|
none are proposed merely to supply a fluid effect. This design does not change
|
||||||
|
foundation-proof scope or authorize any World0 action.
|
||||||
|
|
||||||
|
## Future verification checklist
|
||||||
|
|
||||||
|
These are checks a later implementation must perform, not results claimed here:
|
||||||
|
|
||||||
|
- Still liquid, uniform flow, circulating flow, and smooth transition cases.
|
||||||
|
- Procedural 2-n current generation, differing speeds/directions, intersections,
|
||||||
|
and identical reconstruction from saved generation configuration.
|
||||||
|
- Relative swimming versus world movement; braking does not imply free station keeping.
|
||||||
|
- Useful founder control across ordinary currents, with no high-speed contact skips.
|
||||||
|
- Finite food survives repeated circuits without gain, loss, or boundary piles.
|
||||||
|
- Passing-cell food drift has bounded distance falloff and temporal decay, combines
|
||||||
|
predictably across cells, and restores identically without changing food stock.
|
||||||
|
- Attachment, release, force/load handling, and ordinary multi-cell propulsion.
|
||||||
|
- Thermal map reconstruction from the linked world area, gradient crossings, and
|
||||||
|
scaling continuity.
|
||||||
|
- Region cap birth refusal, slot reopening, operator culling records, emergence
|
||||||
|
export and target selection, and logout delay followed by protected anchoring.
|
||||||
|
- Combined three-temperature E response: transition cost can diminish after
|
||||||
|
adjustment while off-preference cost persists; near-preference operation approaches
|
||||||
|
baseline. Check the balanced exponential curve without double-counting stress.
|
||||||
|
- Bounded acclimation, lethal extreme entry, and meaningful asymmetric cold/heat
|
||||||
|
and broad thermal-adaptation effects, including any supported zero-extra-cost range.
|
||||||
|
- Heat-map cues, compass, and gauge distinguish ambient/cell state and communicate
|
||||||
|
hazards before entry without requiring a mutation for basic visibility.
|
||||||
|
- Unsupported/missing fields rejected or explicitly disabled, never treated as safe defaults.
|
||||||
|
- Deterministic motion/thermal continuation through restore, retry, and batch partitioning.
|
||||||
|
- One-owner and cross-boundary conservation, including escrow and terminal events.
|
||||||
|
- No offline controlled-organism drift, feeding, exposure catch-up, or earned mutation credit.
|
||||||
|
- Perception limits and equivalent biological presentation for player/NPC organisms.
|
||||||
|
- Ordinary first-birth timing across seeds and novice routes, plus progression-time tails.
|
||||||
|
|
||||||
|
## Remaining tuning and implementation details
|
||||||
|
|
||||||
|
The original ten responses are recorded near the beginning. Do not present settled
|
||||||
|
procedural generation, visible cues, flow-speed effects, or exponential thermal
|
||||||
|
cost as unanswered gameplay questions. Remaining work is:
|
||||||
|
|
||||||
|
- **Thermal equation:** combine current cell, preferred cell, and environment
|
||||||
|
temperatures with acclimation and mutations. Preserve extra cost for drastic
|
||||||
|
transitions and sustained off-preference conditions; the coefficients and exact
|
||||||
|
relationship require balancing, not another choice of a single reference.
|
||||||
|
- **Playtesting:** founder/current speed ranges, crossing/escape control, proposed
|
||||||
|
006 braking and 008 coasting tradeoffs, exponential
|
||||||
|
E curve, acclimation rates/limits, lethal thresholds, colony roles, and whether
|
||||||
|
active feeding naturally outperforms risky unattended feeding.
|
||||||
|
- **Generation and composition:** maximum n, route/thermal-map generation rules,
|
||||||
|
intersecting-current composition, bounded work, and recorded configuration.
|
||||||
|
- **Food disturbance tuning:** induced-drift radius, strength, distance falloff,
|
||||||
|
decay, multiple-cell combination, and world-versus-relative driving velocity.
|
||||||
|
- **Thermal map scaling:** how the world area's thermal map is scaled to the habitat;
|
||||||
|
ambient/cell response and lethal-event semantics.
|
||||||
|
- **Controls/presentation:** exact coasting/braking/reversing/anchoring inputs in
|
||||||
|
the focused movement draft, and gauge layout, with baseline visible cues established.
|
||||||
|
- **Lifecycle:** logout delay duration and spawn placement within a chosen region.
|
||||||
|
- **Capacity and emergence:** region cap value, region-or-world creation equation,
|
||||||
|
emergence conversion scale, candidate count, and bulk-queue timing/similarity.
|
||||||
|
- **Engineering contracts:** ownership/contact, conservative boundaries, deterministic
|
||||||
|
recovery, explicit version changes, and eventual cross-region transport. The
|
||||||
|
maintainer marked original question 3 N/A for the gameplay discussion; these
|
||||||
|
existing technical constraints remain without becoming new required gameplay.
|
||||||
|
|
||||||
|
## Document validation scope
|
||||||
|
|
||||||
|
Check local reference targets, Markdown structure, unique headings, required design
|
||||||
|
sections, and whitespace. Preserve the separately reviewed mutation draft. These
|
||||||
|
checks establish document integrity only; no fluid behavior, thermal response,
|
||||||
|
ecological balance, implementation availability, or pacing result is qualified by
|
||||||
|
creating this file.
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
# Cellular region and movement implementation plan
|
||||||
|
|
||||||
|
Status: approved for implementation, 2026-10-21. Implements
|
||||||
|
[Cellular region changes](Cellular_Region_Changes.md),
|
||||||
|
[Cellular movement draft](Cellular_movement_draft.md) and
|
||||||
|
[ADR-0177](docs/adr/0177-cellular-regions-world-linkage.md). Movement mutation
|
||||||
|
weights and timing start from the values chosen here and are tuned through the
|
||||||
|
tuning file; the separate [mutation review](Cellular_mutation_draft.md) can
|
||||||
|
replace them later.
|
||||||
|
|
||||||
|
## Approach
|
||||||
|
|
||||||
|
- **Test on the live DEV system.** Every phase ends in a deployable image and a new
|
||||||
|
DEV region opened with the new rules, then a playtest. No local-simulation gate.
|
||||||
|
- **Fast pushes (Phase 0, done).** A push to `main` gates only on the deploy policy
|
||||||
|
suite, then builds and publishes images. The full check matrix runs nightly, on
|
||||||
|
pull requests and on manual dispatch.
|
||||||
|
- **Disposable DEV worlds (ADR-0177).** New rules get new versions and a fresh
|
||||||
|
opening. No upgrade paths from existing bundles, checkpoints or envelopes.
|
||||||
|
- **One tuning file in Git.** Every tunable value lives in one file; see
|
||||||
|
[Tuning file](#tuning-file). Retuning is a Git change and a full Argo sync; no
|
||||||
|
image build.
|
||||||
|
- **Client and server together.** Each phase ships its client half, so every DEV
|
||||||
|
deploy is playable.
|
||||||
|
- **One shared motion step.** The same integer code runs on the server and in the
|
||||||
|
client predictor.
|
||||||
|
|
||||||
|
## Current code this plan changes
|
||||||
|
|
||||||
|
| Area | Today | File(s) |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Motion | Stateless per-tick proposal: position from intent x speed, cost proportional to distance, instant stop. | `include/evo/biology/cellular_motion.hpp`, `src/biology/cellular_motion.cpp` |
|
||||||
|
| Life step | Maintenance, then movement, then intake (ADR-0104). | `src/biology/cellular_step.cpp` |
|
||||||
|
| Region step | Lives in life-id order, shared deposit contention, engulfment, corpses become bubbles. | `src/biology/cellular_region_step.cpp` |
|
||||||
|
| Food | Habitat format 2: up to 4,096 static deposits, ordered and updated by address. | `include/evo/biology/cellular_habitat.hpp`, `src/biology/cellular_habitat.cpp` |
|
||||||
|
| Environment | Joint owner `AEVOCEN1`: one ambient temperature, infall, heat export. | `src/server/lifecycle/cellular_environment.cpp` |
|
||||||
|
| Lives and population | Owners 7/8, rules up to 11, bundle 13, schema 57. | `src/server/lifecycle/cellular_lives.cpp`, `cellular_population*.cpp` |
|
||||||
|
| Wildlife | Shared controller choosing intents. | `src/server/lifecycle/wildlife_controller.cpp` |
|
||||||
|
| Sessions | Session v12 perception lists in-range deposits by id (max 512, 26 bytes each). | `src/network/protocol/session_protocol.cpp`, `src/server/session/region_sessions.cpp` |
|
||||||
|
| Client | Probe-style own-marker predictor and interpolation. | `src/client/prediction/*.cpp`, `src/client/views/*.cpp` |
|
||||||
|
| Opening | `cellular-v8`: 30 x 30 mm, 9 pools, 1,800 bubbles, 20 C ambient. | `apps/evo-world-clone/main.cpp`, `deploy/kubernetes/region/dev/region-values.yaml` |
|
||||||
|
|
||||||
|
The world has no thermal map yet: each cellular region has one ambient temperature.
|
||||||
|
Phase 3 adds a seeded world thermal field for regions to sample.
|
||||||
|
|
||||||
|
## Tuning file
|
||||||
|
|
||||||
|
- **Location:** `deploy/kubernetes/region/dev/tuning/cellular.tuning`, mounted into
|
||||||
|
the region pod by a kustomize `configMapGenerator`, so a change restarts the
|
||||||
|
region through a normal Argo sync.
|
||||||
|
- **Format:** plain `key = value` lines with `#` comments; units in key names
|
||||||
|
(for example `founder.thrust_um_per_s2 = 400`). Integer values only, matching the
|
||||||
|
simulation. No new dependency.
|
||||||
|
- **Validation:** unknown keys, missing keys, duplicates and out-of-range values
|
||||||
|
are refused at startup, so a typo fails the sync visibly instead of running with
|
||||||
|
a default. The file carries a `tuning.version` key.
|
||||||
|
- **Determinism:** the region persists the tuning values with its checkpoint. When
|
||||||
|
a restarted region finds different values, it records a tuning change at the
|
||||||
|
next tick boundary and uses the new values from that tick. Replay of earlier
|
||||||
|
intervals uses the values in force at the time.
|
||||||
|
- **Scope:** every value in [v0 trial values](#v0-trial-values) plus movement
|
||||||
|
mutation weights, offer timing and future tunables as they are added. Values
|
||||||
|
that only shape a new region (size, current routes, seed) apply when a region
|
||||||
|
opens; the rest apply on restart.
|
||||||
|
|
||||||
|
## v0 trial values
|
||||||
|
|
||||||
|
Starting values for the tuning file, none locked.
|
||||||
|
|
||||||
|
| Quantity | v0 value | Reasoning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Region size | 60 x 60 mm | Founder crosses in about 5 min; room for 2-4 routes and quiet pockets. Within the existing 1,000,000 um axis limit. |
|
||||||
|
| Perception radius | 5 mm (unchanged) | About 25 s of founder travel. |
|
||||||
|
| Founder top speed | 200 um/s (unchanged) | Top speed = thrust / drag. |
|
||||||
|
| Founder drag | k = 2 /s (95,163 ppm per tick) | 0.5 s time constant: responsive, coasts about 100 um from top speed. |
|
||||||
|
| Founder thrust | 400 um/s^2 | Gives the 200 um/s top speed at k = 2. Reverse thrust equal. |
|
||||||
|
| Founder turn rate | 1 turn/s | Responsive founder handling. |
|
||||||
|
| Currents | 2-4 per region, 3-6 mm wide, 60-300 um/s | 0.3x-1.5x founder speed (accepted). |
|
||||||
|
| Flow grid pitch | 250 um | Smooth at cell scale, 240 x 240 grid. |
|
||||||
|
| Ambient range | 5-40 C across the region | Gradual gradients; extremes optional. |
|
||||||
|
| Founder preferred | 20 C, comfort band +/- 5 C | Matches today's 20 C ambient. |
|
||||||
|
| Body response | tau = 20 s | Readable lag; gives warning before lethal. |
|
||||||
|
| Lethal (body temperature) | <= 0 C or >= 45 C | Applied to body, not ambient. |
|
||||||
|
| Thermal multiplier | `min(8, exp(0.08 * off_pref_C + 0.04 * transition_C))` | Two costs from the region draft, capped. |
|
||||||
|
| Region organism cap | 2,000 | Above today's population; tune from census. |
|
||||||
|
| Deposit limit | 8,192 | Larger region; raises the 4,096 limit. |
|
||||||
|
| Merged bubble cap | 8x a scattered bubble's stock | Bounds clumping; see moving food. |
|
||||||
|
| Visible moving bubbles | 256 per update, nearest first | Fits the snapshot budget with velocities. |
|
||||||
|
| Logout delay | 10 s | Same as the existing linger. |
|
||||||
|
| Movement mutation step | +/- 5 reference points, paired -/+ 2 | From the movement draft. |
|
||||||
|
| Recovery weight | `max(0.10, (index/100)^2)` below 100 | From the movement draft. |
|
||||||
|
| Offer cadence | 25 s of productive active play, 3 options per offer | Midpoint of the draft's 20-30 s. |
|
||||||
|
|
||||||
|
## Moving food
|
||||||
|
|
||||||
|
- **Merging.** When two bubbles touch, they become one bubble holding both
|
||||||
|
inventories. Its radius follows its total stock, and it keeps the lower id.
|
||||||
|
Bubbles at the merged-size cap stop merging, so currents cannot collapse all food
|
||||||
|
into a few huge bubbles. Merging is conserved by construction (one inventory sum)
|
||||||
|
and resolved in id order for determinism.
|
||||||
|
- **Multi-channel bubbles.** A merged bubble can hold several channels; contact
|
||||||
|
feeding already drains per channel. The client draws a merged bubble with its
|
||||||
|
channel colors.
|
||||||
|
- **Update limit.** Each update carries at most the configured number of moving
|
||||||
|
bubbles, nearest first. Farther ones are dropped from that update; the client
|
||||||
|
keeps advancing them with the shared flow field until a later update corrects
|
||||||
|
them. Bubbles overlapping on screen are indistinguishable, so this is not visible.
|
||||||
|
|
||||||
|
## Phases
|
||||||
|
|
||||||
|
Each phase lists server and client deliverables, then what is verified on DEV.
|
||||||
|
|
||||||
|
### Phase 0: pipeline (done)
|
||||||
|
|
||||||
|
- `.gitea/workflows/build.yaml`: on push only the deploy suite runs before the image
|
||||||
|
jobs; the full matrix runs nightly (09:00 UTC), on pull requests and on dispatch.
|
||||||
|
Nightly runs have their own concurrency group so pushes do not cancel them.
|
||||||
|
|
||||||
|
### Phase 1: motion core and tuning file
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- `CellularMotionState`: Q10 velocity, 16-bit heading, sub-micrometre accumulator.
|
||||||
|
- Checked-in integer sine/cosine table with golden tests.
|
||||||
|
- Per-tick step from the movement draft's numeric representation: turn, funded
|
||||||
|
thrust, drag toward exactly zero, add flow, displacement with carried remainder.
|
||||||
|
- Cost proportional to thrust used, divided by efficiency, not to distance.
|
||||||
|
Unfundable thrust is not applied; the cell coasts. Maintenance failure still
|
||||||
|
kills (existing behavior).
|
||||||
|
- Swept contact against deposits and cells, subdividing so no step exceeds half
|
||||||
|
the smallest contact radius, with a fixed work bound per tick.
|
||||||
|
- `CellularMovementProfile` derived from the genome: thrust, efficiency, burst
|
||||||
|
capacity and reserve, turn rate, forward and lateral drag, reverse thrust, anchor
|
||||||
|
capacity, colony drive. Ten fields for 001-010.
|
||||||
|
- Genome schema 6 with movement records at reference 100 for the founder; founder
|
||||||
|
version 5; development version 6.
|
||||||
|
- Tuning file parser and validation, shared by the server and `evo-world-clone`.
|
||||||
|
|
||||||
|
Client:
|
||||||
|
- Shared motion step linked into the client; the cell predictor uses it.
|
||||||
|
- Brake and reverse controls (rebindable, ADR-0085); movement-state indicator.
|
||||||
|
|
||||||
|
Verify: golden trajectories, decay to zero, no tunneling at 2x the top current
|
||||||
|
speed, equal results across restore points, thrust-cost properties, tuning file
|
||||||
|
refusals.
|
||||||
|
|
||||||
|
### Phase 2: currents, moving food and persistence
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Habitat format 3: deposits keyed and updated by stable id (not address), each
|
||||||
|
with Q10 velocity for induced drift; a fixed-pitch spatial bucket index for
|
||||||
|
contact; deposit limit from tuning.
|
||||||
|
- Seeded current generator: 2-n looping routes with width, direction and speed,
|
||||||
|
rasterized to the Q10 flow grid. Intersections add as vectors and are clamped to
|
||||||
|
the larger route speed.
|
||||||
|
- Bubbles move with the flow each tick in id order, merge on contact (see moving
|
||||||
|
food), and deflect along solid edges so nothing piles up.
|
||||||
|
- Induced drift from passing cells: radius, falloff, decay and maximum speed from
|
||||||
|
tuning; contributions combine in life-id order.
|
||||||
|
- Region step tick order: maintenance, turn and thrust, motion and swept contact,
|
||||||
|
deposit advection, induced drift and merging, contact feeding, engulfment,
|
||||||
|
deaths, births.
|
||||||
|
- Persistence: rules 12, owner format 10, population envelope 4 and joint envelope
|
||||||
|
format 2 carry motion state, deposit velocities and current configuration;
|
||||||
|
durable bundle 14 and schema 58, entered only by a fresh `cellular-v9` opening.
|
||||||
|
Joint batch 2 re-derives currents from configuration.
|
||||||
|
- Opening `cellular-v9` in a new DEV region (`evo-world-clone`).
|
||||||
|
|
||||||
|
Client:
|
||||||
|
- Session v13: own-life motion state; deposits with velocity under the update limit;
|
||||||
|
current configuration sent once at admission so the client builds the same grid.
|
||||||
|
- Bubbles advanced with the flow field between updates; merged bubbles drawn with
|
||||||
|
their channel colors.
|
||||||
|
- Flow cues: trails and drifting specks that are clearly not food.
|
||||||
|
|
||||||
|
Verify on DEV: food circulates and merges without loss or piles; founder handling
|
||||||
|
in and across currents; restart resumes identical trajectories; tick time against
|
||||||
|
the load governor (ADR-0097).
|
||||||
|
|
||||||
|
### Phase 3: thermal map and thermal biology
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- World thermal field: seeded and coarse per world, sampled over the region's world
|
||||||
|
area and scaled down to the habitat (ADR-0177). The region configuration stores
|
||||||
|
the world-area reference and scale.
|
||||||
|
- Per-cell thermal state: body temperature (mK) and acclimation offset.
|
||||||
|
- Genome thermal fields: preferred temperature, comfort band, tau, lethal cold and
|
||||||
|
heat limits; the parameters thermal mutations (091-095, 097) edit.
|
||||||
|
- Integer exp table (Q16) for the capped multiplier on survival E. A body-temperature
|
||||||
|
lethal check feeds the existing corpse-to-bubbles path with a new death cause.
|
||||||
|
|
||||||
|
Client:
|
||||||
|
- Heat-map terrain; compass; temperature gauge showing ambient, body and preferred
|
||||||
|
band; contours or patterns for stressful and lethal areas, not color alone.
|
||||||
|
- Thermal death shown as its own cause on the end-of-life screen.
|
||||||
|
|
||||||
|
Verify on DEV: costs rise and settle as expected crossing gradients; lethal areas
|
||||||
|
are reached only by choice; first-birth time stays near 3 minutes.
|
||||||
|
|
||||||
|
### Phase 4: movement mutations 001-010
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Operators for all ten as fixed-reference percentage edits on the Phase 1 fields,
|
||||||
|
including acquisition and shedding for 003, 007, 009 and 010.
|
||||||
|
- 007 anchor: a player-triggered drop that fixes the cell at the point it hits
|
||||||
|
until released; holding capacity against flow load.
|
||||||
|
- 009 and 010 are offered only where colony attachment makes them meaningful.
|
||||||
|
- Offer weights, recovery factor and cadence from the tuning file.
|
||||||
|
|
||||||
|
Client:
|
||||||
|
- Offer screen previews: before and after movement profile at matched conditions.
|
||||||
|
- Anchor drop/release control and anchored state.
|
||||||
|
- Visual body changes from the movement draft's tentative indicators (001-006),
|
||||||
|
shared by NPCs and players.
|
||||||
|
|
||||||
|
Verify on DEV: each option changes handling in the expected direction.
|
||||||
|
|
||||||
|
### Phase 5: wildlife
|
||||||
|
|
||||||
|
- The wildlife controller plans with inertia (brakes before targets), uses currents
|
||||||
|
(rides toward food), avoids lethal temperatures, seeks its preferred range and
|
||||||
|
drops its anchor when it has one. Same rules as players.
|
||||||
|
- Verify on DEV: wildlife survives and reproduces in the new regions without
|
||||||
|
collapsing into one site.
|
||||||
|
|
||||||
|
### Phase 6: logout, capacity and region choice
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Logout: a delay with the cell vulnerable, then anchored, protected, and with
|
||||||
|
metabolism and thermal response frozen; resume restores frozen motion state.
|
||||||
|
Replaces the ADR-0098 linger for rules 12.
|
||||||
|
- Region cap: births refused at the cap with a recorded reason; the wildlife
|
||||||
|
controller stops attempting them.
|
||||||
|
- Admin culling: an operator endpoint on the existing ops HTTP server
|
||||||
|
(`src/server/ops_http.cpp`) that records each cull as an operator action.
|
||||||
|
- Fresh-life region choice: list a world's regions with open capacity at admission,
|
||||||
|
and route the new life through the existing redirect and handoff path (ADR-0096).
|
||||||
|
|
||||||
|
Client:
|
||||||
|
- Region choice screen for a fresh life; logout countdown; a notice when a birth is
|
||||||
|
refused because the region is full.
|
||||||
|
|
||||||
|
Verify on DEV: cannot escape a closing predator by logging out; a capped region
|
||||||
|
refuses births and reopens after deaths; two accounts choose the same region.
|
||||||
|
|
||||||
|
### Later: emergence
|
||||||
|
|
||||||
|
Emergence (scaled export, candidate selection, bulk queue) needs multicellularity
|
||||||
|
and the 3D world. This plan keeps it possible: the region's world-area link and the
|
||||||
|
thermal field from Phase 3 are what emergence targeting will use.
|
||||||
|
|
||||||
|
## Instrumentation for every playtest
|
||||||
|
|
||||||
|
Extend `src/server/lifecycle/cellular_play_summary.cpp` with first-birth time,
|
||||||
|
solitary-stage length, deaths by cause (starved, engulfed, thermal), time spent in
|
||||||
|
currents versus quiet water versus anchored, propulsion E share of total E, bubble
|
||||||
|
merges, and per-tick region work. These answer whether the 3-minute and
|
||||||
|
30-60-minute targets hold.
|
||||||
|
|
||||||
|
## Risks
|
||||||
|
|
||||||
|
| Risk | Mitigation |
|
||||||
|
| --- | --- |
|
||||||
|
| Moving deposits raise tick cost | Spatial bucket index and merging reduce work; measure against the load governor in Phase 2. |
|
||||||
|
| Merging collapses food into few large bubbles | Merged-size cap from tuning; watch merge counts. |
|
||||||
|
| Prediction feels rubbery | Shared motion code in the client; measure prediction error on DEV. |
|
||||||
|
| Ten movement parameters interact badly | Instrumentation plus removal of options that do not fit, as decided. |
|
||||||
|
| Determinism drift between server and client | One library, golden trajectory tests in both builds. |
|
||||||
|
| Less CI on pushes lets regressions reach DEV | Nightly full matrix; fix red nightly runs before the next phase. |
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
# Cellular revamp build plan
|
||||||
|
|
||||||
|
Status: approved for implementation, 2026-10-22. Builds the
|
||||||
|
[cellular gameplay plan](Cellular_gameplay_plan.md) and its system plans:
|
||||||
|
[mutation](Cellular_mutation_plan.md), [reproduction](Cellular_reproduction_plan.md),
|
||||||
|
[feeding and energy](Cellular_feeding_energy_plan.md),
|
||||||
|
[predation and defense](Cellular_predation_defense_plan.md) and
|
||||||
|
[body and maintenance](Cellular_body_maintenance_plan.md). Decision record:
|
||||||
|
[ADR-0179](docs/adr/0179-cellular-gameplay-revamp.md). Continues from phases 1-2 of
|
||||||
|
the [region and movement plan](Cellular_Region_Movement_Plan.md), which shipped as
|
||||||
|
rules 12.
|
||||||
|
|
||||||
|
## Approach
|
||||||
|
|
||||||
|
- **Build every phase, then playtest once.** Each phase is committed and pushed with
|
||||||
|
CI green (AGENTS.md), but nothing is deployed until the last phase. The playtest
|
||||||
|
runs on a fresh DEV region opened with the new rules.
|
||||||
|
- **New versions, disposable DEV worlds.** Rules 13, genome schema 7, development 7,
|
||||||
|
founder 6, a new owner format, bundle and schema, and a fresh `cellular-v10`
|
||||||
|
opening. No upgrade from existing rules-12 regions (ADR-0177).
|
||||||
|
- **One revamp tuning file.** Every new tunable goes in
|
||||||
|
`deploy/kubernetes/region/dev/tuning/cellular-revamp.tuning`, beside the rules-12
|
||||||
|
`cellular.tuning`, with the same format and validation.
|
||||||
|
- **Server phases first, then one session version.** Phases 1-5 build and test the
|
||||||
|
server halves. The wire changes in every one of them (body values, offers, bud
|
||||||
|
choices, organisms), so session v14 and the client screens for all of them are one
|
||||||
|
step after phase 5, rather than a protocol revision per phase. Nothing deploys before
|
||||||
|
that step anyway.
|
||||||
|
- **Shared biology.** Derivations stay in the headless library, so the client
|
||||||
|
predictor and the server agree.
|
||||||
|
|
||||||
|
## Phases
|
||||||
|
|
||||||
|
### Phase 1: genome and body (rules 13 foundation) - done
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Genome schema 7: every heritable value the plans name, in points (founder 100)
|
||||||
|
unless stated:
|
||||||
|
- size, density, membrane, body recipe (per thousand, C/N/P/O), upkeep
|
||||||
|
efficiency, growth speed;
|
||||||
|
- collection per channel (E/C/N/P/O), shared intake, burn efficiency per matter
|
||||||
|
channel, energy kept per bubble (`energy_conversion`), light capture;
|
||||||
|
- engulf capacity, kill absorption;
|
||||||
|
- bud share, litter (founder 0), Adhesion flag;
|
||||||
|
- the existing movement arrangement.
|
||||||
|
- Development 7 and founder 6: size, density and recipe set mass, footprint and
|
||||||
|
surface; upkeep = essential floor + adjustable part / efficiency; membrane mass
|
||||||
|
from points; no legacy photosynthesis speed penalty.
|
||||||
|
- Rules 13 owner skeleton (new owner format) and tuning keys for every body value.
|
||||||
|
|
||||||
|
Client: in the session v14 step.
|
||||||
|
|
||||||
|
Verify: founder 6 derives the same body as founder 5 where the plans say "today's
|
||||||
|
value"; the essential floor holds; encode/decode and bound checks for schema 7.
|
||||||
|
|
||||||
|
### Phase 2: feeding, energy and predation - server done
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Collection per channel with the shared intake limit; the membrane collection penalty.
|
||||||
|
- Energy kept per bubble; the rest to heat.
|
||||||
|
- Matter as energy: burn the largest non-excluded channel, upkeep overrides
|
||||||
|
exclusions, death only when nothing can pay.
|
||||||
|
- Region spent pool with a seeded drip back as bubbles; waits at the deposit limit.
|
||||||
|
- Reserve matter in mass for handling and movement energy, not upkeep.
|
||||||
|
- Engulf check with engulf capacity and `engulf_reserve_mass_percent`; kill
|
||||||
|
absorption; the kill remainder split between bubbles and the spent pool.
|
||||||
|
- Channel exclusions are a 4-bit step intent field, carried in the trace's byte 14.
|
||||||
|
|
||||||
|
Client (session v14 step): energy display including what matter can stand in for;
|
||||||
|
channel exclusion toggles; spent-pool drips drawn like infall; hover and HUD show the
|
||||||
|
phase 1 body values.
|
||||||
|
|
||||||
|
Verify: conservation per channel and energy across burning, the pool, kills and
|
||||||
|
drips; no burn of excluded matter except for upkeep; replay determinism.
|
||||||
|
|
||||||
|
### Phase 3: mutation offers - server done
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Catalog of the 49 mutations as data: effect, eligibility, triggers, base weight,
|
||||||
|
steps, cost and `enabled`, all from the tuning file.
|
||||||
|
- Per-cell affinity scores, inherited at birth; activity counters for every trigger.
|
||||||
|
- Chance allocation (`clamp(k x weight, floor, cap)`, summing to the option count)
|
||||||
|
and a seeded systematic draw; the draw and chances are recorded so a retry never
|
||||||
|
rerolls.
|
||||||
|
- Offer cadence from the tuning file; one pending offer.
|
||||||
|
- Cost paid from the reserve (matter may stand in for energy) and reclaimed as seeded
|
||||||
|
random bubbles, merging into the farthest bubble at the deposit limit.
|
||||||
|
|
||||||
|
Until phase 4, a chosen mutation edits the offspring plan (as rules 10-12 do); phase 4
|
||||||
|
turns the choice into the split.
|
||||||
|
|
||||||
|
Client (session v14 step): offer screen with name, pro, con, chance, cost and shortfall.
|
||||||
|
|
||||||
|
Verify: chances sum to the option count and respect floor and cap; the draw's
|
||||||
|
marginal frequencies match the chances over a seed ensemble; triggers fire as
|
||||||
|
specified; costs conserve.
|
||||||
|
|
||||||
|
### Phase 4: reproduction - server done
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- On-demand bud with the control choice (stay or become the bud), the tunable fee and
|
||||||
|
bud share; one-way control transfer (ADR-0163).
|
||||||
|
- Mutation split: write the mutation into both plans, split body and reserve by
|
||||||
|
`split_share`, the offspring expresses it, the player chooses the cell; refusals
|
||||||
|
leave the offer pending.
|
||||||
|
- Litter: guaranteed and chance extra offspring sharing one investment, limited by
|
||||||
|
free spots and the region cap.
|
||||||
|
- Wildlife buds from its own plan with litter; wildlife never mutates.
|
||||||
|
|
||||||
|
Client: Bud with Stay / Become; offer options with Stay as founder / Become offspring;
|
||||||
|
refusal reasons.
|
||||||
|
|
||||||
|
Verify: control transfer is one way and exactly once across retries and restarts;
|
||||||
|
splits and litters conserve; a refused split spends nothing.
|
||||||
|
|
||||||
|
### Phase 5: multicellular organisms and emergence - server done
|
||||||
|
|
||||||
|
Unblocked 2026-10-23: the maintainer accepted whole-organism mutations and the
|
||||||
|
playtest form of Emerge (ADR-0179).
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- Adhesion forms the organism at once. The organism is one life with a member count,
|
||||||
|
one genome, one reserve and a body that is the sum of its members.
|
||||||
|
- Internal buds add members; mutations are expressed by the whole organism; whole-
|
||||||
|
organism engulfment by total mass; mass-scaled handling.
|
||||||
|
- Emergence threshold (members, mass, reserve energy) and the Emerge action; the
|
||||||
|
wildlife member limit as a safeguard.
|
||||||
|
|
||||||
|
As built:
|
||||||
|
- An organism develops as its genome with the target size times its members, so mass,
|
||||||
|
footprint, upkeep, intake and engulf mass all follow from it. Its corpse records the
|
||||||
|
single-cell extent.
|
||||||
|
- Adhesion ends the single cell's life as `merged` (an empty corpse) and starts the
|
||||||
|
organism as a new life (bud identity, two members) holding the whole body and reserve,
|
||||||
|
at the cell's spot and with its account, affinity and progress.
|
||||||
|
- An organism's mutation is recorded as a direct expression (no split); its changed
|
||||||
|
tissue is paid from the reserve with construction energy. Unaffordable keeps the offer.
|
||||||
|
- An organism's bud pays the bud fee and adds litter members at the current growth.
|
||||||
|
Wildlife organisms stop one member short of the threshold. An organism cannot become
|
||||||
|
its bud.
|
||||||
|
- Handling adds `organism.load_per_mille` of the extra members' mass as load.
|
||||||
|
- Emerge (intent bit, exclusive with bud, engulf, intake and frozen) at the threshold
|
||||||
|
exports the body and reserve through the boundary ledger and ends the life as
|
||||||
|
`emerged`. Below the threshold the request is ignored.
|
||||||
|
|
||||||
|
Client: organism drawn as its member cells; Emerge button at the threshold.
|
||||||
|
|
||||||
|
Verify: one reserve and one genome across members; whole engulfment conserves; the
|
||||||
|
Emerge action only at the threshold.
|
||||||
|
|
||||||
|
### Session v14 and the client - done
|
||||||
|
|
||||||
|
- Session v14: the phase 1 body values in perception; payable energy; the exclusion
|
||||||
|
control; named offers with pro, con, chance, cost and Stay / Become; the bud choice;
|
||||||
|
organisms and the Emerge action.
|
||||||
|
- Client screens for all of the above.
|
||||||
|
|
||||||
|
As built ([schema](schemas/network/session-v14-cellular-revamp.md)): a 64-byte body block
|
||||||
|
(members, threshold, exclusions, Emerge open, payable energy, mass, the 20 traits); become,
|
||||||
|
emerge and exclusions on actions; become on choices; catalog offers (id, chance, cost) named
|
||||||
|
by the client from the shared catalog; the emerged ending. The client shows Stay / Become
|
||||||
|
offspring on each offer (one Choose for an organism or Adhesion), "Continue as the bud",
|
||||||
|
the organism's size and the Emerge button, the channels kept from burning, the body, and the
|
||||||
|
emerged end screen.
|
||||||
|
|
||||||
|
### Durable plumbing - done
|
||||||
|
|
||||||
|
Bundle 15, schema 60 and the `cellular-v10` opening (ADR-0179 "Durable form"): the
|
||||||
|
14 -> 15 revamp profile migration with recovery, become stored as bit 15 of the durable
|
||||||
|
choice's operator, the action input's new bits, and mutation results 0-6.
|
||||||
|
|
||||||
|
### Phase 6: wildlife, instrumentation and the playtest
|
||||||
|
|
||||||
|
- Wildlife controller: matter-as-energy aware, budding with litter, engulfing with the
|
||||||
|
new eligibility. Done: hunger counts payable energy, buds wait for the bud fee (litter is
|
||||||
|
the owner's), an organism adds members until one short of the threshold, and hunting uses
|
||||||
|
the region step's rules-13 engulf test (reserve share, capacity, membrane in nanometres).
|
||||||
|
- Play summary: first-birth time, time to Adhesion, deaths by cause, energy share paid
|
||||||
|
by matter, offers seen and chosen, mutations held per lineage.
|
||||||
|
- Mount `tuning/cellular-revamp.tuning` into the provision Job beside `cellular.tuning`
|
||||||
|
(kustomize `configMapGenerator`) in the push that promotes the new images. Revamp keys
|
||||||
|
live in that separate file so images from before rules 13 never read them.
|
||||||
|
- Opening `cellular-v10` in a new DEV region; promote the images; full Argo sync.
|
||||||
|
- Playtest.
|
||||||
|
|
||||||
|
## Playtest feedback (2026-10-26)
|
||||||
|
|
||||||
|
- Choices stalled after one split: a split needs a grown cell. The view now carries growth and
|
||||||
|
a split-ready flag; the client gates Stay / Become; an offer waits until a single cell can
|
||||||
|
split; DEV splits once half grown (region 13).
|
||||||
|
- The region edge is drawn and named when the cell is against it; the region's cell count is
|
||||||
|
shown; the client says when upkeep is burning kept matter.
|
||||||
|
- Mixed bubbles (every nutrient, recipe proportions) via `--mixed-motes`, drawn as small pools;
|
||||||
|
liquid openings move pools out of the currents into still water.
|
||||||
|
- Phosphorus: intake per channel follows the body's recipe, so single-nutrient phosphorus
|
||||||
|
bubbles fed slowly while growth used it at once; mixed bubbles carry it with everything else.
|
||||||
|
|
||||||
|
## Open items
|
||||||
|
|
||||||
|
| Item | Phase |
|
||||||
|
| --- | --- |
|
||||||
|
| Retuning bubble energy or founder `energy_conversion` (keep 40% vs today's 100%) | 2 |
|
||||||
|
| Organism pace: in tests a two-member organism at half growth swims about 7.5 µm per tick and needed about 5,000 ticks on a rich mote to fund one internal member | 6 |
|
||||||
|
| Region migration does not carry rules-13 per-life state (affinity, members); an organism's move would be refused | 6 |
|
||||||
|
|
||||||
|
## Risks
|
||||||
|
|
||||||
|
| Risk | Mitigation |
|
||||||
|
| --- | --- |
|
||||||
|
| Many new genome fields exceed the 256-byte genome bound | Measure in phase 1; widen the bound in schema 7 if needed. |
|
||||||
|
| Matter-as-energy makes cells nearly unkillable by starvation | Burn rates and drip rate are tunable; instrument the matter share of energy paid. |
|
||||||
|
| 49 triggers add per-tick work | Counters are integer and per cell; measure tick time in phase 6. |
|
||||||
|
| Control transfer across retries duplicates or loses control | Durable action receipts, as for existing births. |
|
||||||
|
| One deploy at the end hides integration problems | Every phase ships its client half and runs end to end in local tests. |
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# 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
|
||||||
|
[Cellular_energy_photosynthesis_draft.md](Cellular_energy_photosynthesis_draft.md).
|
||||||
|
No code, runtime rule or live region is changed by it.
|
||||||
|
|
||||||
|
All indices below are stored in points with the founder at 100, and change in the
|
||||||
|
mutation plan's 5-point steps unless stated otherwise.
|
||||||
|
|
||||||
|
## 1. Size
|
||||||
|
|
||||||
|
The genome's `target_size` (the full-grown body mass) moves to points; 100 is today's
|
||||||
|
founder (8,000,000 fg).
|
||||||
|
|
||||||
|
| Larger | Smaller |
|
||||||
|
| --- | --- |
|
||||||
|
| Harder to engulf; can engulf bigger prey | Easier to engulf; limited to smaller prey |
|
||||||
|
| More upkeep (upkeep follows body mass) | Less upkeep |
|
||||||
|
| Costlier buds and regrowth | Cheaper buds and regrowth |
|
||||||
|
| Heavier, so slower to move | Lighter, so quicker |
|
||||||
|
| Bigger footprint, so it touches more food | Smaller footprint |
|
||||||
|
|
||||||
|
None of these are separate penalties; they follow from mass and size.
|
||||||
|
|
||||||
|
## 2. Body recipe
|
||||||
|
|
||||||
|
The body's share of each matter channel (C, N, P, O, in per thousand, summing to
|
||||||
|
1000) becomes a heritable trait. The founder's recipe is today's fixed composition.
|
||||||
|
|
||||||
|
- A recipe mutation moves a tunable step (trial 20 per thousand) from one channel to
|
||||||
|
another.
|
||||||
|
- Each channel has a tunable minimum share, so no body drops a channel entirely.
|
||||||
|
- The recipe changes what the body needs to build, regrow and bud. It has no
|
||||||
|
performance effect: its value is fitting the body to what the region supplies.
|
||||||
|
- Together with separate collection rates, this lets a lineage specialize, for example
|
||||||
|
a nitrogen-poor body that thrives where nitrogen is scarce.
|
||||||
|
|
||||||
|
## 3. Upkeep efficiency
|
||||||
|
|
||||||
|
Upkeep can be made cheaper but never zero:
|
||||||
|
|
||||||
|
```text
|
||||||
|
upkeep = essential part + adjustable part x 100 / upkeep efficiency
|
||||||
|
```
|
||||||
|
|
||||||
|
- The essential part is a tunable share of the founder's upkeep (trial 25%), which no
|
||||||
|
mutation reduces.
|
||||||
|
- Upkeep efficiency is an index, founder 100.
|
||||||
|
- Upkeep stays on the body only (feeding and energy plan).
|
||||||
|
|
||||||
|
Flexible upkeep (switching unused machinery off, draft 030) is postponed.
|
||||||
|
|
||||||
|
## 4. Density
|
||||||
|
|
||||||
|
Tissue density is an index, founder 100. Body mass is set by size, so density changes
|
||||||
|
how large the body is for that mass:
|
||||||
|
|
||||||
|
| Denser | Lighter |
|
||||||
|
| --- | --- |
|
||||||
|
| Smaller footprint for the same mass | Larger footprint for the same mass |
|
||||||
|
| Less surface, so slower collection and less membrane mass | More surface, so faster collection but more membrane mass and upkeep |
|
||||||
|
| Touches less food and fewer cells | Touches more food and more cells |
|
||||||
|
|
||||||
|
Body mass is unchanged by density; only membrane mass changes, because it follows the
|
||||||
|
surface.
|
||||||
|
|
||||||
|
Shape traits (elongated, flattened, rounded, flexible, rigid) and flexible adult size
|
||||||
|
are dropped: the body is a square and there is no shape or deformation model.
|
||||||
|
|
||||||
|
## 5. Growth
|
||||||
|
|
||||||
|
- Growth speed is an index, founder 100, scaling a tunable base rate (trial 5 per
|
||||||
|
thousand of full size per tick, today's value).
|
||||||
|
- Faster growth spends the same matter and energy in less time; it does not make
|
||||||
|
growth cheaper.
|
||||||
|
- After a mutation split, each half starts at the size its half of the body covers and
|
||||||
|
regrows at its growth speed.
|
||||||
|
|
||||||
|
## 6. Bud size
|
||||||
|
|
||||||
|
The reproduction capability sets the size of an on-demand bud, as a share of the
|
||||||
|
parent's body, in points (founder 100, which is 500 per thousand: half the body),
|
||||||
|
built from the parent's reserve. Extra offspring per bud come from litter (mutation
|
||||||
|
plan, section 9). Bigger buds cost more but start larger and are harder to engulf; smaller
|
||||||
|
buds are cheap but vulnerable.
|
||||||
|
|
||||||
|
## 7. Dropped
|
||||||
|
|
||||||
|
| Draft | Why |
|
||||||
|
| --- | --- |
|
||||||
|
| 031-034 storage | No storage caps. |
|
||||||
|
| 039-040 recycling and leakage | No tissue turnover or leakage model. |
|
||||||
|
| Dropping food to provision offspring | Splits already share resources. |
|
||||||
|
| 043-047 shape, 050 flexible size | No shape model. |
|
||||||
|
|
||||||
|
## 8. Genome indices and mutations
|
||||||
|
|
||||||
|
| Index | Founder | Mutations |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Size | 100 | Larger Body, Smaller Body (mutation plan, section 8) |
|
||||||
|
| Body recipe | Today's composition | Carbon-, Nitrogen-, Phosphorus- and Other-Thrifty Body (section 8) |
|
||||||
|
| Upkeep efficiency | 100 | Efficient Upkeep, Rapid Growth (section 8) |
|
||||||
|
| Density | 100 | Dense Tissue, Light Tissue (section 8) |
|
||||||
|
| Growth speed | 100 | Rapid Growth, Efficient Upkeep (section 8) |
|
||||||
|
| Bud share | 100 | Bigger Buds, Smaller Buds (section 9) |
|
||||||
|
|
||||||
|
## 9. Tunables
|
||||||
|
|
||||||
|
| Setting | Trial |
|
||||||
|
| --- | --- |
|
||||||
|
| Recipe step | 20 per thousand |
|
||||||
|
| Minimum share per channel | To be selected in playtesting |
|
||||||
|
| Essential upkeep share | 25% of the founder's upkeep |
|
||||||
|
| Base growth rate | 5 per thousand per tick |
|
||||||
|
| Size, density, efficiency and growth index bounds | To be selected in playtesting |
|
||||||
|
|
||||||
|
## 10. Implementation map
|
||||||
|
|
||||||
|
| Piece | State today |
|
||||||
|
| --- | --- |
|
||||||
|
| Size from `target_size` | Exists, in femtograms; points are new. |
|
||||||
|
| Body recipe | Fixed per development version; heritable shares are new. |
|
||||||
|
| Upkeep with an essential floor and efficiency | New. |
|
||||||
|
| Density | Fixed per development version; heritable index is new. |
|
||||||
|
| Funded regrowth | Exists (funded maturation, rules 9); the growth index is new. |
|
||||||
|
| Bud size from the reproduction capability | Exists; the new bud flow is in the reproduction plan. |
|
||||||
|
|
||||||
|
Every new behaviour goes in a new rules version; regions on earlier rules keep their
|
||||||
|
meaning.
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
# Cellular feeding and energy plan
|
||||||
|
|
||||||
|
Status: planning draft, 2026-10-22. Records the maintainer's decisions on how cells
|
||||||
|
collect resources and pay for energy. Part of the
|
||||||
|
[Cellular gameplay plan](Cellular_gameplay_plan.md). Replaces the collection and fuel
|
||||||
|
sections of [Cellular_feeding_draft.md](Cellular_feeding_draft.md) and the energy
|
||||||
|
sections of [Cellular_energy_photosynthesis_draft.md](Cellular_energy_photosynthesis_draft.md).
|
||||||
|
No code, runtime rule or live region is changed by it.
|
||||||
|
|
||||||
|
## 1. Resources
|
||||||
|
|
||||||
|
| Channel | Unit | Used for |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| E (energy) | picojoules | Upkeep, thrust, construction, mutation costs |
|
||||||
|
| C (carbon) | femtograms | Body tissue; energy stand-in |
|
||||||
|
| N (nitrogen) | femtograms | Body tissue; energy stand-in |
|
||||||
|
| P (phosphorus) | femtograms | Body tissue; energy stand-in |
|
||||||
|
| O (other matter) | femtograms | Body tissue; energy stand-in |
|
||||||
|
|
||||||
|
Resources enter a region through its infall sources (as today), and come from light
|
||||||
|
for producers. They return to the region through deaths, kills (predation and defense
|
||||||
|
plan), mutation costs and the spent pool (section 3).
|
||||||
|
|
||||||
|
There are no storage caps. Reserve matter counts toward the cell's mass (section 4).
|
||||||
|
|
||||||
|
## 2. Collection
|
||||||
|
|
||||||
|
### Separate rates per channel
|
||||||
|
|
||||||
|
Each cell has a **collection index per channel** in its genome, with the founder at
|
||||||
|
100 on every channel:
|
||||||
|
|
||||||
|
```text
|
||||||
|
collection: energy 100, carbon 100, nitrogen 100, phosphorus 100, other 100
|
||||||
|
```
|
||||||
|
|
||||||
|
- A channel's collection rate is the founder's rate for that channel scaled by its
|
||||||
|
index (105 collects that channel 5% faster).
|
||||||
|
- The existing ingestion capability stays as the **shared limit**: total matter taken
|
||||||
|
per tick cannot exceed it, so raising every channel does not bypass the cell's
|
||||||
|
overall intake.
|
||||||
|
- Collection is still by contact, as today: the cell drains what it touches.
|
||||||
|
|
||||||
|
This gives lives real variation: a nitrogen gatherer and a carbon gatherer feed
|
||||||
|
differently in the same region. The founder rates, the shared limit and how they
|
||||||
|
interact need serious tuning.
|
||||||
|
|
||||||
|
## 3. Matter as energy
|
||||||
|
|
||||||
|
### The rule
|
||||||
|
|
||||||
|
When an energy cost is larger than the reserve's energy, the cell pays the remainder
|
||||||
|
with **reserve matter** instead. The matter is not converted into energy; it stands in
|
||||||
|
for it. It covers every energy cost: upkeep, thrust, growth and bud construction, and
|
||||||
|
the energy part of mutation costs.
|
||||||
|
|
||||||
|
- **Burn rate:** each channel has a tunable rate, the picojoules 1,000 fg of it stands in
|
||||||
|
for, scaled by the cell's burn efficiency for that channel (founder 100). Matter pays
|
||||||
|
at a worse rate than the energy bubbles carry, so burning matter is always the
|
||||||
|
expensive way to stay alive (trial: 2,000 pJ per 1,000 fg).
|
||||||
|
- **Only reserve matter burns.** The body is never burned.
|
||||||
|
- **Death:** a cell dies when its upkeep cannot be paid by energy or any reserve
|
||||||
|
matter.
|
||||||
|
|
||||||
|
### Which matter burns
|
||||||
|
|
||||||
|
- The cell burns the channel it has the **most** of (in femtograms). If that channel
|
||||||
|
runs out mid-payment, it moves to the next largest. Ties go in the order C, N, P, O.
|
||||||
|
- The player can **exclude** channels (for example, keep phosphorus for budding).
|
||||||
|
Excluded channels are not burned for thrust, construction or mutation costs. The
|
||||||
|
controlled cell keeps its exclusions through splits and buds; wildlife excludes
|
||||||
|
nothing.
|
||||||
|
- **Upkeep overrides exclusions.** If upkeep cannot be paid any other way, it burns
|
||||||
|
excluded matter rather than let the cell die with matter on board.
|
||||||
|
|
||||||
|
### Where the burned matter goes
|
||||||
|
|
||||||
|
Burned matter goes into the region's **spent pool**, one amount per channel. The pool
|
||||||
|
drips back into the region as new bubbles at random points, at a tunable rate. If the
|
||||||
|
region is at its deposit limit, the drip waits.
|
||||||
|
|
||||||
|
- The region keeps all its matter; nothing is destroyed.
|
||||||
|
- Burned matter cannot be collected straight back, so matter is not an endless energy
|
||||||
|
supply. The drip rate decides how scarce energy is.
|
||||||
|
- Energy paid with real energy still goes to heat, as today.
|
||||||
|
|
||||||
|
### Presentation
|
||||||
|
|
||||||
|
The energy display shows the reserve's energy plus what the usable (non-excluded)
|
||||||
|
matter can stand in for, and roughly how long the cell can live on it.
|
||||||
|
|
||||||
|
## 4. Mass
|
||||||
|
|
||||||
|
Carried reserve matter counts toward the cell's total mass, alongside its body. Mass
|
||||||
|
slows acceleration and turning and raises movement energy (see the reproduction plan's
|
||||||
|
mass rule). Hoarding mass for emergence makes an organism slower and costlier to move.
|
||||||
|
|
||||||
|
Upkeep is charged on the **body only**. Reserve matter adds to movement costs, not to
|
||||||
|
upkeep, so hoarding is paid for once.
|
||||||
|
|
||||||
|
## 4a. Energy-bubble efficiency
|
||||||
|
|
||||||
|
The founder's `energy_conversion` capability (400 per thousand, unused in cellular play
|
||||||
|
today) becomes the share of collected energy-bubble E the cell keeps as reserve
|
||||||
|
energy. The rest goes to heat. Matter is collected whole; this applies to E only.
|
||||||
|
|
||||||
|
This gives extraction mutations a real axis: a higher share means more energy per
|
||||||
|
bubble, paid for by the mutation's paired change.
|
||||||
|
|
||||||
|
Today a cell keeps 100% of bubble energy. At the founder's 400 per thousand it would
|
||||||
|
keep 40%, cutting its energy income by more than half. Either the founder's value or
|
||||||
|
the energy in bubbles must be retuned when this is turned on.
|
||||||
|
|
||||||
|
## 5. Photosynthesis
|
||||||
|
|
||||||
|
- **Unlock:** Acquire Photosynthesis becomes available after the cell has burned a
|
||||||
|
tunable amount of carbon as energy. The count carries to offspring, like affinity
|
||||||
|
scores.
|
||||||
|
- **Weights:** burning carbon raises its chance; burning other channels lowers it.
|
||||||
|
Cells that live on carbon drift toward becoming producers.
|
||||||
|
- **Mass:** producer tissue slows the cell through the mass model only. The legacy
|
||||||
|
speed penalty is dropped in the new rules.
|
||||||
|
- **Light:** constant; there is no day/night cycle and no spatial light. The light
|
||||||
|
specialists (024/025) are dropped.
|
||||||
|
|
||||||
|
## 6. Genome indices and mutations
|
||||||
|
|
||||||
|
| Index | Founder | Mutations (mutation plan, section 6) |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Collection per channel (E, C, N, P, O) | 100 each | Carbon, Nitrogen, Phosphorus and Other Matter Gatherer |
|
||||||
|
| Shared intake limit | 100 | Big Appetite, Small Appetite |
|
||||||
|
| Burn efficiency per matter channel | 100 each | Carbon, Nitrogen, Phosphorus and Other Matter Metabolism |
|
||||||
|
| Energy kept per bubble (`energy_conversion`) | 100 | Thorough Extraction, Rapid Extraction |
|
||||||
|
| Light capture | Absent; 100 when acquired | Acquire, Expand, Reduce and Shed Photosynthesis |
|
||||||
|
|
||||||
|
## 7. Tunables
|
||||||
|
|
||||||
|
| Setting | Trial |
|
||||||
|
| --- | --- |
|
||||||
|
| Founder collection rate per channel | From today's derived limits |
|
||||||
|
| Shared ingestion limit | Founder ingestion capability |
|
||||||
|
| Burn rate per channel (pJ per 1,000 fg) | 2,000 |
|
||||||
|
| Spent-pool drip rate | To be selected in playtesting |
|
||||||
|
| Carbon burned before photosynthesis is offered | To be selected in playtesting |
|
||||||
|
|
||||||
|
## 8. Open questions
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
## 9. Implementation map
|
||||||
|
|
||||||
|
| Piece | State today |
|
||||||
|
| --- | --- |
|
||||||
|
| Contact feeding with per-channel limits | Exists; limits derive from one ingestion rate. |
|
||||||
|
| Collection index per channel | New genome field (new genome schema). |
|
||||||
|
| Matter paying energy costs | New, in every place an energy cost is charged. |
|
||||||
|
| Burn order and player exclusions | New per-cell state and a new client control. |
|
||||||
|
| Region spent pool and drip | New region state; releases bubbles like infall. |
|
||||||
|
| Reserve matter in mass | New in handling and movement energy; upkeep unchanged. |
|
||||||
|
| Energy-bubble efficiency from `energy_conversion` | Capability exists; applying it to cellular E intake is new. |
|
||||||
|
| Carbon-burned count, inherited | New per-cell state. |
|
||||||
|
| Photosynthesis without the legacy speed penalty | New rules; light capture exists (rules 11+). |
|
||||||
|
|
||||||
|
Every new behaviour goes in a new rules version; regions on earlier rules keep their
|
||||||
|
meaning.
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
# Cellular gameplay plan
|
||||||
|
|
||||||
|
Status: planning index, 2026-10-22. Tracks every cellular gameplay system, its state,
|
||||||
|
and the maintainer's decisions. Each system gets its own plan; once all are settled,
|
||||||
|
the mutation catalog is reworked across them. After the cellular game is finished,
|
||||||
|
every mutation is reviewed for its effect on the 3D organism.
|
||||||
|
|
||||||
|
Plans so far:
|
||||||
|
|
||||||
|
- [Cellular_mutation_plan.md](Cellular_mutation_plan.md): what a mutation is, offers,
|
||||||
|
weights, costs, and the full catalog (49 mutations).
|
||||||
|
- [Cellular_reproduction_plan.md](Cellular_reproduction_plan.md): budding, mutation
|
||||||
|
splits, multicellular organisms, emergence.
|
||||||
|
- [Cellular_feeding_energy_plan.md](Cellular_feeding_energy_plan.md): collection,
|
||||||
|
matter as energy, the spent pool, photosynthesis.
|
||||||
|
- [Cellular_predation_defense_plan.md](Cellular_predation_defense_plan.md): engulfment,
|
||||||
|
what a predator gets, membrane defense.
|
||||||
|
- [Cellular_body_maintenance_plan.md](Cellular_body_maintenance_plan.md): size, body
|
||||||
|
recipe, upkeep, density, growth, bud size.
|
||||||
|
|
||||||
|
The earlier drafts (feeding, energy/photosynthesis, defense, movement, mutation) are
|
||||||
|
source material. They were written against superseded policies and are rewritten
|
||||||
|
into plans rather than merged.
|
||||||
|
|
||||||
|
## Systems
|
||||||
|
|
||||||
|
| System | Today | Status | Plan |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| Movement | Liquid motion with the movement arrangement | Planned | Mutation plan |
|
||||||
|
| Reproduction and multicellular | Budding into wildlife | Planned | Reproduction plan |
|
||||||
|
| Collection | One ingestion rate split into per-channel limits; contact feeding | Planned | Feeding and energy plan |
|
||||||
|
| Energy sources | Energy bubbles; light (rules 11+) | Planned | Feeding and energy plan |
|
||||||
|
| Engulfment | Instant; attacker mass vs prey mass x membrane | Planned | Predation and defense plan |
|
||||||
|
| Defense | Membrane thickness | Planned | Predation and defense plan |
|
||||||
|
| Body and maintenance | Upkeep from mass and membrane | Planned | Body and maintenance plan |
|
||||||
|
| Temperature | Tuning keys read, unused | **Postponed** | - |
|
||||||
|
| Sensing and communication | None | **Postponed** | - |
|
||||||
|
| Multicellular mutations | None | **Postponed** | - |
|
||||||
|
| Damage and repair | Damage field exists, unused | **Out for now** | - |
|
||||||
|
|
||||||
|
## Decisions, 2026-10-22
|
||||||
|
|
||||||
|
### Feeding and energy
|
||||||
|
|
||||||
|
- **Matter as energy.** When the reserve's energy cannot cover an energy cost, the
|
||||||
|
cell pays it with reserve matter instead, at a higher rate than pure energy. The
|
||||||
|
matter is not converted into energy; it stands in for it. A cell dies only when
|
||||||
|
neither energy nor usable matter can pay. The cell burns the channel it has most of;
|
||||||
|
the player can exclude channels. Burned matter goes to a region spent pool that drips
|
||||||
|
back as random bubbles.
|
||||||
|
- **Separate collection rates per channel** (E, C, N, P, O). More variation between
|
||||||
|
lives; needs serious tuning.
|
||||||
|
- **Carried reserve matter counts toward mass** for movement and movement energy, not
|
||||||
|
upkeep. Hoarding for emergence slows an organism down.
|
||||||
|
- **No storage caps.**
|
||||||
|
|
||||||
|
### Predation and defense
|
||||||
|
|
||||||
|
- **Engulfment stays instant** for this pass.
|
||||||
|
- **Prey recovery:** the predator absorbs up to its per-tick collection limit; half the
|
||||||
|
remainder becomes bubbles at the prey's spot, half goes to the spent pool.
|
||||||
|
- **Everyone engulfs**, wildlife included.
|
||||||
|
- **Membrane** is stored in points (founder 100); thicker membrane also slows
|
||||||
|
collection.
|
||||||
|
- **Reserve matter in engulf mass** is a tunable percentage (0% turns it off).
|
||||||
|
- **Armor is postponed.** Membrane thickness is the defense for now.
|
||||||
|
- Postponed with live capture: prey retention, slippery coating, adhesive grip,
|
||||||
|
defensive expulsion, siphoning.
|
||||||
|
|
||||||
|
### Photosynthesis
|
||||||
|
|
||||||
|
- **Legacy speed penalty dropped** in the new rules. Producer tissue slows a cell
|
||||||
|
through the mass model only.
|
||||||
|
- **Light specialists dropped** (024/025): there is no day/night cycle and no spatial
|
||||||
|
light.
|
||||||
|
- **Unlock:** offered after burning a tunable amount of carbon as energy; burning
|
||||||
|
carbon raises its chance, burning other channels lowers it.
|
||||||
|
|
||||||
|
### Body and maintenance
|
||||||
|
|
||||||
|
- **Size** moves to points; Larger and Smaller follow from mass.
|
||||||
|
- **Body recipe** (C/N/P/O shares) becomes heritable.
|
||||||
|
- **Upkeep efficiency** is in, with an essential floor; flexible upkeep is postponed.
|
||||||
|
- **Density** is kept as an index; all shape traits are dropped.
|
||||||
|
- **Growth speed** is a trait with a tunable base rate.
|
||||||
|
- **Bud size** comes from the reproduction capability.
|
||||||
|
- **Dropped:** storage (031-034), recycling and leakage (039-040), food provisioning.
|
||||||
|
|
||||||
|
### Catalog scope
|
||||||
|
|
||||||
|
- Mutation deep dive covers the planned systems: movement, feeding and energy,
|
||||||
|
predation and defense, body and maintenance, reproduction.
|
||||||
|
- **Draft groups 071-150 are on hold**: colonies and colony architecture, producers and
|
||||||
|
exchange, environmental adaptation, sensing, metabolic regulation, loss and
|
||||||
|
simplification, habitat specializations. Sensing and multicellular mutations are
|
||||||
|
postponed as systems.
|
||||||
|
|
||||||
|
## Order
|
||||||
|
|
||||||
|
1. Done: system plans for movement, reproduction, feeding and energy, predation and
|
||||||
|
defense, body and maintenance; the mutation catalog for this pass.
|
||||||
|
2. Build the plans in phases ([build plan](Cellular_Revamp_Build_Plan.md),
|
||||||
|
[ADR-0179](docs/adr/0179-cellular-gameplay-revamp.md)), then playtest at the end.
|
||||||
|
3. Later: temperature, damage and repair, armor, live capture, sensing, multicellular
|
||||||
|
mutations, draft groups 071-150.
|
||||||
|
4. After the cellular game: each mutation's effect on the 3D organism.
|
||||||
@@ -0,0 +1,718 @@
|
|||||||
|
# Cellular movement draft
|
||||||
|
|
||||||
|
Status: discussion draft, 2026-10-21. This is the focused movement review for
|
||||||
|
draft mutations 001-010. It documents verified source behavior separately from
|
||||||
|
planned changes and proposed replacement adaptations. No code, runtime rule,
|
||||||
|
public contract, live region, or deployment changes are made here. No commit or
|
||||||
|
push is authorized during the maintainer's draft review.
|
||||||
|
|
||||||
|
Companions:
|
||||||
|
|
||||||
|
- [Cellular mutation draft](Cellular_mutation_draft.md): overall selection,
|
||||||
|
expression, reproduction, and the 150-entry catalog index.
|
||||||
|
- [Cellular region changes](Cellular_Region_Changes.md): procedural currents,
|
||||||
|
thermal conditions, food disturbance, presentation, and region ownership.
|
||||||
|
|
||||||
|
### Maintainer decisions, 2026-10-21
|
||||||
|
|
||||||
|
| Topic | Decision |
|
||||||
|
| --- | --- |
|
||||||
|
| Scope | 001-010 are the cellular movement mutation options. All ten stay in the first implementation; options that do not fit in play are removed afterwards. |
|
||||||
|
| Drag and top speed | Accepted: lowering passive drag (008) also raises top speed, because top speed is thrust divided by drag. |
|
||||||
|
| Precision | Fixed-point motion state, as specified in [Numeric representation](#numeric-representation). |
|
||||||
|
| Scale | Currents start at 0.3x-1.5x founder swimming speed, so the strongest cannot be swum against. Region size is chosen with founder speed and current speed together. |
|
||||||
|
| Client prediction | The client runs the same motion step and flow field as the server. |
|
||||||
|
| Energy exhaustion | Unchanged: a cell that cannot pay maintenance dies and its corpse becomes food bubbles at its death location. Thrust that cannot be funded in a tick is not applied; the cell coasts and drifts. |
|
||||||
|
| 007 anchor | Player-triggered, like a boat anchor: the anchor drops and the point it hits becomes where the cell stays. It needs no prepared surface. |
|
||||||
|
| Logout anchor | A lifecycle state ([ADR-0177](docs/adr/0177-cellular-regions-world-linkage.md)), not the 007 mechanic. |
|
||||||
|
| Offer volume | Edits are percentage-based +/- steps off the fixed base, offered three at a time from a large catalog. No per-axis cap is needed now: extreme movement investment is limited by its own energy cost. |
|
||||||
|
|
||||||
|
## 1. How movement currently works
|
||||||
|
|
||||||
|
This section describes the inspected repository implementation, not a claim
|
||||||
|
about which version is currently deployed or how the proposed liquid controls
|
||||||
|
already feel in play. Test descriptions below refer to inspected test source;
|
||||||
|
the tests were not executed for this documentation change.
|
||||||
|
|
||||||
|
### Authoritative motion and input
|
||||||
|
|
||||||
|
The motion API is in
|
||||||
|
[cellular_motion.hpp](include/evo/biology/cellular_motion.hpp), implemented in
|
||||||
|
[cellular_motion.cpp](src/biology/cellular_motion.cpp). Its historical design is
|
||||||
|
[ADR-0102](docs/adr/0102-cellular-spatial-trial.md).
|
||||||
|
|
||||||
|
- A tick is 50 ms. The cellular motion resolver accepts per-second budgets and
|
||||||
|
converts them to that tick duration.
|
||||||
|
- A movement intention is an X/Y direction-and-magnitude vector. Each component
|
||||||
|
is between -1000 and 1000, and its squared length cannot exceed 1,000,000.
|
||||||
|
It does not authorize a client-supplied position or speed.
|
||||||
|
- Maximum per-tick travel is the current phenotype's movement speed multiplied
|
||||||
|
by the tick duration, rounded down to integer micrometres.
|
||||||
|
- Each axis displacement is the intention component times that maximum step,
|
||||||
|
divided by 1000 with integer truncation. The resulting position is clamped
|
||||||
|
to keep the square body footprint inside the declared rectangular area.
|
||||||
|
- The position identifies the lower-left footprint corner. This helper permits
|
||||||
|
areas up to 1,000,000 micrometres per axis; that bound is not a selected new
|
||||||
|
region size or a planetary layout.
|
||||||
|
- There is no stored velocity, acceleration, facing/turn-rate limit, passive
|
||||||
|
deceleration, coasting, active braking, or local-flow input in this resolver.
|
||||||
|
Releasing input immediately requests zero displacement. Reversing requests the
|
||||||
|
other direction on the next tick without an acceleration/braking transition.
|
||||||
|
- Bounds clamp position; there is no wraparound. The square-footprint contact
|
||||||
|
helper counts an exact edge touch. It is not a liquid obstacle/pushing solver.
|
||||||
|
|
||||||
|
### Current movement energy
|
||||||
|
|
||||||
|
The resolver derives a full-speed tick cost from the metabolic budget, rounded
|
||||||
|
up, then scales it by actual bounded travel. Conceptually:
|
||||||
|
|
||||||
|
`movement E = ceil(full-speed tick E * conservative travelled distance / maximum tick distance)`
|
||||||
|
|
||||||
|
Travel distance is the integer ceiling of the Euclidean distance between the
|
||||||
|
old and final clamped position. A zero-distance move costs zero movement E.
|
||||||
|
This means pressing against the region boundary with no resulting displacement
|
||||||
|
does not pay an active station-keeping cost under the current model.
|
||||||
|
|
||||||
|
The funded helper either transfers the entire movement cost from reserve E to
|
||||||
|
heat in its detached candidate or refuses the move. It does not apply a reduced
|
||||||
|
affordable fraction of a requested move. Reserve matter channels are not consumed
|
||||||
|
by that movement transfer. Basal maintenance remains a separate charge.
|
||||||
|
|
||||||
|
The composed step in [cellular_step.cpp](src/biology/cellular_step.cpp) charges
|
||||||
|
maintenance before movement, then handles applicable intake. Underfunded movement
|
||||||
|
leaves the cell in place while the step can continue; later food cannot retroactively
|
||||||
|
fund earlier movement. See
|
||||||
|
[ADR-0104](docs/adr/0104-cellular-single-life-tick-order.md). Later region/deposit
|
||||||
|
rules extend feeding and lifecycle behavior; this motion helper is not by itself
|
||||||
|
the complete ecology, collision, or publication contract.
|
||||||
|
|
||||||
|
### Current founder, size, and other traits
|
||||||
|
|
||||||
|
The inspected [founder parameters](include/evo/biology/founder.hpp) specify
|
||||||
|
**200 micrometres/second** movement for an ordinary primitive founder. With no
|
||||||
|
speed-reducing producer trait, that permits a maximum 10-micrometre step per
|
||||||
|
50 ms tick. This is an existing tunable, not acceptance of the future founder
|
||||||
|
speed or proof that the three-minute first-birth target is met.
|
||||||
|
|
||||||
|
[Development](src/biology/development.cpp) reads the movement capability as a
|
||||||
|
speed, not as thrust or a set of acceleration/steering properties. An absent
|
||||||
|
capability yields zero speed. Ordinary growth-size changes do not independently
|
||||||
|
scale speed in the inspected derivation. The
|
||||||
|
[metabolic budget](src/biology/metabolism.cpp) makes full-speed movement demand
|
||||||
|
depend on total mass and phenotype speed, with versioned integer coefficients
|
||||||
|
and rounding. Mass and membrane changes can therefore change movement cost
|
||||||
|
without changing the basic movement-speed parameter.
|
||||||
|
|
||||||
|
Under that approximately linear mass-and-speed budget, increasing the speed
|
||||||
|
parameter raises full-speed E/time but does not independently create a less
|
||||||
|
efficient E/distance motor, apart from integer rounding. The simple derivation
|
||||||
|
also does not build extra propulsion tissue merely because movement is acquired
|
||||||
|
or raised. Real machinery investment and independent efficiency/output properties
|
||||||
|
are planned extensions, not existing costs to describe as already implemented.
|
||||||
|
|
||||||
|
Development version 5 adds photosynthetic organelle mass/upkeep and reduces
|
||||||
|
movement speed according to the existing producer rule: at efficiency p per
|
||||||
|
thousand, retained speed is `(1000 - p/2) / 1000`, with integer arithmetic.
|
||||||
|
See [ADR-0175](docs/adr/0175-photosynthesis-producers.md). This is a versioned
|
||||||
|
existing coupling, not the new general body-drag model.
|
||||||
|
|
||||||
|
[Mutation implementation](src/biology/mutation.cpp) currently offers generic
|
||||||
|
adjust-up/down/acquire/shed operations over capability records. Schemas 4 and 5
|
||||||
|
use a step of one tenth of the current parameter, at least one. These are not
|
||||||
|
the proposed compound movement adaptations below, and their runtime operator IDs
|
||||||
|
must not be confused with this document's draft IDs.
|
||||||
|
|
||||||
|
### Source checks inspected
|
||||||
|
|
||||||
|
| Test source | Behavior specified by the existing checks |
|
||||||
|
| --- | --- |
|
||||||
|
| [cellular_motion_tests.cpp](tests/cellular_motion_tests.cpp) | Full/partial/diagonal movement, zero input, boundary clamping, invalid vectors, low-speed quantization, funded refusal, heat transfer, and footprint contact. |
|
||||||
|
| [cellular_step_tests.cpp](tests/cellular_step_tests.cpp) | Maintenance before movement/intake and conservation of the composed candidate. |
|
||||||
|
| [development_tests.cpp](tests/development_tests.cpp) | Zero speed without capability and unchanged speed under ordinary size changes in the tested derivation. |
|
||||||
|
| [metabolism_tests.cpp](tests/metabolism_tests.cpp) | Derived movement budgets, founder values, and membrane/mass relationships. |
|
||||||
|
| [photosynthesis_tests.cpp](tests/photosynthesis_tests.cpp) | Producer tissue costs and the version-5 speed reduction. |
|
||||||
|
| [mutation_tests.cpp](tests/mutation_tests.cpp) | Versioned capability operations, prerequisites, and mutation adjustment behavior. |
|
||||||
|
|
||||||
|
These existing checks are useful baselines; they do not validate liquid flows,
|
||||||
|
propulsion controls, thermal changes, or the proposed ten movement adaptations.
|
||||||
|
|
||||||
|
## 2. Planned movement model
|
||||||
|
|
||||||
|
### Liquid-relative propulsion and world travel
|
||||||
|
|
||||||
|
Cells propel themselves through liquid while procedural currents carry both
|
||||||
|
cells and loose food. The region design specifies 2-n currents with individual
|
||||||
|
directions/speeds, possible intersections, quiet areas, and circulating routes.
|
||||||
|
The bounded maximum n, flow combinations, and speed ranges remain trial values.
|
||||||
|
|
||||||
|
`world velocity = local liquid velocity + swimming velocity relative to liquid`
|
||||||
|
|
||||||
|
This is a conceptual decomposition, not a finalized integrator or repeated
|
||||||
|
unbounded acceleration. At comparable propulsion output, travelling with flow
|
||||||
|
increases world progress, travelling against it decreases progress, and zero
|
||||||
|
ambient flow gives ordinary swimming for the current body/conditions. Cross-flow
|
||||||
|
deflects travel; a strong current can prevent upstream progress.
|
||||||
|
|
||||||
|
Do not apply an additional same-direction speed bonus after adding current.
|
||||||
|
Passive drift does not consume propulsion E, but ordinary maintenance and any
|
||||||
|
thermal survival cost continue. A cell drifting beside a bubble at the same speed
|
||||||
|
still needs relative motion or useful contact to collect it.
|
||||||
|
|
||||||
|
### Acceleration, slowing, and controls
|
||||||
|
|
||||||
|
| Behavior | Planned response | Resource consequence |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Propel | Accelerate relative to liquid toward the requested direction within available output/steering limits. | Fund actual output; extra machinery can have construction/upkeep costs. |
|
||||||
|
| Release propulsion | Passive resistance reduces relative swimming velocity; world drift can continue. | No active propulsion expenditure; dissipation does not refill usable E. |
|
||||||
|
| Brake/reverse | Opposing propulsion changes swimming velocity faster than passive slowing alone. | Fund actual braking/reverse output. |
|
||||||
|
| Hold world position | Counter local flow rather than treating no input as a free stop. | Sustained funded output while resisting current. |
|
||||||
|
| Anchor (007) | Player drops the anchor; the cell holds at the point it hits until released. | Anchor construction, drop/release, and any supported maintenance costs. |
|
||||||
|
| Move an attached group | Useful member propulsion moves the whole arrangement against its combined resistance/load. | No free member-count speed multiplier or duplicate charging of shared work. |
|
||||||
|
|
||||||
|
Start founders with responsive handling. Exact controls for automatic/manual
|
||||||
|
braking, reverse thrust, turning at speed, and steering assistance remain open.
|
||||||
|
Do not impose long uncontrollable coasting just to demonstrate acceleration.
|
||||||
|
|
||||||
|
Passive deceleration has a two-sided consequence: stronger slowing improves
|
||||||
|
precise stops but sacrifices coasting; weaker slowing preserves motion but makes
|
||||||
|
overshooting more likely. Active braking can address that weakness, at its actual
|
||||||
|
machinery/output cost. Stopping relative to liquid is not stopping relative to
|
||||||
|
the region.
|
||||||
|
|
||||||
|
### Numeric representation
|
||||||
|
|
||||||
|
Biology stays integer-only and deterministic; server and client run the same code.
|
||||||
|
|
||||||
|
| State | Representation | Notes |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Position | Existing integer micrometres plus a per-cell sub-micrometre accumulator. | Public position and contact keep whole micrometres. |
|
||||||
|
| Velocity relative to liquid | Signed 32-bit, 1/1024 micrometre per second (Q10). | About 1 nm/s resolution; far beyond any trial speed range. |
|
||||||
|
| Heading | Unsigned 16-bit angle, 65,536 steps per turn. | Turn rate limits heading change per tick. |
|
||||||
|
| Direction vectors | Checked-in integer sine/cosine table (Q14). | Golden-tested; no floating point or platform math. |
|
||||||
|
| Flow sample | Q10 velocity grid at a fixed pitch, bilinear integer interpolation. | Rounds toward zero; seeded and versioned. |
|
||||||
|
|
||||||
|
Per tick:
|
||||||
|
|
||||||
|
1. Turn: move heading toward the intent direction by at most the turn rate.
|
||||||
|
2. Thrust: add funded acceleration along heading (reverse thrust for braking).
|
||||||
|
3. Drag: `v -= trunc(v * drag_ppm_per_tick / 1,000,000)`, rounding toward zero so
|
||||||
|
speed decays to exactly zero; a speed below a small threshold snaps to zero.
|
||||||
|
4. World velocity: add the flow sample at the cell's position.
|
||||||
|
5. Displacement: `acc += v_world * tick_us`; whole micrometres are
|
||||||
|
`floor(acc / (1024 * 1,000,000))`, carried into position, with the remainder kept
|
||||||
|
in `acc`. There is no rounding drift across ticks.
|
||||||
|
6. Contact: sweep the path against food and cells, subdividing so no step exceeds
|
||||||
|
half the smallest contact radius, with a fixed per-tick work bound.
|
||||||
|
|
||||||
|
All arithmetic is 64-bit with overflow checks. The motion state (velocity,
|
||||||
|
heading, accumulator) is persisted with the cell so restore and replay continue
|
||||||
|
exactly.
|
||||||
|
|
||||||
|
### Derive one profile from the current organism
|
||||||
|
|
||||||
|
Use propulsion capacity, efficiency, steering arrangement, body shape, mass,
|
||||||
|
and resistance as contributors. Derive a consistent resulting movement profile.
|
||||||
|
Do not independently assign unrelated percentage changes to every output merely
|
||||||
|
to manufacture a pro/con pair.
|
||||||
|
|
||||||
|
| Displayed comparison | Definition | Founder reference |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Maximum swimming speed | Supported speed relative to liquid under reference conditions. | 100%. |
|
||||||
|
| Propulsion energy cost | E/distance at a stated reference speed; also show E/time at actual output when useful. | 100%; lower is cheaper. |
|
||||||
|
| Acceleration | Rate of increasing relative swimming velocity. | 100%. |
|
||||||
|
| Passive deceleration | Rate of losing swimming velocity without propulsion. | 100%; faster stopping also reduces coasting. |
|
||||||
|
| Active braking | Available opposing propulsion response. | 100% for ordinary supported founder braking, not possession of specialized 006 machinery. |
|
||||||
|
| Turning control | Ability/rate to redirect movement at a stated reference speed. | 100%. |
|
||||||
|
|
||||||
|
Percentages compare against a fixed founder at stated body/growth/environment
|
||||||
|
conditions; they do not reset after every mutation. Store actual quantities and
|
||||||
|
derive the display. An absent burst or anchor is absent, not 100%. Every fresh
|
||||||
|
primitive life has the same baseline biology regardless of account age.
|
||||||
|
|
||||||
|
The future founder's absolute values and mutation magnitudes require playtesting.
|
||||||
|
The numeric trial map below supplies starting steps for review, not qualified
|
||||||
|
balance. Do not automatically carry forward the existing 200-micrometre/second
|
||||||
|
speed or generic ten-percent mutation step as a selected propulsion rule.
|
||||||
|
Keep previews at matched conditions, then explain actual newborn size, reserves,
|
||||||
|
flow, and temperature separately. Thermal cost uses current cell, preferred cell,
|
||||||
|
and environment temperatures as recorded in the region draft; it is not an
|
||||||
|
automatic multiplier on every movement cost.
|
||||||
|
|
||||||
|
### Combining one to many adaptations
|
||||||
|
|
||||||
|
Mutation changes the current body/offspring plan. The history remains an archive,
|
||||||
|
not a stack of named buff cards applied indefinitely.
|
||||||
|
|
||||||
|
| Combination | Useful resulting strategy | Cost or limit that remains |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 001 strong propulsion + 004 agile steering | Fast, responsive interception. | Actual machinery, operating demand, and capacity allocation. |
|
||||||
|
| 002 economical propulsion + 005 straight swimmer | Efficient sustained directional travel. | Reduced pursuit output and close turning. |
|
||||||
|
| 006 active braking + 008 coasting-biased body | Coast between targets, then brake deliberately. | Dedicated brake structure/output; overshooting if braking is delayed or unfunded. |
|
||||||
|
| 001 strong + 002 economical propulsion | Potentially a balanced power/economy design. | Valid only if output and efficiency are genuinely separate properties; opposite edits to one property are not two permanent bonuses. |
|
||||||
|
| 004 agile steering + 005 straight swimmer | Intermediate or mixed arrangement. | Recalculate one body geometry; do not keep mutually contradictory shape bonuses. |
|
||||||
|
| 009 shed propulsion + a supported propelling group | Nonpropelling specialist carried by others. | Donors supply force; group still carries its mass and needs viable material/E supply. |
|
||||||
|
|
||||||
|
Resistance is counted once. In particular, 005 changes directional streamlining
|
||||||
|
and 008 changes passive/coasting response; if the chosen body model cannot express
|
||||||
|
them as distinct changes, merge/revise them rather than applying the same drag
|
||||||
|
reduction twice. Bound changes, reject no-op candidates, and preview the complete
|
||||||
|
combined outcome and construction requirements.
|
||||||
|
|
||||||
|
### Frequent offers and percentage-step convention
|
||||||
|
|
||||||
|
The maintainer wants frequent opportunities to tweak the organism while playing.
|
||||||
|
Propose a small-tuning offer approximately every **20-30 seconds of productive
|
||||||
|
active play**, including an early first offer in that range, rather than the
|
||||||
|
earlier 60-90-second interval. These timing values are trial targets, not a
|
||||||
|
wall-clock entitlement or a selected activity-credit formula. Do not gate basic
|
||||||
|
reproduction on getting any particular offer.
|
||||||
|
|
||||||
|
Keep one pending offer rather than an accumulating queue of forced menus. Existing
|
||||||
|
earned opportunities remain available; no immediate free reroll follows a decline.
|
||||||
|
The first three minutes could therefore contain several small plan decisions
|
||||||
|
without demanding a separate division for every decision. Structural changes still
|
||||||
|
develop through funded offspring. Evolve now requires a viable division/succession;
|
||||||
|
Prepare offspring can accumulate edits to the next plan. Frequent offers do not
|
||||||
|
authorize free live reconstruction or automatic mutation of an offline cell.
|
||||||
|
|
||||||
|
For the initial movement experiment, use **percentage points of a fixed reference**
|
||||||
|
for parameter edits, not a percentage of the current value:
|
||||||
|
|
||||||
|
- An ordinary tuning step adds or removes 5 reference points on its primary axis.
|
||||||
|
- A paired specialization tradeoff initially moves 2 reference points on the
|
||||||
|
specified competing axis, where the proposed tissue arrangement supports it.
|
||||||
|
- 100 -> 105 -> 110 is two +5-point edits. It is not 100 -> 105 -> 110.25.
|
||||||
|
- These are changes to underlying normalized parameters, not promises that every
|
||||||
|
derived final speed/acceleration value changes by those same points.
|
||||||
|
- No amount or step may bypass a parameter's physical/recipe bounds. Reject or
|
||||||
|
clearly preview a bounded partial step; never advertise a full change then silently
|
||||||
|
truncate it. Bounds and rounding remain to be specified before implementation.
|
||||||
|
- Acquisition and complete shedding are structural cases, not a +5/-5 edit to
|
||||||
|
an absent trait. They need a real developed module/removal and explicit funding.
|
||||||
|
|
||||||
|
The same reference remains valid across successive mutations and one-way succession.
|
||||||
|
Compare equal body/environment conditions; temporary low reserves, small newborn
|
||||||
|
size, flow, thermal stress, and damage do not redefine inherited parameter values.
|
||||||
|
|
||||||
|
### Initial numeric map for movement adaptations
|
||||||
|
|
||||||
|
This is a **proposed first trial matrix**. Each row names an underlying arrangement,
|
||||||
|
its primary improvement, and its competing change. Values do not create independent
|
||||||
|
RPG buffs: development must realize the arrangement with actual tissue, supported
|
||||||
|
geometry, costs, and a consistent movement model. If the proposed pair cannot be
|
||||||
|
realized meaningfully, revise it instead of inventing a flat penalty.
|
||||||
|
|
||||||
|
| ID | Primary parameter and proposed change per tuning selection | Competing change or numeric consequence | Meaning of a positive direction |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 001 | Propulsion-output capacity +5 points. | Propulsion-efficiency index -2 points for the proposed high-output arrangement; additional tissue funded where needed. | More available useful output. |
|
||||||
|
| 002 | Propulsion-efficiency index +5 points. | Propulsion-output capacity -2 points in the economical arrangement. | More useful propulsion work per E, not a higher displayed E cost. |
|
||||||
|
| 003 | Burst-output capacity +5 points after acquisition. | Sustained-output allocation -2 points at comparable investment; actual burst E is spent and replenished. | More supported short-term output. |
|
||||||
|
| 004 | Steering-authority allocation +5 points. | Forward-output allocation -2 points at comparable investment. | More useful redirection authority. |
|
||||||
|
| 005 | Axial streamlining index +5 points. | Steering-authority allocation -2 points for that directional arrangement. | Less resistance along the chosen body axis. |
|
||||||
|
| 006 | Opposing/braking-output allocation +5 points beyond ordinary supported braking. | Forward-output allocation -2 points at comparable investment; active braking still spends E. | More supported opposing output. |
|
||||||
|
| 007 | Anchor holding capacity +5 points after acquisition. | Holding-tissue investment +5% of its reference module recipe; no arbitrary whole-body speed penalty. | More supported attachment load. |
|
||||||
|
| 008 | Coasting-response time index +5 points. | Passive slowing rate changes reciprocally in the candidate response model: 100/105 of baseline at index 105, about 95.24%. No second drag debit. | Longer preservation of swimming velocity, with slower passive stops. |
|
||||||
|
| 009 | Remove independent propulsion: its available output becomes 0. | Avoid that module's future construction/upkeep, not 100% of total maintenance; lose independent swimming/braking. | Reacquisition is a separate funded positive change, not +5 to an absent motor. |
|
||||||
|
| 010 | Dedicated colony-drive capacity +5 points after acquisition. | Dedicated propulsion-tissue investment +5% of its reference module recipe; extra mass and donor operating costs are derived. | More useful group-driving capacity. |
|
||||||
|
|
||||||
|
The paired 5/2 values are deliberately modest starting proposals for frequent
|
||||||
|
offers. Construction, upkeep, drag, total mass, final speed, and E/time are derived
|
||||||
|
from the resulting recipe; they are not also assigned all the table's percentages.
|
||||||
|
Efficiency is normalized useful work per E, with a physically valid actual range;
|
||||||
|
an index above 100 does not mean conversion efficiency above 100%.
|
||||||
|
|
||||||
|
For a module absent in the founder, a provisional acquisition reference of 100
|
||||||
|
means the performance of its explicit first module recipe, not that the founder
|
||||||
|
already owns it. Its initial construction and any displacement of other tissue
|
||||||
|
must be previewed; acquisition does not provide free mass. Repeated 007/010 scaling
|
||||||
|
uses that same module reference, without increasing all whole-body costs by 5%.
|
||||||
|
The initial burst recipe/capacity, anchor recipe, and colony-drive recipe still need
|
||||||
|
definition before those acquisition options can be offered.
|
||||||
|
|
||||||
|
For 008, reciprocal slowing is one candidate lumped response: increasing a decay
|
||||||
|
time by 5% reduces the corresponding decay rate to approximately 95.24%, not 95%.
|
||||||
|
This illustrates why coasting and passive deceleration cannot be assigned unrelated
|
||||||
|
percentages. It does not select the full velocity integrator or add usable E.
|
||||||
|
|
||||||
|
Example of composable edits: starting at output 100 and efficiency 100, one 001
|
||||||
|
selection proposes output 105 / efficiency 98. A subsequent 002 selection would
|
||||||
|
produce output 103 / efficiency 103 before bounds and physical derivation. This
|
||||||
|
does not erase the funded machinery or any construction/upkeep its final recipe
|
||||||
|
requires. Show the complete combined result, not only the primary green number.
|
||||||
|
|
||||||
|
### Decreasing a movement trait
|
||||||
|
|
||||||
|
A supported lower-investment variant should also have a reason to choose it.
|
||||||
|
Use the following inverse steps as trial proposals, without creating another ten
|
||||||
|
catalog IDs. They are directional variants of the reviewed adaptations, not a
|
||||||
|
requirement to offer every inverse in every context.
|
||||||
|
|
||||||
|
| ID | Proposed lower-primary variant | Benefit in return | Lost capacity |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 001 | Output capacity -5 points. | Efficiency index +2 points in the inverse arrangement. | Maximum useful output. |
|
||||||
|
| 002 | Efficiency index -5 points. | Output capacity +2 points in the higher-throughput arrangement. | Work obtained per E. |
|
||||||
|
| 003 | Burst capacity -5 points. | Sustained-output allocation +2 points. | Short escape/interception output. |
|
||||||
|
| 004 | Steering authority -5 points. | Forward-output allocation +2 points. | Close maneuvering. |
|
||||||
|
| 005 | Axial streamlining -5 points. | Steering authority +2 points in the less directional arrangement. | Long-axis swimming economy. |
|
||||||
|
| 006 | Braking allocation -5 points. | Forward-output allocation +2 points. | Rapid stopping/reversal. |
|
||||||
|
| 007 | Anchor holding capacity -5 points, within a viable module. | Holding-tissue recipe investment -5% of reference. | Maximum supported attachment load. |
|
||||||
|
| 008 | Coasting-response time -5 points. | Faster passive stopping; at index 95 the candidate slowing rate is 100/95 of baseline, about 105.26%. | Preserved motion between propulsion intervals. |
|
||||||
|
| 009 | Full shedding is already the loss direction. | Avoid future propulsion-module investment. | All independent propulsion; restoration needs an explicit viable reacquisition recipe. |
|
||||||
|
| 010 | Dedicated group-drive capacity -5 points, within a viable module. | Dedicated propulsion-tissue investment -5% of reference. | Supported group-driving output. |
|
||||||
|
|
||||||
|
Inverse edits affect the next developed recipe; they do not refund the unchanged
|
||||||
|
parent's existing tissue. Partial reduction cannot cross a capability's minimum
|
||||||
|
supported recipe or accidentally become complete removal. A lower-primary variant
|
||||||
|
must have the stated benefit in the physical model; otherwise exclude it rather
|
||||||
|
than offering a plain detrimental decrease.
|
||||||
|
|
||||||
|
### Below-baseline traits and positive-offer weighting
|
||||||
|
|
||||||
|
The maintainer's direction is that **the further into the negative a trait goes,
|
||||||
|
the less likely a positive mutation for that trait should be offered**. Interpret
|
||||||
|
this draft's negative position as a net reduction of the relevant inherited
|
||||||
|
capacity/investment index below its fixed 100 reference. "Positive" here means
|
||||||
|
increasing that option's named primary axis, not a mutation with no drawbacks.
|
||||||
|
For example, output 70 is -30 reference points; output 90 is -10. Merely falling
|
||||||
|
from output 150 to 120 is not yet below the founder baseline.
|
||||||
|
|
||||||
|
Use the primary underlying axis rather than the color/sign of every displayed
|
||||||
|
result. Lower E/distance can be an improvement: an economical motor must not be
|
||||||
|
classified as genetically negative merely because its displayed energy cost is
|
||||||
|
80%. Coasting likewise has a useful positive axis and a stopping disadvantage.
|
||||||
|
|
||||||
|
Propose a persistent **recovery weight factor** for a positive movement candidate:
|
||||||
|
|
||||||
|
`recovery = max(0.10, (index / 100)^2)` when `0 <= index < 100`; otherwise `1`.
|
||||||
|
|
||||||
|
| Inherited primary index | Offset from reference | Relative weight for its positive-direction candidate |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 100 or higher | At/above reference. | 100% of otherwise applicable weight. |
|
||||||
|
| 95 | -5 points. | 90.25%. |
|
||||||
|
| 90 | -10 points. | 81%. |
|
||||||
|
| 80 | -20 points. | 64%. |
|
||||||
|
| 70 | -30 points. | 49%. |
|
||||||
|
| 60 | -40 points. | 36%. |
|
||||||
|
| 50 | -50 points. | 25%. |
|
||||||
|
| 40 | -60 points. | 16%. |
|
||||||
|
| 30 or lower | -70 points or more. | 10% floor. |
|
||||||
|
|
||||||
|
These are **relative sampling weights, not the probability of seeing an option
|
||||||
|
in a whole offer**. Actual appearance depends on all eligible candidates, their
|
||||||
|
weights, the number of slots, and sampling without replacement. If there are only
|
||||||
|
three eligible candidates and three slots, all three appear regardless of weights;
|
||||||
|
do not present the table as an appearance guarantee in that situation.
|
||||||
|
|
||||||
|
Apply the factor to that candidate's primary beneficial axis after checking hard
|
||||||
|
eligibility and alongside the master draft's behavior/context/preference weights.
|
||||||
|
Do not suppress every positive movement candidate because one trait is low.
|
||||||
|
Its paired drawback is not a second multiplicative suppression. Net inherited
|
||||||
|
reductions count regardless of which adaptation produced them, not the number
|
||||||
|
of historical "negative clicks". Do not impose an extra probability reduction
|
||||||
|
merely for being above 100; any upper-bound or advanced-body rule needs separate review.
|
||||||
|
|
||||||
|
The factor follows the inherited plan through succession and changes when the
|
||||||
|
underlying index changes; it does not expire after several offers. This differs
|
||||||
|
from transient decline preferences, which still decay. It applies to mutation
|
||||||
|
opportunities for the offspring plan, not temporary performance lost to current,
|
||||||
|
temperature, energy starvation, growth, or damage.
|
||||||
|
|
||||||
|
Complete loss requires a distinct acquisition option. First acquisition of a
|
||||||
|
capability the founder never had is not automatically penalized as a below-baseline
|
||||||
|
defect. Reacquiring a deliberately shed propulsion module can use the proposed
|
||||||
|
10% floor, subject to a viable supported recipe; no requirement to swim first may
|
||||||
|
make a nonpropelling lineage permanently ineligible. Ordinary and alternate viable
|
||||||
|
strategies must remain available. This does not guarantee a recovery option on
|
||||||
|
the next offer, reset a body, refund its costs, or grant a free reroll.
|
||||||
|
|
||||||
|
Both the quadratic shape and 10% floor are initial tuning proposals, not accepted
|
||||||
|
probabilities. The intended consequence is commitment that becomes harder to
|
||||||
|
reverse, without a permanent hidden class lock. Preview that consequence alongside
|
||||||
|
large reductions and removal. Frequent offers are important here: a low recovery
|
||||||
|
weight must not produce an unusable session-length wait or invalidate the overall
|
||||||
|
30-60-minute cellular pacing target. Measure the long tail, not only average draws.
|
||||||
|
|
||||||
|
## 3. Revised movement mutations 001-010
|
||||||
|
|
||||||
|
These ten draft entries are **proposals for review**, not ten approved mechanics
|
||||||
|
or mandatory movement unlocks. Changes to 006 and 008 below are proposed replacements
|
||||||
|
for options that lacked a distinct movement purpose. The numeric matrix above
|
||||||
|
provides trial percentage steps; no price, final derived movement equation, or
|
||||||
|
qualified balance is selected. IDs are discussion references, not runtime operator IDs.
|
||||||
|
|
||||||
|
| ID | Movement candidate | Review disposition |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 001 | Strong propulsion | Core candidate; increases available output with real costs. |
|
||||||
|
| 002 | Economical propulsion | Core candidate; economy versus peak output. |
|
||||||
|
| 003 | Burst propulsion | Conditional on a funded, bounded burst mechanism. |
|
||||||
|
| 004 | Agile steering | Core candidate; steering allocation versus forward output. |
|
||||||
|
| 005 | Straight swimmer | Core candidate; directional streamlining versus maneuverability. |
|
||||||
|
| 006 | Active braking propulsion | Proposed replacement for Current sail. |
|
||||||
|
| 007 | Anchor | Core candidate; player-triggered, holds the cell where the anchor hits. |
|
||||||
|
| 008 | Coasting-biased body | Proposed movement replacement for Food-gradient sensing. |
|
||||||
|
| 009 | Shed independent propulsion | Only for an actually supported stationary/carried role. |
|
||||||
|
| 010 | Specialized colony propulsion | Only if it adds machinery beyond ordinary member propulsion. |
|
||||||
|
|
||||||
|
### Tentative visual indicators
|
||||||
|
|
||||||
|
The maintainer proposed the following starting ideas for recognizing movement
|
||||||
|
adaptations on the cell. They are **visual concepts for review, not strong shape
|
||||||
|
definitions, accepted anatomy, or proof of a particular movement equation**.
|
||||||
|
"Limbs" here means visible cellular appendages; it does not require macroscopic
|
||||||
|
limbs or introduce a fixed species/body class.
|
||||||
|
|
||||||
|
| ID | Initial visual idea | Intended readability |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 001 | More limbs, thicker limbs, or a combination. | A visibly stronger propulsion arrangement. |
|
||||||
|
| 002 | Longer limbs. | A distinct economical-propulsion form. |
|
||||||
|
| 003 | Shorter limbs. | A distinct burst-propulsion form. |
|
||||||
|
| 004 | Additional limbs along the cell's sides. | More lateral steering structures. |
|
||||||
|
| 005 | Small limbs at the cell's front. | A recognizable forward-oriented arrangement. |
|
||||||
|
| 006 | A hook-shaped limb at the back. | A recognizable braking/reversing structure. |
|
||||||
|
|
||||||
|
Front, back, and sides refer to the cell's body orientation, not compass direction
|
||||||
|
or the current's flow direction. Visuals for 007-010 remain open; do not fill them
|
||||||
|
with arbitrary anatomy just to complete the table.
|
||||||
|
|
||||||
|
Frequent percentage steps should produce readable gradual changes where practical;
|
||||||
|
each +5-point selection does not have to add a whole limb. Continuous thickness,
|
||||||
|
length, or arrangement changes and later count thresholds are possible approaches,
|
||||||
|
not selected rules. Preview the difference at useful viewing scale without promising
|
||||||
|
an exact one-to-one mapping from a numeric point to an appendage.
|
||||||
|
|
||||||
|
When adaptations combine, render one coherent resulting body. In particular, 002's
|
||||||
|
longer-limb idea and 003's shorter-limb idea need a combined design: perhaps different
|
||||||
|
appendage roles or a resulting intermediate arrangement. Neither approach is selected
|
||||||
|
here. Opposing edits must not leave contradictory cosmetic layers or continually
|
||||||
|
accumulate disconnected limbs.
|
||||||
|
|
||||||
|
Tie any eventual physical appendage choice to the developed body's actual capacity,
|
||||||
|
mass, and construction recipe. These concept sketches do not add a new fee or assert
|
||||||
|
that the proposed shapes already provide their intended mechanical advantages.
|
||||||
|
Structural changes appear on the offspring that develops them, including immediate
|
||||||
|
succession's new organism; an unchanged parent keeps its existing appearance.
|
||||||
|
Apply the same biological visual rules to NPCs and players, with a before/after
|
||||||
|
preview for the player considering a mutation.
|
||||||
|
|
||||||
|
### 001: Strong propulsion
|
||||||
|
|
||||||
|
- **Mechanism:** enlarge/support propulsion machinery to increase usable output.
|
||||||
|
Speed, acceleration, braking, body load, and E demand follow from that body.
|
||||||
|
- **Reason to choose:** cross currents, intercept food/prey, or escape faster.
|
||||||
|
- **Drawback:** additional construction/upkeep and greater E demand when high
|
||||||
|
output is used. Slow travel does not always pay maximum operating cost.
|
||||||
|
- **Available when:** enlargement changes actual capacity and its physical costs
|
||||||
|
are modeled; no fixed number of prior movement mutations is required.
|
||||||
|
- **Increases chance:** productive long routes, relevant pursuits, useful current
|
||||||
|
crossings where output is limiting.
|
||||||
|
- **Decreases chance:** reliable local feeding, little propulsion use, or construction
|
||||||
|
already being the dominant shortage.
|
||||||
|
|
||||||
|
### 002: Economical propulsion
|
||||||
|
|
||||||
|
- **Mechanism:** configure machinery for efficient sustained swimming at lower
|
||||||
|
maximum output; explicitly define efficiency rather than granting a flat discount.
|
||||||
|
- **Reason to choose:** reach more food per unit of propulsion E and sustain routes.
|
||||||
|
- **Drawback:** weaker pursuit, rapid escape, and upstream performance.
|
||||||
|
- **Available when:** output/efficiency tradeoff actually works. It does not require
|
||||||
|
first becoming inefficient or approaching starvation.
|
||||||
|
- **Increases chance:** propulsion consumes a large share of acquired E during useful
|
||||||
|
travel; repeated ordinary routes do not need maximum output.
|
||||||
|
- **Decreases chance:** repeated peak-output pursuits or necessary strong-current
|
||||||
|
crossings; abundant E makes economy less useful.
|
||||||
|
|
||||||
|
### 003: Burst propulsion
|
||||||
|
|
||||||
|
- **Mechanism:** support a short high-output interval using a defined reserve and
|
||||||
|
machinery capacity. Recovery means funded replenishment, not free timed refilling.
|
||||||
|
- **Reason to choose:** briefly escape a current/predator or intercept a moving cluster.
|
||||||
|
- **Drawback:** burst machinery occupies tissue/resources and high output drains the
|
||||||
|
available reserve rapidly; lower sustained performance than a sustained-output
|
||||||
|
arrangement at comparable construction investment.
|
||||||
|
- **Available when:** the burst capacity, cost, exhaustion, and replenishment work.
|
||||||
|
- **Increases chance:** short useful escapes/interceptions where ordinary output
|
||||||
|
falls short; observed opportunities, not deliberate repeated failed input.
|
||||||
|
- **Decreases chance:** long uninterrupted swimming or lack of E to replenish bursts.
|
||||||
|
|
||||||
|
### 004: Agile steering
|
||||||
|
|
||||||
|
- **Mechanism:** allocate more machinery/geometry to redirecting useful propulsion.
|
||||||
|
- **Reason to choose:** navigate current intersections, track drifting food, and
|
||||||
|
change course around supported obstacles or organisms.
|
||||||
|
- **Drawback:** at comparable investment, less machinery is available for sustained
|
||||||
|
forward propulsion. Turning is not an independent free speed multiplier.
|
||||||
|
- **Available when:** heading/force redirection has real movement consequences.
|
||||||
|
- **Increases chance:** frequent productive turns and close interceptions.
|
||||||
|
- **Decreases chance:** mainly straight travel with little need to redirect.
|
||||||
|
|
||||||
|
### 005: Straight swimmer
|
||||||
|
|
||||||
|
- **Mechanism:** streamline geometry/propulsion along the main travel axis.
|
||||||
|
- **Reason to choose:** reduce directional resistance on long routes.
|
||||||
|
- **Drawback:** poorer tight turning or lateral maneuvering; route commitment matters.
|
||||||
|
- **Available when:** direction-dependent geometry/resistance and turning work.
|
||||||
|
- **Increases chance:** sustained directional foraging, pursuit, or useful current routes.
|
||||||
|
- **Decreases chance:** dense turning/interception demands and frequent route reversal.
|
||||||
|
- **Combination note:** ordinary drift is already free of propulsion expenditure;
|
||||||
|
this must improve relative swimming, not duplicate a with-flow bonus.
|
||||||
|
|
||||||
|
### 006: Active braking propulsion
|
||||||
|
|
||||||
|
- **Mechanism:** allocate machinery to useful opposing/reverse output beyond the
|
||||||
|
founder's ordinary braking capacity. It changes relative velocity, not ambient flow.
|
||||||
|
- **Reason to choose:** stop near food, recover from overshooting, and reverse swimming
|
||||||
|
quickly without waiting for passive slowing.
|
||||||
|
- **Drawback:** additional or reallocated machinery reduces another capacity at matched
|
||||||
|
investment, and using stronger braking consumes E. The exact forward-output versus
|
||||||
|
construction tradeoff must be selected and measured before offering it.
|
||||||
|
- **Available when:** active braking works and improved capacity changes outcomes.
|
||||||
|
- **Increases chance:** productive routes with repeated stopping/reversal demands or
|
||||||
|
overshooting despite useful collection opportunities.
|
||||||
|
- **Decreases chance:** long uninterrupted travel, sufficient ordinary braking, or a
|
||||||
|
viable anchored strategy that seldom moves.
|
||||||
|
- **Restriction:** braking to zero relative speed leaves world drift; it is not free
|
||||||
|
station keeping. Current sail is archived below, not quietly treated as approved.
|
||||||
|
|
||||||
|
### 007: Anchor
|
||||||
|
|
||||||
|
- **Mechanism:** the player triggers the anchor, like dropping a boat anchor. The
|
||||||
|
point it hits becomes the location the cell holds until the player releases it.
|
||||||
|
No prepared surface is required.
|
||||||
|
- **Reason to choose:** stay at a productive fixed site without continuously swimming
|
||||||
|
against the current.
|
||||||
|
- **Drawback:** anchor construction investment, and the cell cannot travel while
|
||||||
|
anchored; release is needed before independent movement. Excessive loads can
|
||||||
|
exceed supported holding capacity.
|
||||||
|
- **Available when:** currents exist so that holding position has value.
|
||||||
|
- **Increases chance:** costly station keeping or repeated drifting away from useful sites.
|
||||||
|
- **Decreases chance:** frequent relocation or still liquid.
|
||||||
|
- **Distinct from logout:** the logout anchor is a lifecycle state (ADR-0177), not 007.
|
||||||
|
|
||||||
|
### 008: Coasting-biased body
|
||||||
|
|
||||||
|
- **Mechanism:** reduce passive slowing through a supported body-resistance arrangement.
|
||||||
|
Recalculate the whole profile; do not grant free extra momentum or a second drag bonus.
|
||||||
|
- **Reason to choose:** preserve relative travel between propulsion intervals.
|
||||||
|
- **Drawback:** slower passive stopping and more overshooting; precise stops may require
|
||||||
|
paid braking. It must differ meaningfully from 005 or the two candidates should merge.
|
||||||
|
Lower drag also raises top speed (accepted); 005 lowers forward drag only.
|
||||||
|
- **Available when:** relative velocity/passive resistance are modeled and changing
|
||||||
|
them has a demonstrable control/energy tradeoff.
|
||||||
|
- **Increases chance:** productive long, open travel with useful propulsion-release intervals.
|
||||||
|
- **Decreases chance:** frequent precise stops, short crowded routes, or repeated uncontrolled
|
||||||
|
overshooting without enough braking capacity.
|
||||||
|
- **Classification:** this is a proposed replacement movement entry; the former food
|
||||||
|
sensor remains a sensing review item, not a forgotten adaptation.
|
||||||
|
|
||||||
|
### 009: Shed independent propulsion
|
||||||
|
|
||||||
|
- **Mechanism:** future offspring omit independent propulsion machinery and its actual
|
||||||
|
construction/upkeep. Their bodies/reserves still exist and require maintenance.
|
||||||
|
- **Reason to choose:** devote resources to feeding, production, or another supported
|
||||||
|
role while stationary or carried by propelling colony members.
|
||||||
|
- **Drawback:** no independent swimming, propulsion braking, or escape. Passive drift
|
||||||
|
remains; being carried is not the ability to choose a new position independently.
|
||||||
|
- **Available when:** propulsion exists and a demonstrated stationary E/material supply
|
||||||
|
or supported carried role makes the resulting offspring viable. Exclude unsupported
|
||||||
|
solitary founders; photosynthesis alone does not supply C/N/P/O.
|
||||||
|
- **Increases chance:** reliable support, useful specialization, and little independent
|
||||||
|
propulsion use.
|
||||||
|
- **Decreases chance:** independent foraging, uncertain transport, depleting local food,
|
||||||
|
or temperature changes requiring relocation.
|
||||||
|
- **Restriction:** 010 is not a required partner unlock. Ordinary propelled neighbors
|
||||||
|
can provide transport where attachment mechanics support it.
|
||||||
|
|
||||||
|
### 010: Specialized colony propulsion
|
||||||
|
|
||||||
|
- **Mechanism:** add dedicated group-propelling machinery beyond ordinary attached
|
||||||
|
member contributions; specify what new capacity the tissue actually provides.
|
||||||
|
- **Reason to choose:** move useful attached mass that ordinary member output struggles
|
||||||
|
to carry, including supported nonpropelling specialists.
|
||||||
|
- **Drawback:** propulsion roles spend E moving other members, occupy material, and
|
||||||
|
sacrifice feeding/other functional capacity. More tissue still adds load.
|
||||||
|
- **Available when:** attached motion/load and differentiated machinery work, with a
|
||||||
|
distinct benefit. Neither shedding movement nor an arbitrary large colony is a
|
||||||
|
prerequisite; required group/body geometry must follow the actual mechanism.
|
||||||
|
- **Increases chance:** useful growing groups with a measured propulsion shortfall.
|
||||||
|
- **Decreases chance:** solitary life, adequate ordinary member output, or insufficient
|
||||||
|
feeding/transport support for a dedicated role.
|
||||||
|
- **Restriction:** ordinary colony movement is baseline attachment behavior, not gated
|
||||||
|
by 010. Coordination/polarity belongs to catalog 078 unless a clearly distinct
|
||||||
|
mechanism justifies both; do not charge twice for the same improvement.
|
||||||
|
|
||||||
|
### Reclassified and archived concepts
|
||||||
|
|
||||||
|
| Previous draft entry | Disposition in this review |
|
||||||
|
| --- | --- |
|
||||||
|
| 006 Current sail | On hold: ordinary cells/bubbles already drift. Reconsider only if it adds a distinct supported benefit and drawback. It is not accepted merely because currents now exist. |
|
||||||
|
| 008 Food-gradient sensing | Reclassified as sensing, retained here as an archived concept pending that category's review. No new catalog ID is assigned, and it is not a propulsion modifier. |
|
||||||
|
|
||||||
|
Basic cellular visual cues, including the current/thermal environment, are already
|
||||||
|
promised to every player in the region draft. A future food sensor must add useful
|
||||||
|
information beyond those cues within a defined perception model. Do not reintroduce
|
||||||
|
it just to refill a movement slot. The master catalog retains 150 indexed entries;
|
||||||
|
archived concepts are not additional approved mutations or runtime IDs.
|
||||||
|
|
||||||
|
## 4. Food, temperature, reproduction, and colony integration
|
||||||
|
|
||||||
|
- Loose food follows flow. Passing cells also induce short-lived food drift with
|
||||||
|
spatial falloff and temporal decay, as recorded in the region draft. The driving
|
||||||
|
velocity, influence radius, multiple-cell combination, and work budget remain open.
|
||||||
|
- Food collection does not automatically slow the cell. High-speed crossing needs
|
||||||
|
conservative contact detection so neither food nor organisms are skipped.
|
||||||
|
- Existing food identities and E/C/N/P/O remain finite while moving; circulating,
|
||||||
|
disturbed, or visually clustered food does not duplicate stock.
|
||||||
|
- Temperature contributes to survival E use through the region draft's three-temperature
|
||||||
|
model. Cold/heat adaptations can affect handling/support, but do not automatically
|
||||||
|
change movement stats without a defined coupling.
|
||||||
|
- Evolve now versus Prepare offspring follows the master mutation draft. Structural
|
||||||
|
propulsion/body changes develop in offspring; current-cell experience uses funded
|
||||||
|
division and immediate one-way succession, not free parent reconstruction.
|
||||||
|
- Offspring size/reserves influence actual load, capacity, and survival. A fixed-founder
|
||||||
|
percentage preview must not promise that a newly divided small body performs exactly
|
||||||
|
like a reference adult.
|
||||||
|
- The first birth must not require a movement mutation, a colony unlock, or a specific
|
||||||
|
random draw. Useful movement and flow routes must support the three-minute target.
|
||||||
|
- NPCs and players obey the same movement/resource rules. Offline controlled organisms
|
||||||
|
do not acquire passive drift, feeding, mutations, or thermal catch-up. After the logout
|
||||||
|
delay the cell is anchored, protected, and frozen (ADR-0177); it resumes with its
|
||||||
|
frozen velocity and heading.
|
||||||
|
|
||||||
|
## 5. Implementation boundaries and future verification
|
||||||
|
|
||||||
|
This is documentation, not authorization to implement these systems during review.
|
||||||
|
The new profile changes the current public motion/state model. Before code changes,
|
||||||
|
define versions, units, ranges, rounding, tick order, source/work accounting, contact,
|
||||||
|
perception, replay, persistence, migration, and lifecycle semantics. Do not silently
|
||||||
|
reinterpret earlier speed-only genomes, motion traces, or founder baselines.
|
||||||
|
|
||||||
|
Keep headless biology/world logic independent of graphics, transport, databases,
|
||||||
|
and Kubernetes. Client interpolation is presentation, not authority over motion.
|
||||||
|
No fluid dependency, placeholder service, or World0 operation is introduced here.
|
||||||
|
|
||||||
|
Later checks must cover:
|
||||||
|
|
||||||
|
- No-flow, with-flow, against-flow, cross-flow, intersections, and entry/exit behavior.
|
||||||
|
- Propulsion output costs, passive slowing, active braking, and funded station keeping.
|
||||||
|
- Combined body arrangements, directional drag, limits, no-op rejection, and fair previews.
|
||||||
|
- Exhausted E, zero propulsion, anchored roles, attachment release, and ordinary group load.
|
||||||
|
- Food contact at speed, passing-cell disturbance, finite stock, and stable contention.
|
||||||
|
- Deterministic continuation through restore, retry, and differently partitioned batches.
|
||||||
|
- Valid references/IDs and shared NPC/player biological presentation.
|
||||||
|
- Playtested founder handling, active feeding, first-birth time, and useful mutation tradeoffs.
|
||||||
|
- Frequent small-step offers, fixed-reference arithmetic, paired body allocation,
|
||||||
|
below-baseline recovery weights, and viable reacquisition after loss.
|
||||||
|
- Recovery-offer tail times across extreme specialization without making reversal
|
||||||
|
guaranteed or trapping ordinary active players beyond the intended stage length.
|
||||||
|
|
||||||
|
Unselected balancing choices include the founder's future absolute quantities,
|
||||||
|
output-cost curve, braking controls, limits on mutation effects, exact recipes,
|
||||||
|
005/008 distinctness, 006's machinery tradeoff, and 010's extra group machinery.
|
||||||
|
All must be concrete before candidates become implemented offers. The trial 5/2-point
|
||||||
|
matrix, module scaling, 20-30-second cadence, and quadratic recovery factor also
|
||||||
|
require review and measured balancing; documenting them does not qualify them.
|
||||||
|
|
||||||
|
Document checks for this segment verify source/reference targets, ten unique
|
||||||
|
movement draft IDs, consistent master-index links, unchanged 011-150 entries,
|
||||||
|
and Markdown/whitespace structure. They do not claim executed C++ tests or
|
||||||
|
qualified movement/flow behavior.
|
||||||
@@ -0,0 +1,694 @@
|
|||||||
|
# Cellular mutation draft
|
||||||
|
|
||||||
|
Status: discussion draft, 2026-10-21. No runtime rules, public contracts, schemas,
|
||||||
|
live regions, or implementation milestones are changed by this document.
|
||||||
|
|
||||||
|
## Purpose and authority
|
||||||
|
|
||||||
|
Design a cellular opening about reproduction, ecological consequences, and early
|
||||||
|
colonies. Solitary bubble collection must quickly lead to something new to do.
|
||||||
|
This catalog contains **150 candidate adaptations**, not 150 features required
|
||||||
|
for the first playable release. Every option needs a reason to choose it, a real
|
||||||
|
drawback, and understandable conditions for appearing.
|
||||||
|
|
||||||
|
The maintainer's pacing direction from the discussion is:
|
||||||
|
|
||||||
|
- First funded bud within about **three minutes of active, purposeful play**.
|
||||||
|
- Several births quickly establish visible life around the player.
|
||||||
|
- Around **five successful buds**, attachment/colony opportunities become much
|
||||||
|
more likely. Five is a proposed tuning point, not an accepted hard unlock.
|
||||||
|
- A player pursuing progression should have an opportunity to move beyond
|
||||||
|
solitary cellular play in about **30 minutes**, with roughly **one hour** as
|
||||||
|
the outer target rather than an enforced waiting period.
|
||||||
|
- Remaining unicellular can be viable. No mandatory species class, intelligence
|
||||||
|
endpoint, or fixed cell-to-animal ladder is introduced.
|
||||||
|
|
||||||
|
The catalog, numeric offer tuning, eligibility details, and bad-luck protection
|
||||||
|
below remain proposals. They must not silently become accepted game rules.
|
||||||
|
|
||||||
|
Read this draft alongside:
|
||||||
|
|
||||||
|
- [Project vision](docs/PROJECT_VISION.md).
|
||||||
|
- [Genome and development model](docs/biology/GENOME_MODEL.md).
|
||||||
|
- [Energy and matter accounting](docs/biology/ENERGY_MODEL.md).
|
||||||
|
- [Behavior-weighted evolution and colonies proposal](docs/adr/0135-behaviour-driven-evolution-and-colonies.md).
|
||||||
|
- [Structural inheritance and succession](docs/adr/0163-structural-inheritance-and-offspring-succession.md).
|
||||||
|
- [Retained offspring plans](docs/adr/0165-retained-cellular-offspring-plans.md).
|
||||||
|
- [Environmental ownership and compartments](docs/adr/0172-cellular-environment-ownership.md).
|
||||||
|
- [Photosynthesis producers](docs/adr/0175-photosynthesis-producers.md).
|
||||||
|
|
||||||
|
The existing colony proposal contains historical provisional rules and policy
|
||||||
|
choices. Linking it does not adopt its colony ownership, death, logout, or
|
||||||
|
coalescence details. Those need reconciliation with later accepted requirements.
|
||||||
|
|
||||||
|
## Mutation costs and expression
|
||||||
|
|
||||||
|
Recommended starting policy: **no separate resource fee to select a mutation**.
|
||||||
|
Earned opportunities create choices; actually building a changed organism spends
|
||||||
|
resources. This is consistent with the offspring-plan selection mode described
|
||||||
|
in ADR-0165, not a claim that every historical mutation mode already works so.
|
||||||
|
|
||||||
|
Separate four kinds of cost:
|
||||||
|
|
||||||
|
| Cost | Meaning |
|
||||||
|
| --- | --- |
|
||||||
|
| Construction | Energy, C, N, P, and Other Matter transferred into actual tissue at development/birth. |
|
||||||
|
| Operation | Energy and any substrates consumed while a capability operates. |
|
||||||
|
| Maintenance | Upkeep of tissue that actually exists; do not invent upkeep for an unexpressed plan. |
|
||||||
|
| Specialization | Physical capacity, performance, habitat access, or independence surrendered elsewhere. |
|
||||||
|
|
||||||
|
A drawback must arise from a specified mechanism. Do not charge every mutation
|
||||||
|
an arbitrary flat energy penalty. A resource-poor organism can select an expensive
|
||||||
|
offspring plan without being able to build it immediately; show the additional
|
||||||
|
requirements and permit revising the plan through subsequent earned choices.
|
||||||
|
Do not make the three-minute first bud depend on acquiring a particular mutation.
|
||||||
|
|
||||||
|
Structural changes affect future offspring, not the parent's existing anatomy.
|
||||||
|
Removing a structure avoids building it in future offspring; it does not refund
|
||||||
|
the parent's current body. Live physiological adjustment, damage, and ordinary
|
||||||
|
growth need separate expression classifications. Birth-time succession remains
|
||||||
|
one-way; nothing here grants possession of independent relatives or rescue after
|
||||||
|
death. New autonomous NPC mutations are outside this draft's authorization.
|
||||||
|
|
||||||
|
## Two mutation routes: evolve now or prepare offspring
|
||||||
|
|
||||||
|
Discussion addition, 2026-10-21: offer two ways to commit an earned adaptation.
|
||||||
|
The current-cell route gives immediate experience at the cost of dividing now;
|
||||||
|
the offspring route lets the player observe a genetic direction before committing
|
||||||
|
their controlled organism to it. This section records design intent and a proposed
|
||||||
|
resolution through offspring succession, not implemented reproduction rules.
|
||||||
|
|
||||||
|
| | Evolve now (current-cell experience) | Prepare offspring |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Trigger | Select the adaptation and perform a viable funded division now. | Select a heritable plan, then choose when to reproduce. |
|
||||||
|
| Player control | Continue immediately as the newly developed mutated offspring. | Keep playing the unchanged parent; a newborn can become the controlled organism at a later birth. |
|
||||||
|
| Main benefit | Immediate experience of the adaptation, with another organism added to the habitat. | Observe autonomous offspring and evaluate whether that genetic direction suits the habitat. |
|
||||||
|
| Main drawback | Commit to a smaller organism with fewer reserves and the adaptation's consequences immediately. | No immediate experience of the changed body; gather, reproduce, and evaluate before transferring control. |
|
||||||
|
| Body and reserves | Start from roughly half the dividing organism's mass and resources, subject to viable allocation and actual development costs. | Transfer the funded offspring investment when reproduction is initiated; retain the parent's remaining body and reserves. |
|
||||||
|
| Changing direction | Earn another suitable adaptation to shed, replace, or counter the trait; fund another viable development event. | Revise the future-offspring plan through subsequent earned choices; existing offspring retain their actual inherited forms. |
|
||||||
|
|
||||||
|
### Immediate division and identity
|
||||||
|
|
||||||
|
For the current-cell experience, the player continues as the **mutated half**;
|
||||||
|
the unchanged half becomes independent wildlife, or remains attached where supported.
|
||||||
|
"Unchanged" means retaining the established traits, not retaining full original
|
||||||
|
mass and reserves after those have been divided.
|
||||||
|
|
||||||
|
For structural changes, interpret this as **division plus immediate one-way
|
||||||
|
offspring succession**, rather than rebuilding the existing adult. The unchanged
|
||||||
|
organism retains the original permanent identity and expressed developmental basis;
|
||||||
|
the mutated offspring has a new identity and its actual inherited plan. The
|
||||||
|
relinquished organism keeps its established behavior and selected reproductive
|
||||||
|
plan, separately from its unchanged expressed traits, as required by ADR-0163.
|
||||||
|
No control can return to it after transfer or after the controlled offspring dies.
|
||||||
|
|
||||||
|
The roughly half-and-half allocation is a starting design target, not a rule that
|
||||||
|
every nutrient must be split blindly when that makes either body invalid. Specify
|
||||||
|
actual tissue partitioning, viable size, reserves, placement, and development costs
|
||||||
|
before implementation. This needs an explicit division contract; existing budding
|
||||||
|
semantics must not be silently reinterpreted as division.
|
||||||
|
|
||||||
|
The resources the player gives up remain in the other organism. They are not a
|
||||||
|
mutation fee or destroyed stock. Development work can consume E into heat, and
|
||||||
|
material changes must account for every channel. Two full-sized, fully stocked
|
||||||
|
cells cannot emerge from one without additional funded growth.
|
||||||
|
|
||||||
|
An adaptation that cannot currently fund a viable division may be prepared for
|
||||||
|
later; **Evolve now** must not create missing tissue or force an invalid split.
|
||||||
|
Show why it is unavailable, without hiding the adaptation from the planning route.
|
||||||
|
|
||||||
|
Immediate commitment is consequential: disliking a trait does not grant a free
|
||||||
|
undo, guaranteed shed offer, or free reconstruction. The player must survive,
|
||||||
|
gather what the replacement body needs, and earn a useful subsequent choice.
|
||||||
|
Reversal opportunities must nevertheless remain discoverable under the weighting
|
||||||
|
and preference-decay rules; a bad fit must not become a permanent hidden class lock.
|
||||||
|
|
||||||
|
### Testing a lineage through offspring
|
||||||
|
|
||||||
|
The prepared route is:
|
||||||
|
|
||||||
|
1. Earn and select an adaptation for the offspring plan without rebuilding the parent.
|
||||||
|
2. Gather the resources and choose a useful time/location to reproduce.
|
||||||
|
3. Keep control of the parent and watch the actual offspring feed, move, survive,
|
||||||
|
and interact under its inherited traits.
|
||||||
|
4. Keep or revise the retained plan for subsequent births.
|
||||||
|
5. At a later birth, optionally continue as that newborn and relinquish the parent.
|
||||||
|
|
||||||
|
The later control choice concerns a **newborn at that birth**, not possession of an
|
||||||
|
older offspring observed earlier. Observing a successful sibling reduces uncertainty;
|
||||||
|
it does not guarantee that the next offspring will survive changed conditions.
|
||||||
|
Later plan revisions never rewrite an already born organism.
|
||||||
|
|
||||||
|
The parent does not keep the offspring's allocated material. The advantage is
|
||||||
|
retaining a familiar body and controlling the timing of investment, rather than
|
||||||
|
avoiding reproduction costs. A plan can also be selected solely to produce useful
|
||||||
|
autonomous descendants, with no obligation to transfer player control.
|
||||||
|
|
||||||
|
### Cost of divergence from the parent
|
||||||
|
|
||||||
|
Offspring may cost more when expressing a different body requires more construction,
|
||||||
|
reorganization, or provisioning. Price those requirements directly rather than
|
||||||
|
charging an arbitrary amount for each different trait:
|
||||||
|
|
||||||
|
| Difference | Proposed cost consequence |
|
||||||
|
| --- | --- |
|
||||||
|
| Small pigment or regulatory adjustment | Modest cost only where the actual recipe or developmental work changes. |
|
||||||
|
| New propulsion, shell, or other machinery | Fund the required material, assembly E, and relevant newborn operating reserves. |
|
||||||
|
| Changed body layout | Additional developmental work where supported, even if final mass is similar; quantify it rather than inventing a complexity tax. |
|
||||||
|
| Removal or simplification | May make offspring cheaper by avoiding tissue construction and upkeep. |
|
||||||
|
| Several interdependent changes | Account for the resulting integrated body once; do not charge for shared tissue repeatedly or count plan-edit history as anatomy. |
|
||||||
|
|
||||||
|
Division transfers existing material into resulting organisms; it must not also
|
||||||
|
charge the full cost of building that same transferred material from nothing.
|
||||||
|
Any breakdown/reassembly work and losses need an explicit funded model. Do not
|
||||||
|
automatically reuse the old budding bill for the proposed division route.
|
||||||
|
|
||||||
|
Preview both resulting organisms, E/C/N/P/O allocations, actual changed traits,
|
||||||
|
construction requirements, and which organism the player will control. Distinguish
|
||||||
|
estimated future operating budgets from guaranteed survival. Experimenting with a
|
||||||
|
divergent offspring must remain affordable enough to support the early pacing target.
|
||||||
|
|
||||||
|
### Ordinary reproduction and colony growth
|
||||||
|
|
||||||
|
Division remains possible **without a mutation**; random offers and declines must
|
||||||
|
not gate the first three-minute birth or the ability to populate the habitat.
|
||||||
|
Mutation selection also need not force an immediate split: the prepared route
|
||||||
|
exists for players gathering resources, travelling, or avoiding danger.
|
||||||
|
|
||||||
|
Proposed early default: ordinary division separates similar offspring; a selected
|
||||||
|
adaptation changes the new offspring; retained attachment keeps the resulting cells
|
||||||
|
together. Further adaptations support transport and specialized colony roles.
|
||||||
|
Budding can remain an alternative reproductive strategy rather than being removed
|
||||||
|
from every lineage.
|
||||||
|
|
||||||
|
The catalog's existing "bud/budding" wording is retained while the maintainer
|
||||||
|
reviews its 150 entries. Read the pacing targets here as **first funded birth**
|
||||||
|
(division in this proposed early default). Catalog adaptations that affect offspring
|
||||||
|
size, provisioning, or birth rate need explicit compatibility with division versus
|
||||||
|
budding; this note does not silently apply historical budding rules to division.
|
||||||
|
Avoid a mandatory regrow-to-full waiting period after each split, while retaining
|
||||||
|
minimum viable bodies and real material/energy requirements for further births.
|
||||||
|
|
||||||
|
## Resources and producer rules
|
||||||
|
|
||||||
|
Abbreviations: **E** = usable energy, **C** = carbon, **N** = nitrogen,
|
||||||
|
**P** = phosphorus, **O** = Other Matter. Here **O never means oxygen**.
|
||||||
|
|
||||||
|
Energy is not matter. Light-powered organisms may make nutrients accessible by
|
||||||
|
processing an environmental material source, not by turning sunlight into C/N/P/O.
|
||||||
|
For example, real photosynthesis uses light while drawing carbon from carbon
|
||||||
|
dioxide: [NASA carbon-cycle explanation](https://science.nasa.gov/earth/earth-observatory/the-carbon-cycle/).
|
||||||
|
The game can simplify chemistry without manufacturing conserved elements.
|
||||||
|
|
||||||
|
Every proposed producer must name its source, work cost, useful output, losses,
|
||||||
|
and environmental debit or recorded boundary import. A source does not exist
|
||||||
|
merely because an organism has the relevant mutation. Dissolved uptake, gases,
|
||||||
|
mineral extraction, and secretion require their own supported processes; existing
|
||||||
|
environmental compartments are not automatically edible. Other Matter is not a
|
||||||
|
wildcard that can be relabeled as C, N, or P.
|
||||||
|
|
||||||
|
Three different designs must remain distinct:
|
||||||
|
|
||||||
|
1. **Lower nutrient demand:** a different tissue recipe needs less of a channel.
|
||||||
|
2. **No need to collect that nutrient's bubbles:** obtain it through environmental
|
||||||
|
processing, recycling, prey, or a partner instead.
|
||||||
|
3. **No use of that nutrient at all:** an explicit alternative body chemistry with
|
||||||
|
fully specified replacement material and capability consequences. This larger
|
||||||
|
proposal is not approved by this catalog.
|
||||||
|
|
||||||
|
Recycling reduces replacement demand; it cannot supply the missing net material
|
||||||
|
for unlimited new offspring. Secretion transfers real resources out of the donor.
|
||||||
|
Giving nutrients to a neighbor does not duplicate either organism's inventory.
|
||||||
|
|
||||||
|
## When an offer is earned
|
||||||
|
|
||||||
|
**Offer timing is different from which options can appear.** The following is an
|
||||||
|
initial playtest proposal, not a timer the player should wait beside a pool:
|
||||||
|
|
||||||
|
- Aim for the first meaningful offer after roughly 45-60 seconds of active play,
|
||||||
|
then about one useful decision per 60-90 seconds of productive activity.
|
||||||
|
- Earn bounded activity credit through net useful food gathering, purposeful
|
||||||
|
travel with feeding/discovery, successful births, or relevant ecological
|
||||||
|
interactions. Contributions and thresholds need measurement before acceptance.
|
||||||
|
- Repeated failed budding, empty swimming loops, toggling inputs, and passing the
|
||||||
|
same empty location do not generate unlimited credit. Count outcomes, not clicks.
|
||||||
|
- Viable stationary producers can earn credit from actual capture, nutrient use,
|
||||||
|
births, and interactions. Moving is not the only legitimate activity.
|
||||||
|
- AFK camping, passive elapsed session time, and an offline player organism do
|
||||||
|
not earn progression. Defining engaged stationary play without intrusive input
|
||||||
|
requirements remains an open design/measurement question.
|
||||||
|
- Keep an earned offer available while the player navigates. No forced pause,
|
||||||
|
countdown dismissal, or need to inspect a menu during danger.
|
||||||
|
- Start by showing up to three distinct choices. A decline does not spend matter
|
||||||
|
and does not immediately reroll the offer. The next earned opportunity can draw
|
||||||
|
again. Exact cadence must avoid making a decline another long wait.
|
||||||
|
|
||||||
|
## Availability versus probability
|
||||||
|
|
||||||
|
### Hard availability checks
|
||||||
|
|
||||||
|
An option enters the eligible pool only when:
|
||||||
|
|
||||||
|
1. Its benefit, drawback, required resource processes, and presentation actually
|
||||||
|
work under the region's rules. An unimplemented thermal system means no thermal
|
||||||
|
offers, including supposedly beneficial shedding of unused tolerance.
|
||||||
|
2. Required anatomy is present in the offspring plan or supplied by the same
|
||||||
|
explicitly defined adaptation. A removal option requires something to remove.
|
||||||
|
3. The change is within the plan's supported bounds, has a nonzero effect, and
|
||||||
|
does not invalidate a dependent structure without a disclosed replacement.
|
||||||
|
4. Any required colony role, partner exchange, environmental source, or substrate
|
||||||
|
is supported and plausibly accessible. Use perceived/recorded context, not
|
||||||
|
hidden map knowledge. Row conditions referring to a habitat include a known,
|
||||||
|
reachable habitat, not only the precise spot occupied this tick.
|
||||||
|
5. There is an understandable survival strategy for the resulting offspring.
|
||||||
|
Do not offer shed-movement to an isolated feeder with no workable stationary
|
||||||
|
or carried role. This is a useful-context filter, not a promise of survival.
|
||||||
|
|
||||||
|
Resource affordability is shown separately from eligibility. Do not hide the
|
||||||
|
adaptation that solves a shortage because that same shortage makes it temporarily
|
||||||
|
unaffordable. Do not require injury, starvation, or five births to discover every
|
||||||
|
basic defensive, efficient, or colony adaptation. Those are weighting signals.
|
||||||
|
|
||||||
|
### Soft weighting proposal
|
||||||
|
|
||||||
|
For each eligible option, start with:
|
||||||
|
|
||||||
|
`weight = clamp(base * behavior * context * preference * direction, floor, cap)`
|
||||||
|
|
||||||
|
| Factor | Initial trial range | Purpose |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Base | 100 | A neutral eligible adaptation remains discoverable. |
|
||||||
|
| Behavior | 1-3x | Recent relevant outcomes increase related opportunities. |
|
||||||
|
| Context | 0.5-2x | Current scarcity, crowding, threats, and known habitats affect usefulness. |
|
||||||
|
| Preference | 0.5-1.5x | Recent accept/decline feedback nudges individual options, without permanent bans. |
|
||||||
|
| Direction | 1-3x | Sustained pursuit, especially early budding, supports a chosen direction. |
|
||||||
|
| Final floor/cap | 10 / 2000 | Keep alternatives possible and limit runaway preference loops. |
|
||||||
|
|
||||||
|
These are **relative sampling weights, not percentage probabilities**. Normalize
|
||||||
|
against the actual eligible pool; draw without replacement. Use at most the
|
||||||
|
strongest applicable signal inside each factor, rather than multiplying every
|
||||||
|
similar event. Repeatedly accepting a family must not create unbounded compounding.
|
||||||
|
|
||||||
|
Use a bounded window of approximately 90 seconds of active context, plus a few
|
||||||
|
explicit retained milestones. Long-past behavior should not trap a lineage in
|
||||||
|
one strategy. Soft preference suppression decays toward neutral over about five
|
||||||
|
subsequent earned offers; reacquisition remains possible after shedding a trait.
|
||||||
|
All durations and ranges need playtesting. Inheritable adaptation is separate
|
||||||
|
from whether transient preferences/context should carry through succession.
|
||||||
|
|
||||||
|
The row's **increases chance** and **decreases chance** columns are proposals for
|
||||||
|
these signals. Neither overrides a hard prerequisite. No listed decrease sets an
|
||||||
|
otherwise useful eligible adaptation permanently to zero. Dangerous behavior is
|
||||||
|
not required to qualify, and deliberately taking damage must not be the fastest
|
||||||
|
way to farm defensive offers. Only actual observed deficits or interactions count.
|
||||||
|
|
||||||
|
Explain the main reason in the UI, for example: "More likely because your recent
|
||||||
|
births were limited by phosphorus." Do not expose a fake exact probability when
|
||||||
|
the eligible pool changes. A later implementation must retain bounded authoritative
|
||||||
|
context and deterministic recorded draws; reconnects/retries cannot reroll them.
|
||||||
|
|
||||||
|
### Budding and colony opportunity protection
|
||||||
|
|
||||||
|
- Attachment can appear before the fifth bud. It is not locked behind a badge.
|
||||||
|
- Proposed direction multipliers: after one successful active controlled birth,
|
||||||
|
1.5x; three, 2x; five, 3x for relevant eligible colony opportunities.
|
||||||
|
- Count actual funded births along the controlled succession path. Carry that
|
||||||
|
bounded milestone through one-way succession without duplicating it; never use
|
||||||
|
account age or all births from autonomous/offline relatives as earned credit.
|
||||||
|
- After five births, if two earned offers provide no colony entry option, reserve
|
||||||
|
one slot in the next earned offer for a useful eligible entry adaptation, such
|
||||||
|
as retained daughter attachment. This is proposed bad-luck protection, not an
|
||||||
|
automatic selection, free attached cell, or guaranteed survival.
|
||||||
|
- If no entry option is eligible because required mechanics are absent, explain
|
||||||
|
that limit in the playtest report. Probability tuning cannot fix missing colony
|
||||||
|
gameplay or justify claiming the 30-minute progression target is met.
|
||||||
|
- Independent-cell strategies remain available. Declining colony direction can
|
||||||
|
suppress its reserved slot temporarily through the same decaying preference
|
||||||
|
mechanism; it does not ban future colonies.
|
||||||
|
|
||||||
|
### Catalog reading guide
|
||||||
|
|
||||||
|
IDs **001-100 preserve the discussion's original ordering**; 101-150 extend it.
|
||||||
|
These are draft reference IDs, **not runtime mutation/operator IDs**.
|
||||||
|
|
||||||
|
Every row assumes the global hard checks above. "Available when" names its extra
|
||||||
|
prerequisites, not an assertion that the feature is implemented today. All rows
|
||||||
|
remain design candidates; especially currents, sensing, damage/repair, chemical
|
||||||
|
processing, colony transport, specialized tissues, dormancy, and environmental
|
||||||
|
hazards require supporting mechanics before their offers can ship.
|
||||||
|
|
||||||
|
The two chance columns describe observed recent activity/context, not mandatory
|
||||||
|
quests. A cost saving must correspond to actual tissue, work, or recipe changes.
|
||||||
|
If balancing cannot demonstrate both the benefit and drawback, revise or remove
|
||||||
|
the option rather than inventing a tooltip explanation.
|
||||||
|
|
||||||
|
## 001-010: Movement and navigation
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 001 | Strong propulsion | Reach food and escape pursuit faster. | More E at high propulsion output. | Functional propulsion can be enlarged. | Long food trips; observed pursuits. | Feeding locally; propulsion seldom used. |
|
||||||
|
| 002 | Economical propulsion | Travel farther on limited E. | Lower maximum speed. | Propulsion has an economy/speed tradeoff. | Movement consumes much of acquired E. | Frequent chases require peak speed. |
|
||||||
|
| 003 | Burst propulsion | Briefly escape or intercept prey. | Depletes a limited burst reserve; weak sustained performance. | Propulsion and bounded burst storage work. | Short pursuits; repeated near interceptions. | Long uninterrupted travel. |
|
||||||
|
| 004 | Agile steering | Navigate dense bubbles and obstacles. | Less straight-line propulsion capacity. | Turning dynamics affect movement. | Productive routes require frequent turns. | Open, straight travel. |
|
||||||
|
| 005 | Straight swimmer | Cross open areas efficiently. | Wide turns hinder close maneuvering. | Body shape affects steering and drag. | Long straight feeding routes. | Dense obstacles; close turning. |
|
||||||
|
| 006 | Current sail | Travel using environmental flow. | Difficult upstream movement and precise positioning. | Perceivable currents and sail drag work. | Useful downstream foraging. | Still water; repeated upstream routes. |
|
||||||
|
| 007 | Surface anchor | Hold a productive location in flow. | Material investment; release needed before travel. | Suitable surfaces and anchoring work. | Productive local feeding disrupted by flow. | Frequent relocations; no useful surfaces. |
|
||||||
|
| 008 | Food-gradient sensing | Locate promising food before contact. | Sensory tissue consumes E and N. | Perceivable food gradients and sensing work. | Searches between discovered clusters. | Food is continuously within contact. |
|
||||||
|
| 009 | Shed independent propulsion | Cheaper stationary or carried offspring. | Cannot independently relocate or escape. | Propulsion exists; supported stationary/carried survival is plausible. | Producer surplus; reliable colony transport. | Independent travel; insufficient stationary intake. |
|
||||||
|
| 010 | Colony propulsion | Move several attached cells together. | Propulsion cells carry others and sacrifice feeding capacity. | Attached members and force transmission work. | Growing group struggles to move. | Solitary life; already ample group propulsion. |
|
||||||
|
|
||||||
|
## 011-020: Feeding and engulfing
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 011 | Broad collection fringe | Touch more bubbles per pass. | More drag and exposed footprint. | Collection geometry affects contact. | Many nearby bubbles missed during passes. | Narrow gaps; frequent predator contact. |
|
||||||
|
| 012 | Concentrated intake | Drain rich clusters quickly. | Large machinery; little advantage between clusters. | Intake capacity has a tissue/work cost. | Contact feeding repeatedly hits its rate limit. | Deposits empty before intake capacity is used. |
|
||||||
|
| 013 | Generalist digestion | Use diverse food sources. | More machinery; lower specialist throughput. | At least two mechanically distinct food substrates exist. | Useful mixed diets. | One reliable substrate dominates feeding. |
|
||||||
|
| 014 | Selective intake | Collect a limiting nutrient without unwanted loading. | Reduced collection of other resources. | Resource-specific uptake and storage limits work. | One shortage despite other surpluses. | Several channels simultaneously scarce. |
|
||||||
|
| 015 | Detritus digestion | Use remains other cells process poorly. | Slow processing displaces fresh-food machinery. | Detritus differs meaningfully from fresh food. | Repeated successful scavenging. | Fresh food dominates; little detritus observed. |
|
||||||
|
| 016 | Expanding engulfment chamber | Capture larger prey relative to body size. | Reduced movement while occupied. | Engulfment volume and occupied-state costs work. | Suitable prey just beyond chamber capacity. | Feeding mostly on bubbles. |
|
||||||
|
| 017 | Armor digestion | Extract resources from protected prey. | Costly machinery; poor throughput on ordinary food. | Armor and substrate-specific digestion work. | Encounters with edible armored organisms. | Soft prey and bubbles dominate. |
|
||||||
|
| 018 | Prey retention | Keep captured prey from escaping. | Holding structures add mass and reduce feeding space. | Capture and escape are distinct supported outcomes. | Prey escapes during digestion. | Captures already reliably succeed. |
|
||||||
|
| 019 | Shed engulfment apparatus | Cheaper producer or bubble-feeding offspring. | No living prey intake. | Apparatus exists; nonprey feeding supports offspring. | Little prey intake; strong alternative feeding. | Prey supplies an important resource. |
|
||||||
|
| 020 | External digestion | Feed on remains too large to swallow. | Secretion costs material; rivals can steal released food. | Finite digestive secretion and released food are modeled. | Large remains; limited engulfment space. | Few remains; heavy theft of released material. |
|
||||||
|
|
||||||
|
## 021-030: Energy and photosynthesis
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 021 | Acquire photosynthesis | Supplement E without energy bubbles. | Build and maintain light-capturing tissue. | Supported light capture; no photosynthesis in plan. | Lit feeding sites; E limits budding. | Persistently dark known habitat. |
|
||||||
|
| 022 | Expanded photosynthetic tissue | Produce more E in light. | More construction and tissue capacity occupied. | Photosynthesis exists and can expand. | Light capture useful but E still limiting. | Persistent E surplus; N/P construction shortage. |
|
||||||
|
| 023 | Mobile photosynthesis | Capture more light while travelling. | Lower peak stationary capture. | Mobile/stationary producer arrangements differ. | Productive movement by photosynthetic cells. | Successful stationary production. |
|
||||||
|
| 024 | Low-light pigments | Produce E in shade. | Lower maximum bright-light output. | Light intensity and pigment responses differ. | Shaded producer activity. | Consistently bright habitat. |
|
||||||
|
| 025 | Bright-light specialization | High output in exposed habitats. | Weak production in shade. | Distinct light intensity responses work. | Sustained strong light. | Frequent shade or variable illumination. |
|
||||||
|
| 026 | Shed photosynthesis | Remove unused producer costs. | Lose light-derived E. | Producer tissue exists; alternative E source works. | Dark habitat; feeding supplies E. | Light sustains maintenance or births. |
|
||||||
|
| 027 | Thorough energy extraction | Obtain more usable E per food unit. | Slower maximum processing rate. | Food-to-E yield and throughput trade off. | Food scarce; processing capacity underused. | E delivery rate limits abundant feeding. |
|
||||||
|
| 028 | Rapid energy extraction | Deliver E quickly during rich feeding. | Less E extracted per unit; more heat. | Actual yield/throughput tradeoff exists. | Abundant food; burst activity or rapid births. | Food scarcity; heat stress if modeled. |
|
||||||
|
| 029 | Expanded energy storage | Cross food-poor stretches. | Storage tissue and reserves add mass. | E capacity is bounded with physical storage costs. | Alternating abundance and shortages. | Continuous intake; mobility limited by carried mass. |
|
||||||
|
| 030 | Reduced energy storage | Lighter, cheaper offspring. | Shorter survival margin without intake. | E storage above a useful supported minimum exists. | Reliable local intake; costly carried reserves. | Long gaps between food or light. |
|
||||||
|
|
||||||
|
## 031-040: Nutrient demand, storage, and recycling
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 031 | Carbon storage | Bank C for later growth and births. | Extra mass and storage space. | Bounded C storage has a tissue cost. | C-rich visits followed by C-limited births. | C always nearby; other capacity limiting. |
|
||||||
|
| 032 | Nitrogen storage | Carry scarce N between habitats. | More investment and less other storage. | Bounded N storage works. | Intermittent N abundance and shortages. | Constant N supply; N surplus rarely spent. |
|
||||||
|
| 033 | Phosphorus storage | Leave a rare P site without delaying births. | Carried mass without immediate survival benefit. | Bounded P storage works. | Births blocked by P after leaving deposits. | P consistently accessible. |
|
||||||
|
| 034 | Other Matter storage | Bank O for demanding structures. | Competes with other reserve capacity. | O has defined uses and bounded storage. | Intermittent O supply; O-limited construction. | Current body plans use little O. |
|
||||||
|
| 035 | Carbon-thrifty structure | Build offspring using less C. | Reduced mechanical strength. | Alternative structural recipe and strength effects work. | C-limited births. | High contact forces; structural damage. |
|
||||||
|
| 036 | Nitrogen-thrifty machinery | Reproduce in N-poor areas. | Lower peak machinery throughput. | A defined lower-N recipe changes actual capacity. | N shortages; machinery seldom at peak. | Peak feeding/propulsion repeatedly needed. |
|
||||||
|
| 037 | Phosphorus-thrifty development | Lower P cost per offspring. | Lower maximum assembly rate. | Lower-P development has an explicit recipe. | P-limited births. | Rapid assembly is useful; P abundant. |
|
||||||
|
| 038 | Reduced Other Matter dependence | Grow where O is scarce. | Lose performance of O-dependent structures. | Valid lower-O replacement recipe exists. | O blocks development. | O-based protection/support frequently useful. |
|
||||||
|
| 039 | Internal material recycling | Recover part of replaced tissue material. | Recovery machinery costs E; losses remain. | Tissue turnover and recovery transfers work. | Repeated repair/turnover under scarcity. | Little turnover; abundant raw nutrients. |
|
||||||
|
| 040 | Nutrient-retaining membrane | Reduce nutrient leakage. | Slower passive exchange. | Leakage and exchange both have consequences. | Losses worsen a limiting nutrient. | Intake throughput limits productive feeding. |
|
||||||
|
|
||||||
|
## 041-050: Size, shape, and construction
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 041 | Larger adult size | Handle larger prey; resist some engulfers. | More upkeep and reproductive material. | Size changes both costs and interactions. | Useful prey outgrown; larger predators observed. | Reproduction repeatedly resource-limited. |
|
||||||
|
| 042 | Smaller adult size | Lower living and offspring costs. | Smaller reserves; more possible predators. | A smaller viable body is supported. | Scarce food; expensive births. | Large prey important; nearby size-based predation. |
|
||||||
|
| 043 | Elongated body | Spread contact along narrow feeding corridors. | Hard turning; exposed length. | Shape affects collision, feeding, and steering. | Long narrow food paths. | Tight turns; attacks along body. |
|
||||||
|
| 044 | Flattened body | More exposed feeding/light area. | Broad footprint harder to maneuver and protect. | Shape affects capture area and collision. | Surface feeding or light capture useful. | Crowded narrow routes; exposed-surface danger. |
|
||||||
|
| 045 | Rounded body | Compact geometry with less exposed surface. | Less capture/collection area per volume. | Geometry affects protection and exchange. | Surface damage; compact travel routes. | Uptake or light area limits growth. |
|
||||||
|
| 046 | Flexible body | Pass gaps and deform around obstacles. | Lower compression resistance. | Deformation and mechanical damage work. | Productive routes through tight gaps. | Compression or capture threats. |
|
||||||
|
| 047 | Rigid body | Resist deformation and transmit force. | Supporting material; cannot squeeze through gaps. | Rigidity affects mechanics. | Pushing, compression, or stable support useful. | Narrow passages; material-limited births. |
|
||||||
|
| 048 | Lightweight tissue | Move a broad footprint with less mass. | Less strength and contact force. | Density, mass, and strength differ by recipe. | Movement is costly; contact force seldom needed. | Forceful prey capture or collisions. |
|
||||||
|
| 049 | Dense tissue | Resist displacement and exert force. | Costly movement and construction. | Density affects force and material budgets. | Displacement disrupts feeding; force useful. | Long travel; frequent resource shortages. |
|
||||||
|
| 050 | Flexible adult size | Remain small in scarcity, grow in abundance. | Regulation costs; weaker peak specialization. | Bounded growth regulation and recipe costs work. | Repeated feast/famine transitions. | Stable conditions favor one size. |
|
||||||
|
|
||||||
|
## 051-060: Membranes and protection
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 051 | Thick membrane | Resist puncture and applicable engulfment. | More material, upkeep, and mass. | Thickness provides actual protection. | Relevant predators or damage observed. | Safe habitat; membrane cost limits births. |
|
||||||
|
| 052 | Thin membrane | Cheaper, lighter offspring. | Lower protection. | Thinning changes both cost and protection. | Safe productive feeding; material shortage. | Repeated relevant attacks. |
|
||||||
|
| 053 | Protective shell | Survive attacks that soft cells cannot. | Heavy build; restricted expansion and intake openings. | Shell mechanics and feeding restrictions work. | Persistent protection-limited survival. | Fast travel/growth useful; few threats. |
|
||||||
|
| 054 | Stretchable membrane | Expand around food and changing shape. | Weaker against concentrated attacks. | Elasticity affects feeding and protection. | Engulfment/deformation regularly useful. | Puncture-like threats dominate. |
|
||||||
|
| 055 | Permeable membrane | Rapid dissolved nutrient exchange. | Leakage and harmful exposure. | Dissolved uptake and leakage are modeled. | Rich dissolved sources; low hazards. | Toxic exposure; costly nutrient losses. |
|
||||||
|
| 056 | Selective membrane | Retain nutrients and exclude hazards. | Active transport E and lower peak exchange. | Selective transport processes work. | Leakage or contamination limits feeding. | Clean, rich sources need throughput. |
|
||||||
|
| 057 | Slippery surface | Escape adhesive capture. | Harder to maintain useful attachment. | Adhesion and detachment work. | Unwanted attachment or capture observed. | Stable colony junctions needed. |
|
||||||
|
| 058 | Adhesive surface | Hold food and establish contact. | Unwanted sticking; difficult detachment. | Surface adhesion has physical effects. | Useful surface feeding; neighboring buds. | Frequent escape/dispersal; debris fouling. |
|
||||||
|
| 059 | Active membrane repair | Recover from survivable damage. | Repair consumes E and materials. | Nonfatal damage and repair accounting work. | Damage interrupts otherwise viable feeding. | Little damage; nutrients needed for reproduction. |
|
||||||
|
| 060 | Shed protective shell | Restore mobility, growth, and intake access. | Lose shell protection. | Shell exists; viable unshelled strategy supported. | Shell hinders feeding/travel; threats absent. | Shell frequently prevents injury. |
|
||||||
|
|
||||||
|
## 061-070: Budding and offspring investment
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 061 | Small buds | Produce offspring with less material per birth. | Smaller newborn reserves and protection. | A smaller viable newborn recipe exists. | Birth cost limits expansion. | Small newborns repeatedly fail to establish. |
|
||||||
|
| 062 | Large buds | Offspring feed and defend themselves sooner. | Fewer births from the same reserves. | Variable funded newborn size is supported. | Small newborns struggle in observed habitat. | Parent cannot fund frequent births. |
|
||||||
|
| 063 | Split brood | Spread one investment among several offspring. | Each begins smaller; total matter is unchanged. | Multi-birth placement and partitioning work. | Several nearby establishment opportunities. | Individual newborn size is critical. |
|
||||||
|
| 064 | Rapid bud assembly | Use brief food surpluses quickly. | High assembly power; worse construction efficiency. | Assembly rate and energy efficiency differ. | Surplus lost before ordinary assembly completes. | E scarcity; stable supply. |
|
||||||
|
| 065 | Energy-provisioned buds | Give newborns fuel for dispersal. | More parent E transferred per birth. | Provisioning is explicit and funded. | Newborns face gaps before first feeding. | Nearby food; parent E limits reproduction. |
|
||||||
|
| 066 | Nutrient-provisioned buds | Let newborns grow away from nutrient deposits. | Transfer scarce material; fewer siblings. | Per-channel provisioning works. | Newborns encounter nutrient-poor habitat. | Parent nutrient shortages; reliable local deposits. |
|
||||||
|
| 067 | Compact budding apparatus | Lower reproductive tissue upkeep. | Lower maximum birth frequency. | Reproductive tissue cost and rate are modeled. | Intermittent reproduction; scarce resources. | Continuous surplus supports fast expansion. |
|
||||||
|
| 068 | Brood chamber | Protect developing buds. | Carry developing mass; clustered loss risk. | Exposed development and chamber protection work. | Developing buds encounter hazards. | Travel burden; safe open development. |
|
||||||
|
| 069 | Dispersing offspring | Establish descendants beyond local depletion. | Dispersal investment; fewer nearby collaborators. | Newborn dispersal has physical machinery/costs. | Crowded, depleted birth sites. | Useful local partners and abundant local food. |
|
||||||
|
| 070 | Dormant offspring | Preserve descendants through bad conditions. | No feeding or reproductive contribution while dormant. | Finite dormancy and activation conditions work. | Observed recurring unsuitable periods. | Stable productive conditions. |
|
||||||
|
|
||||||
|
## 071-080: Colonies and cooperation
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 071 | Retained daughter attachment | Keep buds together and form a colony. | Local competition and movement burden. | Funded attachment and viable attached feeding work. | Successful births; nearby descendants; five-bud direction. | Crowded depletion; recent attachment declines. |
|
||||||
|
| 072 | Loose attachment | Separate when trapped or locally starved. | Colony breaks apart under smaller stresses. | Attachment strength can vary. | Trapping; uneven local food. | Separation repeatedly harms members. |
|
||||||
|
| 073 | Flexible junctions | Bend around obstacles without separating. | Poorer force transfer. | Attached geometry and junction mechanics work. | Colony encounters narrow/curved routes. | Straight propulsion needs rigid force transfer. |
|
||||||
|
| 074 | Rigid junctions | Maintain shape and transmit pushing force. | Costly junctions; less maneuverable. | Junction stiffness affects movement. | Propulsive forces deform useful arrangements. | Gaps and turns impede travel. |
|
||||||
|
| 075 | Feeding channels | Supply food to interior members. | Fewer cells per footprint. | Colony geometry affects food access. | Interior feeding deficits; fed outer members. | Small groups with no sheltered interior. |
|
||||||
|
| 076 | Energy transfer junctions | Productive members support E-poor members. | Transfer losses and donor opportunity cost. | Paired E transfers and junction costs work. | Uneven E among connected members. | Members independently E-sufficient. |
|
||||||
|
| 077 | Nutrient transfer junctions | Supply growing or specialized cells. | Transport machinery; donor depletion risk. | Per-channel member transfers work. | Complementary nutrient surpluses/shortages. | Similar deficits across all members. |
|
||||||
|
| 078 | Coordinated polarity | Align feeding surfaces and propulsion. | Harder reversal/reorganization. | Shared orientation and force coordination work. | Members push against one another. | Frequently changing routes and food directions. |
|
||||||
|
| 079 | Branching colony growth | Expand exposed feeding surface in several directions. | Fragile connections; large defensive perimeter. | Controlled attachment geometry works. | Separated nearby food/light opportunities. | Strong shear; perimeter attacks. |
|
||||||
|
| 080 | Shed attachment | Leave a failing group and establish independently. | Lose collective transport and protection. | Attachment exists; independent offspring are viable. | Group depletion or trapping; independent resources nearby. | Strong dependence on transport or donors. |
|
||||||
|
|
||||||
|
## 081-090: Producers and resource exchange
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 081 | Carbon fixation | Use inorganic environmental C instead of C bubbles. | Work E and processing machinery. | Defined accessible carbon source and conversion work. | C scarcity beside suitable source. | Cheap organic C; source inaccessible. |
|
||||||
|
| 082 | Nitrogen fixation | Access environmental N unavailable to ordinary feeders. | High processing E and specialized tissue. | Explicit suitable N source and balanced conversion exist. | N shortage; useful source and E surplus. | N-rich food; E shortage. |
|
||||||
|
| 083 | Phosphate mobilization | Access P in otherwise unusable deposits. | Contact/process costs; source dependence. | Defined P-bearing deposits can be processed. | Births P-limited beside deposits. | Readily edible P; frequent relocation. |
|
||||||
|
| 084 | Other Matter extraction | Obtain O from a specified environmental source. | Machinery useless away from that source. | An O-bearing source and extraction recipe exist. | O scarcity with source access. | Little O demand; cheap edible O. |
|
||||||
|
| 085 | Energy-rich secretion | Supply descendants or useful neighbors. | Export E and secretion material; theft possible. | Finite secretion and uptake by recipients work. | E surplus; useful nearby recipients. | E shortage; secretion mostly stolen or wasted. |
|
||||||
|
| 086 | Nitrogen secretion | Support N-poor partners supplying another need. | Lose acquired N; depend on useful neighbors. | Explicit N secretion and recipient uptake work. | N surplus and productive complementary partners. | N shortage; no useful recipients. |
|
||||||
|
| 087 | Phosphorus recovery | Recover P from specified waste/remains. | Recovery E; limited source stock. | Waste has tracked recoverable P. | P shortage with recoverable local waste. | Fresh P abundant; little recoverable material. |
|
||||||
|
| 088 | Controlled resource exchange | Trade surplus for a limiting resource. | Exchange structures; partner dependence. | Paired bounded exchanges and compatible interfaces work. | Complementary observed surpluses and deficits. | No compatible partner; similar shortages. |
|
||||||
|
| 089 | Specialized daughter cells | Divide feeding, producer, and movement roles. | Dependent specialists need transport and support. | Role-specific development and colony support work. | Complementary roles; supported growing colony. | Repeated separation; inadequate transport. |
|
||||||
|
| 090 | Self-sufficient daughter cells | Survive separation and disperse. | Duplicate machinery and higher per-cell cost. | Generalist offspring can be developed. | Fragmentation; variable partners. | Stable colony with useful specialization. |
|
||||||
|
|
||||||
|
## 091-100: Environmental adaptation
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 091 | Heat specialization | Feed and reproduce in hot habitat. | Worse cool performance; protective costs. | Temperature changes actual survival/performance. | Useful hot feeding areas observed. | Cool habitat; little thermal variation. |
|
||||||
|
| 092 | Cold specialization | Remain productive in cold habitat. | Worse warm performance. | Functional temperature response exists. | Useful cold feeding areas observed. | Warm habitat dominates. |
|
||||||
|
| 093 | Broad thermal tolerance | Cross boundaries and survive fluctuations. | More machinery; lower specialist peak efficiency. | Thermal protection has real costs and benefits. | Repeated temperature changes on useful routes. | Stable narrow temperature band. |
|
||||||
|
| 094 | Narrow thermal specialization | Efficient operation in one stable band. | Vulnerability outside that band. | Defined specialist recipe saves actual costs. | Stable productive temperature. | Frequent thermal transitions. |
|
||||||
|
| 095 | Thermal acclimation | Adjust to gradual temperature change. | Adjustment time/E; abrupt shifts still dangerous. | Bounded acclimation and thermal effects work. | Gradual recurrent temperature changes. | Constant conditions or very abrupt shifts. |
|
||||||
|
| 096 | Toxin exclusion | Use contaminated food-rich areas. | Slower useful uptake; barrier costs. | Specific contaminants and exclusion work. | Valuable resources behind contamination. | Clean habitat; intake throughput limiting. |
|
||||||
|
| 097 | Shed unused thermal protection | Cheaper offspring in a safe band. | Lose the former protected range. | Costly protection exists and temperature gameplay works. | Stable safe habitat; protection rarely used. | Thermal transitions or exposed migration. |
|
||||||
|
| 098 | Protective resting state | Survive temporary environmental crisis. | Stop feeding, travel, and reproduction while protected. | Funded resting state and finite survival rules work. | Recurring short hazards. | Stable productive habitat. |
|
||||||
|
| 099 | Flow-resistant attachment | Stay at useful sites in strong currents. | Heavy attachment and costly relocation. | Flow and surface attachment work. | Current repeatedly dislodges feeding organisms. | Weak flow; frequent travel. |
|
||||||
|
| 100 | Light-direction sensing | Seek useful illumination or avoid excess. | Sensory and corrective-movement costs. | Spatial light differences and sensing work. | Productive routes between light zones. | Uniform illumination; light irrelevant to strategy. |
|
||||||
|
|
||||||
|
## 101-110: Additional sensing and communication
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 101 | Predator-cue sensing | Detect nearby biological danger earlier. | Sensory upkeep; imperfect cues can divert feeding. | Biological cues and readable detection limits work. | Nearby predators observed, without requiring injury. | Few threats; expensive unnecessary detours. |
|
||||||
|
| 102 | Chemical compatibility recognition | Attach or exchange with compatible cells more reliably. | Recognition machinery; rejects some usable unfamiliar partners. | Actual chemical interfaces exist; no account/owner labels. | Useful compatible contacts; failed incompatible contacts. | Solitary life; diverse beneficial partners. |
|
||||||
|
| 103 | Resource composition sensing | Choose deposits containing the limiting nutrient. | Sensor cost; cannot collect resources itself. | Deposits differ in composition and can be sensed. | Repeated one-channel shortages amid mixed deposits. | All nearby food has similar composition. |
|
||||||
|
| 104 | Flow sensing | Choose favorable currents and safer attachment sites. | Sensory E/N investment. | Spatial currents and limited local sensing work. | Flow strongly changes productive travel. | Still habitat; no benefit from route adjustment. |
|
||||||
|
| 105 | Contact feelers | Navigate obstacles without exposing the whole body. | Extra drag and vulnerable projections. | Contact geometry and obstacle feedback work. | Obstacle-rich productive routes. | Open routes; projections frequently damaged. |
|
||||||
|
| 106 | Prey-size sensing | Avoid costly futile engulfment attempts. | Sensory tissue instead of feeding capacity. | Prey geometry can be sensed within limits. | Encounters near engulfment thresholds. | Prey absent or uniformly easy to take. |
|
||||||
|
| 107 | Compact short-range sensing | Cheaper close-quarters sensing. | Less warning and discovery range. | Existing sensing can trade range for tissue cost. | Dense local food and short routes. | Widely separated targets; distant threats. |
|
||||||
|
| 108 | Shed food sensing | Cheaper feeders supplied locally or through a colony. | Cannot independently locate distant food. | Food sensor exists; local feeding strategy viable. | Reliable contact supply; colony guidance. | Independent foraging; patchy food. |
|
||||||
|
| 109 | Colony signal relay | Coordinate distant members without every cell sensing everything. | Signal production and relay costs; delay. | Bounded biological signaling and connected roles work. | Group coordination fails across distance. | Small group; little coordination need. |
|
||||||
|
| 110 | Shed signal relay | Remove unnecessary communication machinery. | Lose distant coordination. | Relay exists; independent/local behavior remains viable. | Solitary dispersal; tiny groups. | Distant members depend on relay. |
|
||||||
|
|
||||||
|
## 111-120: Metabolic allocation and physiological regulation
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 111 | Low idle metabolism | Spend less E between productive activities. | Slower return to full output. | Physiological activity and wake-up work are modeled. | Frequent short inactive intervals between useful actions. | Continuous pursuit or feeding. |
|
||||||
|
| 112 | High-output metabolism | Sustain intense feeding, propulsion, or assembly. | Higher basal upkeep of supporting machinery. | Tissue-backed metabolic throughput has a real limit. | Useful actions repeatedly hit delivery limits. | Low utilization; food scarcity. |
|
||||||
|
| 113 | Demand-responsive intake | Avoid spending transport E on already-full reserves. | Regulation costs and delayed response to new food. | Active uptake costs E and reserves have limits. | Frequent excess uptake effort. | Rapidly changing food; few full reserves. |
|
||||||
|
| 114 | Reserve rationing | Preserve maintenance E through short shortages. | Lower available movement and assembly output. | Explicit reserve allocation affects actual actions. | Brief predictable feeding gaps. | Peak escape power often needed. |
|
||||||
|
| 115 | Surplus storage synthesis | Package temporary E surplus into usable stored reserves. | Processing E/material costs and storage delay. | Reserve packaging has specified inputs and capacity. | Bursty capture exceeds immediate use. | Persistent scarcity; little surplus. |
|
||||||
|
| 116 | Reversible machinery shutdown | Reduce upkeep of temporarily unused functions. | Restart consumes time/E; regulation tissue costs. | Physiological suppression works without deleting anatomy. | Alternating use of expensive capabilities. | All functions continuously needed. |
|
||||||
|
| 117 | Emergency movement reserve | Keep escape fuel from ordinary growth spending. | Less reserve freely available for births and feeding. | Explicit bounded reserve partitioning works. | Encounters occur just after heavy construction. | Safe habitat; reserved fuel rarely used. |
|
||||||
|
| 118 | Flexible nutrient allocation | Redirect available material to the most useful ongoing tissue task. | Regulation overhead; slower peak assembly. | Competing growth/repair tasks and allocation work. | Alternating repair and growth shortages. | One stable construction task dominates. |
|
||||||
|
| 119 | Conservative reproductive provisioning | Avoid leaving the parent without basic survival reserves. | Smaller or less frequent births during marginal conditions. | Heritable provisioning policy and actual reserve bounds work. | Births followed by parent shortages. | Reliable immediate refilling after birth. |
|
||||||
|
| 120 | Shed broad digestive machinery | Cheap specialist offspring using a reliable substrate. | Lose access to other food types. | Generalist machinery exists; retained food source viable. | One substrate consistently supplies needs. | Mixed/variable diet important. |
|
||||||
|
|
||||||
|
## 121-130: Colony architecture and tissue precursors
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 121 | Junction scaffolding | Support larger attachments and future force-bearing tissue. | C/O construction and extra mass. | Explicit scaffold recipe and structural loads work. | Junction stresses limit useful group growth. | Small flexible groups; O scarcity. |
|
||||||
|
| 122 | Contractile specialist cells | Generate coordinated force for a group. | High N/E demand; reduced independent feeding. | Specialized force generation and support transport work. | A supported group lacks propulsion/force. | Nutrient transport absent; low force demand. |
|
||||||
|
| 123 | Support specialist cells | Protect soft members and maintain body shape. | Nonfeeding mass must be supported. | Role differentiation and physical support work. | Soft group deformation causes problems. | Small independent groups; scarce food. |
|
||||||
|
| 124 | Producer surface sorting | Place light-capturing cells where light reaches them. | Repositioning/junction cost; exposes producers. | Colony rearrangement and self-shading work. | Producers are shaded by other members. | Uniform exposure; little photosynthesis. |
|
||||||
|
| 125 | Peripheral feeding layer | Collect food around a group and transport it inward. | Outer feeders vulnerable; inner cells become dependent. | Spatial roles and member transport work. | Interior shortage despite exterior abundance. | Small group; transport bottlenecks. |
|
||||||
|
| 126 | Protected reproductive cells | Keep developing offspring inside a supported group. | Other cells must feed and protect a nonfeeding role. | Differentiation, brood development, and protection work. | Exposed births fail near viable colonies. | Low group surplus; dispersal priority. |
|
||||||
|
| 127 | Modular growth units | Limit damage spread between colony regions. | Duplicate junction/support machinery; slower integration. | Mechanical modules and localized damage work. | Local damage propagates through a group. | Small stable group; costs dominate. |
|
||||||
|
| 128 | Detachable dispersal lobe | Release a funded multicell fragment to establish elsewhere. | Lose group tissue and reserve investment. | Viable fragment development/separation work. | Local crowding; reachable new habitat. | Small group; strong mutual dependence. |
|
||||||
|
| 129 | Hollow colony arrangement | Expose inner surfaces to food flow. | Larger footprint and weaker compact support. | Food movement through explicit colony geometry works. | Interior access limits a growing group. | Crushing/shear threats; little interior shortage. |
|
||||||
|
| 130 | Radial colony arrangement | Feed and respond in several directions. | Poorer forward specialization and pursuit. | Attachment geometry affects feeding/propulsion. | Resources arrive from changing directions. | Long directional travel or hunting. |
|
||||||
|
|
||||||
|
Modules/fragments never restore a dead controlled organism. Autonomous survivors
|
||||||
|
keep their own identities; player control still follows accepted succession and
|
||||||
|
permadeath rules. Tissue-like precursors do not themselves authorize the separate
|
||||||
|
multicellular or 3D transition.
|
||||||
|
|
||||||
|
## 131-140: Loss, simplification, and alternative material use
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 131 | Shed expanded nitrogen storage | Lighter offspring with less storage tissue. | Cannot bank as much N between deposits. | Expanded N storage exists; baseline storage remains viable. | Continuous N supply; unused capacity. | Intermittent N; shortages between visits. |
|
||||||
|
| 132 | Shed expanded phosphorus storage | Lower storage construction and carried mass. | Shorter independence from P sources. | Expanded P storage exists. | Reliable P supply; capacity seldom used. | Rare P sites fund later births. |
|
||||||
|
| 133 | Shed expanded carbon storage | Free body capacity for active machinery. | Less C available for growth after leaving food. | Expanded C storage exists. | Constant C access; crowded tissue capacity. | Large intermittent growth demands. |
|
||||||
|
| 134 | Shed expanded Other Matter storage | Reduce investment in seldom-used O reserves. | Lose preparation for O-heavy construction. | Expanded O storage exists. | Low O use; reliable O access. | Planned O-dependent support/protection. |
|
||||||
|
| 135 | Shed nutrient exchange junctions | Cheaper independently feeding offspring. | Lose nutrient support and trade. | Nutrient junctions exist; independent feeding viable. | Members self-sufficient; transfers rarely used. | Specialized members need imported nutrients. |
|
||||||
|
| 136 | Shed energy exchange junctions | Reduce transport losses and junction upkeep. | Cannot support or receive E from neighbors. | E junctions exist; independent E budget viable. | Little beneficial transfer. | Producers support shaded/nonfeeding cells. |
|
||||||
|
| 137 | Shed nitrogen fixation | Remove costly unused processing tissue. | Depend again on food/partners for N. | Fixation exists; alternative N accessible. | N-rich food; processing E scarce. | Environmental processing supplies most N. |
|
||||||
|
| 138 | Shed carbon fixation | Remove unused carbon-processing machinery. | Lose access to inorganic C. | Fixation exists; organic C source viable. | Reliable organic food; little fixation output. | Inorganic source supports most construction. |
|
||||||
|
| 139 | Shed selective intake machinery | Restore broad intake and reduce sorting costs. | More unwanted loading; less targeted collection. | Selective uptake exists; broad feeding viable. | Several channels needed; little excess loading. | One persistent shortage amid other surpluses. |
|
||||||
|
| 140 | Carbon-rich protective covering | Replace an O-dependent covering where O is scarce. | More C and lower rigidity/protection. | Explicit replacement recipe conserves each channel. | O-limited covering development; C surplus. | C scarcity; rigid protection essential. |
|
||||||
|
|
||||||
|
These losses need actual savings. Merely deleting a parameter is not a benefit.
|
||||||
|
Replacing O with a C-rich structure changes the recipe; it does not convert O to C.
|
||||||
|
|
||||||
|
## 141-150: Further habitat and energy specializations
|
||||||
|
|
||||||
|
| ID | Adaptation | Reason to want it | Drawback | Available when | Increases chance | Decreases chance |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| 141 | Osmotic buffering | Survive changes in external dissolved concentration. | Buffer material and regulation E. | Water exchange and osmotic stress work. | Useful routes cross concentration boundaries. | Stable concentration; buffer seldom used. |
|
||||||
|
| 142 | Salt specialization | Operate efficiently in a stable salty habitat. | Poor performance in dilute habitat. | Explicit salinity and supported response exist. | Productive saline sites. | Dilute sites or frequent salinity changes. |
|
||||||
|
| 143 | Acid specialization | Use acidic resource-rich habitat. | Poor neutral/alkaline performance; protection cost. | Acidity has actual supported effects. | Useful acidic sites observed. | Neutral/alkaline foraging dominates. |
|
||||||
|
| 144 | Alkaline specialization | Use alkaline resource-rich habitat. | Poor acidic performance; protection cost. | Alkalinity has actual supported effects. | Useful alkaline sites observed. | Acidic sites or frequent transitions. |
|
||||||
|
| 145 | Broad chemical buffering | Cross variable pH/salinity boundaries. | More machinery; lower specialist efficiency. | Each buffered hazard and its material cost work. | Recurrent chemical transitions on useful routes. | One stable chemical habitat. |
|
||||||
|
| 146 | Excess-light shielding | Remain productive under damaging illumination. | Shield blocks some useful light and costs material. | Excess light causes real damage or capture impairment. | Useful high-light sites cause overexposure. | Shade; weak illumination. |
|
||||||
|
| 147 | Oxygen-assisted energy extraction | Extract more E from food where oxygen is available. | Requires environmental oxygen and respiratory tissue. | Explicit oxygen compartment, reactants, and energy balance exist. | Food and oxygen coexist; yield limits survival. | Low oxygen; machinery rarely useful. |
|
||||||
|
| 148 | Oxygen-independent energy extraction | Remain active without environmental oxygen. | Lower food-to-usable-E yield and/or output. | Defined balanced oxygen-independent pathway exists. | Productive oxygen-poor habitat. | Stable oxygen-rich conditions favor another pathway. |
|
||||||
|
| 149 | Chemical energy capture | Gain usable E from a defined environmental chemical reaction. | Source dependence and processing machinery. | Finite reactants/potential, products, and conversion are modeled. | Useful chemical source; light/food E scarce. | No accessible reactants; ample ordinary E. |
|
||||||
|
| 150 | Shed chemical energy capture | Remove unused processing tissue. | Lose that environmental E source. | Capture machinery exists; another E source supports offspring. | Relocation away from reactants; unused machinery. | Chemical reaction sustains the current strategy. |
|
||||||
|
|
||||||
|
Oxygen in 147-148 is a separately modeled environmental species, never the O
|
||||||
|
inventory abbreviation. Neither pathway creates food energy from nothing;
|
||||||
|
conversion must debit the appropriate finite chemical energy and material inputs.
|
||||||
|
|
||||||
|
## Future evolutionary consequences
|
||||||
|
|
||||||
|
Consequences should follow anatomy, material recipes, and support relationships.
|
||||||
|
They are not permanent hidden class locks. Reacquisition/replacement is possible
|
||||||
|
through future eligible adaptations, with real construction costs.
|
||||||
|
|
||||||
|
| Earlier choices | Potential later consequence | Route to adapt again |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 036 nitrogen-thrifty machinery | High-output contractile tissue/limbs exceed the supported N recipe or throughput. | Improve N acquisition/transport and build a richer recipe, or use lower-output structures. |
|
||||||
|
| 037 phosphorus-thrifty development | Low-P construction cannot assemble a large new organ at specialist speed. | Restore faster assembly with more P, or retain thrift and build gradually. |
|
||||||
|
| 038 reduced O dependence | An O-requiring support or protective structure cannot be built from the current recipe. | Reintroduce O use or select an explicit alternative construction. |
|
||||||
|
| 009 shed propulsion | Independent mobile descendants lack a force-producing structure. | Reacquire propulsion or develop supported contractile tissue. |
|
||||||
|
| 021-025 photosynthetic specialization | Light-facing surface and nutrient supply constrain thicker bodies. | Rearrange producer surfaces, develop transport, mix feeding strategies. |
|
||||||
|
| 076-077 resource transfer | Support for internal specialists becomes possible, but separation is harder. | Retain transfer or produce self-sufficient dispersing descendants. |
|
||||||
|
| 089 specialized daughters | A detached specialist may not survive independently. | Provide viable generalist development or retain support until establishment. |
|
||||||
|
| 090 self-sufficient daughters | Duplicated machinery makes dense specialized tissue expensive. | Specialize some roles while establishing replacement support. |
|
||||||
|
| 053 shell or 074 rigid junctions | Flexible limbs/growth openings need an explicit mechanical arrangement. | Local joints/openings, flexible replacements, or shedding in future offspring. |
|
||||||
|
| 052 thin membrane | Exposed organs and transport paths may need reinforcement. | Add local protective tissue rather than forcing whole-body thickening. |
|
||||||
|
| 061 small buds | Small founders face limited reserves for large-organ construction. | Larger/provisioned offspring or staged funded growth. |
|
||||||
|
| 069 dispersal and 080 detachment | Local cooperating population is harder to retain. | Reacquire attachment or develop a mixture of retained and dispersing offspring. |
|
||||||
|
| 078 polarity and 130 radial arrangement | Different body layouts favor different directions of feeding and force. | Rearrange attachment/development rather than applying a universal speed penalty. |
|
||||||
|
| 093 broad tolerance versus 094 narrow specialization | Migration range and local efficiency diverge. | Rebuild broader protection or remain a habitat specialist. |
|
||||||
|
| 121-129 structural precursors | Make some integrated body plans feasible but increase support/transport demands. | Fund missing tissues and transport; no automatic free multicellular conversion. |
|
||||||
|
|
||||||
|
Example player-facing card:
|
||||||
|
|
||||||
|
> **Nitrogen-thrifty machinery**
|
||||||
|
>
|
||||||
|
> Your offspring need less nitrogen, making births easier in this habitat. Their
|
||||||
|
> maximum feeding and propulsion output will be lower.
|
||||||
|
>
|
||||||
|
> **Why offered:** recent births were limited by nitrogen while food was available.
|
||||||
|
>
|
||||||
|
> **Future consequence:** high-output organs need more nitrogen or a different
|
||||||
|
> construction strategy. This choice does not permanently forbid limbs.
|
||||||
|
>
|
||||||
|
> **Expression:** future offspring. Your existing body stays as it is.
|
||||||
|
|
||||||
|
## Initial subset and balancing work
|
||||||
|
|
||||||
|
Pick roughly 20-30 adaptations for an initial coherent experiment. Start with
|
||||||
|
movement, contact feeding, meaningful energy yield/throughput, small/large buds,
|
||||||
|
photosynthesis, and attachment. A suggested evaluation set is:
|
||||||
|
|
||||||
|
001, 002, 011, 012, 014, 016, 019, 021, 022, 026, 027, 028, 029, 030, 031,
|
||||||
|
032, 033, 041, 042, 061, 062, 063, 065, 066, 067, 071, 072, 073, 080.
|
||||||
|
|
||||||
|
This is **29 candidates to evaluate**, not a claim that 29 can ship now. For
|
||||||
|
example, 014 needs real selective uptake, 027-028 need a real yield/throughput
|
||||||
|
tradeoff, storage needs capacity costs, and colony options need working colony
|
||||||
|
behavior. Exclude an option until both its advantage and drawback are supported.
|
||||||
|
Prefer a smaller useful set over filling offers with inert possibilities.
|
||||||
|
|
||||||
|
Do not offer plain decreased energy conversion, unsupported thermal changes,
|
||||||
|
isolated shed-movement, or cosmetic numerical mutations with no changed decisions.
|
||||||
|
Inverse adaptations must each earn their place; no requirement says every trait
|
||||||
|
needs four automatically generated increase/decrease/acquire/shed buttons.
|
||||||
|
|
||||||
|
Measure the following in controlled playtests before accepting numeric rules:
|
||||||
|
|
||||||
|
| Question | Evidence needed |
|
||||||
|
| --- | --- |
|
||||||
|
| Can an ordinary active founder bud within three minutes? | Distributions across seeds and novice routes; energy and every material bottleneck. |
|
||||||
|
| Does active foraging beat camping? | Net useful intake after movement/maintenance, time spent stationary by reason, and actual birth times. |
|
||||||
|
| Does each choice change play? | Subsequent routes, food use, offspring investment, and observed downsides, not acceptance alone. |
|
||||||
|
| Are colony seekers progressing? | Successful birth count, eligible offers, misses, first attachment, and supported group survival. |
|
||||||
|
| Does bad luck respect the intended duration? | Median and tail times to useful attachment/progression, not only average draws. |
|
||||||
|
| Are other strategies still discoverable? | Eligible family diversity, observed choice diversity, and recovery after declines/shedding. |
|
||||||
|
| Does growth produce an ecosystem? | Offspring establishment, local depletion, interactions, recycling, and lineage persistence. |
|
||||||
|
| Are future consequences readable? | Players can explain a choice's present cost and later dependency before accepting it. |
|
||||||
|
|
||||||
|
Activity and draw records must be bounded, authoritative, reproducible, and
|
||||||
|
account-free in aggregate reports where possible. Player observations remain
|
||||||
|
consented playtest notes rather than silently expanded behavioral surveillance.
|
||||||
|
|
||||||
|
## Decisions still open
|
||||||
|
|
||||||
|
- Which trial timings/weights actually meet the three-minute and 30-60-minute
|
||||||
|
targets across ordinary players, seeds, and resource channels?
|
||||||
|
- Which exact adaptations form the first coherent set, and what physical recipe
|
||||||
|
and measured drawback does each use?
|
||||||
|
- What earns engaged stationary-play credit without rewarding unattended camping
|
||||||
|
or requiring meaningless input?
|
||||||
|
- Which bounded context/preferences carry through succession, and how quickly
|
||||||
|
should a player be able to change evolutionary direction?
|
||||||
|
- Should stronger bad-luck protection be opt-in through an expressed direction,
|
||||||
|
rather than inferred only from behavior?
|
||||||
|
- How are useful multi-change adaptations represented without hiding dependent
|
||||||
|
losses or turning the catalog into fixed classes?
|
||||||
|
- What exact tissue/reserve partition and viable-size rules support immediate
|
||||||
|
division, and which reproductive adaptations apply to division versus budding?
|
||||||
|
- How does the UI preview Evolve now versus Prepare offspring, including both
|
||||||
|
resulting organisms and the irreversible control choice?
|
||||||
|
- Which real developmental work makes a divergent offspring more expensive,
|
||||||
|
without double-charging transferred tissue or making experimentation too slow?
|
||||||
|
- Which traits can change physiologically during life, and which only develop in
|
||||||
|
offspring? Classify each operator explicitly before implementation.
|
||||||
|
- How do colony membership, resource ownership, control, death, and logout work
|
||||||
|
under the current accepted inheritance requirements?
|
||||||
|
- What separates an attached colony from funded integrated multicellular tissue,
|
||||||
|
and what additional qualification precedes entry to the 3D habitat?
|
||||||
|
- Is truly nutrient-free alternative chemistry desirable, or are lower demand and
|
||||||
|
different acquisition paths sufficient? No total C/N/P/O removal is accepted here.
|
||||||
|
- Are heritable mutation-frequency/replication traits desirable? Do not add them
|
||||||
|
merely to make a 150-option catalog: faster mutation opportunities need a useful
|
||||||
|
tradeoff and must not gate basic budding or create another waiting-time economy.
|
||||||
|
|
||||||
|
## Draft completion checks
|
||||||
|
|
||||||
|
This documentation segment should verify exactly 150 unique sequential draft IDs,
|
||||||
|
seven populated fields per catalog row, resolvable local source links, and no
|
||||||
|
trailing whitespace. These checks validate document structure only. They do not
|
||||||
|
validate ecological balance, implementation availability, or the pacing targets.
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
# Cellular mutation plan
|
||||||
|
|
||||||
|
Status: planning draft, 2026-10-22. Records the maintainer's decisions on what a
|
||||||
|
mutation is, how offers work, and the full catalog for this pass (49 mutations). Where this document
|
||||||
|
conflicts with [Cellular_mutation_draft.md](Cellular_mutation_draft.md) or
|
||||||
|
[Cellular_movement_draft.md](Cellular_movement_draft.md), this document wins. No code,
|
||||||
|
runtime rule or live region is changed by it.
|
||||||
|
|
||||||
|
For a single cell, accepting a mutation divides it: the offspring expresses the
|
||||||
|
mutation and both cells carry it in their heritable plan. A multicellular organism
|
||||||
|
expresses an accepted mutation directly, without dividing. See
|
||||||
|
[Cellular_reproduction_plan.md](Cellular_reproduction_plan.md), sections 4 and 6.
|
||||||
|
|
||||||
|
## 1. What a mutation is
|
||||||
|
|
||||||
|
A mutation is an opportunity to steer the evolution of your organism. Each one is a
|
||||||
|
catalog entry describing one change to the genome. Very few mutations are pure
|
||||||
|
upgrades: most carry a pro and a con, and both are shown to the player when choosing.
|
||||||
|
|
||||||
|
| Field | Meaning |
|
||||||
|
| --- | --- |
|
||||||
|
| Name / description | What the player sees. |
|
||||||
|
| Effect | The exact genome change, e.g. `output +5, efficiency -2`. |
|
||||||
|
| Pro / Con | Shown in the offer. Derived from the effect where possible, not a flat penalty. |
|
||||||
|
| Available | Prerequisites (anatomy, region features) and limits (never past an axis bound). |
|
||||||
|
| Increase trigger | Behaviour that raises the mutation's affinity score. |
|
||||||
|
| Decrease trigger | Behaviour that lowers it. |
|
||||||
|
| Cost | Tunable price in energy and matter, per channel (section 4). |
|
||||||
|
|
||||||
|
## 2. Offer cadence
|
||||||
|
|
||||||
|
Offers arrive periodically while the player is actively playing. One offer is pending
|
||||||
|
at a time; it stays available while the player moves and is not dismissed by a timer.
|
||||||
|
|
||||||
|
Tunable: `mutation.offer_interval_ms` (trial 25,000) and the definition of active play.
|
||||||
|
Both need playtesting.
|
||||||
|
|
||||||
|
## 3. Weights and the draw
|
||||||
|
|
||||||
|
### Affinity scores
|
||||||
|
|
||||||
|
- Every cell holds an integer **affinity score per mutation**, starting at 0.
|
||||||
|
- When a mutation's increase trigger completes, its score rises by that mutation's
|
||||||
|
`increase_points`; a decrease trigger lowers it by `decrease_points`. The trigger's
|
||||||
|
timer then restarts, so a held behaviour fires repeatedly.
|
||||||
|
- Scores are bounded to `[score_min, score_max]`.
|
||||||
|
- **No drift:** scores change only through triggers, never with time.
|
||||||
|
- **Inheritance:** offspring start with their parent's scores.
|
||||||
|
|
||||||
|
### From score to chance
|
||||||
|
|
||||||
|
1. **Eligible pool:** every mutation whose prerequisites are met and whose effect stays
|
||||||
|
within its limits. Ineligible mutations have no chance at all.
|
||||||
|
2. **Weight:** `weight = base_weight x multiplier(score)`. The multiplier is 1 at score 0
|
||||||
|
and rises or falls linearly to `max_multiplier` at `score_max` and `min_multiplier`
|
||||||
|
at `score_min`.
|
||||||
|
3. **Chance of appearing in the offer:** `p = clamp(k x weight, floor, cap)`, with `k`
|
||||||
|
solved so that the chances of the eligible pool sum to the number of options
|
||||||
|
(300% for three). `floor` = **0.001%** (anomalies always happen); `cap` = **70%**.
|
||||||
|
4. **Draw:** systematic sampling over the pool. One random number picks the options,
|
||||||
|
they are always distinct, and each mutation's real chance of appearing equals its
|
||||||
|
`p`. The draw is seeded per cell and offer, so a retry or reconnect never rerolls.
|
||||||
|
|
||||||
|
The pool always holds well over five eligible mutations, so the 70% cap is always
|
||||||
|
satisfiable.
|
||||||
|
|
||||||
|
### Tunable draw settings
|
||||||
|
|
||||||
|
| Setting | Scope | Trial |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `offer_options` | global | 3 |
|
||||||
|
| `cap`, `floor` | global | 70%, 0.001% |
|
||||||
|
| `score_min`, `score_max` | global | -1000, +1000 |
|
||||||
|
| `max_multiplier`, `min_multiplier` | global | 10x, 0x (the floor still applies) |
|
||||||
|
| `base_weight` | per mutation | 100 |
|
||||||
|
| `increase_points`, `decrease_points` | per mutation | 100 |
|
||||||
|
| Trigger thresholds (seconds, counts, angles) | per mutation | listed with each mutation |
|
||||||
|
| Step sizes: primary, paired, spread | per mutation | 5, 2, 1 points |
|
||||||
|
|
||||||
|
## 4. Choosing and cost
|
||||||
|
|
||||||
|
The player picks one of the options or declines. Declining is free; the next offer
|
||||||
|
draws again.
|
||||||
|
|
||||||
|
Each mutation has its own tunable **cost**: an amount per channel (energy E in
|
||||||
|
picojoules; carbon C, nitrogen N, phosphorus P and other matter O in femtograms), plus
|
||||||
|
one **scale** from 0% to 100% for fine tuning. The charged amount per channel is
|
||||||
|
`amount x scale`.
|
||||||
|
|
||||||
|
```text
|
||||||
|
mutation.strong_propulsion.cost_e_pj = 0
|
||||||
|
mutation.strong_propulsion.cost_c_fg = 0
|
||||||
|
mutation.strong_propulsion.cost_n_fg = 0
|
||||||
|
mutation.strong_propulsion.cost_p_fg = 0
|
||||||
|
mutation.strong_propulsion.cost_o_fg = 0
|
||||||
|
mutation.strong_propulsion.cost_scale_percent = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
Every mutation starts with all amounts and the scale at 0. Playtesting decides whether
|
||||||
|
a mutation needs a cost at all, and further playtesting tunes it, one mutation at a
|
||||||
|
time.
|
||||||
|
|
||||||
|
The cost is paid from the reserve when the mutation is applied; reserve matter can
|
||||||
|
stand in for its energy part (feeding and energy plan, section 3). An unaffordable
|
||||||
|
option is still offered; it shows the shortfall and cannot be selected until the
|
||||||
|
reserve covers it.
|
||||||
|
|
||||||
|
**Where the cost goes:** the environment reclaims it. Each non-empty channel of the
|
||||||
|
paid cost becomes a new resource bubble of that amount at a random point in the
|
||||||
|
region, chosen by the region's seeded draw so a replay places it identically. Nothing
|
||||||
|
is destroyed; the region's totals are unchanged.
|
||||||
|
|
||||||
|
If the region is already at its deposit limit, the reclaimed amount merges into the
|
||||||
|
existing bubble **farthest** from the paying cell, so the cost cannot easily be
|
||||||
|
collected straight back.
|
||||||
|
|
||||||
|
This replaces the earlier draft policy of no separate fee for selecting a mutation.
|
||||||
|
|
||||||
|
### Testing the pool
|
||||||
|
|
||||||
|
For testing, every mutation can be switched on or off in the tuning file
|
||||||
|
(`mutation.<name>.enabled = 1`). A disabled mutation is not in the pool at all, even
|
||||||
|
at the floor. Together with `base_weight`, this lets a playtest narrow the pool to
|
||||||
|
the mutations under test or bias the draw toward them.
|
||||||
|
|
||||||
|
## 5. Movement mutations
|
||||||
|
|
||||||
|
Movement edits the genome's movement arrangement, in reference points where the founder
|
||||||
|
is 100. Steps add or remove fixed points; they never compound (100 -> 105 -> 110).
|
||||||
|
Global defaults: primary step `mutation.step_points` = 5, paired step
|
||||||
|
`mutation.paired_points` = 2; each mutation can override them (section 3).
|
||||||
|
|
||||||
|
Percentages below are at matched conditions against the arrangement before the edit,
|
||||||
|
from the current handling model (top speed ~ thrust / drag; thrust energy ~ output /
|
||||||
|
efficiency).
|
||||||
|
|
||||||
|
### Core mutations (available from birth)
|
||||||
|
|
||||||
|
#### Strong Propulsion
|
||||||
|
|
||||||
|
- **Effect:** output +5, efficiency -2.
|
||||||
|
- **Pro:** top speed and acceleration +5%.
|
||||||
|
- **Con:** energy per second at full thrust +7%; energy per distance +2%.
|
||||||
|
- **Increase:** thrust for 10 s in total.
|
||||||
|
- **Decrease:** no thrust for 30 min.
|
||||||
|
|
||||||
|
#### Economical Propulsion
|
||||||
|
|
||||||
|
- **Effect:** coasting +5 (lower drag, forward and sideways).
|
||||||
|
- **Pro:** drifts about 5% further after letting go; top speed +5%; cheaper travel when
|
||||||
|
thrust is pulsed.
|
||||||
|
- **Con:** stops more slowly, so precise stops need braking, which costs energy; slides
|
||||||
|
more in turns.
|
||||||
|
- **Increase:** thrust at least every 15 s for a minute, or move steadily for a minute.
|
||||||
|
- **Decrease:** no movement for 2 min.
|
||||||
|
|
||||||
|
#### Efficient Propulsion
|
||||||
|
|
||||||
|
- **Effect:** efficiency +5, output -2.
|
||||||
|
- **Pro:** energy per distance -5%; energy per second at full thrust -7%.
|
||||||
|
- **Con:** top speed and acceleration -2%.
|
||||||
|
- **Increase:** movement is over half the energy spent in a minute.
|
||||||
|
- **Decrease:** no thrust for 5 min.
|
||||||
|
|
||||||
|
#### Agile Steering
|
||||||
|
|
||||||
|
- **Effect:** steering +5, output -2.
|
||||||
|
- **Pro:** turns 5% faster.
|
||||||
|
- **Con:** top speed and acceleration -2%.
|
||||||
|
- **Increase:** 5 sharp turns (over 90 degrees) within 20 s.
|
||||||
|
- **Decrease:** hold one heading (within 20 degrees) for 60 s of thrust.
|
||||||
|
|
||||||
|
#### Streamlined Body
|
||||||
|
|
||||||
|
- **Effect:** streamlining +5, steering -2 (lower forward drag only).
|
||||||
|
- **Pro:** top speed +5% and longer forward glide.
|
||||||
|
- **Con:** turns 2% slower.
|
||||||
|
- **Increase:** thrust in a straight line (within 20 degrees) for 20 s.
|
||||||
|
- **Decrease:** 5 sharp turns within 20 s.
|
||||||
|
|
||||||
|
Distinct from Economical Propulsion: Streamlined lowers forward drag only and pays in
|
||||||
|
turning; Economical lowers drag in every direction and pays in stopping and sliding.
|
||||||
|
|
||||||
|
#### Strong Brakes
|
||||||
|
|
||||||
|
- **Effect:** braking +5, output -2.
|
||||||
|
- **Pro:** stops and reverses 5% faster.
|
||||||
|
- **Con:** top speed -2%; each brake draws 5% more energy.
|
||||||
|
- **Increase:** brake 5 times within a minute.
|
||||||
|
- **Decrease:** no braking for 10 min.
|
||||||
|
|
||||||
|
### Mirror mutations (kept for now)
|
||||||
|
|
||||||
|
Each core mutation has a mirror that moves the same axes the other way, so lowering a
|
||||||
|
trait is a real choice with its own benefit. A mirror's triggers are its core
|
||||||
|
mutation's triggers swapped.
|
||||||
|
|
||||||
|
| Mirror | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Light Propulsion | output -5, efficiency +2 | Energy per second -7%, per distance -2% | Top speed -5% | No thrust for 30 min | Thrust for 10 s |
|
||||||
|
| Damped Body | coasting -5 | Stops sooner, slides less | Top speed -5%; energy per distance +5% | No movement for 2 min | Pulsed or steady movement for a minute |
|
||||||
|
| Overdriven Propulsion | efficiency -5, output +2 | Top speed +2% | Energy per second +7%, per distance +5% | No thrust for 5 min | Movement over half of energy spent |
|
||||||
|
| Forward Drive | steering -5, output +2 | Top speed +2% | Turns 5% slower | One heading for 60 s of thrust | 5 sharp turns in 20 s |
|
||||||
|
| Rounded Body | streamlining -5, steering +2 | Turns 2% faster | Top speed -5% | 5 sharp turns in 20 s | Straight thrust for 20 s |
|
||||||
|
| Light Brakes | braking -5, output +2 | Top speed +2% | Stops 5% slower | No braking for 10 min | Brake 5 times in a minute |
|
||||||
|
|
||||||
|
### Limits
|
||||||
|
|
||||||
|
Each axis has tunable bounds (trial: 25 to 1,000 points; the genome already caps at
|
||||||
|
1,000). A mutation that would cross a bound is not eligible. Efficiency divides thrust
|
||||||
|
cost, so it can never reach 0.
|
||||||
|
|
||||||
|
### Postponed
|
||||||
|
|
||||||
|
Burst, Anchor, Shed propulsion and Colony propulsion are postponed. They are not in the
|
||||||
|
pool, not even at the 0.001% floor, until their mechanics exist.
|
||||||
|
|
||||||
|
## 6. Feeding and energy mutations
|
||||||
|
|
||||||
|
Systems and terms are defined in the
|
||||||
|
[feeding and energy plan](Cellular_feeding_energy_plan.md). All indices are points with
|
||||||
|
the founder at 100. All available from birth unless stated.
|
||||||
|
|
||||||
|
**Spread pattern:** a channel mutation raises one matter channel by the primary step
|
||||||
|
(5) and lowers each of the other three matter channels by the spread step (1). The
|
||||||
|
steps are tunable per mutation.
|
||||||
|
|
||||||
|
### Feeding
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Carbon Gatherer | C collection +5, N/P/O collection -1 each | Collects carbon 5% faster | Collects N, P, O 1% slower each | Carbon is at least half the matter collected in the last minute | No carbon collected for 5 min |
|
||||||
|
| Nitrogen Gatherer | N collection +5, C/P/O -1 each | Collects nitrogen 5% faster | Collects C, P, O 1% slower each | Same, for nitrogen | Same, for nitrogen |
|
||||||
|
| Phosphorus Gatherer | P collection +5, C/N/O -1 each | Collects phosphorus 5% faster | Collects C, N, O 1% slower each | Same, for phosphorus | Same, for phosphorus |
|
||||||
|
| Other Matter Gatherer | O collection +5, C/N/P -1 each | Collects other matter 5% faster | Collects C, N, P 1% slower each | Same, for other matter | Same, for other matter |
|
||||||
|
| Big Appetite | Shared intake limit +5, upkeep efficiency -2 | Takes in 5% more per second at rich food | More upkeep | Feeding at the intake limit for 10 s total | No feeding for 5 min |
|
||||||
|
| Small Appetite (mirror) | Shared intake limit -5, upkeep efficiency +2 | Less upkeep | Takes in 5% less at rich food | No feeding for 5 min | Feeding at the intake limit for 10 s total |
|
||||||
|
|
||||||
|
### Energy
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Thorough Extraction | Energy kept per bubble +5, energy collection -2 | More energy from each energy bubble | Drains energy bubbles 2% slower | Burning matter for energy for 30 s total | No matter burned for 10 min |
|
||||||
|
| Rapid Extraction | Energy collection +5, energy kept per bubble -2 | Drains energy bubbles 5% faster | Keeps slightly less of each | Energy collection at its limit for 10 s total | No energy collected for 5 min |
|
||||||
|
| Carbon Metabolism | C burn efficiency +5, N/P/O -1 each | Carbon covers 5% more energy when burned | N, P, O cover 1% less each | Burning carbon for 30 s total | No carbon burned for 10 min |
|
||||||
|
| Nitrogen Metabolism | N burn efficiency +5, C/P/O -1 each | Nitrogen covers 5% more energy | C, P, O cover 1% less each | Burning nitrogen for 30 s total | No nitrogen burned for 10 min |
|
||||||
|
| Phosphorus Metabolism | P burn efficiency +5, C/N/O -1 each | Phosphorus covers 5% more energy | C, N, O cover 1% less each | Burning phosphorus for 30 s total | No phosphorus burned for 10 min |
|
||||||
|
| Other Matter Metabolism | O burn efficiency +5, C/N/P -1 each | Other matter covers 5% more energy | C, N, P cover 1% less each | Burning other matter for 30 s total | No other matter burned for 10 min |
|
||||||
|
|
||||||
|
Thorough and Rapid Extraction mirror each other. Energy kept per bubble can never
|
||||||
|
exceed 100% of the bubble's energy.
|
||||||
|
|
||||||
|
### Photosynthesis
|
||||||
|
|
||||||
|
Light capture is in points, with acquisition at 100.
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Available | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| Acquire Photosynthesis | Gain producer tissue at 100, energy collection -2 | Steady energy from light | Tissue adds mass (slower, more upkeep); drains energy bubbles slower | After burning a tunable amount of carbon; not a producer | Burning carbon for 30 s total | Burning other channels for 30 s total |
|
||||||
|
| Expand Photosynthesis | Light capture +5, energy collection -2 | 5% more energy from light | More tissue mass and upkeep; drains energy bubbles slower | Is a producer | Drifting without thrust for 60 s total | Thrust for 2 min total |
|
||||||
|
| Reduce Photosynthesis (mirror) | Light capture -5, energy collection +2 | Less tissue, lighter; drains energy bubbles faster | Less energy from light | Is a producer, above the minimum | Thrust for 2 min total | Drifting without thrust for 60 s total |
|
||||||
|
| Shed Photosynthesis | Remove producer tissue | No producer mass or upkeep | No light energy | Is a producer | Thrust for 5 min total | Drifting without thrust for 60 s total |
|
||||||
|
|
||||||
|
Shed Photosynthesis has `base_weight` 25 (others 100), so shedding is rarer than
|
||||||
|
trimming. A cell that sheds it can be offered Acquire again; the carbon it has already
|
||||||
|
burned still counts.
|
||||||
|
|
||||||
|
## 7. Predation and defense mutations
|
||||||
|
|
||||||
|
Systems and terms are defined in the
|
||||||
|
[predation and defense plan](Cellular_predation_defense_plan.md). All indices are points
|
||||||
|
with the founder at 100. All available from birth.
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Reinforced Membrane | Membrane +5 | Predators need 5% more mass to engulf you | More membrane mass and upkeep, slower collection, heavier | In contact with a cell over 1.5x your mass for 5 s total | No contact with a larger cell for 10 min |
|
||||||
|
| Thin Membrane (mirror) | Membrane -5 | Faster collection, less mass and upkeep | Easier to engulf | No contact with a larger cell for 10 min | In contact with a cell over 1.5x your mass for 5 s total |
|
||||||
|
| Expanding Chamber | Engulf capacity +5, membrane -2 | Can engulf prey 5% bigger | Stretched wall: slightly easier to engulf yourself | 3 failed engulfs because the prey was too large or its membrane too thick | No engulf attempts for 10 min |
|
||||||
|
| Small Mouth (mirror) | Engulf capacity -5, membrane +2 | Tougher wall | Only smaller prey | No engulf attempts for 10 min | 3 failed engulfs because the prey was too large |
|
||||||
|
| Rapid Digestion | Kill absorption +5, shared intake -2 | Takes 5% more from a kill straight away, so less is left behind | Slower everyday feeding | A successful engulf | No successful engulf for 15 min |
|
||||||
|
| Grazer's Gut (mirror) | Kill absorption -5, shared intake +2 | Faster everyday feeding | Takes less from kills | No successful engulf for 15 min | A successful engulf |
|
||||||
|
|
||||||
|
Expanding Chamber links offense and defense: a better hunter is slightly easier prey.
|
||||||
|
Failed-engulf reasons (prey too large, membrane too thick) are already reported by the
|
||||||
|
server; contact with a larger cell is a new counter.
|
||||||
|
|
||||||
|
## 8. Body and maintenance mutations
|
||||||
|
|
||||||
|
Systems and terms are defined in the
|
||||||
|
[body and maintenance plan](Cellular_body_maintenance_plan.md). Indices are points with
|
||||||
|
the founder at 100; the body recipe is in per thousand. All available from birth.
|
||||||
|
|
||||||
|
**Recipe spread:** a thrifty body lowers one channel's share by the recipe step (20 per
|
||||||
|
thousand) and spreads the same amount evenly across the other three. Tunable per
|
||||||
|
mutation.
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Larger Body | Size +5 | Harder to engulf, can engulf bigger prey, larger footprint touches more food | More upkeep, costlier buds and regrowth, heavier and slower | Reserve holds more matter than the body for 60 s total | Burning matter for energy for 30 s total |
|
||||||
|
| Smaller Body (mirror) | Size -5 | Less upkeep, cheaper buds and regrowth, quicker | Easier to engulf, smaller prey only | Burning matter for energy for 30 s total | Reserve holds more matter than the body for 60 s total |
|
||||||
|
| Carbon-Thrifty Body | Carbon share -20, N/P/O share +20 in total | Building, regrowth and buds need less carbon | Need more N, P and O | Growth or a bud blocked by lack of carbon for 10 s total | Carbon is at least half the matter collected in the last minute |
|
||||||
|
| Nitrogen-Thrifty Body | Nitrogen share -20, C/P/O share +20 in total | Need less nitrogen | Need more C, P and O | Same, for nitrogen | Same, for nitrogen |
|
||||||
|
| Phosphorus-Thrifty Body | Phosphorus share -20, C/N/O share +20 in total | Need less phosphorus | Need more C, N and O | Same, for phosphorus | Same, for phosphorus |
|
||||||
|
| Other-Thrifty Body | Other-matter share -20, C/N/P share +20 in total | Need less other matter | Need more C, N and P | Same, for other matter | Same, for other matter |
|
||||||
|
| Efficient Upkeep | Upkeep efficiency +5, growth speed -2 | Lower upkeep, never below the essential floor | Regrows 2% slower | Upkeep is over half the energy spent in the last 5 min | Regrowing for 60 s total |
|
||||||
|
| Rapid Growth | Growth speed +5, upkeep efficiency -2 | Regrows 5% faster after splits | More upkeep | Regrowing for 60 s total | Fully grown for 10 min |
|
||||||
|
| Dense Tissue | Density +5 | Smaller footprint for the same mass, lighter membrane, less upkeep | Less surface: slower collection, touches less food | In contact with a cell over 1.5x your mass for 5 s total | Feeding by contact for 60 s total |
|
||||||
|
| Light Tissue (mirror) | Density -5 | Larger surface: faster collection, touches more food | More membrane mass and upkeep, bigger target | Feeding by contact for 60 s total | In contact with a cell over 1.5x your mass for 5 s total |
|
||||||
|
|
||||||
|
Thrifty bodies have no performance effect; their value is fitting the region's supply,
|
||||||
|
and they pair with the Gatherer mutations. Efficient Upkeep and Rapid Growth mirror
|
||||||
|
each other. Dense Tissue and Reinforced Membrane share an increase trigger: both answer
|
||||||
|
the same threat.
|
||||||
|
|
||||||
|
## 9. Reproduction mutations
|
||||||
|
|
||||||
|
Systems and terms are defined in the
|
||||||
|
[reproduction plan](Cellular_reproduction_plan.md). Bud share is in points with the
|
||||||
|
founder at 100 (half the parent's body). Only on-demand buds count as reproductions;
|
||||||
|
mutation splits do not.
|
||||||
|
|
||||||
|
### Bud size
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Bigger Buds | Bud share +5 | Buds start 5% larger: harder to engulf, more likely to survive | Each bud costs 5% more from the reserve | One of your buds is engulfed within 2 min of birth | A bud refused for lack of resources |
|
||||||
|
| Smaller Buds (mirror) | Bud share -5 | Each bud is cheaper | Buds start smaller and more vulnerable | A bud refused for lack of resources | One of your buds is engulfed within 2 min of birth |
|
||||||
|
|
||||||
|
### Multiple offspring
|
||||||
|
|
||||||
|
**Litter** is a heritable value, founder 0, giving extra offspring per bud:
|
||||||
|
|
||||||
|
- Each full 100 litter points is one guaranteed extra offspring; the remainder is the
|
||||||
|
percentage chance of one more. Litter 150 means one extra, plus a 50% chance of a
|
||||||
|
second.
|
||||||
|
- Every offspring of one bud shares the same investment, so more offspring means each
|
||||||
|
is smaller. The bud costs the same.
|
||||||
|
- The maximum offspring per bud is tunable (trial 10, so litter up to 900).
|
||||||
|
- Each extra offspring needs a free spot touching the parent and room under the region
|
||||||
|
cap. If fewer can be placed, fewer are born; the parent keeps the share of any that
|
||||||
|
were not.
|
||||||
|
- This replaces the current 25% twin chance: new founders start at litter 0.
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| Twinning | Litter +25 | More offspring per bud | Each offspring starts smaller and more vulnerable | Bud while the reserve covers at least twice the bud's cost | One of your buds is engulfed within 2 min of birth |
|
||||||
|
| Single Bud (mirror) | Litter -25 | Each offspring starts larger | Fewer offspring per bud | One of your buds is engulfed within 2 min of birth | Bud while the reserve covers at least twice the bud's cost |
|
||||||
|
|
||||||
|
Single Bud is not eligible at litter 0. Twinning is not eligible at the maximum.
|
||||||
|
|
||||||
|
### Becoming multicellular
|
||||||
|
|
||||||
|
| Name | Effect | Pro | Con | Available | Increase | Decrease |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| Adhesion | Gain Adhesion | Become a multicellular organism: the path to emerging into the world | Permanent: no more splits, one shared reserve, the whole organism can be engulfed at once, heavier | After a tunable number of on-demand buds (trial 5) | Each on-demand bud | No bud for 15 min |
|
||||||
|
|
||||||
|
Adhesion has `base_weight` 50. Accepting it is a split whose offspring expresses
|
||||||
|
Adhesion and attaches, so the organism forms at once whichever cell the player keeps;
|
||||||
|
its offer shows Accept and Decline only.
|
||||||
|
|
||||||
|
Emerging into the world is a **button**, not a mutation: it appears once the organism
|
||||||
|
reaches the emergence threshold (reproduction plan, section 7).
|
||||||
|
|
||||||
|
## 10. Balance notes
|
||||||
|
|
||||||
|
- Economical Propulsion and Streamlined Body raise top speed without raising energy per
|
||||||
|
second. Their cost and weights must keep them from dominating.
|
||||||
|
- Big Appetite only matters where a channel's own limit is above the share of the
|
||||||
|
shared limit it gets; the shared limit and channel limits must be tuned together.
|
||||||
|
- Thresholds above are first guesses. "Thrust for 10 s" is cumulative and fires each
|
||||||
|
time 10 s of thrust accrues; "no thrust for 30 min" is continuous.
|
||||||
|
|
||||||
|
## 11. Implementation map
|
||||||
|
|
||||||
|
| Piece | State today |
|
||||||
|
| --- | --- |
|
||||||
|
| Movement arrangement in the genome | Exists (schema 6); not edited by any mutation yet. |
|
||||||
|
| Handling from the arrangement | Exists: output, efficiency, steering, streamlining, braking, coasting. |
|
||||||
|
| Step/paired points, interval, option count | Keys exist in `cellular.tuning`; unused by code. |
|
||||||
|
| Named catalog with pro/con, triggers and cost | New: replaces the 32 generic adjust/acquire/shed operators for new rules. |
|
||||||
|
| Per-cell affinity scores | New persisted state, inherited at birth (lives format bump). |
|
||||||
|
| Trigger tracking | New server-side activity counters from per-tick thrust, brake, heading and velocity. |
|
||||||
|
| Chance allocation and systematic draw | New: replaces the current uniform draw of 3. |
|
||||||
|
| Per-mutation cost and scale | New tuning keys and funding path; defaults all 0. |
|
||||||
|
| Reclaimed cost | New: paid channels become seeded random bubbles in the region. |
|
||||||
|
| Per-mutation `enabled` switch | New tuning key, for narrowing the pool in tests. |
|
||||||
|
| Per-mutation step sizes | New tuning keys (primary, paired, spread). |
|
||||||
|
| Feeding and energy genome fields | New: collection index per channel, shared intake, burn efficiency per channel; energy kept per bubble reuses `energy_conversion`. |
|
||||||
|
| Feeding and energy triggers | New counters: diet share per channel, time at intake limit, matter burned per channel, drifting time. |
|
||||||
|
| Predation genome fields | New: membrane in points, engulf capacity, kill absorption. |
|
||||||
|
| Predation triggers | Failed-engulf reasons exist; contact time with larger cells and kill timers are new. |
|
||||||
|
| Body genome fields | New: size in points, body recipe, upkeep efficiency, density, growth speed. |
|
||||||
|
| Body triggers | New: growth or bud blocked by a named channel, regrowth time, time fully grown, reserve-to-body ratio. |
|
||||||
|
| Reproduction genome fields | Bud share exists (reproduction capability, in points is new); litter and Adhesion are new. |
|
||||||
|
| Multiple offspring per bud | Twin budding exists (shared investment, room check); litter in place of the fixed 25% chance is new. |
|
||||||
|
| Reproduction triggers | New: on-demand bud count, bud refusals, early deaths of own buds, reserve-to-bud-cost ratio. |
|
||||||
|
| Offer UI | Shows name, pro, con, cost, shortfall and chance. |
|
||||||
|
|
||||||
|
Every new behaviour goes in a new rules version; regions on earlier rules keep their
|
||||||
|
meaning.
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
# Cellular predation and defense plan
|
||||||
|
|
||||||
|
Status: planning draft, 2026-10-22. Records the maintainer's decisions on engulfment
|
||||||
|
and membrane defense. Part of the [Cellular gameplay plan](Cellular_gameplay_plan.md).
|
||||||
|
Replaces the engulfment sections of [Cellular_feeding_draft.md](Cellular_feeding_draft.md)
|
||||||
|
and the active parts of [Cellular_defense_draft.md](Cellular_defense_draft.md). No code,
|
||||||
|
runtime rule or live region is changed by it.
|
||||||
|
|
||||||
|
## 1. Who can engulf
|
||||||
|
|
||||||
|
Every cell can try to engulf, wildlife included. The player engulfs by targeting a cell
|
||||||
|
it touches (the existing engulf action); wildlife uses the same action through its
|
||||||
|
controller. Engulfing is not a capability gained by mutation.
|
||||||
|
|
||||||
|
## 2. Eligibility
|
||||||
|
|
||||||
|
Engulfment is **instant**: if the attempt is eligible, the prey dies that tick.
|
||||||
|
|
||||||
|
```text
|
||||||
|
predator engulf mass x (predator engulf capacity / 100)
|
||||||
|
>= prey engulf mass x engulf ratio x (prey membrane points / 100)
|
||||||
|
```
|
||||||
|
|
||||||
|
Engulf capacity is a genome index, founder 100 (section 6).
|
||||||
|
|
||||||
|
- **Engulf mass** = body mass + reserve matter x `engulf_reserve_mass_percent`. At 100%
|
||||||
|
a hoarding cell is both harder to engulf and able to take larger prey; at 0% only
|
||||||
|
the body counts. Movement always counts all reserve matter; this setting affects
|
||||||
|
predation only.
|
||||||
|
- **Engulf ratio:** tunable; trial 1.5 (today's value), so at the founder's membrane a
|
||||||
|
predator needs 1.5 times the prey's mass.
|
||||||
|
- **Multicellular organisms** are engulfed whole or not at all, judged on the
|
||||||
|
organism's total engulf mass.
|
||||||
|
- Same-tick contests resolve in stable life order, as today.
|
||||||
|
|
||||||
|
## 3. What the predator gets
|
||||||
|
|
||||||
|
1. The predator absorbs up to its **per-tick collection limit** on each channel,
|
||||||
|
scaled by its kill absorption index (founder 100), from the prey's body and
|
||||||
|
reserve. Energy absorbed this way follows the energy-bubble efficiency rule
|
||||||
|
(feeding and energy plan, section 4a); the rest of it is heat.
|
||||||
|
2. The **remainder** is split:
|
||||||
|
- **Half becomes bubbles** at the prey's spot (one per non-empty channel), for the
|
||||||
|
predator to eat over the next ticks. Other cells and the currents compete for
|
||||||
|
them.
|
||||||
|
- **Half goes to the region's spent pool** and seeps back into the region as
|
||||||
|
random bubbles.
|
||||||
|
3. The prey's accumulated heat goes to the region's heat owner, as today.
|
||||||
|
|
||||||
|
If the region is at its deposit limit, the bubble half goes to the spent pool as well.
|
||||||
|
|
||||||
|
Staying to eat the bubbles is a risk: a predator that sits still long enough can
|
||||||
|
become prey itself.
|
||||||
|
|
||||||
|
## 4. Membrane defense
|
||||||
|
|
||||||
|
Membrane thickness is stored in **points**, with the founder at 100 (today's 1 µm), so
|
||||||
|
it can change in 5-point steps like movement.
|
||||||
|
|
||||||
|
| Thicker membrane | Thinner membrane |
|
||||||
|
| --- | --- |
|
||||||
|
| Harder to engulf (the ratio scales with points) | Easier to engulf |
|
||||||
|
| More membrane mass, which is upkept twice (exists) | Less mass and upkeep |
|
||||||
|
| Slower collection on every channel (new) | Faster collection |
|
||||||
|
| Heavier, so slower to move | Lighter |
|
||||||
|
|
||||||
|
The collection penalty is a tunable coefficient. Membrane points have a tunable
|
||||||
|
minimum (a viable cell wall) and maximum.
|
||||||
|
|
||||||
|
## 5. Postponed
|
||||||
|
|
||||||
|
Armor, live capture and escape, prey retention, slippery coating, adhesive grip,
|
||||||
|
defensive expulsion and siphoning wait for a live-capture system. They are not in the
|
||||||
|
mutation pool.
|
||||||
|
|
||||||
|
## 6. Genome indices and mutations
|
||||||
|
|
||||||
|
| Index | Founder | Mutations (mutation plan, section 7) |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Membrane points | 100 | Reinforced Membrane, Thin Membrane |
|
||||||
|
| Engulf capacity: scales the predator's side of the eligibility check | 100 | Expanding Chamber, Small Mouth |
|
||||||
|
| Kill absorption: scales the per-tick limit during a kill | 100 | Rapid Digestion, Grazer's Gut |
|
||||||
|
|
||||||
|
## 7. Tunables
|
||||||
|
|
||||||
|
| Setting | Trial |
|
||||||
|
| --- | --- |
|
||||||
|
| Engulf ratio | 1.5 |
|
||||||
|
| `engulf_reserve_mass_percent` | 100% |
|
||||||
|
| Kill remainder bubble share | 50% (the rest to the spent pool) |
|
||||||
|
| Membrane collection penalty | To be selected in playtesting |
|
||||||
|
| Membrane points minimum and maximum | To be selected in playtesting |
|
||||||
|
|
||||||
|
## 8. Implementation map
|
||||||
|
|
||||||
|
| Piece | State today |
|
||||||
|
| --- | --- |
|
||||||
|
| Instant engulfment by contact, in stable order | Exists (rules 3+). |
|
||||||
|
| Wildlife engulfing | Exists (rules 7+). |
|
||||||
|
| Engulf mass with tunable reserve share | New; today only body plus reserve as total mass. |
|
||||||
|
| Membrane in points | New genome representation (whole micrometres today). |
|
||||||
|
| Kill remainder split between bubbles and spent pool | New; today all of it becomes bubbles. |
|
||||||
|
| Membrane slowing collection | New. |
|
||||||
|
| Engulf capacity and kill absorption indices | New genome fields. |
|
||||||
|
| Whole-organism engulfment | New, with the multicellular organism. |
|
||||||
|
|
||||||
|
Every new behaviour goes in a new rules version; regions on earlier rules keep their
|
||||||
|
meaning.
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
# 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
|
||||||
|
proposals in ADR-0135, this document wins. No code, runtime rule or live region is
|
||||||
|
changed by it.
|
||||||
|
|
||||||
|
## 1. Purpose
|
||||||
|
|
||||||
|
Today reproduction has no purpose for the player: it costs resources, and the player
|
||||||
|
watches the offspring swim off, eat and reproduce until it dies.
|
||||||
|
|
||||||
|
The goal is one loop:
|
||||||
|
|
||||||
|
**gather energy and matter -> evolve and reproduce -> become a multicellular
|
||||||
|
organism -> break out of the region into the world.**
|
||||||
|
|
||||||
|
Reproduction becomes the way a lineage evolves, and the way a multicellular organism
|
||||||
|
grows.
|
||||||
|
|
||||||
|
## 2. Two genomes per cell
|
||||||
|
|
||||||
|
Every cell carries two genome references (they already exist from rules 10):
|
||||||
|
|
||||||
|
| Genome | Meaning |
|
||||||
|
| --- | --- |
|
||||||
|
| **Expressed** | What its own body is built from: its traits, handling, costs. |
|
||||||
|
| **Heritable plan** | What its offspring are born expressing. |
|
||||||
|
|
||||||
|
A newborn starts with both references naming the same genome: it expresses its plan.
|
||||||
|
|
||||||
|
## 3. Bud (on demand)
|
||||||
|
|
||||||
|
- **Trigger:** the player presses Bud.
|
||||||
|
- **Requires:** fully grown (`bud_min_growth`), a free spot touching the parent, and
|
||||||
|
the region below its organism cap.
|
||||||
|
- **Cost:** the parent's reserve pays the bud's body, the energy to build it and its
|
||||||
|
starting energy supply, as today. A tunable fee per channel (default 0, with the same
|
||||||
|
amount-and-scale model as mutation costs) is added on top and reclaimed by the
|
||||||
|
environment as random bubbles.
|
||||||
|
- **Offspring:** expresses the parent's heritable plan, so it carries every mutation
|
||||||
|
held in that plan.
|
||||||
|
- **Size:** the reproduction capability's share of the parent's body (founder: half),
|
||||||
|
built from the parent's reserve (body and maintenance plan, section 6).
|
||||||
|
- **Litter:** a heritable value (founder 0) can give extra offspring per bud, up to a
|
||||||
|
tunable maximum (trial 10). They share one investment, so each is smaller. See the
|
||||||
|
mutation plan, section 9.
|
||||||
|
- **Control:** the player chooses to stay as the parent or become the bud. The cell the
|
||||||
|
player leaves becomes wildlife. The choice is one way.
|
||||||
|
|
||||||
|
This section describes a single cell. A multicellular organism's bud becomes an
|
||||||
|
internal cell instead (section 6).
|
||||||
|
|
||||||
|
## 4. Mutation split
|
||||||
|
|
||||||
|
Accepting a mutation divides a single cell. (A multicellular organism expresses an
|
||||||
|
accepted mutation directly; section 6.)
|
||||||
|
|
||||||
|
1. The mutation's cost is paid and reclaimed by the environment (mutation plan,
|
||||||
|
section 4).
|
||||||
|
2. The mutation is written into the heritable plan of **both** cells.
|
||||||
|
3. The cell divides. Body and reserve are split per channel by `split_share` (trial
|
||||||
|
50%); a rounding remainder stays with the founder. Each half starts at the size its
|
||||||
|
half of the body covers and regrows by feeding (body and maintenance plan,
|
||||||
|
section 5).
|
||||||
|
4. The **offspring expresses the mutation**. The **founder does not**: its body is
|
||||||
|
unchanged, but its plan now carries the mutation.
|
||||||
|
5. The player chooses which cell to continue as. The other becomes wildlife. (When the
|
||||||
|
mutation is Adhesion, the two stay attached instead; section 6.)
|
||||||
|
|
||||||
|
The control choice is made in the offer itself: each option has **Stay as founder**
|
||||||
|
and **Become offspring**. Nothing waits on a decision window after the birth.
|
||||||
|
|
||||||
|
| Choice | The player controls | The other cell |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Stay as founder | The unchanged body, with half the resources. Every later bud expresses the mutation. | The mutated offspring becomes wildlife: the player watches how the mutation does. |
|
||||||
|
| Become offspring | The mutated body, with half the resources, not starting from nothing. | The founder becomes wildlife with an unchanged body; its own buds are mutated. |
|
||||||
|
|
||||||
|
Consequences:
|
||||||
|
|
||||||
|
- A player who always stays as the founder accumulates mutations in their plan, but
|
||||||
|
their own body never changes. To live in a mutated body, the player must at some
|
||||||
|
point become an offspring.
|
||||||
|
- If a mutation changes how much matter the body needs, the offspring funds the
|
||||||
|
difference from its half. If it cannot, the split is refused and nothing is spent.
|
||||||
|
- Both cells inherit the founder's affinity scores.
|
||||||
|
|
||||||
|
### When a split is not possible
|
||||||
|
|
||||||
|
A split needs a minimum growth (`split_min_growth`, trial: fully grown), a free spot
|
||||||
|
touching the founder, and the region below its organism cap. If any is missing, the
|
||||||
|
option shows why and cannot be chosen; the offer stays pending until the split is
|
||||||
|
possible or the player declines.
|
||||||
|
|
||||||
|
## 5. The cell the player leaves
|
||||||
|
|
||||||
|
It becomes autonomous wildlife, as today: it feeds, buds from its own heritable plan
|
||||||
|
and dies. Wildlife earns no mutation offers.
|
||||||
|
|
||||||
|
## 6. Becoming multicellular
|
||||||
|
|
||||||
|
### The transition
|
||||||
|
|
||||||
|
- **Adhesion** is a mutation, offered after a tunable number of on-demand buds (trial
|
||||||
|
5; mutation splits do not count). A newborn that expresses Adhesion stays attached to
|
||||||
|
its parent.
|
||||||
|
- The moment a newborn attaches, the parent and newborn become **one multicellular
|
||||||
|
organism**. There is no separate colony stage.
|
||||||
|
- Accepting Adhesion is a mutation split (section 4) whose offspring expresses
|
||||||
|
Adhesion, so it attaches at once: the organism forms immediately, whichever cell the
|
||||||
|
player would have kept. The offer shows Accept and Decline only.
|
||||||
|
- The organism expresses **one genome**: the founder's heritable plan at the moment of
|
||||||
|
attachment, which now includes Adhesion. Mutations the founder held in its plan
|
||||||
|
become expressed for the whole organism. Any tissue that change requires is funded
|
||||||
|
from the combined reserve; if it cannot be funded, the split is refused and nothing
|
||||||
|
is spent.
|
||||||
|
- A member can never be detached.
|
||||||
|
|
||||||
|
### Life as a multicellular organism
|
||||||
|
|
||||||
|
- **One reserve:** every member's reserve combines into the organism's reserve.
|
||||||
|
- **Mutations affect the whole organism.** Accepting one does not split anything; it is
|
||||||
|
expressed by the organism directly, paid from the organism's reserve, and changed
|
||||||
|
tissue is funded from it. The offer shows only Accept or Decline; there is no
|
||||||
|
Stay / Become choice.
|
||||||
|
- **Budding adds an internal cell.** The bud's body is built from the organism's
|
||||||
|
reserve and becomes part of the organism. It counts toward the emergence threshold.
|
||||||
|
- **The goal changes:** the organism gathers mass and energy to emerge into the world.
|
||||||
|
- **Region cap:** a multicellular organism counts once toward the region's organism
|
||||||
|
cap, however many members it has.
|
||||||
|
- **Mass drives movement and energy.** Every member adds to the organism's mass.
|
||||||
|
Heavier organisms accelerate and turn more slowly for the same thrust, and movement
|
||||||
|
energy rises with total mass, reserve matter included. Upkeep rises with body mass
|
||||||
|
only (feeding and energy plan, section 4). The coefficients are tuned in
|
||||||
|
playtesting.
|
||||||
|
|
||||||
|
### Wildlife organisms
|
||||||
|
|
||||||
|
Because Adhesion always forms the organism at once with the player's cell, and an
|
||||||
|
organism never releases a cell, wildlife cannot currently become multicellular. As a
|
||||||
|
safeguard, a wildlife organism **cannot emerge**: it stops budding one member short of
|
||||||
|
the emergence member threshold. Wildlife earns no mutation offers.
|
||||||
|
|
||||||
|
### Death
|
||||||
|
|
||||||
|
The organism lives and dies as one body.
|
||||||
|
|
||||||
|
- **Starvation:** with one reserve, members cannot starve individually. The organism
|
||||||
|
starves when its reserve cannot pay its maintenance, and the whole organism dies.
|
||||||
|
- **Engulfment:** a predator engulfs the whole organism or none of it, judged on the
|
||||||
|
organism's total mass.
|
||||||
|
- **On death:** every member becomes a corpse and its matter returns to the region as
|
||||||
|
food, as deaths do today.
|
||||||
|
|
||||||
|
This replaces the earlier rule that a dead member is recycled to the colony: with a
|
||||||
|
combined reserve, a member cannot die on its own.
|
||||||
|
|
||||||
|
## 7. Emergence
|
||||||
|
|
||||||
|
When the organism reaches the emergence threshold, an **Emerge** button appears. It is
|
||||||
|
not a mutation and is not drawn in offers. Pressing it leaves the region and enters the
|
||||||
|
world as ADR-0177 describes: the matter is a recorded export, and the organism arrives
|
||||||
|
at a world-scaled value at a location chosen near its preferred temperature and
|
||||||
|
nutrients. Individual or bulk emergence
|
||||||
|
follows ADR-0177.
|
||||||
|
|
||||||
|
The threshold is tunable: member count, total mass and reserve energy.
|
||||||
|
|
||||||
|
## 8. Tunables
|
||||||
|
|
||||||
|
| Setting | Trial |
|
||||||
|
| --- | --- |
|
||||||
|
| `bud_min_growth` | 1000 per thousand (fully grown) |
|
||||||
|
| `bud_fee` per channel, `bud_fee_scale_percent` | 0, 0 |
|
||||||
|
| `split_min_growth` | 1000 per thousand |
|
||||||
|
| `split_share` | 50% |
|
||||||
|
| Emergence threshold: members, total mass, reserve energy | To be selected in playtesting |
|
||||||
|
| Wildlife member limit | Emergence member threshold minus 1 |
|
||||||
|
| Mass coefficients for acceleration, turning, movement and maintenance energy | To be selected in playtesting |
|
||||||
|
|
||||||
|
## 9. Open questions
|
||||||
|
|
||||||
|
None. Organism size, drag and feeding contact by member count are tuned with the mass
|
||||||
|
coefficients above.
|
||||||
|
|
||||||
|
## 10. Implementation map
|
||||||
|
|
||||||
|
| Piece | State today |
|
||||||
|
| --- | --- |
|
||||||
|
| Expressed genome and heritable plan per cell | Exists (lives format 8, rules 10-12). |
|
||||||
|
| Bud funding with a different offspring genome | Exists (`fund_offspring`, ADR-0164). |
|
||||||
|
| Funding a mutation at the current growth | Exists (`fund_mutation_at_growth`, ADR-0157). |
|
||||||
|
| Funded regrowth after a split | Exists (funded maturation, rules 9). |
|
||||||
|
| Choosing parent or child at birth | Accepted direction (ADR-0163); not built. |
|
||||||
|
| On-demand bud with a control choice and a fee | New. |
|
||||||
|
| Mutation split: even division of body and reserve | New transition; not the bud bill. |
|
||||||
|
| Offer options with Stay / Become | New wire and UI. |
|
||||||
|
| Adhesion and the multicellular transition | New. |
|
||||||
|
| Multicellular organism: one genome, one reserve, internal buds | New. |
|
||||||
|
| Mass-scaled handling and energy for the organism | Partial: movement and maintenance energy already scale with a cell's body mass; reserve mass in movement and organism-level handling are new. |
|
||||||
|
| Wildlife member limit below the emergence threshold | New safeguard. |
|
||||||
|
| Emergence | Accepted direction (ADR-0177); not built. |
|
||||||
|
|
||||||
|
Every new behaviour goes in a new rules version; regions on earlier rules keep their
|
||||||
|
meaning.
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
// ADR-0182 read-only admin API and portal host for one world (DEV).
|
||||||
|
//
|
||||||
|
// evo-admin-api --listen ADDRESS:PORT --world N --jwks JSON --oidc-issuer URL
|
||||||
|
// --audience NAME --client NAME --role NAME --assets DIR
|
||||||
|
// --pg-passfile F --pg-service F [--region REGION=HOST:PORT ...] [--baseline-tuning F]
|
||||||
|
// [--region-tuning F] [--deploy-config DIR]
|
||||||
|
//
|
||||||
|
// --assets holds the portal's index.html, app.js and style.css. Each --region names a
|
||||||
|
// region's operations address, whose /admin/view the portal may show; those regions adopt
|
||||||
|
// tuning revisions. --baseline-tuning is the revamp tuning file they opened with, shown
|
||||||
|
// until the first revision; --region-tuning the region tuning file they start with, shown
|
||||||
|
// read only. --deploy-config is the mounted Secret holding the Gitea and Argo CD settings and
|
||||||
|
// tokens (one file per key) that let the portal open a region (ADR-0182 section 15); without
|
||||||
|
// it, or with a key missing, that feature stays off. No token is printed.
|
||||||
|
#include "evo/persistence/postgres.hpp"
|
||||||
|
#include "evo/server/admin/admin_api.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <charconv>
|
||||||
|
#include <chrono>
|
||||||
|
#include <csignal>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using namespace evo;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
volatile std::sig_atomic_t stop_requested = 0;
|
||||||
|
void on_stop(int) {
|
||||||
|
stop_requested = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Options {
|
||||||
|
std::string listen, jwks, oidc_issuer, audience, client, role, assets, baseline_tuning,
|
||||||
|
region_tuning, deploy_config;
|
||||||
|
std::uint64_t world{};
|
||||||
|
std::map<std::uint64_t, std::string> regions; // Region to its operations address.
|
||||||
|
persistence::PgOptions pg;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::optional<std::uint64_t> number(std::string_view text) {
|
||||||
|
std::uint64_t value{};
|
||||||
|
const auto [end, error] = std::from_chars(text.data(), text.data() + text.size(), value);
|
||||||
|
if (error != std::errc{} || end != text.data() + text.size())
|
||||||
|
return std::nullopt;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<Options> parse(int argc, char** argv) {
|
||||||
|
Options o;
|
||||||
|
std::string pg_service, pg_passfile;
|
||||||
|
for (int i = 1; i + 1 < argc; i += 2) {
|
||||||
|
const std::string_view flag = argv[i];
|
||||||
|
const std::string_view value = argv[i + 1];
|
||||||
|
const auto n = number(value);
|
||||||
|
if (flag == "--listen")
|
||||||
|
o.listen = value;
|
||||||
|
else if (flag == "--world" && n && *n > 0)
|
||||||
|
o.world = *n;
|
||||||
|
else if (flag == "--jwks")
|
||||||
|
o.jwks = value;
|
||||||
|
else if (flag == "--oidc-issuer")
|
||||||
|
o.oidc_issuer = value;
|
||||||
|
else if (flag == "--audience")
|
||||||
|
o.audience = value;
|
||||||
|
else if (flag == "--client")
|
||||||
|
o.client = value;
|
||||||
|
else if (flag == "--role")
|
||||||
|
o.role = value;
|
||||||
|
else if (flag == "--assets")
|
||||||
|
o.assets = value;
|
||||||
|
else if (flag == "--baseline-tuning")
|
||||||
|
o.baseline_tuning = value;
|
||||||
|
else if (flag == "--region-tuning")
|
||||||
|
o.region_tuning = value;
|
||||||
|
else if (flag == "--deploy-config")
|
||||||
|
o.deploy_config = value;
|
||||||
|
else if (flag == "--pg-service")
|
||||||
|
pg_service = value;
|
||||||
|
else if (flag == "--pg-passfile")
|
||||||
|
pg_passfile = value;
|
||||||
|
else if (flag == "--region") {
|
||||||
|
const auto equals = value.find('=');
|
||||||
|
const auto region =
|
||||||
|
equals == std::string_view::npos ? std::nullopt : number(value.substr(0, equals));
|
||||||
|
const auto address =
|
||||||
|
equals == std::string_view::npos ? std::string_view{} : value.substr(equals + 1);
|
||||||
|
if (!region || *region == 0 || address.empty() || address.size() > 128 ||
|
||||||
|
!o.regions.emplace(*region, std::string(address)).second)
|
||||||
|
return std::nullopt;
|
||||||
|
} else
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
// Names are embedded in the portal's JSON settings: printable ASCII without quotes.
|
||||||
|
const auto plain = [](std::string_view text) {
|
||||||
|
return !text.empty() && text.size() <= 256 && std::ranges::all_of(text, [](char ch) {
|
||||||
|
return ch > ' ' && ch <= '~' && ch != '"' && ch != '\\';
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (argc % 2 != 1 || o.listen.empty() || o.world == 0 || o.jwks.empty() ||
|
||||||
|
!plain(o.oidc_issuer) || !o.oidc_issuer.starts_with("https://") || !plain(o.audience) ||
|
||||||
|
!plain(o.client) || !plain(o.role) || o.assets.empty() || pg_service.empty() ||
|
||||||
|
pg_passfile.empty())
|
||||||
|
return std::nullopt;
|
||||||
|
auto service = persistence::read_pg_service(pg_service, "evolution");
|
||||||
|
if (!service)
|
||||||
|
return std::nullopt;
|
||||||
|
o.pg = *service;
|
||||||
|
o.pg.password_file = pg_passfile;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> read_file(const std::string& path) {
|
||||||
|
std::ifstream file{path, std::ios::binary};
|
||||||
|
if (!file)
|
||||||
|
return std::nullopt;
|
||||||
|
std::string body{std::istreambuf_iterator<char>{file}, std::istreambuf_iterator<char>{}};
|
||||||
|
if (body.empty() || body.size() > (std::size_t{1} << 20U))
|
||||||
|
return std::nullopt;
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint64_t wall_seconds() {
|
||||||
|
return static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
|
||||||
|
std::chrono::system_clock::now().time_since_epoch())
|
||||||
|
.count());
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
const auto options = parse(argc, argv);
|
||||||
|
if (!options) {
|
||||||
|
std::fputs("usage: evo-admin-api (see apps/evo-admin-api/main.cpp)\n", stderr);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
std::signal(SIGTERM, on_stop);
|
||||||
|
std::signal(SIGINT, on_stop);
|
||||||
|
std::signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
auto verifier = server::broker::TokenVerifier::from_jwks(
|
||||||
|
options->jwks,
|
||||||
|
{options->oidc_issuer, options->audience, options->client, 30, options->role});
|
||||||
|
if (!verifier) {
|
||||||
|
std::puts("error jwks");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
std::vector<server::admin::AdminAsset> assets;
|
||||||
|
for (const auto& [name, type] : {std::pair{"index.html", "text/html; charset=utf-8"},
|
||||||
|
std::pair{"app.js", "text/javascript; charset=utf-8"},
|
||||||
|
std::pair{"style.css", "text/css; charset=utf-8"}}) {
|
||||||
|
auto body = read_file(options->assets + "/" + name);
|
||||||
|
if (!body) {
|
||||||
|
std::printf("error assets %s\n", name);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
assets.push_back({std::string("/") + name, type, std::move(*body)});
|
||||||
|
}
|
||||||
|
// The realm's origin: sign-in redirects there and the portal exchanges tokens with it.
|
||||||
|
const auto origin_end = options->oidc_issuer.find('/', std::string_view{"https://"}.size());
|
||||||
|
const auto origin = options->oidc_issuer.substr(0, origin_end);
|
||||||
|
server::admin::AdminConfig config;
|
||||||
|
config.world = options->world;
|
||||||
|
for (const auto& [region, address] : options->regions)
|
||||||
|
config.view_regions.push_back(region);
|
||||||
|
if (!options->baseline_tuning.empty()) {
|
||||||
|
auto baseline = read_file(options->baseline_tuning);
|
||||||
|
if (!baseline) {
|
||||||
|
std::puts("error baseline-tuning");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
config.baseline_tuning = std::move(*baseline);
|
||||||
|
}
|
||||||
|
if (!options->region_tuning.empty()) {
|
||||||
|
auto region = read_file(options->region_tuning);
|
||||||
|
if (!region) {
|
||||||
|
std::puts("error region-tuning");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
config.region_tuning = std::move(*region);
|
||||||
|
}
|
||||||
|
config.portal_config_json = "{\"issuer\":\"" + options->oidc_issuer + "\",\"client_id\":\"" +
|
||||||
|
options->client + "\",\"world\":" + std::to_string(options->world) +
|
||||||
|
"}\n";
|
||||||
|
config.content_security_policy =
|
||||||
|
"default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; "
|
||||||
|
"connect-src 'self' " +
|
||||||
|
origin + "; form-action 'self' " + origin + "; frame-ancestors 'none'; base-uri 'none'";
|
||||||
|
|
||||||
|
auto listening = server::OpsServer::listen(options->listen,
|
||||||
|
server::OpsServer::max_configurable_response_bytes);
|
||||||
|
if (!listening) {
|
||||||
|
std::puts("error listen");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
const auto pg = options->pg;
|
||||||
|
const auto regions = options->regions;
|
||||||
|
server::admin::AdminApi api{std::move(config), std::move(*verifier),
|
||||||
|
[pg]() -> std::unique_ptr<persistence::Postgres> {
|
||||||
|
auto db = persistence::Postgres::connect(pg, 3s);
|
||||||
|
return db ? std::move(*db) : nullptr;
|
||||||
|
},
|
||||||
|
[regions](std::uint64_t region) -> std::optional<std::string> {
|
||||||
|
const auto found = regions.find(region);
|
||||||
|
if (found == regions.end())
|
||||||
|
return std::nullopt;
|
||||||
|
return server::admin::http_get(
|
||||||
|
found->second, "/admin/view", 1500ms,
|
||||||
|
server::OpsServer::max_configurable_response_bytes);
|
||||||
|
},
|
||||||
|
std::move(assets)};
|
||||||
|
// ADR-0182 section 15: the portal opens regions only when every deploy key is present.
|
||||||
|
if (!options->deploy_config.empty()) {
|
||||||
|
const auto key = [&](const char* name) {
|
||||||
|
auto text = read_file(options->deploy_config + "/" + name).value_or("");
|
||||||
|
while (!text.empty() &&
|
||||||
|
(text.back() == '\n' || text.back() == '\r' || text.back() == ' '))
|
||||||
|
text.pop_back();
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
server::admin::AdminDeployConfig deploy{.gitea_base = key("GITEA_BASE_URL"),
|
||||||
|
.gitea_repository = key("GITEA_REPOSITORY"),
|
||||||
|
.gitea_token = key("GITEA_TOKEN"),
|
||||||
|
.branch = "main",
|
||||||
|
.argo_server = key("ARGOCD_SERVER"),
|
||||||
|
.argo_application = key("ARGOCD_APPLICATION"),
|
||||||
|
.argo_token = key("ARGOCD_TOKEN"),
|
||||||
|
.argo_verify = key("ARGOCD_TLS_VERIFY") != "false"};
|
||||||
|
if (deploy.gitea_base.empty() || deploy.gitea_repository.empty() ||
|
||||||
|
deploy.gitea_token.empty() || deploy.argo_server.empty() ||
|
||||||
|
deploy.argo_application.empty() || deploy.argo_token.empty()) {
|
||||||
|
std::puts("deploy disabled (incomplete configuration)");
|
||||||
|
} else {
|
||||||
|
std::printf("deploy enabled repository %s application %s argo-verify %s\n",
|
||||||
|
deploy.gitea_repository.c_str(), deploy.argo_application.c_str(),
|
||||||
|
deploy.argo_verify ? "yes" : "no");
|
||||||
|
api.enable_deploy(std::move(deploy), server::admin::https_request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::printf("admin api listening %u world %llu\n", static_cast<unsigned>((*listening)->port()),
|
||||||
|
static_cast<unsigned long long>(options->world));
|
||||||
|
std::fflush(stdout);
|
||||||
|
while (stop_requested == 0) {
|
||||||
|
(*listening)
|
||||||
|
->serve_api(
|
||||||
|
[&](const server::ApiRequest& request) {
|
||||||
|
return api.handle(request, wall_seconds(), std::chrono::steady_clock::now());
|
||||||
|
},
|
||||||
|
server::OpsServer::max_api_body_bytes); // Tuning texts (ADR-0182 section 13).
|
||||||
|
std::this_thread::sleep_for(5ms);
|
||||||
|
}
|
||||||
|
std::puts("admin api stopped");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex">
|
||||||
|
<title>AEvolution Admin</title>
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
<script type="module" src="/app.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header class="bar">
|
||||||
|
<a class="brand" href="#/accounts">AEvolution <span>admin</span></a>
|
||||||
|
<nav class="sections" aria-label="Sections">
|
||||||
|
<div class="section">
|
||||||
|
<span class="section-name">Cellular</span>
|
||||||
|
<a href="#/accounts" data-route="accounts">Accounts</a>
|
||||||
|
<a href="#/regions" data-route="regions">Regions</a>
|
||||||
|
<a href="#/tuning" data-route="tuning">Tuning</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="who">
|
||||||
|
<span id="env" class="env" hidden></span>
|
||||||
|
<div class="theme-switch" role="group" aria-label="Theme">
|
||||||
|
<button type="button" data-theme-choice="system" title="Follow the system">Auto</button>
|
||||||
|
<button type="button" data-theme-choice="light" title="Light">☀</button>
|
||||||
|
<button type="button" data-theme-choice="dark" title="Dark">☾</button>
|
||||||
|
</div>
|
||||||
|
<span id="who" class="muted small"></span>
|
||||||
|
<button id="sign-out" class="ghost" hidden>Sign out</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main id="main" tabindex="-1">
|
||||||
|
<p class="muted">Loading…</p>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,625 @@
|
|||||||
|
/* ADR-0182 admin portal. Tokens first: light by default, dark from the system or the header's
|
||||||
|
theme switch (html[data-theme]). The region map reads the map tokens when it paints. */
|
||||||
|
:root {
|
||||||
|
--bg: #f3f5f8;
|
||||||
|
--panel: #ffffff;
|
||||||
|
--panel-2: #f6f8fa;
|
||||||
|
--panel-3: #eef1f5;
|
||||||
|
--line: #e1e6ec;
|
||||||
|
--line-strong: #cfd6de;
|
||||||
|
--text: #17202a;
|
||||||
|
--muted: #5f6c79;
|
||||||
|
--faint: #8b96a2;
|
||||||
|
--accent: #2563eb;
|
||||||
|
--accent-soft: rgba(37, 99, 235, 0.1);
|
||||||
|
--on-accent: #ffffff;
|
||||||
|
--good: #15925f;
|
||||||
|
--good-soft: rgba(21, 146, 95, 0.1);
|
||||||
|
--warn: #b7791f;
|
||||||
|
--warn-soft: rgba(183, 121, 31, 0.12);
|
||||||
|
--bad: #d64545;
|
||||||
|
--bad-soft: rgba(214, 69, 69, 0.1);
|
||||||
|
--shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
|
||||||
|
--shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.14);
|
||||||
|
/* Region map. */
|
||||||
|
--map-bg: #fbfcfd;
|
||||||
|
--map-grid: rgba(23, 32, 42, 0.05);
|
||||||
|
--map-edge: #cfd6de;
|
||||||
|
--map-glass: rgba(255, 255, 255, 0.86);
|
||||||
|
--player: #2f6fed;
|
||||||
|
--online: #06b6d4;
|
||||||
|
--wildlife: #16a34a;
|
||||||
|
--pool: rgba(37, 99, 235, 0.1);
|
||||||
|
--pool-edge: rgba(37, 99, 235, 0.45);
|
||||||
|
--patch: rgba(120, 90, 40, 0.14);
|
||||||
|
--select: #f59e0b;
|
||||||
|
--energy: #eab308;
|
||||||
|
--carbon: #4b5563;
|
||||||
|
--nitrogen: #8b5cf6;
|
||||||
|
--phosphorus: #f97316;
|
||||||
|
--other: #ec4899;
|
||||||
|
--radius: 10px;
|
||||||
|
--radius-sm: 7px;
|
||||||
|
--mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
|
||||||
|
color-scheme: light;
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root:not([data-theme="light"]) {
|
||||||
|
--bg: #0b0f14;
|
||||||
|
--panel: #121820;
|
||||||
|
--panel-2: #161e27;
|
||||||
|
--panel-3: #1c2531;
|
||||||
|
--line: #232d3a;
|
||||||
|
--line-strong: #2f3b4b;
|
||||||
|
--text: #e4eaf0;
|
||||||
|
--muted: #8d9aa8;
|
||||||
|
--faint: #64717f;
|
||||||
|
--accent: #5b9dff;
|
||||||
|
--accent-soft: rgba(91, 157, 255, 0.14);
|
||||||
|
--on-accent: #06101f;
|
||||||
|
--good: #3ecf8e;
|
||||||
|
--good-soft: rgba(62, 207, 142, 0.12);
|
||||||
|
--warn: #f2b84b;
|
||||||
|
--warn-soft: rgba(242, 184, 75, 0.13);
|
||||||
|
--bad: #ff6b6b;
|
||||||
|
--bad-soft: rgba(255, 107, 107, 0.12);
|
||||||
|
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
||||||
|
--shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55);
|
||||||
|
--map-bg: #070b10;
|
||||||
|
--map-grid: rgba(140, 170, 200, 0.06);
|
||||||
|
--map-edge: #2a3646;
|
||||||
|
--map-glass: rgba(18, 24, 32, 0.86);
|
||||||
|
--player: #5b9dff;
|
||||||
|
--online: #5ff2ff;
|
||||||
|
--wildlife: #3ecf8e;
|
||||||
|
--pool: rgba(91, 157, 255, 0.12);
|
||||||
|
--pool-edge: rgba(91, 157, 255, 0.5);
|
||||||
|
--patch: rgba(200, 160, 90, 0.14);
|
||||||
|
--select: #ffd166;
|
||||||
|
--energy: #ffd84d;
|
||||||
|
--carbon: #a3adb8;
|
||||||
|
--nitrogen: #a78bfa;
|
||||||
|
--phosphorus: #ff9a3c;
|
||||||
|
--other: #ff6fb5;
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:root[data-theme="dark"] {
|
||||||
|
--bg: #0b0f14;
|
||||||
|
--panel: #121820;
|
||||||
|
--panel-2: #161e27;
|
||||||
|
--panel-3: #1c2531;
|
||||||
|
--line: #232d3a;
|
||||||
|
--line-strong: #2f3b4b;
|
||||||
|
--text: #e4eaf0;
|
||||||
|
--muted: #8d9aa8;
|
||||||
|
--faint: #64717f;
|
||||||
|
--accent: #5b9dff;
|
||||||
|
--accent-soft: rgba(91, 157, 255, 0.14);
|
||||||
|
--on-accent: #06101f;
|
||||||
|
--good: #3ecf8e;
|
||||||
|
--good-soft: rgba(62, 207, 142, 0.12);
|
||||||
|
--warn: #f2b84b;
|
||||||
|
--warn-soft: rgba(242, 184, 75, 0.13);
|
||||||
|
--bad: #ff6b6b;
|
||||||
|
--bad-soft: rgba(255, 107, 107, 0.12);
|
||||||
|
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
||||||
|
--shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55);
|
||||||
|
--map-bg: #070b10;
|
||||||
|
--map-grid: rgba(140, 170, 200, 0.06);
|
||||||
|
--map-edge: #2a3646;
|
||||||
|
--map-glass: rgba(18, 24, 32, 0.86);
|
||||||
|
--player: #5b9dff;
|
||||||
|
--online: #5ff2ff;
|
||||||
|
--wildlife: #3ecf8e;
|
||||||
|
--pool: rgba(91, 157, 255, 0.12);
|
||||||
|
--pool-edge: rgba(91, 157, 255, 0.5);
|
||||||
|
--patch: rgba(200, 160, 90, 0.14);
|
||||||
|
--select: #ffd166;
|
||||||
|
--energy: #ffd84d;
|
||||||
|
--carbon: #a3adb8;
|
||||||
|
--nitrogen: #a78bfa;
|
||||||
|
--phosphorus: #ff9a3c;
|
||||||
|
--other: #ff6fb5;
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Base ---------- */
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
[hidden] { display: none !important; }
|
||||||
|
html, body { margin: 0; }
|
||||||
|
body {
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
a { color: var(--accent); text-decoration: none; }
|
||||||
|
a:hover { text-decoration: underline; }
|
||||||
|
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
|
||||||
|
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
|
||||||
|
h3 { font-size: 13px; font-weight: 600; margin: 0; }
|
||||||
|
.muted { color: var(--muted); }
|
||||||
|
.faint { color: var(--faint); }
|
||||||
|
.mono { font-family: var(--mono); font-size: 12.5px; }
|
||||||
|
.num { font-variant-numeric: tabular-nums; }
|
||||||
|
.error { color: var(--bad); }
|
||||||
|
.good { color: var(--good); }
|
||||||
|
.small { font-size: 12px; }
|
||||||
|
.center { display: grid; place-items: center; min-height: 55vh; text-align: center; }
|
||||||
|
.center h1 { margin-bottom: 6px; }
|
||||||
|
.center .muted { margin-bottom: 18px; }
|
||||||
|
|
||||||
|
button {
|
||||||
|
font: inherit;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
background: var(--panel);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 6px 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.12s, border-color 0.12s, color 0.12s;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
button:hover { border-color: var(--accent); color: var(--accent); }
|
||||||
|
button:disabled { opacity: 0.5; cursor: default; }
|
||||||
|
button:disabled:hover { border-color: var(--line-strong); color: var(--text); }
|
||||||
|
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
|
||||||
|
button.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
|
||||||
|
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
|
||||||
|
button.ghost:hover { background: var(--panel-3); color: var(--text); }
|
||||||
|
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
|
||||||
|
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
|
||||||
|
button.icon { padding: 5px 9px; line-height: 1; }
|
||||||
|
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||||
|
|
||||||
|
input[type="search"], input[type="text"], input[type="number"], select {
|
||||||
|
font: inherit;
|
||||||
|
color: var(--text);
|
||||||
|
background: var(--panel);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 6px 10px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
|
||||||
|
input[type="search"] { width: 280px; }
|
||||||
|
input[type="checkbox"] { accent-color: var(--accent); }
|
||||||
|
|
||||||
|
/* ---------- Top bar ---------- */
|
||||||
|
.bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28px;
|
||||||
|
height: 56px;
|
||||||
|
padding: 0 22px;
|
||||||
|
background: color-mix(in srgb, var(--panel) 88%, transparent);
|
||||||
|
backdrop-filter: saturate(1.4) blur(10px);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
|
||||||
|
.brand:hover { text-decoration: none; }
|
||||||
|
.brand::before {
|
||||||
|
content: "";
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: radial-gradient(circle at 35% 35%, var(--online), var(--player) 55%, var(--wildlife));
|
||||||
|
box-shadow: 0 0 12px color-mix(in srgb, var(--online) 45%, transparent);
|
||||||
|
}
|
||||||
|
.brand span { color: var(--muted); font-weight: 500; }
|
||||||
|
.sections { display: flex; gap: 20px; flex: 1; }
|
||||||
|
.section { display: flex; align-items: center; gap: 2px; }
|
||||||
|
.section-name {
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 10.5px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
color: var(--faint);
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.section a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
|
||||||
|
.section a:hover { color: var(--text); background: var(--panel-3); text-decoration: none; }
|
||||||
|
.section a.active { background: var(--accent-soft); color: var(--accent); }
|
||||||
|
.who { display: flex; align-items: center; gap: 12px; }
|
||||||
|
.env {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--warn);
|
||||||
|
background: var(--warn-soft);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 2px 9px;
|
||||||
|
}
|
||||||
|
.theme-switch { display: flex; background: var(--panel-3); border-radius: 999px; padding: 2px; }
|
||||||
|
.theme-switch button {
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--muted);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 3px 9px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
.theme-switch button:hover { color: var(--text); }
|
||||||
|
.theme-switch button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
|
||||||
|
|
||||||
|
/* ---------- Page ---------- */
|
||||||
|
main { padding: 22px 24px 40px; max-width: 1760px; margin: 0 auto; }
|
||||||
|
main:focus { outline: none; }
|
||||||
|
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
|
||||||
|
.head .crumb { display: inline-block; font-size: 12.5px; margin-bottom: 4px; color: var(--muted); }
|
||||||
|
.head .crumb:hover { color: var(--accent); }
|
||||||
|
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||||
|
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||||
|
.subtitle { color: var(--muted); margin-top: 3px; }
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: var(--panel);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 16px 18px;
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
}
|
||||||
|
.card + .card { margin-top: 14px; }
|
||||||
|
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
|
||||||
|
.card-head h2 { margin: 0; }
|
||||||
|
|
||||||
|
.stats, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
|
||||||
|
.stat, .kpi {
|
||||||
|
background: var(--panel);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 12px 14px;
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.stat .label, .kpi .label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.07em;
|
||||||
|
color: var(--muted);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.stat .value, .kpi .value { font-size: 21px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.stat .value small { font-size: 12px; font-weight: 400; color: var(--muted); }
|
||||||
|
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.kpi.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
|
||||||
|
.kpi.warn .value { color: var(--warn); }
|
||||||
|
.kpi.bad { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
|
||||||
|
.kpi.bad .value { color: var(--bad); }
|
||||||
|
.kpi .meter { margin-top: 8px; }
|
||||||
|
|
||||||
|
.meter { height: 5px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
|
||||||
|
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
|
||||||
|
.meter.warn > span { background: var(--warn); }
|
||||||
|
.meter.bad > span { background: var(--bad); }
|
||||||
|
.meter.smooth > span { transition: width 0.25s linear; }
|
||||||
|
|
||||||
|
/* ---------- Tables ---------- */
|
||||||
|
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--panel); }
|
||||||
|
table { border-collapse: collapse; width: 100%; background: var(--panel); }
|
||||||
|
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
|
||||||
|
tbody tr:last-child td { border-bottom: 0; }
|
||||||
|
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--panel-2); cursor: pointer; user-select: none; }
|
||||||
|
th.sorted { color: var(--text); }
|
||||||
|
th.sorted::after { content: " ▾"; }
|
||||||
|
th.sorted.up::after { content: " ▴"; }
|
||||||
|
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
|
||||||
|
tbody tr:hover { background: var(--panel-2); }
|
||||||
|
tbody tr.clickable { cursor: pointer; }
|
||||||
|
table.compact { font-size: 12.5px; background: transparent; }
|
||||||
|
table.compact td { padding: 6px 4px; white-space: normal; vertical-align: top; }
|
||||||
|
table.compact tr:hover { background: transparent; }
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 11.5px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 1px 9px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--panel-3);
|
||||||
|
color: var(--muted);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.badge.alive { color: var(--good); background: var(--good-soft); }
|
||||||
|
.badge.dead { color: var(--bad); background: var(--bad-soft); }
|
||||||
|
.badge.online { color: var(--accent); background: var(--accent-soft); }
|
||||||
|
.badge.warn { color: var(--warn); background: var(--warn-soft); }
|
||||||
|
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
|
||||||
|
.badge .dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
|
||||||
|
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
||||||
|
|
||||||
|
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
|
||||||
|
dl.facts dt { color: var(--muted); }
|
||||||
|
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
||||||
|
.window-controls { display: flex; gap: 8px; margin: 12px 0 8px; flex-wrap: wrap; }
|
||||||
|
|
||||||
|
/* ---------- Region page ---------- */
|
||||||
|
.region-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(420px, 30vw, 560px); gap: 16px; align-items: start; }
|
||||||
|
@media (max-width: 1150px) { .region-grid { grid-template-columns: minmax(0, 1fr); } }
|
||||||
|
|
||||||
|
.map-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: max(560px, calc(100vh - 250px));
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
background: var(--panel);
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
}
|
||||||
|
.map-toolbar { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
|
||||||
|
.map-stage { position: relative; flex: 1; min-height: 0; background: var(--map-bg); overflow: hidden; }
|
||||||
|
.map-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; }
|
||||||
|
.map-stage canvas.dragging { cursor: grabbing; }
|
||||||
|
.glass {
|
||||||
|
background: var(--map-glass);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
}
|
||||||
|
.map-layers { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
|
.chip {
|
||||||
|
display: inline-flex;
|
||||||
|
background: var(--panel-2);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
align-items: center;
|
||||||
|
gap: 7px;
|
||||||
|
font-size: 12.5px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 4px 10px 4px 8px;
|
||||||
|
border-radius: 999px;
|
||||||
|
color: var(--text);
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||||
|
.chip.off { opacity: 0.45; }
|
||||||
|
.chip.off .swatch { background: transparent !important; }
|
||||||
|
.chip:hover { border-color: var(--accent); }
|
||||||
|
.map-zoom { display: flex; overflow: hidden; flex: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
|
||||||
|
.map-zoom button { border: 0; border-radius: 0; background: transparent; padding: 5px 11px; font-size: 15px; line-height: 1.2; }
|
||||||
|
.map-zoom button + button { border-left: 1px solid var(--line); }
|
||||||
|
.map-zoom button:hover { background: var(--panel-3); }
|
||||||
|
.map-foot { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; pointer-events: none; }
|
||||||
|
.map-hint { font-size: 12px; color: var(--muted); padding: 3px 9px; }
|
||||||
|
.mark-bar { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; font-size: 13px; font-weight: 500; }
|
||||||
|
.mark-bar button { padding: 3px 10px; }
|
||||||
|
.scale { font-size: 11.5px; color: var(--muted); padding: 4px 9px 3px; text-align: center; }
|
||||||
|
.scale .rule { height: 6px; border: 1.5px solid var(--muted); border-top: 0; margin-top: 2px; }
|
||||||
|
.map-banner {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 12px;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
padding: 6px 14px;
|
||||||
|
font-size: 12.5px;
|
||||||
|
color: var(--warn);
|
||||||
|
border-color: color-mix(in srgb, var(--warn) 50%, var(--line));
|
||||||
|
}
|
||||||
|
.tooltip {
|
||||||
|
position: absolute;
|
||||||
|
pointer-events: none;
|
||||||
|
padding: 8px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
min-width: 170px;
|
||||||
|
max-width: 290px;
|
||||||
|
z-index: 3;
|
||||||
|
box-shadow: var(--shadow-pop);
|
||||||
|
}
|
||||||
|
.tooltip .tip-title { font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
|
||||||
|
.tooltip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
|
||||||
|
.tooltip .tip-row span:first-child { color: var(--muted); }
|
||||||
|
|
||||||
|
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
|
||||||
|
.swatch.player { background: var(--player); }
|
||||||
|
.swatch.online { background: var(--online); }
|
||||||
|
.swatch.wildlife { background: var(--wildlife); }
|
||||||
|
.swatch.pool { background: var(--pool); border: 1.5px solid var(--pool-edge); }
|
||||||
|
.swatch.patch { background: var(--patch); border: 1.5px solid var(--faint); border-radius: 2px; }
|
||||||
|
.swatch.energy { background: var(--energy); }
|
||||||
|
.swatch.carbon { background: var(--carbon); }
|
||||||
|
.swatch.nitrogen { background: var(--nitrogen); }
|
||||||
|
.swatch.phosphorus { background: var(--phosphorus); }
|
||||||
|
.swatch.other { background: var(--other); }
|
||||||
|
|
||||||
|
/* Side panel with tabs. */
|
||||||
|
.panel {
|
||||||
|
position: sticky;
|
||||||
|
top: 72px;
|
||||||
|
max-height: calc(100vh - 88px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: var(--panel);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
@media (max-width: 1150px) { .panel { position: static; max-height: none; } }
|
||||||
|
.tabs { flex: none; display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); background: var(--panel-2); overflow-x: auto; overflow-y: hidden; }
|
||||||
|
.tabs button {
|
||||||
|
border: 0;
|
||||||
|
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--muted);
|
||||||
|
padding: 8px 12px 9px;
|
||||||
|
font-size: 13px;
|
||||||
|
border-bottom: 2px solid transparent;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
}
|
||||||
|
.tabs button:hover { color: var(--text); background: transparent; }
|
||||||
|
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); background: var(--panel); }
|
||||||
|
.tabs .tab-badge { margin-left: 6px; font-size: 10.5px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
|
||||||
|
.panel-body { overflow-y: auto; padding: 4px 18px 18px; flex: 1; }
|
||||||
|
.block { padding: 16px 0; border-bottom: 1px solid var(--line); }
|
||||||
|
.block:last-child { border-bottom: 0; }
|
||||||
|
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
|
||||||
|
.block-head .muted { font-size: 12px; }
|
||||||
|
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
|
||||||
|
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
|
||||||
|
.empty .big { font-size: 26px; margin-bottom: 6px; opacity: 0.6; }
|
||||||
|
|
||||||
|
/* Forms. */
|
||||||
|
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
|
||||||
|
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
||||||
|
.field label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
|
||||||
|
.field input, .field select { width: 100%; }
|
||||||
|
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
|
||||||
|
.form-row .grow { flex: 1; min-width: 120px; }
|
||||||
|
.form-row input.count { width: 84px; }
|
||||||
|
input.wide, .wide { width: 100%; }
|
||||||
|
.note { font-size: 12.5px; margin-top: 8px; min-height: 0; }
|
||||||
|
.note:empty { display: none; }
|
||||||
|
.segmented { display: inline-flex; background: var(--panel-3); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
|
||||||
|
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; font-size: 12.5px; border-radius: 5px; }
|
||||||
|
.segmented button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
|
||||||
|
|
||||||
|
/* Resource ledger. */
|
||||||
|
table.ledger { font-size: 12.5px; background: transparent; }
|
||||||
|
table.ledger th { background: transparent; cursor: default; padding: 6px 6px; font-size: 10.5px; }
|
||||||
|
table.ledger td { padding: 6px 6px; }
|
||||||
|
table.ledger td:first-child, table.ledger th:first-child { padding-left: 0; }
|
||||||
|
table.ledger td:last-child, table.ledger th:last-child { padding-right: 0; }
|
||||||
|
table.ledger tr.total td { font-weight: 650; border-top: 1px solid var(--line-strong); }
|
||||||
|
table.ledger tr:hover { background: transparent; }
|
||||||
|
table.ledger th .swatch { margin-right: 4px; vertical-align: -1px; width: 8px; height: 8px; }
|
||||||
|
.split { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--panel-3); }
|
||||||
|
.split > span { display: block; height: 100%; }
|
||||||
|
.split-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
|
||||||
|
.split-legend span { display: inline-flex; align-items: center; gap: 5px; }
|
||||||
|
.split-row { display: grid; grid-template-columns: 80px 1fr; gap: 10px; align-items: center; margin-top: 8px; font-size: 12px; }
|
||||||
|
|
||||||
|
/* Spent pool and drip. */
|
||||||
|
.drip-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
|
||||||
|
.drip-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
|
||||||
|
.drip-count { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
|
||||||
|
.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; margin-top: 10px; }
|
||||||
|
.channel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; min-width: 0; }
|
||||||
|
.channel .name { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
|
||||||
|
.channel .amt { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.channel .sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.channel.empty-ch { opacity: 0.55; }
|
||||||
|
.callout {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
font-size: 12.5px;
|
||||||
|
background: var(--warn-soft);
|
||||||
|
color: var(--text);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.callout::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: var(--panel); font-weight: 700; display: grid; place-items: center; font-size: 12px; }
|
||||||
|
.callout.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
|
||||||
|
.callout.info::before { content: "i"; background: var(--accent); }
|
||||||
|
|
||||||
|
/* Lists in the panel. */
|
||||||
|
.list { display: flex; flex-direction: column; }
|
||||||
|
.list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
|
||||||
|
.list-item:last-child { border-bottom: 0; }
|
||||||
|
.list-item .grow { flex: 1; min-width: 0; }
|
||||||
|
.list-item.clickable { cursor: pointer; }
|
||||||
|
.list-item.clickable:hover .grow { color: var(--accent); }
|
||||||
|
.list-item .sub { color: var(--muted); font-size: 11.5px; }
|
||||||
|
|
||||||
|
/* Inspector. */
|
||||||
|
.inspect-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
|
||||||
|
.inspect-head .swatch { width: 14px; height: 14px; }
|
||||||
|
.inspect-head h2 { margin: 0; }
|
||||||
|
.inspect-head .grow { flex: 1; }
|
||||||
|
|
||||||
|
/* Tuning settings. */
|
||||||
|
.settings-group { margin-top: 6px; }
|
||||||
|
.settings-group summary {
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 12.5px;
|
||||||
|
text-transform: capitalize;
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.settings-group summary::-webkit-details-marker { display: none; }
|
||||||
|
.settings-group summary::before { content: "▸"; color: var(--faint); margin-right: 8px; transition: transform 0.15s; display: inline-block; }
|
||||||
|
.settings-group[open] summary::before { transform: rotate(90deg); }
|
||||||
|
.settings-group summary .label { flex: 1; }
|
||||||
|
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 6px 0 6px 16px; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
|
||||||
|
.setting:last-child { border-bottom: 0; }
|
||||||
|
.setting .key { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
|
||||||
|
.setting .val { font-family: var(--mono); font-size: 12px; font-weight: 600; text-align: right; }
|
||||||
|
.setting .why { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
|
||||||
|
.setting.changed .val { color: var(--accent); }
|
||||||
|
mark { background: var(--warn-soft); color: inherit; border-radius: 2px; }
|
||||||
|
|
||||||
|
/* ---------- Tuning editor ---------- */
|
||||||
|
.tuning-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
|
||||||
|
@media (max-width: 1100px) { .tuning-layout { grid-template-columns: 1fr; } }
|
||||||
|
.tuning-layout .side { display: flex; flex-direction: column; gap: 14px; }
|
||||||
|
.tuning-layout .side .card + .card { margin-top: 0; }
|
||||||
|
textarea.tuning {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 62vh;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 12.5px;
|
||||||
|
line-height: 1.55;
|
||||||
|
color: var(--text);
|
||||||
|
background: var(--panel-2);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 12px 14px;
|
||||||
|
resize: vertical;
|
||||||
|
tab-size: 4;
|
||||||
|
}
|
||||||
|
textarea.tuning:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
|
||||||
|
.action { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
|
||||||
|
.action .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
|
||||||
|
|
||||||
|
/* Guided tuning editor: sections, fields, changes. */
|
||||||
|
.tuning-guided { display: grid; grid-template-columns: 230px minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
|
||||||
|
@media (max-width: 1250px) { .tuning-guided { grid-template-columns: 210px minmax(0, 1fr); } .tuning-guided > .side { grid-column: 1 / -1; } }
|
||||||
|
@media (max-width: 800px) { .tuning-guided { grid-template-columns: minmax(0, 1fr); } }
|
||||||
|
.tuning-guided .side { display: flex; flex-direction: column; gap: 14px; }
|
||||||
|
.tuning-guided .side .card + .card { margin-top: 0; }
|
||||||
|
.nav-card { position: sticky; top: 72px; padding: 12px; }
|
||||||
|
.section-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
|
||||||
|
.section-link { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: transparent; color: var(--text); padding: 7px 10px; border-radius: var(--radius-sm); font-weight: 500; }
|
||||||
|
.section-link .grow { flex: 1; }
|
||||||
|
.section-link:hover { background: var(--panel-3); color: var(--text); }
|
||||||
|
.section-link.on { background: var(--accent-soft); color: var(--accent); }
|
||||||
|
.tuning-section + .tuning-section { margin-top: 14px; }
|
||||||
|
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 8px 20px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
|
||||||
|
.field-row.changed .field-label { color: var(--accent); }
|
||||||
|
.field-row.changed .input-unit input, .field-row.changed .input-unit select { border-color: var(--accent); }
|
||||||
|
.field-row.bad .input-unit input { border-color: var(--bad); }
|
||||||
|
.field-label { font-weight: 600; }
|
||||||
|
.field-key { color: var(--faint); font-size: 11.5px; margin-top: 1px; overflow-wrap: anywhere; }
|
||||||
|
.field-note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
|
||||||
|
.field-input { display: flex; flex-direction: column; gap: 3px; }
|
||||||
|
.input-unit { display: flex; align-items: center; gap: 6px; }
|
||||||
|
.input-unit input, .input-unit select { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; text-align: right; }
|
||||||
|
.input-unit select { text-align: left; font-family: inherit; }
|
||||||
|
.input-unit .unit { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 48px; }
|
||||||
|
.gloss { color: var(--muted); font-size: 12px; text-align: right; padding-right: 86px; min-height: 0; }
|
||||||
|
.gloss:empty, .field-problem:empty { display: none; }
|
||||||
|
.field-problem { font-size: 12px; text-align: right; padding-right: 86px; color: var(--accent); }
|
||||||
|
.field-row.bad .field-problem { color: var(--bad); }
|
||||||
|
.changes-card { position: sticky; top: 72px; }
|
||||||
|
.changes-card .wide { margin-top: 10px; }
|
||||||
|
@media (max-width: 1250px) { .changes-card, .nav-card { position: static; } }
|
||||||
@@ -12,6 +12,9 @@ namespace evo::client_app {
|
|||||||
struct CellularControls {
|
struct CellularControls {
|
||||||
bool auto_feed{true}, slow_near_food{true}, precision{};
|
bool auto_feed{true}, slow_near_food{true}, precision{};
|
||||||
int speed_percent{100};
|
int speed_percent{100};
|
||||||
|
// Rules 13 (v14): matter channels kept from burning as energy (bit 0 carbon .. bit 3
|
||||||
|
// other). Upkeep still burns them when nothing else can pay.
|
||||||
|
std::uint8_t exclude{};
|
||||||
};
|
};
|
||||||
struct CellularSteering {
|
struct CellularSteering {
|
||||||
client::Intention intention;
|
client::Intention intention;
|
||||||
@@ -96,6 +99,13 @@ steer_cellular(const CellularControls& controls, client::Intention intention,
|
|||||||
short_on[i + 1] = d.bud_cost_matter_fg[i] > d.reserve_matter_fg[i];
|
short_on[i + 1] = d.bud_cost_matter_fg[i] > d.reserve_matter_fg[i];
|
||||||
return short_on;
|
return short_on;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] inline bool bud_affordable(const network::CellularLifeDiagnostics& d) {
|
||||||
|
const bool known =
|
||||||
|
d.bud_cost_energy_pj != 0 ||
|
||||||
|
std::ranges::any_of(d.bud_cost_matter_fg, [](auto amount) { return amount != 0; });
|
||||||
|
const auto short_on = bud_shortfall(d);
|
||||||
|
return known && std::ranges::none_of(short_on, [](bool missing) { return missing; });
|
||||||
|
}
|
||||||
[[nodiscard]] inline bool can_fund(const network::CellularOfferedCandidate& candidate,
|
[[nodiscard]] inline bool can_fund(const network::CellularOfferedCandidate& candidate,
|
||||||
const network::CellularLifeDiagnostics& reserve) {
|
const network::CellularLifeDiagnostics& reserve) {
|
||||||
if (candidate.cost_energy_pj > reserve.reserve_energy_pj)
|
if (candidate.cost_energy_pj > reserve.reserve_energy_pj)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "evo/network/session_protocol.hpp"
|
#include "evo/network/session_protocol.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@@ -14,9 +15,10 @@ namespace evo::client_app {
|
|||||||
struct MutationChoice {
|
struct MutationChoice {
|
||||||
std::uint64_t life{}, event{}, offer_tick{};
|
std::uint64_t life{}, event{}, offer_tick{};
|
||||||
std::uint16_t operator_id{};
|
std::uint16_t operator_id{};
|
||||||
|
bool become{}; // Rules 13 (v14): continue as the offspring the choice splits off.
|
||||||
friend bool operator==(const MutationChoice&, const MutationChoice&) = default;
|
friend bool operator==(const MutationChoice&, const MutationChoice&) = default;
|
||||||
};
|
};
|
||||||
enum class CellAction : std::uint8_t { engulf, bud, mutation };
|
enum class CellAction : std::uint8_t { engulf, bud, mutation, emerge };
|
||||||
enum class CellActionState : std::uint8_t {
|
enum class CellActionState : std::uint8_t {
|
||||||
queued,
|
queued,
|
||||||
sent,
|
sent,
|
||||||
@@ -32,11 +34,19 @@ struct CellActionRecord {
|
|||||||
std::uint64_t id{}, life{}, tick{};
|
std::uint64_t id{}, life{}, tick{};
|
||||||
MutationChoice choice{};
|
MutationChoice choice{};
|
||||||
network::AdmitStatus refusal{network::AdmitStatus::admitted};
|
network::AdmitStatus refusal{network::AdmitStatus::admitted};
|
||||||
|
// The region's reported effect of this engulf or bud, once a view carries it.
|
||||||
|
std::optional<network::CellularEngulfResult> engulf;
|
||||||
|
std::optional<network::CellularBudOutcome> bud;
|
||||||
|
bool become{}; // A bud the player continues as (v14).
|
||||||
};
|
};
|
||||||
struct CellEnergyChange {
|
struct CellEnergyChange {
|
||||||
std::uint64_t from_tick{}, to_tick{}, amount{};
|
std::uint64_t from_tick{}, to_tick{}, amount{};
|
||||||
bool falling{};
|
bool falling{};
|
||||||
};
|
};
|
||||||
|
// Rules 13 (v14): each channel's flows over the last second of views (energy, C, N, P, other).
|
||||||
|
struct CellFlows {
|
||||||
|
std::array<std::uint64_t, 5> collected{}, into_growth{}, burned{};
|
||||||
|
};
|
||||||
|
|
||||||
class CellularPlay {
|
class CellularPlay {
|
||||||
public:
|
public:
|
||||||
@@ -90,6 +100,16 @@ class CellularPlay {
|
|||||||
energy_change_.reset();
|
energy_change_.reset();
|
||||||
}
|
}
|
||||||
energy_sample_ = EnergySample{view.life_identity, view.tick, energy};
|
energy_sample_ = EnergySample{view.life_identity, view.tick, energy};
|
||||||
|
// One sample per tick of this life, the last second (20 ticks) kept.
|
||||||
|
if (!flow_samples_.empty() && flow_samples_.back().life != view.life_identity)
|
||||||
|
flow_samples_.clear();
|
||||||
|
const auto& d = *view.diagnostics;
|
||||||
|
if (d.has_tick_effects &&
|
||||||
|
(flow_samples_.empty() || flow_samples_.back().tick < view.tick))
|
||||||
|
flow_samples_.push_back(
|
||||||
|
{view.life_identity, view.tick, {d.collected, d.into_growth, d.burned}});
|
||||||
|
while (!flow_samples_.empty() && flow_samples_.front().tick + 20 <= view.tick)
|
||||||
|
flow_samples_.pop_front();
|
||||||
}
|
}
|
||||||
// Never replay an intention onto a later life. Keep its uncertain result visible.
|
// Never replay an intention onto a later life. Keep its uncertain result visible.
|
||||||
if (life_ != view.life_identity) {
|
if (life_ != view.life_identity) {
|
||||||
@@ -107,11 +127,17 @@ class CellularPlay {
|
|||||||
if (view.diagnostics && view.diagnostics->has_tick_effects) {
|
if (view.diagnostics && view.diagnostics->has_tick_effects) {
|
||||||
const auto& d = *view.diagnostics;
|
const auto& d = *view.diagnostics;
|
||||||
if (d.engulf != network::CellularEngulfResult::not_reported &&
|
if (d.engulf != network::CellularEngulfResult::not_reported &&
|
||||||
d.engulf != network::CellularEngulfResult::not_requested)
|
d.engulf != network::CellularEngulfResult::not_requested) {
|
||||||
engulf_feedback_ = std::pair{view.tick, d.engulf};
|
engulf_feedback_ = std::pair{view.tick, d.engulf};
|
||||||
|
if (auto* record = awaiting_effect(CellAction::engulf, view.tick))
|
||||||
|
record->engulf = d.engulf;
|
||||||
|
}
|
||||||
if (d.bud != network::CellularBudOutcome::not_reported &&
|
if (d.bud != network::CellularBudOutcome::not_reported &&
|
||||||
d.bud != network::CellularBudOutcome::not_requested)
|
d.bud != network::CellularBudOutcome::not_requested) {
|
||||||
bud_feedback_ = std::pair{view.tick, d.bud};
|
bud_feedback_ = std::pair{view.tick, d.bud};
|
||||||
|
if (auto* record = awaiting_effect(CellAction::bud, view.tick))
|
||||||
|
record->bud = d.bud;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (life_ != 0) {
|
if (life_ != 0) {
|
||||||
birth_pending_ = false;
|
birth_pending_ = false;
|
||||||
@@ -140,7 +166,8 @@ class CellularPlay {
|
|||||||
[[nodiscard]] bool can_act() const {
|
[[nodiscard]] bool can_act() const {
|
||||||
return connected_ && fresh_ && life_ != 0 && !ended_ && !pending_ && !birth_pending_;
|
return connected_ && fresh_ && life_ != 0 && !ended_ && !pending_ && !birth_pending_;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool queue(CellAction kind, std::uint64_t tick, MutationChoice choice = {}) {
|
[[nodiscard]] bool queue(CellAction kind, std::uint64_t tick, MutationChoice choice = {},
|
||||||
|
bool become = false) {
|
||||||
if (!can_act() || tick == 0)
|
if (!can_act() || tick == 0)
|
||||||
return false;
|
return false;
|
||||||
if (kind == CellAction::mutation &&
|
if (kind == CellAction::mutation &&
|
||||||
@@ -154,7 +181,16 @@ class CellularPlay {
|
|||||||
const auto id = allocate_id();
|
const auto id = allocate_id();
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return false;
|
return false;
|
||||||
pending_ = CellActionRecord{kind, CellActionState::queued, id, life_, tick, choice};
|
pending_ = CellActionRecord{kind,
|
||||||
|
CellActionState::queued,
|
||||||
|
id,
|
||||||
|
life_,
|
||||||
|
tick,
|
||||||
|
choice,
|
||||||
|
network::AdmitStatus::admitted,
|
||||||
|
std::nullopt,
|
||||||
|
std::nullopt,
|
||||||
|
kind == CellAction::bud && become};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void sent() {
|
void sent() {
|
||||||
@@ -288,6 +324,21 @@ class CellularPlay {
|
|||||||
[[nodiscard]] const auto& energy_change() const {
|
[[nodiscard]] const auto& energy_change() const {
|
||||||
return energy_change_;
|
return energy_change_;
|
||||||
}
|
}
|
||||||
|
// Flows per second, scaled up when views were missed.
|
||||||
|
[[nodiscard]] CellFlows flows_per_second() const {
|
||||||
|
CellFlows total;
|
||||||
|
for (const auto& sample : flow_samples_)
|
||||||
|
for (std::size_t c = 0; c < 5; ++c) {
|
||||||
|
total.collected.at(c) += sample.flows.collected.at(c);
|
||||||
|
total.into_growth.at(c) += sample.flows.into_growth.at(c);
|
||||||
|
total.burned.at(c) += sample.flows.burned.at(c);
|
||||||
|
}
|
||||||
|
if (!flow_samples_.empty() && flow_samples_.size() < 20)
|
||||||
|
for (auto* channel : {&total.collected, &total.into_growth, &total.burned})
|
||||||
|
for (auto& value : *channel)
|
||||||
|
value = value * 20 / flow_samples_.size();
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void finish() {
|
void finish() {
|
||||||
@@ -298,6 +349,20 @@ class CellularPlay {
|
|||||||
history_.push_back(*pending_);
|
history_.push_back(*pending_);
|
||||||
pending_.reset();
|
pending_.reset();
|
||||||
}
|
}
|
||||||
|
// The newest engulf/bud of this life, at or before `tick`, still without a reported
|
||||||
|
// effect: the view for its tick carries what the region did with it.
|
||||||
|
CellActionRecord* awaiting_effect(CellAction kind, std::uint64_t tick) {
|
||||||
|
const auto waiting = [&](const CellActionRecord& r) {
|
||||||
|
return r.kind == kind && r.life == life_ && r.tick <= tick &&
|
||||||
|
!(kind == CellAction::engulf ? r.engulf.has_value() : r.bud.has_value());
|
||||||
|
};
|
||||||
|
if (pending_ && waiting(*pending_))
|
||||||
|
return &*pending_;
|
||||||
|
for (auto it = history_.rbegin(); it != history_.rend(); ++it)
|
||||||
|
if (waiting(*it))
|
||||||
|
return &*it;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
std::uint64_t next_id_{1}, life_{}, view_tick_{}, birth_tick_{}, birth_request_{}, seen_end_{};
|
std::uint64_t next_id_{1}, life_{}, view_tick_{}, birth_tick_{}, birth_request_{}, seen_end_{};
|
||||||
bool connected_{}, fresh_{}, birth_pending_{};
|
bool connected_{}, fresh_{}, birth_pending_{};
|
||||||
network::PrimitiveLifeResult birth_result_{network::PrimitiveLifeResult::pending};
|
network::PrimitiveLifeResult birth_result_{network::PrimitiveLifeResult::pending};
|
||||||
@@ -311,6 +376,11 @@ class CellularPlay {
|
|||||||
std::uint64_t life{}, tick{}, energy{};
|
std::uint64_t life{}, tick{}, energy{};
|
||||||
};
|
};
|
||||||
std::optional<EnergySample> energy_sample_;
|
std::optional<EnergySample> energy_sample_;
|
||||||
|
struct FlowSample {
|
||||||
|
std::uint64_t life{}, tick{};
|
||||||
|
CellFlows flows;
|
||||||
|
};
|
||||||
|
std::deque<FlowSample> flow_samples_;
|
||||||
std::optional<CellEnergyChange> energy_change_;
|
std::optional<CellEnergyChange> energy_change_;
|
||||||
};
|
};
|
||||||
} // namespace evo::client_app
|
} // namespace evo::client_app
|
||||||
|
|||||||
+118
-5
@@ -1,5 +1,6 @@
|
|||||||
#include "cellular_scene.hpp"
|
#include "cellular_scene.hpp"
|
||||||
#include "controls_flow.hpp"
|
#include "controls_flow.hpp"
|
||||||
|
#include "evo/biology/cellular_currents.hpp"
|
||||||
#include "evo/client/application.hpp"
|
#include "evo/client/application.hpp"
|
||||||
#include "evo/client/auth.hpp"
|
#include "evo/client/auth.hpp"
|
||||||
#include "evo/client/launcher.hpp"
|
#include "evo/client/launcher.hpp"
|
||||||
@@ -486,6 +487,12 @@ int main(int argc, char** argv) try {
|
|||||||
std::uint64_t seen_deposit_tick{};
|
std::uint64_t seen_deposit_tick{};
|
||||||
std::vector<LivePop> live_pops;
|
std::vector<LivePop> live_pops;
|
||||||
bool scene_active = false;
|
bool scene_active = false;
|
||||||
|
// Rules 12: the region's current field, regenerated when the perceived configuration
|
||||||
|
// changes, and when the latest perception arrived (to carry bubbles between views).
|
||||||
|
std::optional<evo::network::CellularCurrentsView> flow_config;
|
||||||
|
std::optional<evo::biology::CellularFlowField> flow_field;
|
||||||
|
std::uint64_t flow_view_tick = 0;
|
||||||
|
auto flow_view_at = std::chrono::steady_clock::now();
|
||||||
evo::client_app::PanelActions actions;
|
evo::client_app::PanelActions actions;
|
||||||
(*app)->set_overlay([&] {
|
(*app)->set_overlay([&] {
|
||||||
evo::client_app::PanelView view;
|
evo::client_app::PanelView view;
|
||||||
@@ -566,7 +573,8 @@ int main(int argc, char** argv) try {
|
|||||||
buffers.cellular_controls.auto_feed = false;
|
buffers.cellular_controls.auto_feed = false;
|
||||||
}
|
}
|
||||||
if (auto* remote = host.session(); remote && mode() == Mode::remote) {
|
if (auto* remote = host.session(); remote && mode() == Mode::remote) {
|
||||||
if (actions.cell_action && remote->request_cellular(*actions.cell_action))
|
if (actions.cell_action &&
|
||||||
|
remote->request_cellular(*actions.cell_action, {}, actions.cell_become))
|
||||||
cellular_feed_target.reset();
|
cellular_feed_target.reset();
|
||||||
if (actions.mutation)
|
if (actions.mutation)
|
||||||
static_cast<void>(remote->request_cellular(evo::client_app::CellAction::mutation,
|
static_cast<void>(remote->request_cellular(evo::client_app::CellAction::mutation,
|
||||||
@@ -741,15 +749,20 @@ int main(int argc, char** argv) try {
|
|||||||
const double width = state.logical_width, height = state.logical_height;
|
const double width = state.logical_width, height = state.logical_height;
|
||||||
// 2026-10-16 microscope view: in cellular play, patches and cells are a scene the
|
// 2026-10-16 microscope view: in cellular play, patches and cells are a scene the
|
||||||
// panels draw as granules and living cells; elsewhere organisms stay rectangles.
|
// panels draw as granules and living cells; elsewhere organisms stay rectangles.
|
||||||
|
scene.flows.clear();
|
||||||
scene.patches.clear();
|
scene.patches.clear();
|
||||||
scene.deposits.clear();
|
scene.deposits.clear();
|
||||||
scene.pops.clear();
|
scene.pops.clear();
|
||||||
scene.cells.clear();
|
scene.cells.clear();
|
||||||
|
scene.region = scene.at_edge = false;
|
||||||
|
scene.region_cells = 0;
|
||||||
scene_active = false;
|
scene_active = false;
|
||||||
const auto* cellular_remote = host.session();
|
const auto* cellular_remote = host.session();
|
||||||
const bool microscope = cellular_remote && mode() == Mode::remote && cellular_trial;
|
const bool microscope = cellular_remote && mode() == Mode::remote && cellular_trial;
|
||||||
if (microscope) {
|
if (microscope) {
|
||||||
const bool fresh = cellular_remote->cellular_play().fresh();
|
const bool fresh = cellular_remote->cellular_play().fresh();
|
||||||
|
scene.camera_centre = camera->centre();
|
||||||
|
scene.stale = !fresh;
|
||||||
if (const auto* perception = cellular_remote->cellular_perception())
|
if (const auto* perception = cellular_remote->cellular_perception())
|
||||||
for (const auto& patch : perception->patches) {
|
for (const auto& patch : perception->patches) {
|
||||||
const auto low =
|
const auto low =
|
||||||
@@ -773,9 +786,72 @@ int main(int argc, char** argv) try {
|
|||||||
p.seed = (static_cast<std::uint64_t>(patch.x_um) << 32U) ^ patch.y_um;
|
p.seed = (static_cast<std::uint64_t>(patch.x_um) << 32U) ^ patch.y_um;
|
||||||
scene.patches.push_back(p);
|
scene.patches.push_back(p);
|
||||||
}
|
}
|
||||||
|
// Rules 12 (v13): the current field from the perceived configuration, drawn
|
||||||
|
// as streaks across the visible area.
|
||||||
|
if (const auto* perception = cellular_remote->cellular_perception()) {
|
||||||
|
if (perception->currents != flow_config) {
|
||||||
|
flow_config = perception->currents;
|
||||||
|
flow_field.reset();
|
||||||
|
if (const auto& c = flow_config) {
|
||||||
|
auto made = evo::biology::CellularFlowField::generate(
|
||||||
|
{c->seed, c->width_um, c->height_um, c->pitch_um, c->min_count,
|
||||||
|
c->max_count, c->min_route_width_um, c->max_route_width_um,
|
||||||
|
c->min_speed_um_per_s, c->max_speed_um_per_s});
|
||||||
|
if (made)
|
||||||
|
flow_field = std::move(*made);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (perception->tick != flow_view_tick) {
|
||||||
|
flow_view_tick = perception->tick;
|
||||||
|
flow_view_at = std::chrono::steady_clock::now();
|
||||||
|
}
|
||||||
|
const auto low = camera->screen_to_world({0, height});
|
||||||
|
const auto high = camera->screen_to_world({width, 0});
|
||||||
|
if (flow_field && low && high) {
|
||||||
|
const double span =
|
||||||
|
std::max({high->x_mm - low->x_mm, high->y_mm - low->y_mm, 0.001});
|
||||||
|
const double step = std::max(0.4, span / 28);
|
||||||
|
const double first_x = std::floor(low->x_mm / step) * step;
|
||||||
|
const double first_y = std::floor(low->y_mm / step) * step;
|
||||||
|
const int columns =
|
||||||
|
std::clamp(static_cast<int>((high->x_mm - first_x) / step) + 1, 1, 30);
|
||||||
|
const int rows =
|
||||||
|
std::clamp(static_cast<int>((high->y_mm - first_y) / step) + 1, 1, 30);
|
||||||
|
for (int row = 0; row < rows; ++row)
|
||||||
|
for (int column = 0; column < columns; ++column) {
|
||||||
|
const double x = first_x + column * step, y = first_y + row * step;
|
||||||
|
const auto flow =
|
||||||
|
flow_field->sample(static_cast<std::int64_t>(x * 1000),
|
||||||
|
static_cast<std::int64_t>(y * 1000));
|
||||||
|
const double vx = flow.x_q10 / 1024.0, vy = flow.y_q10 / 1024.0;
|
||||||
|
const double speed = std::hypot(vx, vy);
|
||||||
|
if (speed < 5)
|
||||||
|
continue;
|
||||||
|
const auto at = camera->world_to_screen({x, y});
|
||||||
|
const auto ahead = camera->world_to_screen(
|
||||||
|
{x + vx / speed * 0.001, y + vy / speed * 0.001});
|
||||||
|
if (!at || !ahead)
|
||||||
|
continue;
|
||||||
|
const double sx = ahead->x - at->x, sy = ahead->y - at->y;
|
||||||
|
const double norm = std::max(std::hypot(sx, sy), 1e-9);
|
||||||
|
const double length = 8 + std::min(speed, 300.0) / 300 * 16;
|
||||||
|
scene.flows.push_back(
|
||||||
|
{static_cast<float>(at->x), static_cast<float>(at->y),
|
||||||
|
static_cast<float>(sx / norm * length),
|
||||||
|
static_cast<float>(sy / norm * length),
|
||||||
|
static_cast<float>(std::min(speed, 300.0) / 300),
|
||||||
|
static_cast<std::uint32_t>(
|
||||||
|
static_cast<std::int64_t>(x * 7919 + y * 104729))});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// ADR-0136 (v11): pools and bubbles, centred; a vanished bubble pops.
|
// ADR-0136 (v11): pools and bubbles, centred; a vanished bubble pops.
|
||||||
if (const auto* perception = cellular_remote->cellular_perception()) {
|
if (const auto* perception = cellular_remote->cellular_perception()) {
|
||||||
const auto now_pop = std::chrono::steady_clock::now();
|
const auto now_pop = std::chrono::steady_clock::now();
|
||||||
|
// Rules 12: carry each bubble along its perceived velocity since the view
|
||||||
|
// arrived (at most 300 ms), so moving food glides between perceptions.
|
||||||
|
const double carried = std::min(
|
||||||
|
std::chrono::duration<double>(now_pop - flow_view_at).count(), 0.3);
|
||||||
std::map<std::uint32_t, SeenDeposit> current;
|
std::map<std::uint32_t, SeenDeposit> current;
|
||||||
for (const auto& d : perception->deposits) {
|
for (const auto& d : perception->deposits) {
|
||||||
std::array<std::uint64_t, 5> stock{};
|
std::array<std::uint64_t, 5> stock{};
|
||||||
@@ -785,13 +861,13 @@ int main(int argc, char** argv) try {
|
|||||||
for (std::size_t c = 1; c < stock.size(); ++c)
|
for (std::size_t c = 1; c < stock.size(); ++c)
|
||||||
if (stock.at(c) > stock.at(static_cast<std::size_t>(channel)))
|
if (stock.at(c) > stock.at(static_cast<std::size_t>(channel)))
|
||||||
channel = static_cast<int>(c);
|
channel = static_cast<int>(c);
|
||||||
const SeenDeposit seen{static_cast<double>(d.x_um) / 1000,
|
const SeenDeposit seen{
|
||||||
static_cast<double>(d.y_um) / 1000,
|
(static_cast<double>(d.x_um) + d.velocity_x_um_s * carried) / 1000,
|
||||||
|
(static_cast<double>(d.y_um) + d.velocity_y_um_s * carried) / 1000,
|
||||||
d.radius_um,
|
d.radius_um,
|
||||||
channel,
|
channel,
|
||||||
d.drained,
|
d.drained,
|
||||||
d.shape ==
|
d.shape == evo::network::CellularDepositShape::bubble};
|
||||||
evo::network::CellularDepositShape::bubble};
|
|
||||||
current[d.id] = seen;
|
current[d.id] = seen;
|
||||||
const auto centre = camera->world_to_screen({seen.x_mm, seen.y_mm});
|
const auto centre = camera->world_to_screen({seen.x_mm, seen.y_mm});
|
||||||
const auto edge = camera->world_to_screen(
|
const auto edge = camera->world_to_screen(
|
||||||
@@ -840,6 +916,43 @@ int main(int argc, char** argv) try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto own = cellular_remote->cellular_play().life();
|
const auto own = cellular_remote->cellular_play().life();
|
||||||
|
// The region's walls, from the perceived current configuration (mm).
|
||||||
|
double region_w_mm = 0, region_h_mm = 0;
|
||||||
|
if (const auto* perception = cellular_remote->cellular_perception();
|
||||||
|
perception && perception->currents) {
|
||||||
|
region_w_mm = static_cast<double>(perception->currents->width_um) / 1000;
|
||||||
|
region_h_mm = static_cast<double>(perception->currents->height_um) / 1000;
|
||||||
|
const auto low = camera->world_to_screen({0, 0});
|
||||||
|
const auto high = camera->world_to_screen({region_w_mm, region_h_mm});
|
||||||
|
if (low && high) {
|
||||||
|
scene.region = true;
|
||||||
|
scene.region_left = static_cast<float>(std::min(low->x, high->x));
|
||||||
|
scene.region_right = static_cast<float>(std::max(low->x, high->x));
|
||||||
|
scene.region_top = static_cast<float>(std::min(low->y, high->y));
|
||||||
|
scene.region_bottom = static_cast<float>(std::max(low->y, high->y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (orgs) {
|
||||||
|
scene.region_cells = static_cast<std::size_t>(
|
||||||
|
std::ranges::count_if(orgs->cells(), [](const auto& cell) {
|
||||||
|
return cell.state != evo::client::OrganismState::dead;
|
||||||
|
}));
|
||||||
|
// Against a wall: within 50 um of it (positions are the lower-left corner).
|
||||||
|
for (const auto& cell : orgs->cells()) {
|
||||||
|
if (own == 0 || cell.id != own || region_w_mm == 0)
|
||||||
|
continue;
|
||||||
|
constexpr auto pitch = static_cast<double>(evo::world::cell_pitch_mm);
|
||||||
|
const double x = static_cast<double>(cell.voxel.x) * pitch +
|
||||||
|
static_cast<double>(cell.x.value) / 1000;
|
||||||
|
const double y = static_cast<double>(cell.voxel.y) * pitch +
|
||||||
|
static_cast<double>(cell.y.value) / 1000;
|
||||||
|
const double extent = static_cast<double>(cell.phenotype.extent) / 1000;
|
||||||
|
constexpr double near = 0.05;
|
||||||
|
scene.at_edge = x <= near || y <= near ||
|
||||||
|
x + extent >= region_w_mm - near ||
|
||||||
|
y + extent >= region_h_mm - near;
|
||||||
|
}
|
||||||
|
}
|
||||||
// ADR-0176: the owner's view lists the producers it can see, by organism.
|
// ADR-0176: the owner's view lists the producers it can see, by organism.
|
||||||
const auto* seen = cellular_remote->cellular_perception();
|
const auto* seen = cellular_remote->cellular_perception();
|
||||||
const auto photosynthesis = [&](std::uint64_t organism) -> std::uint32_t {
|
const auto photosynthesis = [&](std::uint64_t organism) -> std::uint32_t {
|
||||||
|
|||||||
+725
-108
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
|||||||
// pair and the platform adapter use the toolkit.
|
// pair and the platform adapter use the toolkit.
|
||||||
#include "evo/client/auth.hpp"
|
#include "evo/client/auth.hpp"
|
||||||
#include "evo/client/bindings.hpp"
|
#include "evo/client/bindings.hpp"
|
||||||
|
#include "evo/client/camera.hpp"
|
||||||
#include "evo/client/environment_view.hpp"
|
#include "evo/client/environment_view.hpp"
|
||||||
#include "evo/client/launcher.hpp"
|
#include "evo/client/launcher.hpp"
|
||||||
#include "evo/client/organism_view.hpp"
|
#include "evo/client/organism_view.hpp"
|
||||||
@@ -56,19 +57,45 @@ struct ScenePop {
|
|||||||
float x{}, y{}, radius{}, age{}; // Age 0..1 over the pop's life.
|
float x{}, y{}, radius{}, age{}; // Age 0..1 over the pop's life.
|
||||||
int channel{};
|
int channel{};
|
||||||
};
|
};
|
||||||
|
// Rules 12: one streak of the local current; dx/dy in pixels, strength 0..1 by speed.
|
||||||
|
struct SceneFlow {
|
||||||
|
float x{}, y{}, dx{}, dy{}, strength{};
|
||||||
|
std::uint32_t seed{};
|
||||||
|
};
|
||||||
struct CellularScene {
|
struct CellularScene {
|
||||||
|
std::vector<SceneFlow> flows;
|
||||||
std::vector<ScenePatch> patches;
|
std::vector<ScenePatch> patches;
|
||||||
std::vector<SceneDeposit> deposits;
|
std::vector<SceneDeposit> deposits;
|
||||||
std::vector<ScenePop> pops;
|
std::vector<ScenePop> pops;
|
||||||
std::vector<SceneCell> cells;
|
std::vector<SceneCell> cells;
|
||||||
|
// Camera mapping for the local observation map; no undiscovered world state.
|
||||||
|
client::WorldPoint camera_centre{};
|
||||||
|
bool stale{};
|
||||||
|
// The region's walls on screen (liquid regions, from the perceived current configuration),
|
||||||
|
// whether the owner's cell is against one, and how many cells the region holds.
|
||||||
|
bool region{};
|
||||||
|
float region_left{}, region_top{}, region_right{}, region_bottom{};
|
||||||
|
bool at_edge{};
|
||||||
|
std::size_t region_cells{};
|
||||||
};
|
};
|
||||||
// Notice layout (logical pixels); the window name is the prefix plus the notice id.
|
// Notice layout (logical pixels); the window name is the prefix plus the notice id.
|
||||||
inline constexpr float notice_width = 320, notice_close_width = 22;
|
inline constexpr float notice_width = 320, notice_close_width = 22;
|
||||||
inline constexpr const char* notice_window_prefix = "##notice";
|
inline constexpr const char* notice_window_prefix = "##notice";
|
||||||
// Text-field storage for the connect form (bounded; never persisted).
|
// 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 {
|
struct FormBuffers {
|
||||||
bool engineering{};
|
bool engineering{};
|
||||||
bool evolution_open{}; // The mutation window (E or the callout opens it).
|
bool evolution_open{}; // The mutation window (E or the callout opens it).
|
||||||
|
bool notes_minimized{}, vitals_minimized{}, map_minimized{};
|
||||||
|
HudPanelPlacement notes_placement, vitals_placement, map_placement;
|
||||||
|
bool bud_become{}; // Rules 13: the next bud is the player's cell.
|
||||||
CellularControls cellular_controls;
|
CellularControls cellular_controls;
|
||||||
std::array<char, client::max_field_bytes> endpoint{}, server_name{}, authority{}, grants{};
|
std::array<char, client::max_field_bytes> endpoint{}, server_name{}, authority{}, grants{};
|
||||||
void load(const client::ConnectForm& form);
|
void load(const client::ConnectForm& form);
|
||||||
@@ -115,6 +142,7 @@ struct PanelActions {
|
|||||||
std::optional<std::pair<std::uint32_t, std::uint32_t>> feed_patch;
|
std::optional<std::pair<std::uint32_t, std::uint32_t>> feed_patch;
|
||||||
bool stop_feeding{};
|
bool stop_feeding{};
|
||||||
std::optional<CellAction> cell_action;
|
std::optional<CellAction> cell_action;
|
||||||
|
bool cell_become{}; // With a bud: continue as it (v14).
|
||||||
std::optional<MutationChoice> mutation;
|
std::optional<MutationChoice> mutation;
|
||||||
bool restart_life{}, keep_unknown{};
|
bool restart_life{}, keep_unknown{};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -262,11 +262,17 @@ class RemoteSession {
|
|||||||
[[nodiscard]] const CellularPlay& cellular_play() const noexcept {
|
[[nodiscard]] const CellularPlay& cellular_play() const noexcept {
|
||||||
return cellular_play_;
|
return cellular_play_;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool request_cellular(CellAction kind, MutationChoice choice = {}) {
|
[[nodiscard]] bool request_cellular(CellAction kind, MutationChoice choice = {},
|
||||||
|
bool become = false) {
|
||||||
|
const auto lead = cellular_lead_.lead();
|
||||||
|
// A tick takes one action per account: never one a movement already named (movement
|
||||||
|
// runs ahead of the lead after the lead shrinks).
|
||||||
const auto tick = kind == CellAction::mutation
|
const auto tick = kind == CellAction::mutation
|
||||||
? server_tick_
|
? server_tick_
|
||||||
: server_tick_ + (sent_tick_ && *sent_tick_ == server_tick_ ? 2 : 1);
|
: std::max(server_tick_ + lead +
|
||||||
if (!cellular_trial_ || !cellular_play_.queue(kind, tick, choice))
|
(sent_tick_ && *sent_tick_ == server_tick_ ? 1 : 0),
|
||||||
|
cellular_sent_tick_ + 1);
|
||||||
|
if (!cellular_trial_ || !cellular_play_.queue(kind, tick, choice, become))
|
||||||
return false;
|
return false;
|
||||||
action_check_at_ = {};
|
action_check_at_ = {};
|
||||||
if (kind != CellAction::mutation)
|
if (kind != CellAction::mutation)
|
||||||
@@ -499,8 +505,9 @@ class RemoteSession {
|
|||||||
return false;
|
return false;
|
||||||
client::RegionSessionClientConfig config;
|
client::RegionSessionClientConfig config;
|
||||||
if (cellular_trial_)
|
if (cellular_trial_)
|
||||||
// ADR-0176: v12 is v11 (deposits) plus captured light and visible producers.
|
// Rules 13: v14 is v13 (deposits, light, producers, liquid motion and brake) plus the
|
||||||
config.protocol_version = network::session_protocol_v12;
|
// revamp: become, emerge, exclusions, catalog offers and the body block.
|
||||||
|
config.protocol_version = network::session_protocol_v14;
|
||||||
const auto route = routes_.find(target_region_);
|
const auto route = routes_.find(target_region_);
|
||||||
config.transport = route != routes_.end() ? route->second : transport_;
|
config.transport = route != routes_.end() ? route->second : transport_;
|
||||||
if (ticket_) { // A handoff: the ticket replaces a grant, once.
|
if (ticket_) { // A handoff: the ticket replaces a grant, once.
|
||||||
@@ -576,6 +583,8 @@ class RemoteSession {
|
|||||||
predictor_.reset(); // A new session has a new marker.
|
predictor_.reset(); // A new session has a new marker.
|
||||||
smoother_.reset();
|
smoother_.reset();
|
||||||
lead_.reset();
|
lead_.reset();
|
||||||
|
cellular_lead_.reset();
|
||||||
|
cellular_sent_tick_ = 0;
|
||||||
clock_.reset(); // Fresh baseline: the frozen view of a lost session is dropped.
|
clock_.reset(); // Fresh baseline: the frozen view of a lost session is dropped.
|
||||||
interpolator_.reset();
|
interpolator_.reset();
|
||||||
markers_.clear();
|
markers_.clear();
|
||||||
@@ -620,16 +629,26 @@ class RemoteSession {
|
|||||||
if (server_tick_ == 0 || (sent_tick_ && server_tick_ <= *sent_tick_) ||
|
if (server_tick_ == 0 || (sent_tick_ && server_tick_ <= *sent_tick_) ||
|
||||||
!cellular_play_.fresh() || cellular_play_.life() == 0 || cellular_play_.ended())
|
!cellular_play_.fresh() || cellular_play_.life() == 0 || cellular_play_.ended())
|
||||||
return;
|
return;
|
||||||
const auto tick = server_tick_ + 1;
|
// The server admits only ticks still ahead of it when the action arrives; the view
|
||||||
|
// trails it by the replication delay, so schedule by the adaptive lead.
|
||||||
|
// Strictly increasing even when the lead shrinks: one movement per tick.
|
||||||
|
const auto tick = std::max(server_tick_ + cellular_lead_.lead(), cellular_sent_tick_ + 1);
|
||||||
|
// A queued discrete action owns its tick; movement resumes after it is sent.
|
||||||
|
if (const auto& p = cellular_play_.pending(); p && p->state == CellActionState::queued &&
|
||||||
|
p->kind != CellAction::mutation &&
|
||||||
|
p->tick <= tick)
|
||||||
|
return;
|
||||||
const auto steering = steer_cellular(cellular_controls_, intention, cellular_perception(),
|
const auto steering = steer_cellular(cellular_controls_, intention, cellular_perception(),
|
||||||
organisms_.current(), cellular_feed_target_);
|
organisms_.current(), cellular_feed_target_);
|
||||||
cellular_feed_target_ = steering.patch;
|
cellular_feed_target_ = steering.patch;
|
||||||
const auto id = cellular_play_.allocate_id();
|
const auto id = cellular_play_.allocate_id();
|
||||||
if (id == 0 ||
|
if (id == 0 || !client_->send_cellular_action(
|
||||||
!client_->send_cellular_action(id, tick, steering.intention.move_x,
|
id, tick, steering.intention.move_x, steering.intention.move_y,
|
||||||
steering.intention.move_y, cellular_feed_target_))
|
cellular_feed_target_, false, false, steering.intention.brake, false,
|
||||||
|
false, cellular_controls_.exclude))
|
||||||
return;
|
return;
|
||||||
sent_tick_ = server_tick_;
|
sent_tick_ = server_tick_;
|
||||||
|
cellular_sent_tick_ = tick;
|
||||||
}
|
}
|
||||||
void service_cellular(Clock::time_point now) {
|
void service_cellular(Clock::time_point now) {
|
||||||
if (cellular_play_.birth_pending() && now >= birth_check_at_) {
|
if (cellular_play_.birth_pending() && now >= birth_check_at_) {
|
||||||
@@ -644,14 +663,18 @@ class RemoteSession {
|
|||||||
bool sent = false;
|
bool sent = false;
|
||||||
if (p.kind == CellAction::mutation) {
|
if (p.kind == CellAction::mutation) {
|
||||||
sent = client_->send_cellular_mutation(p.id, p.tick, p.choice.life, p.choice.event,
|
sent = client_->send_cellular_mutation(p.id, p.tick, p.choice.life, p.choice.event,
|
||||||
p.choice.offer_tick, p.choice.operator_id);
|
p.choice.offer_tick, p.choice.operator_id,
|
||||||
|
p.choice.become);
|
||||||
} else if (p.state == CellActionState::queued) {
|
} else if (p.state == CellActionState::queued) {
|
||||||
if (p.tick > server_tick_ + 1)
|
if (p.tick > server_tick_ + cellular_lead_.lead())
|
||||||
return; // Do not replace a movement/feeding intention already sent this tick.
|
return; // Do not replace a movement/feeding intention already sent this tick.
|
||||||
sent = client_->send_cellular_action(
|
sent = client_->send_cellular_action(
|
||||||
p.id, p.tick, 0, 0, {}, p.kind == CellAction::engulf, p.kind == CellAction::bud);
|
p.id, p.tick, 0, 0, {}, p.kind == CellAction::engulf, p.kind == CellAction::bud,
|
||||||
if (sent)
|
false, p.become, p.kind == CellAction::emerge, cellular_controls_.exclude);
|
||||||
|
if (sent) {
|
||||||
sent_tick_ = server_tick_; // The discrete intention owns this tick's target.
|
sent_tick_ = server_tick_; // The discrete intention owns this tick's target.
|
||||||
|
cellular_sent_tick_ = std::max(cellular_sent_tick_, p.tick);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sent = client_->query_action(p.id); // A query can never bud a second time.
|
sent = client_->query_action(p.id); // A query can never bud a second time.
|
||||||
}
|
}
|
||||||
@@ -699,6 +722,10 @@ class RemoteSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto& receipt : client_->take_action_receipts()) {
|
for (const auto& receipt : client_->take_action_receipts()) {
|
||||||
|
if (receipt.status == network::AdmitStatus::admitted)
|
||||||
|
cellular_lead_.admitted(receipt.tick, receipt.server_tick);
|
||||||
|
else if (receipt.status == network::AdmitStatus::outside_window)
|
||||||
|
cellular_lead_.too_late(); // Arrived after its tick: schedule further ahead.
|
||||||
cellular_play_.receipt(receipt);
|
cellular_play_.receipt(receipt);
|
||||||
if (receipt.status != network::AdmitStatus::admitted)
|
if (receipt.status != network::AdmitStatus::admitted)
|
||||||
cellular_action_status_ = cellular_admission_message(receipt.status);
|
cellular_action_status_ = cellular_admission_message(receipt.status);
|
||||||
@@ -922,6 +949,8 @@ class RemoteSession {
|
|||||||
Clock::time_point refresh_sent_at_{};
|
Clock::time_point refresh_sent_at_{};
|
||||||
std::map<std::uint64_t, network::quic::ClientConfig> routes_; // Region -> how to dial it.
|
std::map<std::uint64_t, network::quic::ClientConfig> routes_; // Region -> how to dial it.
|
||||||
std::uint64_t target_region_{}, region_{}, handoffs_{}, newest_serial_{};
|
std::uint64_t target_region_{}, region_{}, handoffs_{}, newest_serial_{};
|
||||||
|
client::InputLead cellular_lead_; // Cellular action ticks (2..7 ahead of the view).
|
||||||
|
std::uint64_t cellular_sent_tick_{}; // Newest tick a movement or discrete action named.
|
||||||
std::optional<network::WireGrant> ticket_; // A handoff ticket for the next connection.
|
std::optional<network::WireGrant> ticket_; // A handoff ticket for the next connection.
|
||||||
bool handing_off_{};
|
bool handing_off_{};
|
||||||
std::unique_ptr<client::RegionSessionClient> client_;
|
std::unique_ptr<client::RegionSessionClient> client_;
|
||||||
@@ -994,7 +1023,7 @@ class RemoteSession {
|
|||||||
[[nodiscard]] const CellularPlay& cellular_play() const noexcept {
|
[[nodiscard]] const CellularPlay& cellular_play() const noexcept {
|
||||||
return cellular_play_;
|
return cellular_play_;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool request_cellular(CellAction, MutationChoice = {}) {
|
[[nodiscard]] bool request_cellular(CellAction, MutationChoice = {}, bool = false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool restart_cellular() {
|
[[nodiscard]] bool restart_cellular() {
|
||||||
|
|||||||
@@ -27,6 +27,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace evo::server_app {
|
namespace evo::server_app {
|
||||||
|
// Rules 12: moving bubbles listed per perception, nearest first (the tuning file's trial
|
||||||
|
// food.visible_moving_bubbles). Pools are always listed.
|
||||||
|
inline constexpr std::size_t cellular_visible_moving_bubbles = 256;
|
||||||
// Profile-4 network boundary. Biology and persistence remain owned by the cellular host;
|
// Profile-4 network boundary. Biology and persistence remain owned by the cellular host;
|
||||||
// this bridge handles admission, v7-v9 action receipts, public cell replication and
|
// this bridge handles admission, v7-v9 action receipts, public cell replication and
|
||||||
// owner-filtered v8/v9 perception.
|
// owner-filtered v8/v9 perception.
|
||||||
@@ -39,9 +42,16 @@ class CellularBridge {
|
|||||||
if (!options.complete())
|
if (!options.complete())
|
||||||
return fail("error cellular-session-config");
|
return fail("error cellular-session-config");
|
||||||
CellularBridge bridge;
|
CellularBridge bridge;
|
||||||
|
// A fixed --session-window must be open now; a database window (ADR-0087 amendment)
|
||||||
|
// may open, close and reopen while the region runs.
|
||||||
|
if (!options.window_from_database) {
|
||||||
const auto window = server::SessionWindow::open(options.session_window, wall_seconds());
|
const auto window = server::SessionWindow::open(options.session_window, wall_seconds());
|
||||||
if (!window)
|
if (!window)
|
||||||
return fail("error cellular-session-window");
|
return fail("error cellular-session-window");
|
||||||
|
bridge.window_ = *window;
|
||||||
|
}
|
||||||
|
bridge.window_from_database_ = options.window_from_database;
|
||||||
|
bridge.key_ = key;
|
||||||
const auto colon = options.listen.rfind(':');
|
const auto colon = options.listen.rfind(':');
|
||||||
std::uint16_t port{};
|
std::uint16_t port{};
|
||||||
if (colon == std::string::npos ||
|
if (colon == std::string::npos ||
|
||||||
@@ -82,7 +92,6 @@ class CellularBridge {
|
|||||||
std::copy(issuer.begin(), issuer.end(), public_key.begin());
|
std::copy(issuer.begin(), issuer.end(), public_key.begin());
|
||||||
config.issuer_keys.push_back({1, public_key});
|
config.issuer_keys.push_back({1, public_key});
|
||||||
|
|
||||||
bridge.window_ = *window;
|
|
||||||
bridge.slot_ = std::make_unique<server::PgSlot>(pg, std::chrono::seconds{2});
|
bridge.slot_ = std::make_unique<server::PgSlot>(pg, std::chrono::seconds{2});
|
||||||
const auto lease = [&host] { return host.authority(); };
|
const auto lease = [&host] { return host.authority(); };
|
||||||
bridge.control_ =
|
bridge.control_ =
|
||||||
@@ -107,9 +116,9 @@ class CellularBridge {
|
|||||||
config.select_cellular_mutation = [&host](const network::AccountId& account,
|
config.select_cellular_mutation = [&host](const network::AccountId& account,
|
||||||
std::uint64_t generation,
|
std::uint64_t generation,
|
||||||
const network::CellularMutationAction& m) {
|
const network::CellularMutationAction& m) {
|
||||||
const auto reply =
|
const auto reply = host.select_mutation(
|
||||||
host.select_mutation(account.bytes, generation, m.action_id,
|
account.bytes, generation, m.action_id,
|
||||||
{m.life_identity, m.event_index, m.offer_tick, m.operator_id});
|
{m.life_identity, m.event_index, m.offer_tick, m.operator_id, m.become});
|
||||||
server::CellularMutationAnswer answer{
|
server::CellularMutationAnswer answer{
|
||||||
server::admit_status(reply.status), reply.tick, {}};
|
server::admit_status(reply.status), reply.tick, {}};
|
||||||
if (reply.outcome)
|
if (reply.outcome)
|
||||||
@@ -123,15 +132,25 @@ class CellularBridge {
|
|||||||
: "error cellular-session-config");
|
: "error cellular-session-config");
|
||||||
bridge.sessions_ = std::move(*sessions);
|
bridge.sessions_ = std::move(*sessions);
|
||||||
bridge.sessions_->set_default_interest({0, 0, 0, 7});
|
bridge.sessions_->set_default_interest({0, 0, 0, 7});
|
||||||
|
// A database window admits nobody until it has been read.
|
||||||
|
if (bridge.window_from_database_)
|
||||||
|
bridge.sessions_->set_admission(false);
|
||||||
std::printf("cellular listening %u\n", static_cast<unsigned>(bridge.sessions_->port()));
|
std::printf("cellular listening %u\n", static_cast<unsigned>(bridge.sessions_->port()));
|
||||||
return std::optional<CellularBridge>{std::move(bridge)};
|
return std::optional<CellularBridge>{std::move(bridge)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applies the session window: while it is closed every Hello is refused, and closing
|
||||||
|
// closes the open sessions.
|
||||||
[[nodiscard]] bool accepting(std::uint64_t now_seconds) {
|
[[nodiscard]] bool accepting(std::uint64_t now_seconds) {
|
||||||
const bool open = window_ && window_->accepting(now_seconds);
|
if (window_from_database_)
|
||||||
if (!open && !shutdown_) {
|
read_window(now_seconds);
|
||||||
|
const bool open = window_from_database_ ? feed_.accepting(now_seconds)
|
||||||
|
: window_ && window_->accepting(now_seconds);
|
||||||
|
if (open != sessions_->admitting()) {
|
||||||
|
sessions_->set_admission(open);
|
||||||
|
if (!open)
|
||||||
sessions_->shutdown(std::chrono::steady_clock::now());
|
sessions_->shutdown(std::chrono::steady_clock::now());
|
||||||
shutdown_ = true;
|
std::printf("cellular sessions %s\n", open ? "admitted" : "closed");
|
||||||
}
|
}
|
||||||
return open;
|
return open;
|
||||||
}
|
}
|
||||||
@@ -158,7 +177,12 @@ class CellularBridge {
|
|||||||
static_cast<unsigned long long>(event.session), event.account.c_str(),
|
static_cast<unsigned long long>(event.session), event.account.c_str(),
|
||||||
static_cast<unsigned>(event.reason));
|
static_cast<unsigned>(event.reason));
|
||||||
}
|
}
|
||||||
void replicate(const server::CellularLives& state) {
|
// `state` is what players see (the session batch's working state between commits);
|
||||||
|
// mutation offers and life endings come only from `committed`, so a player can act on
|
||||||
|
// them durably. Without `committed`, both are the same state.
|
||||||
|
void replicate(const server::CellularLives& state,
|
||||||
|
const server::CellularLives* committed = nullptr) {
|
||||||
|
const auto& authority = committed ? *committed : state;
|
||||||
const auto tick = state.tick();
|
const auto tick = state.tick();
|
||||||
if (replicated_tick_ == tick)
|
if (replicated_tick_ == tick)
|
||||||
return;
|
return;
|
||||||
@@ -198,6 +222,12 @@ class CellularBridge {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
sessions_->replicate(tick, source);
|
sessions_->replicate(tick, source);
|
||||||
|
// A tuning adoption changes what a bud costs, so cached costs hold for one rules set.
|
||||||
|
if (auto rules = server::encode_cellular_revamp_rules(state.revamp_rules());
|
||||||
|
rules != bud_rules_) {
|
||||||
|
bud_rules_ = std::move(rules);
|
||||||
|
bud_costs_.clear();
|
||||||
|
}
|
||||||
for (const auto& life : state.lives()) {
|
for (const auto& life : state.lives()) {
|
||||||
if (life.presence == server::CellularPresence::suspended)
|
if (life.presence == server::CellularPresence::suspended)
|
||||||
continue;
|
continue;
|
||||||
@@ -211,7 +241,7 @@ class CellularBridge {
|
|||||||
diagnostics.reserve_energy_pj = life.reserve.energy.value;
|
diagnostics.reserve_energy_pj = life.reserve.energy.value;
|
||||||
for (std::size_t i = 0; i < diagnostics.reserve_matter_fg.size(); ++i)
|
for (std::size_t i = 0; i < diagnostics.reserve_matter_fg.size(); ++i)
|
||||||
diagnostics.reserve_matter_fg[i] = life.reserve.matter[i].value;
|
diagnostics.reserve_matter_fg[i] = life.reserve.matter[i].value;
|
||||||
if (const auto cost = bud_cost_for(state, life.identity.genome)) {
|
if (const auto cost = bud_cost_for(state, life)) {
|
||||||
diagnostics.bud_cost_energy_pj = cost->energy.value;
|
diagnostics.bud_cost_energy_pj = cost->energy.value;
|
||||||
for (std::size_t i = 0; i < diagnostics.bud_cost_matter_fg.size(); ++i)
|
for (std::size_t i = 0; i < diagnostics.bud_cost_matter_fg.size(); ++i)
|
||||||
diagnostics.bud_cost_matter_fg[i] = cost->matter[i].value;
|
diagnostics.bud_cost_matter_fg[i] = cost->matter[i].value;
|
||||||
@@ -254,9 +284,79 @@ class CellularBridge {
|
|||||||
}
|
}
|
||||||
// ADR-0129 (v10): what an engulf or bud intention did this tick.
|
// ADR-0129 (v10): what an engulf or bud intention did this tick.
|
||||||
diagnostics.engulf = engulf_result(feedback->engulf);
|
diagnostics.engulf = engulf_result(feedback->engulf);
|
||||||
diagnostics.bud = feedback->bud ? bud_outcome(*feedback->bud)
|
const auto bud = feedback->bud;
|
||||||
: network::CellularBudOutcome::not_requested;
|
diagnostics.bud =
|
||||||
|
bud ? bud_outcome(*bud) : network::CellularBudOutcome::not_requested;
|
||||||
|
// Rules 13 (v14): what held growth back and the tick's flows by channel.
|
||||||
|
diagnostics.growth_limit = feedback->growth_limit;
|
||||||
|
const auto channels = [](const accounting::Inventory& value) {
|
||||||
|
return std::array<std::uint64_t, 5>{
|
||||||
|
value.energy.value, value.matter[0].value, value.matter[1].value,
|
||||||
|
value.matter[2].value, value.matter[3].value};
|
||||||
|
};
|
||||||
|
diagnostics.collected = channels(feedback->collected);
|
||||||
|
diagnostics.into_growth = channels(feedback->into_growth);
|
||||||
|
diagnostics.burned = channels(feedback->burned);
|
||||||
|
diagnostics.burned[0] = 0; // Energy is spent, never burned.
|
||||||
}
|
}
|
||||||
|
// Rules 12 (v13): the authoritative motion state and the region's currents, from
|
||||||
|
// which the client regenerates the identical flow field.
|
||||||
|
const auto* field = state.flow_field();
|
||||||
|
if (field) {
|
||||||
|
diagnostics.velocity_x_q10 = life.motion.velocity_x_q10;
|
||||||
|
diagnostics.velocity_y_q10 = life.motion.velocity_y_q10;
|
||||||
|
diagnostics.heading = life.motion.heading;
|
||||||
|
const auto& c = state.liquid_rules().currents;
|
||||||
|
view.currents = network::CellularCurrentsView{c.seed,
|
||||||
|
c.width_um,
|
||||||
|
c.height_um,
|
||||||
|
c.pitch_um,
|
||||||
|
c.min_count,
|
||||||
|
c.max_count,
|
||||||
|
c.min_route_width_um,
|
||||||
|
c.max_route_width_um,
|
||||||
|
c.min_speed_um_per_s,
|
||||||
|
c.max_speed_um_per_s};
|
||||||
|
}
|
||||||
|
// Rules 13 (v14): the body block. Older sessions never see it.
|
||||||
|
diagnostics.members = life.revamp.members;
|
||||||
|
diagnostics.growth_per_thousand = static_cast<std::uint16_t>(
|
||||||
|
std::min<std::uint32_t>(life.growth.realized_per_thousand, 1000));
|
||||||
|
if (const auto genome = state.archive().find(life.identity.genome)) {
|
||||||
|
const auto& traits = genome->cellular_traits();
|
||||||
|
const auto t = traits.value_or(biology::CellularTraits{});
|
||||||
|
const std::array<std::uint16_t, 20> fields{
|
||||||
|
t.density, t.upkeep_efficiency, t.growth_speed, t.collection[0],
|
||||||
|
t.collection[1], t.collection[2], t.collection[3], t.collection[4],
|
||||||
|
t.burn[0], t.burn[1], t.burn[2], t.burn[3],
|
||||||
|
t.engulf_capacity, t.kill_absorption, t.litter, t.recipe[0],
|
||||||
|
t.recipe[1], t.recipe[2], t.recipe[3], t.adhesion};
|
||||||
|
if (traits)
|
||||||
|
diagnostics.traits = fields;
|
||||||
|
if (state.rules_version() >= server::cellular_lives_revamp_rules) {
|
||||||
|
const auto& rules = state.revamp_rules();
|
||||||
|
diagnostics.emerge_members = static_cast<std::uint16_t>(
|
||||||
|
std::min<std::uint32_t>(rules.emerge_members, 0xFFFF));
|
||||||
|
diagnostics.can_emerge = server::cellular_can_emerge(life, rules);
|
||||||
|
diagnostics.split_ready =
|
||||||
|
life.revamp.members == 1 &&
|
||||||
|
life.growth.realized_per_thousand >= rules.split_min_growth;
|
||||||
|
if (feedback != state.last_tick_feedback().end() &&
|
||||||
|
feedback->life_id == life.identity.life && feedback->tick == tick)
|
||||||
|
diagnostics.exclude = feedback->exclude;
|
||||||
|
const auto burn = biology::cellular_burn(
|
||||||
|
rules.burn_pj_per_kfg,
|
||||||
|
traits ? t.burn : std::array<std::uint16_t, 4>{100, 100, 100, 100},
|
||||||
|
diagnostics.exclude);
|
||||||
|
diagnostics.payable_energy_pj =
|
||||||
|
biology::cellular_payable_energy(life.reserve, burn, false);
|
||||||
|
} else {
|
||||||
|
diagnostics.payable_energy_pj = life.reserve.energy.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::size_t c = 0; c < life.body.matter.size(); ++c)
|
||||||
|
diagnostics.total_mass_fg +=
|
||||||
|
life.body.matter[c].value + life.reserve.matter[c].value;
|
||||||
view.diagnostics = diagnostics;
|
view.diagnostics = diagnostics;
|
||||||
view.patches.reserve(perceived->size());
|
view.patches.reserve(perceived->size());
|
||||||
// ADR-0136 (rules 8): pools and bubbles go out as v11 deposits, the nearest 512 to
|
// ADR-0136 (rules 8): pools and bubbles go out as v11 deposits, the nearest 512 to
|
||||||
@@ -290,10 +390,41 @@ class CellularBridge {
|
|||||||
before->second.matter.at(i).value;
|
before->second.matter.at(i).value;
|
||||||
}));
|
}));
|
||||||
seen_stock_[patch.id] = patch.available;
|
seen_stock_[patch.id] = patch.available;
|
||||||
|
// Rules 12 (v13): a bubble's world velocity, current plus induced drift, so the
|
||||||
|
// client can carry it between perceptions.
|
||||||
|
if (field && patch.kind == biology::CellularDepositKind::mote) {
|
||||||
|
const auto flow = field->sample(patch.address.x_um, patch.address.y_um);
|
||||||
|
std::int64_t drift_x{}, drift_y{};
|
||||||
|
if (const auto index = state.habitat().find(patch.address)) {
|
||||||
|
drift_x = state.habitat().patches()[*index].drift_x_q10;
|
||||||
|
drift_y = state.habitat().patches()[*index].drift_y_q10;
|
||||||
|
}
|
||||||
|
const auto um_s = [](std::int64_t q10) {
|
||||||
|
return static_cast<std::int16_t>(std::clamp<std::int64_t>(
|
||||||
|
q10 / biology::cellular_velocity_q10_per_um_s, -32'767, 32'767));
|
||||||
|
};
|
||||||
|
deposit.velocity_x_um_s = um_s(flow.x_q10 + drift_x);
|
||||||
|
deposit.velocity_y_um_s = um_s(flow.y_q10 + drift_y);
|
||||||
|
}
|
||||||
const auto dx = std::int64_t{patch.address.x_um} - centre_x;
|
const auto dx = std::int64_t{patch.address.x_um} - centre_x;
|
||||||
const auto dy = std::int64_t{patch.address.y_um} - centre_y;
|
const auto dy = std::int64_t{patch.address.y_um} - centre_y;
|
||||||
near.emplace_back(static_cast<std::uint64_t>(dx * dx + dy * dy), deposit);
|
near.emplace_back(static_cast<std::uint64_t>(dx * dx + dy * dy), deposit);
|
||||||
}
|
}
|
||||||
|
// Rules 12: every pool, but only the nearest moving bubbles (the tuning file's
|
||||||
|
// trial 256); the client carries the rest with the current.
|
||||||
|
if (field) {
|
||||||
|
const auto bubbles = std::ranges::partition(near, [](const auto& entry) {
|
||||||
|
return entry.second.shape == network::CellularDepositShape::pool;
|
||||||
|
});
|
||||||
|
const auto keep = std::min<std::size_t>(cellular_visible_moving_bubbles,
|
||||||
|
static_cast<std::size_t>(bubbles.size()));
|
||||||
|
std::ranges::nth_element(
|
||||||
|
bubbles, bubbles.begin() + static_cast<std::ptrdiff_t>(keep),
|
||||||
|
[](const auto& a, const auto& b) {
|
||||||
|
return std::pair{a.first, a.second.id} < std::pair{b.first, b.second.id};
|
||||||
|
});
|
||||||
|
near.erase(bubbles.begin() + static_cast<std::ptrdiff_t>(keep), near.end());
|
||||||
|
}
|
||||||
if (near.size() > network::max_cellular_perceived_deposits) {
|
if (near.size() > network::max_cellular_perceived_deposits) {
|
||||||
std::ranges::nth_element(
|
std::ranges::nth_element(
|
||||||
near,
|
near,
|
||||||
@@ -363,15 +494,20 @@ class CellularBridge {
|
|||||||
&network::CellularPerceivedProducer::organism);
|
&network::CellularPerceivedProducer::organism);
|
||||||
}
|
}
|
||||||
(void)sessions_->send_cellular_perception(network::AccountId{life.account}, view);
|
(void)sessions_->send_cellular_perception(network::AccountId{life.account}, view);
|
||||||
send_offer(state, life, tick);
|
const auto owned = std::ranges::find(
|
||||||
|
authority.lives(), life.identity.life,
|
||||||
|
[](const server::CellularOwnedLife& value) { return value.identity.life; });
|
||||||
|
if (owned != authority.lives().end())
|
||||||
|
send_offer(authority, *owned, authority.tick());
|
||||||
}
|
}
|
||||||
// After every owner's view: clear only the sessions that got none this tick.
|
// After every owner's view: clear only the sessions that got none this tick.
|
||||||
sessions_->clear_cellular_perceptions(tick);
|
sessions_->clear_cellular_perceptions(tick);
|
||||||
std::erase_if(offers_, [&](const SentOffer& sent) {
|
std::erase_if(offers_, [&](const SentOffer& sent) {
|
||||||
return std::ranges::find(state.lives(), sent.account,
|
return std::ranges::find(authority.lives(), sent.account,
|
||||||
&server::CellularOwnedLife::account) == state.lives().end();
|
&server::CellularOwnedLife::account) ==
|
||||||
|
authority.lives().end();
|
||||||
});
|
});
|
||||||
announce_endings(state);
|
announce_endings(authority);
|
||||||
// What each deposit held when last seen, for next tick's `drained` flags.
|
// What each deposit held when last seen, for next tick's `drained` flags.
|
||||||
deposit_stock_ = std::move(seen_stock_);
|
deposit_stock_ = std::move(seen_stock_);
|
||||||
seen_stock_.clear();
|
seen_stock_.clear();
|
||||||
@@ -385,6 +521,10 @@ class CellularBridge {
|
|||||||
return l.identity.life;
|
return l.identity.life;
|
||||||
}) != state.lives().end())
|
}) != state.lives().end())
|
||||||
continue;
|
continue;
|
||||||
|
// Rules 13: control moved to another life (succession, or a merge into an organism).
|
||||||
|
if (std::ranges::find(state.lives(), account, &server::CellularOwnedLife::account) !=
|
||||||
|
state.lives().end())
|
||||||
|
continue;
|
||||||
const auto corpse =
|
const auto corpse =
|
||||||
std::ranges::find(state.corpses(), life_id, &server::CellularOwnedCorpse::life_id);
|
std::ranges::find(state.corpses(), life_id, &server::CellularOwnedCorpse::life_id);
|
||||||
if (corpse == state.corpses().end())
|
if (corpse == state.corpses().end())
|
||||||
@@ -393,6 +533,8 @@ class CellularBridge {
|
|||||||
? network::CellularDeathReason::starved
|
? network::CellularDeathReason::starved
|
||||||
: corpse->cause == biology::CellularDeathCause::engulfed
|
: corpse->cause == biology::CellularDeathCause::engulfed
|
||||||
? network::CellularDeathReason::engulfed
|
? network::CellularDeathReason::engulfed
|
||||||
|
: corpse->cause == biology::CellularDeathCause::emerged
|
||||||
|
? network::CellularDeathReason::emerged
|
||||||
: network::CellularDeathReason::unrecorded;
|
: network::CellularDeathReason::unrecorded;
|
||||||
static_cast<void>(sessions_->send_life_ended(network::AccountId{account},
|
static_cast<void>(sessions_->send_life_ended(network::AccountId{account},
|
||||||
{corpse->died_tick, life_id, cause}));
|
{corpse->died_tick, life_id, cause}));
|
||||||
@@ -441,17 +583,23 @@ class CellularBridge {
|
|||||||
std::uint64_t tick) {
|
std::uint64_t tick) {
|
||||||
const network::AccountId account{life.account};
|
const network::AccountId account{life.account};
|
||||||
const auto session = sessions_->holder(account);
|
const auto session = sessions_->holder(account);
|
||||||
const auto& progress = life.mutation;
|
// Rules 13 offers are catalog offers (v14 only); earlier rules use the operator offer.
|
||||||
|
const bool named = state.rules_version() >= server::cellular_lives_revamp_rules;
|
||||||
|
const bool pending = named ? life.revamp.offer.count != 0 : life.mutation.offer.has_value();
|
||||||
const SentOffer current{life.account, session.value_or(0), life.identity.life,
|
const SentOffer current{life.account, session.value_or(0), life.identity.life,
|
||||||
progress.offer ? progress.event_index : 0,
|
!pending ? 0
|
||||||
progress.offer ? progress.offer_tick : 0};
|
: named ? life.revamp.offer.event_index
|
||||||
|
: life.mutation.event_index,
|
||||||
|
!pending ? 0
|
||||||
|
: named ? life.revamp.offer.offer_tick
|
||||||
|
: life.mutation.offer_tick};
|
||||||
auto sent = std::ranges::find(offers_, life.account, &SentOffer::account);
|
auto sent = std::ranges::find(offers_, life.account, &SentOffer::account);
|
||||||
if (sent != offers_.end() && *sent == current)
|
if (sent != offers_.end() && *sent == current)
|
||||||
return;
|
return;
|
||||||
if (!session || (!progress.offer && sent == offers_.end()))
|
if (!session || (!pending && sent == offers_.end()))
|
||||||
return; // Nothing to show, or no one to show it to.
|
return; // Nothing to show, or no one to show it to.
|
||||||
if (!sessions_->send_mutation_offer(account, server::offer_view(state, life, tick)))
|
if (!sessions_->send_mutation_offer(account, server::offer_view(state, life, tick), named))
|
||||||
return; // Not a v10 owner (or the stream refused): retried on a later tick.
|
return; // Not a v10 (v14) owner (or the stream refused): retried on a later tick.
|
||||||
if (sent != offers_.end())
|
if (sent != offers_.end())
|
||||||
*sent = current;
|
*sent = current;
|
||||||
else
|
else
|
||||||
@@ -462,19 +610,18 @@ class CellularBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ADR-0129 amendment: a genome's bud cost is pure for this region's temperature, and
|
// The parent/plan charge is pure at this region's temperature and fixed rules.
|
||||||
// deriving it scans up to a thousand bodies, so it is computed once per genome.
|
// Internal-cell costs depend on the current body and are recomputed.
|
||||||
std::optional<accounting::Inventory> bud_cost_for(const server::CellularLives& state,
|
std::optional<accounting::Inventory> bud_cost_for(const server::CellularLives& state,
|
||||||
std::uint64_t genome_id) {
|
const server::CellularOwnedLife& life) {
|
||||||
if (const auto known = bud_costs_.find(genome_id); known != bud_costs_.end())
|
if (life.revamp.members > 1)
|
||||||
|
return state.budding_cost(life.identity.life);
|
||||||
|
const auto key = std::pair{life.identity.genome, server::cellular_offspring_genome(life)};
|
||||||
|
if (const auto known = bud_costs_.find(key); known != bud_costs_.end())
|
||||||
return known->second;
|
return known->second;
|
||||||
const auto genome = state.archive().find(genome_id);
|
|
||||||
if (!genome)
|
|
||||||
return std::nullopt;
|
|
||||||
if (bud_costs_.size() >= 4096)
|
if (bud_costs_.size() >= 4096)
|
||||||
bud_costs_.clear(); // Bounded: recomputing is only slower.
|
bud_costs_.clear(); // Bounded: recomputing is only slower.
|
||||||
return bud_costs_[genome_id] =
|
return bud_costs_[key] = state.budding_cost(life.identity.life);
|
||||||
biology::bud_cost(*genome, state.ambient_temperature_millikelvin());
|
|
||||||
}
|
}
|
||||||
static std::uint64_t wall_seconds() {
|
static std::uint64_t wall_seconds() {
|
||||||
return static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
|
return static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
|
||||||
@@ -489,12 +636,65 @@ class CellularBridge {
|
|||||||
std::puts(message);
|
std::puts(message);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
// The region's newest window record, every 5 s. A failed read keeps the current window,
|
||||||
|
// which still closes at its own deadline.
|
||||||
|
void read_window(std::uint64_t now_seconds) {
|
||||||
|
constexpr std::chrono::seconds interval{5};
|
||||||
|
const auto now = std::chrono::steady_clock::now();
|
||||||
|
if (now < next_window_read_)
|
||||||
|
return;
|
||||||
|
next_window_read_ = now + interval;
|
||||||
|
auto* db = slot_->get();
|
||||||
|
if (db == nullptr)
|
||||||
|
return;
|
||||||
|
const std::array<std::string, 2> parameters{std::to_string(key_.world),
|
||||||
|
std::to_string(key_.region)};
|
||||||
|
const auto rows =
|
||||||
|
db->query("SELECT activation_id, floor(extract(epoch FROM expires_at))::bigint FROM "
|
||||||
|
"evolution.load_session_window_v1($1::evolution.u64, $2::evolution.u64)",
|
||||||
|
parameters, std::chrono::milliseconds{1000});
|
||||||
|
if (!rows) {
|
||||||
|
slot_->broken();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::optional<server::SessionWindowFeed::Record> record;
|
||||||
|
if (!rows->empty() && rows->front().size() == 2 && rows->front()[0]) {
|
||||||
|
record = server::SessionWindowFeed::Record{*rows->front()[0], std::nullopt};
|
||||||
|
if (const auto& expiry = rows->front()[1]) {
|
||||||
|
std::uint64_t value{};
|
||||||
|
const auto [end, ec] =
|
||||||
|
std::from_chars(expiry->data(), expiry->data() + expiry->size(), value);
|
||||||
|
if (ec == std::errc{} && end == expiry->data() + expiry->size())
|
||||||
|
record->expires_at = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (feed_.observe(record, now_seconds)) {
|
||||||
|
case server::SessionWindowFeed::Change::opened:
|
||||||
|
std::printf("cellular window opened activation=%s expires=%llu\n",
|
||||||
|
feed_.window()->activation_id().c_str(),
|
||||||
|
static_cast<unsigned long long>(feed_.window()->deadline_seconds()));
|
||||||
|
break;
|
||||||
|
case server::SessionWindowFeed::Change::closed:
|
||||||
|
std::puts("cellular window closed");
|
||||||
|
break;
|
||||||
|
case server::SessionWindowFeed::Change::refused:
|
||||||
|
std::printf("cellular window refused activation=%s\n",
|
||||||
|
record ? record->activation_id.c_str() : "");
|
||||||
|
break;
|
||||||
|
case server::SessionWindowFeed::Change::none:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<server::PgSlot> slot_;
|
std::unique_ptr<server::PgSlot> slot_;
|
||||||
std::unique_ptr<server::PostgresControlLedger> control_;
|
std::unique_ptr<server::PostgresControlLedger> control_;
|
||||||
std::unique_ptr<server::PostgresActionLedger> actions_;
|
std::unique_ptr<server::PostgresActionLedger> actions_;
|
||||||
std::unique_ptr<server::RegionSessions> sessions_;
|
std::unique_ptr<server::RegionSessions> sessions_;
|
||||||
std::optional<server::SessionWindow> window_;
|
std::optional<server::SessionWindow> window_; // A fixed --session-window.
|
||||||
|
bool window_from_database_{};
|
||||||
|
persistence::RegionKey key_{};
|
||||||
|
server::SessionWindowFeed feed_;
|
||||||
|
std::chrono::steady_clock::time_point next_window_read_{};
|
||||||
std::optional<std::uint64_t> replicated_tick_;
|
std::optional<std::uint64_t> replicated_tick_;
|
||||||
struct SentOffer {
|
struct SentOffer {
|
||||||
server::LifeAccount account{};
|
server::LifeAccount account{};
|
||||||
@@ -502,10 +702,11 @@ class CellularBridge {
|
|||||||
friend bool operator==(const SentOffer&, const SentOffer&) = default;
|
friend bool operator==(const SentOffer&, const SentOffer&) = default;
|
||||||
};
|
};
|
||||||
std::vector<SentOffer> offers_; // Last offer view sent to each owner.
|
std::vector<SentOffer> offers_; // Last offer view sent to each owner.
|
||||||
std::map<std::uint64_t, std::optional<accounting::Inventory>> bud_costs_; // By genome.
|
std::map<std::pair<std::uint64_t, std::uint64_t>, std::optional<accounting::Inventory>>
|
||||||
|
bud_costs_;
|
||||||
|
std::vector<std::uint8_t> bud_rules_; // The rules bud_costs_ were computed under.
|
||||||
// ADR-0136: deposit stocks seen at the last replicated tick, and this tick's.
|
// ADR-0136: deposit stocks seen at the last replicated tick, and this tick's.
|
||||||
std::map<std::uint32_t, accounting::Inventory> deposit_stock_, seen_stock_;
|
std::map<std::uint32_t, accounting::Inventory> deposit_stock_, seen_stock_;
|
||||||
std::vector<std::pair<server::LifeAccount, std::uint64_t>> owned_; // At last replication.
|
std::vector<std::pair<server::LifeAccount, std::uint64_t>> owned_; // At last replication.
|
||||||
bool shutdown_{};
|
|
||||||
};
|
};
|
||||||
} // namespace evo::server_app
|
} // namespace evo::server_app
|
||||||
|
|||||||
@@ -53,6 +53,10 @@
|
|||||||
namespace evo::server_app {
|
namespace evo::server_app {
|
||||||
struct M10Options {
|
struct M10Options {
|
||||||
std::string listen, certificate, key, issuer, environment, session_window;
|
std::string listen, certificate, key, issuer, environment, session_window;
|
||||||
|
// ADR-0087 amendment: `--session-window-source db` reads the window from
|
||||||
|
// evolution.load_session_window_v1 every few seconds instead of --session-window
|
||||||
|
// (cellular profile only). Exactly one of the two is given.
|
||||||
|
bool window_from_database{};
|
||||||
// M10.5c: dev only, 60..14400 s; 0 keeps the default (300 s, ADR-0091).
|
// M10.5c: dev only, 60..14400 s; 0 keeps the default (300 s, ADR-0091).
|
||||||
std::uint64_t max_grant_lifetime{};
|
std::uint64_t max_grant_lifetime{};
|
||||||
// M10.9 (ADR-0097, dev only): `--m10-load-governor off` keeps measuring and exposing the
|
// M10.9 (ADR-0097, dev only): `--m10-load-governor off` keeps measuring and exposing the
|
||||||
@@ -68,15 +72,16 @@ struct M10Options {
|
|||||||
std::vector<std::string> life_routes;
|
std::vector<std::string> life_routes;
|
||||||
[[nodiscard]] bool session_any() const noexcept {
|
[[nodiscard]] bool session_any() const noexcept {
|
||||||
return !listen.empty() || !certificate.empty() || !key.empty() || !issuer.empty() ||
|
return !listen.empty() || !certificate.empty() || !key.empty() || !issuer.empty() ||
|
||||||
!environment.empty() || !session_window.empty() || max_grant_lifetime != 0 ||
|
!environment.empty() || !session_window.empty() || window_from_database ||
|
||||||
!area.empty() || !handoff_key.empty() || !neighbours.empty() || !load_governor;
|
max_grant_lifetime != 0 || !area.empty() || !handoff_key.empty() ||
|
||||||
|
!neighbours.empty() || !load_governor;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool any() const noexcept {
|
[[nodiscard]] bool any() const noexcept {
|
||||||
return session_any() || !life_routes.empty();
|
return session_any() || !life_routes.empty();
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool complete() const noexcept {
|
[[nodiscard]] bool complete() const noexcept {
|
||||||
return !listen.empty() && !certificate.empty() && !key.empty() && !issuer.empty() &&
|
return !listen.empty() && !certificate.empty() && !key.empty() && !issuer.empty() &&
|
||||||
!environment.empty() && !session_window.empty();
|
!environment.empty() && (session_window.empty() == window_from_database);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Actions are handed to the host as soon as they are scheduled (at most 8 ticks ahead).
|
// Actions are handed to the host as soon as they are scheduled (at most 8 ticks ahead).
|
||||||
@@ -117,6 +122,8 @@ template <typename Host> class M10Bridge {
|
|||||||
M10Bridge bridge;
|
M10Bridge bridge;
|
||||||
if (!o.any())
|
if (!o.any())
|
||||||
return bridge;
|
return bridge;
|
||||||
|
if (o.window_from_database)
|
||||||
|
return fail("error m10-window-source"); // The cellular profile only.
|
||||||
const auto window = server::SessionWindow::open(o.session_window, wall_seconds());
|
const auto window = server::SessionWindow::open(o.session_window, wall_seconds());
|
||||||
if (!window)
|
if (!window)
|
||||||
return fail(window.error() == server::SessionWindow::Error::expired
|
return fail(window.error() == server::SessionWindow::Error::expired
|
||||||
|
|||||||
+294
-39
@@ -53,8 +53,10 @@
|
|||||||
// --primitive-* flags enable the v5 new-life listener; biology ticks and genesis
|
// --primitive-* flags enable the v5 new-life listener; biology ticks and genesis
|
||||||
// provisioning remain disabled.
|
// provisioning remain disabled.
|
||||||
#include "evo/biology/founder.hpp"
|
#include "evo/biology/founder.hpp"
|
||||||
|
#include "evo/persistence/sha256.hpp"
|
||||||
#include "evo/processes/development_opening.hpp"
|
#include "evo/processes/development_opening.hpp"
|
||||||
#include "evo/server/cellular_session_batch.hpp"
|
#include "evo/server/cellular_session_batch.hpp"
|
||||||
|
#include "evo/server/lifecycle/cellular_admin_view.hpp"
|
||||||
#include "evo/server/lifecycle/cellular_schedule.hpp"
|
#include "evo/server/lifecycle/cellular_schedule.hpp"
|
||||||
#include "evo/server/lifecycle/primitive_lives.hpp"
|
#include "evo/server/lifecycle/primitive_lives.hpp"
|
||||||
#include "evo/server/lifecycle/wildlife_controller.hpp"
|
#include "evo/server/lifecycle/wildlife_controller.hpp"
|
||||||
@@ -262,6 +264,8 @@ std::optional<Options> parse(int argc, char** argv) {
|
|||||||
o.m10.environment = value;
|
o.m10.environment = value;
|
||||||
else if (flag == "--session-window")
|
else if (flag == "--session-window")
|
||||||
o.m10.session_window = value;
|
o.m10.session_window = value;
|
||||||
|
else if (flag == "--session-window-source" && value == "db")
|
||||||
|
o.m10.window_from_database = true;
|
||||||
else if (flag == "--m10-max-grant-lifetime" && n && *n >= 60 && *n <= 14400)
|
else if (flag == "--m10-max-grant-lifetime" && n && *n >= 60 && *n <= 14400)
|
||||||
o.m10.max_grant_lifetime = *n;
|
o.m10.max_grant_lifetime = *n;
|
||||||
else if (flag == "--m10-area")
|
else if (flag == "--m10-area")
|
||||||
@@ -925,7 +929,9 @@ int serve_cellular(Options& o) {
|
|||||||
return 2;
|
return 2;
|
||||||
std::unique_ptr<server::OpsServer> ops;
|
std::unique_ptr<server::OpsServer> ops;
|
||||||
if (!o.ops_listen.empty()) {
|
if (!o.ops_listen.empty()) {
|
||||||
auto listening = server::OpsServer::listen(o.ops_listen);
|
// Room for /admin/view (ADR-0182); probes and metrics stay small.
|
||||||
|
auto listening = server::OpsServer::listen(
|
||||||
|
o.ops_listen, server::OpsServer::max_configurable_response_bytes);
|
||||||
if (!listening) {
|
if (!listening) {
|
||||||
std::puts("error ops-listen");
|
std::puts("error ops-listen");
|
||||||
return 2;
|
return 2;
|
||||||
@@ -936,7 +942,26 @@ int serve_cellular(Options& o) {
|
|||||||
bool ready = false;
|
bool ready = false;
|
||||||
std::optional<server::HostPhase> phase;
|
std::optional<server::HostPhase> phase;
|
||||||
server::CellularTickSchedule schedule;
|
server::CellularTickSchedule schedule;
|
||||||
|
// The open session batch between commits, the actions it carries, and the monotone pace
|
||||||
|
// head per epoch (rules-12 regions commit every flush interval, not every tick).
|
||||||
|
std::optional<server::CellularSessionBatchBuilder> batch_builder;
|
||||||
|
std::vector<network::CarriedAction> batch_actions;
|
||||||
|
std::uint64_t pace_epoch = 0, pace_tick = 0, flushes_logged = 0;
|
||||||
std::vector<network::CarriedAction> awaiting_outcomes;
|
std::vector<network::CarriedAction> awaiting_outcomes;
|
||||||
|
// The batch being committed on the host's worker thread while the next one builds on its
|
||||||
|
// candidate: its carried actions, birth refusals and operator timing.
|
||||||
|
std::vector<network::CarriedAction> flight_actions;
|
||||||
|
std::vector<server::CellularBirthRefusal> flight_refusals;
|
||||||
|
std::size_t flight_ticks = 0;
|
||||||
|
long long flight_handoff_ms = 0;
|
||||||
|
auto flight_start = std::chrono::steady_clock::now();
|
||||||
|
const auto drop_carried = [&](std::vector<network::CarriedAction>& carried) {
|
||||||
|
bridge->dropped(carried, true);
|
||||||
|
std::erase_if(awaiting_outcomes, [&](const auto& action) {
|
||||||
|
return std::ranges::find(carried, action) != carried.end();
|
||||||
|
});
|
||||||
|
carried.clear();
|
||||||
|
};
|
||||||
// A tick that cannot be built is retried every 50 ms; name each distinct cause once.
|
// A tick that cannot be built is retried every 50 ms; name each distinct cause once.
|
||||||
std::optional<std::pair<std::string_view, server::CellularSessionBatchError>> stalled;
|
std::optional<std::pair<std::string_view, server::CellularSessionBatchError>> stalled;
|
||||||
const auto report_stall = [&](std::string_view where, server::CellularSessionBatchError error,
|
const auto report_stall = [&](std::string_view where, server::CellularSessionBatchError error,
|
||||||
@@ -1003,13 +1028,60 @@ int serve_cellular(Options& o) {
|
|||||||
host.drain();
|
host.drain();
|
||||||
return finish(0);
|
return finish(0);
|
||||||
}
|
}
|
||||||
|
// A finished background commit lands first, so this step sees its head.
|
||||||
|
if (auto landed = host.poll_publish(); landed) {
|
||||||
|
const auto commit_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
std::chrono::steady_clock::now() - flight_start)
|
||||||
|
.count();
|
||||||
|
// Operator evidence: the loop is blocked only for the hand-off, not the commit.
|
||||||
|
if (flight_handoff_ms > 50 || !*landed || ++flushes_logged % 30 == 0)
|
||||||
|
std::printf("cellular commit ticks=%zu ms=%lld handoff_ms=%lld ok=%d\n",
|
||||||
|
flight_ticks, static_cast<long long>(commit_ms), flight_handoff_ms,
|
||||||
|
*landed ? 1 : 0);
|
||||||
|
if (!*landed) {
|
||||||
|
// Categories and SQLSTATE only (never server text); -1 when not reported.
|
||||||
|
const auto& failure = landed->error();
|
||||||
|
const auto store = failure.store.value_or(persistence::LeaseStoreFailure{});
|
||||||
|
std::printf("cellular commit failed host=%u publication=%d store=%d "
|
||||||
|
"sqlstate=%.5s object=%d\n",
|
||||||
|
static_cast<unsigned>(failure.kind),
|
||||||
|
failure.publication ? static_cast<int>(*failure.publication) : -1,
|
||||||
|
failure.store ? static_cast<int>(store.kind) : -1,
|
||||||
|
failure.store ? store.cause.sqlstate.data() : "-",
|
||||||
|
failure.object ? static_cast<int>(*failure.object) : -1);
|
||||||
|
}
|
||||||
|
if (*landed) {
|
||||||
|
host.refuse_births(flight_refusals);
|
||||||
|
flight_actions.clear();
|
||||||
|
if (batch_builder && !batch_builder->rebase(host.committed()->head)) {
|
||||||
|
drop_carried(batch_actions);
|
||||||
|
batch_builder.reset();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// An unresolved outcome keeps its actions for the host to finalize.
|
||||||
|
if (host.status().phase == server::HostPhase::resolving)
|
||||||
|
flight_actions.clear();
|
||||||
|
else
|
||||||
|
drop_carried(flight_actions);
|
||||||
|
// The open batch continued from a state that is not durable.
|
||||||
|
drop_carried(batch_actions);
|
||||||
|
batch_builder.reset();
|
||||||
|
}
|
||||||
|
flight_refusals.clear();
|
||||||
|
}
|
||||||
const auto& status = host.step();
|
const auto& status = host.step();
|
||||||
const auto wall =
|
const auto wall =
|
||||||
static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
|
static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
|
||||||
std::chrono::system_clock::now().time_since_epoch())
|
std::chrono::system_clock::now().time_since_epoch())
|
||||||
.count());
|
.count());
|
||||||
static_cast<void>(bridge->accepting(wall));
|
static_cast<void>(bridge->accepting(wall));
|
||||||
bridge->poll(status, wall);
|
// Sessions schedule and admit against what has been simulated: the open batch's
|
||||||
|
// working tick runs up to a flush interval ahead of the committed head.
|
||||||
|
auto session_status = status;
|
||||||
|
if (batch_builder)
|
||||||
|
session_status.simulated_tick =
|
||||||
|
std::max(session_status.simulated_tick, batch_builder->candidate().tick());
|
||||||
|
bridge->poll(session_status, wall);
|
||||||
deliver_finalized();
|
deliver_finalized();
|
||||||
set_ready(status.ready);
|
set_ready(status.ready);
|
||||||
if (!phase || *phase != status.phase) {
|
if (!phase || *phase != status.phase) {
|
||||||
@@ -1038,6 +1110,31 @@ int serve_cellular(Options& o) {
|
|||||||
counters.checkpoint_age_ms = schedule.status().head_age_us / 1000;
|
counters.checkpoint_age_ms = schedule.status().head_age_us / 1000;
|
||||||
return {200, server::render_metrics(paced, counters)};
|
return {200, server::render_metrics(paced, counters)};
|
||||||
}
|
}
|
||||||
|
// ADR-0182: the admin portal's read-only region view. The port admits only
|
||||||
|
// Prometheus and the admin API (NetworkPolicy).
|
||||||
|
if (path == "/admin/view") {
|
||||||
|
const auto* state = host.state();
|
||||||
|
if (!current.ready || state == nullptr)
|
||||||
|
return {503, "not ready\n"};
|
||||||
|
const auto online = [&](const server::LifeAccount& account) {
|
||||||
|
network::AccountId id;
|
||||||
|
id.bytes = account;
|
||||||
|
return bridge->sessions().holder(id).has_value();
|
||||||
|
};
|
||||||
|
// The digest tuning revisions are adopted by (ADR-0182 section 13).
|
||||||
|
std::string rules_sha256;
|
||||||
|
if (state->rules_version() >= server::cellular_lives_revamp_rules)
|
||||||
|
if (const auto digest = persistence::sha256(
|
||||||
|
server::encode_cellular_revamp_rules(state->revamp_rules())))
|
||||||
|
for (const auto byte : *digest) {
|
||||||
|
constexpr std::string_view digits = "0123456789abcdef";
|
||||||
|
rules_sha256.push_back(digits[byte >> 4U]);
|
||||||
|
rules_sha256.push_back(digits[byte & 0x0FU]);
|
||||||
|
}
|
||||||
|
return {200,
|
||||||
|
server::render_cellular_admin_view(*state, online, {}, rules_sha256),
|
||||||
|
"application/json"};
|
||||||
|
}
|
||||||
return {404, "not found\n"};
|
return {404, "not found\n"};
|
||||||
};
|
};
|
||||||
ops->serve(handler);
|
ops->serve(handler);
|
||||||
@@ -1077,22 +1174,104 @@ int serve_cellular(Options& o) {
|
|||||||
[[maybe_unused]] const auto changed = host.set_population_mode(want_population);
|
[[maybe_unused]] const auto changed = host.set_population_mode(want_population);
|
||||||
state = host.state();
|
state = host.state();
|
||||||
}
|
}
|
||||||
const bool needed = state && (player_present || birth_waiting ||
|
// A queued admin command needs a tick too: an empty region must still take a spawn.
|
||||||
server::cellular_unattended_tick_needed(*state) ||
|
const bool needed =
|
||||||
status.ecological_pending_ticks != 0);
|
state &&
|
||||||
|
(player_present || birth_waiting || server::cellular_unattended_tick_needed(*state) ||
|
||||||
|
status.ecological_pending_ticks != 0 || !host.unbound_admin_commands().empty());
|
||||||
const auto monotonic_us = [] {
|
const auto monotonic_us = [] {
|
||||||
return static_cast<std::uint64_t>(
|
return static_cast<std::uint64_t>(
|
||||||
std::chrono::duration_cast<std::chrono::microseconds>(
|
std::chrono::duration_cast<std::chrono::microseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count());
|
.count());
|
||||||
};
|
};
|
||||||
const auto paced = schedule.observe(monotonic_us(), status.epoch,
|
// Pacing follows the simulated tick (the open batch's working state), never backwards
|
||||||
state ? state->tick() : status.committed_tick, needed,
|
// within an epoch: a discarded batch must not look like a head regression.
|
||||||
|
const auto simulated_tick = batch_builder ? batch_builder->candidate().tick()
|
||||||
|
: state ? state->tick()
|
||||||
|
: status.committed_tick;
|
||||||
|
if (status.epoch != pace_epoch) {
|
||||||
|
pace_epoch = status.epoch;
|
||||||
|
pace_tick = simulated_tick;
|
||||||
|
}
|
||||||
|
pace_tick = std::max(pace_tick, simulated_tick);
|
||||||
|
const auto paced = schedule.observe(monotonic_us(), status.epoch, pace_tick, needed,
|
||||||
status.ready && state, status.ecological_pending_ticks);
|
status.ready && state, status.ecological_pending_ticks);
|
||||||
if (!paced) {
|
if (!paced) {
|
||||||
std::puts("error cellular-schedule");
|
std::puts("error cellular-schedule");
|
||||||
return finish(4);
|
return finish(4);
|
||||||
}
|
}
|
||||||
|
const auto flush_ticks = std::clamp<std::uint64_t>(
|
||||||
|
static_cast<std::uint64_t>(o.host.flush_interval.count()) / 50, 1, 60);
|
||||||
|
// Births wait for a batch that starts on the durable head.
|
||||||
|
const bool admissions_waiting = !held_births.empty();
|
||||||
|
// Write-behind commit: the open batch goes to the host's worker thread and the next
|
||||||
|
// batch continues from its candidate under a provisional head, rebased when the commit
|
||||||
|
// lands. One commit is in flight; meanwhile the open batch simply keeps growing.
|
||||||
|
const auto flush = [&] {
|
||||||
|
if (!batch_builder || batch_builder->batch().ticks.empty()) {
|
||||||
|
if (!host.commit_in_flight())
|
||||||
|
batch_builder.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (host.commit_in_flight())
|
||||||
|
return;
|
||||||
|
const auto handoff_start = std::chrono::steady_clock::now();
|
||||||
|
const auto& candidate = batch_builder->candidate();
|
||||||
|
std::optional<server::CellularSessionBatchBuilder> next;
|
||||||
|
if (!admissions_waiting && candidate.tick() != UINT64_MAX) {
|
||||||
|
persistence::RegionHead provisional{candidate.frame(),
|
||||||
|
host.committed()->head.sequence + 1,
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
candidate.tick()};
|
||||||
|
provisional.commit.fill(0xFF);
|
||||||
|
provisional.digest.fill(0xFF);
|
||||||
|
if (auto created =
|
||||||
|
server::CellularSessionBatchBuilder::create(candidate, provisional);
|
||||||
|
created) {
|
||||||
|
next.emplace(std::move(*created));
|
||||||
|
next->set_tuning_resolver(host.tuning_resolver());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flight_ticks = batch_builder->batch().ticks.size();
|
||||||
|
const auto refusals = batch_builder->refused_births();
|
||||||
|
flight_refusals.assign(refusals.begin(), refusals.end());
|
||||||
|
const auto actions = batch_builder->actions();
|
||||||
|
const auto mutation_actions = batch_builder->mutation_actions();
|
||||||
|
auto begun =
|
||||||
|
host.begin_publish(batch_builder->batch(), {actions.begin(), actions.end()},
|
||||||
|
{mutation_actions.begin(), mutation_actions.end()},
|
||||||
|
batch_builder->take_candidate());
|
||||||
|
batch_builder.reset();
|
||||||
|
flight_actions = std::move(batch_actions);
|
||||||
|
batch_actions.clear();
|
||||||
|
flight_start = std::chrono::steady_clock::now();
|
||||||
|
flight_handoff_ms =
|
||||||
|
std::chrono::duration_cast<std::chrono::milliseconds>(flight_start - handoff_start)
|
||||||
|
.count();
|
||||||
|
if (!begun) {
|
||||||
|
std::printf("cellular commit refused handoff_ms=%lld error=%u\n", flight_handoff_ms,
|
||||||
|
static_cast<unsigned>(begun.error().kind));
|
||||||
|
drop_carried(flight_actions);
|
||||||
|
flight_refusals.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (next)
|
||||||
|
batch_builder = std::move(next);
|
||||||
|
};
|
||||||
|
// A batch cannot outlive the authority or the raw mode it was built under; when demand
|
||||||
|
// ends, what it holds is committed.
|
||||||
|
if (batch_builder && (!status.ready || !state || host.population_mode())) {
|
||||||
|
bridge->dropped(batch_actions, true);
|
||||||
|
std::erase_if(awaiting_outcomes, [&](const auto& action) {
|
||||||
|
return std::ranges::find(batch_actions, action) != batch_actions.end();
|
||||||
|
});
|
||||||
|
batch_builder.reset();
|
||||||
|
batch_actions.clear();
|
||||||
|
} else if (batch_builder && !needed) {
|
||||||
|
flush();
|
||||||
|
}
|
||||||
if (status.ready && state && (needed || host.population_mode())) {
|
if (status.ready && state && (needed || host.population_mode())) {
|
||||||
if (host.population_mode()) {
|
if (host.population_mode()) {
|
||||||
if (paced->retry_ready && (paced->due || status.ecological_pending_ticks != 0)) {
|
if (paced->retry_ready && (paced->due || status.ecological_pending_ticks != 0)) {
|
||||||
@@ -1100,17 +1279,32 @@ int serve_cellular(Options& o) {
|
|||||||
if (!published)
|
if (!published)
|
||||||
schedule.defer(monotonic_us());
|
schedule.defer(monotonic_us());
|
||||||
}
|
}
|
||||||
} else if (paced->due && state->tick() != UINT64_MAX) {
|
} else {
|
||||||
const auto tick = state->tick() + 1;
|
// Rules 12 regions hold thousands of deposits, so their committed payload is
|
||||||
|
// large: commit every flush interval (ADR-0089: 1 s), not every tick. Players
|
||||||
|
// see the batch's working state at once; outcomes become final at its commit.
|
||||||
|
// Births commit promptly, in their own fresh batch.
|
||||||
|
if (batch_builder && admissions_waiting)
|
||||||
|
flush();
|
||||||
|
const auto* current = batch_builder ? &batch_builder->candidate() : state;
|
||||||
|
// A failed commit can leave the host without state until it recovers. While a
|
||||||
|
// commit is in flight the open batch is the only place to simulate, and it is
|
||||||
|
// bounded below the batch limit.
|
||||||
|
const bool can_build = batch_builder ? batch_builder->batch().ticks.size() + 4 <
|
||||||
|
server::max_cellular_batch_ticks
|
||||||
|
: !host.commit_in_flight();
|
||||||
|
if (current && host.committed() && paced->due && needed && can_build &&
|
||||||
|
current->tick() != UINT64_MAX) {
|
||||||
|
const auto tick = current->tick() + 1;
|
||||||
std::vector<server::CellularLifeIntent> baseline;
|
std::vector<server::CellularLifeIntent> baseline;
|
||||||
baseline.reserve(state->lives().size());
|
baseline.reserve(current->lives().size());
|
||||||
// ADR-0128: an owned life whose account holds no session here is frozen
|
// ADR-0128: an owned life whose account holds no session here is frozen
|
||||||
// (rules 5); the trace records the boundary, and its carried actions are
|
// (rules 5); the trace records the boundary, and its carried actions are
|
||||||
// refused below.
|
// refused below.
|
||||||
const bool presence_rules =
|
const bool presence_rules =
|
||||||
state->rules_version() >= server::cellular_lives_presence_rules;
|
current->rules_version() >= server::cellular_lives_presence_rules;
|
||||||
std::vector<server::LifeAccount> offline;
|
std::vector<server::LifeAccount> offline;
|
||||||
for (const auto& life : state->lives()) {
|
for (const auto& life : current->lives()) {
|
||||||
server::CellularLifeIntent intent{life.identity.life, {}};
|
server::CellularLifeIntent intent{life.identity.life, {}};
|
||||||
network::AccountId account;
|
network::AccountId account;
|
||||||
account.bytes = life.account;
|
account.bytes = life.account;
|
||||||
@@ -1124,7 +1318,7 @@ int serve_cellular(Options& o) {
|
|||||||
std::ranges::sort(baseline, {}, &server::CellularLifeIntent::life_id);
|
std::ranges::sort(baseline, {}, &server::CellularLifeIntent::life_id);
|
||||||
// ADR-0125: wildlife follow the deterministic controller; its intentions
|
// ADR-0125: wildlife follow the deterministic controller; its intentions
|
||||||
// ride the trace like a player's, and the owner validates them.
|
// ride the trace like a player's, and the owner validates them.
|
||||||
if (const auto wild = server::wildlife_intents(*state, tick); wild) {
|
if (const auto wild = server::wildlife_intents(*current, tick); wild) {
|
||||||
for (const auto& intent : *wild) {
|
for (const auto& intent : *wild) {
|
||||||
const auto found = std::ranges::lower_bound(
|
const auto found = std::ranges::lower_bound(
|
||||||
baseline, intent.life_id, {}, &server::CellularLifeIntent::life_id);
|
baseline, intent.life_id, {}, &server::CellularLifeIntent::life_id);
|
||||||
@@ -1143,60 +1337,120 @@ int serve_cellular(Options& o) {
|
|||||||
});
|
});
|
||||||
bridge->dropped(departed, true);
|
bridge->dropped(departed, true);
|
||||||
}
|
}
|
||||||
auto builder =
|
// One action per account a tick; a second would refuse the whole tick.
|
||||||
server::CellularSessionBatchBuilder::create(*state, host.committed()->head);
|
if (const auto superseded = server::keep_one_action_per_account(actions);
|
||||||
if (!builder) {
|
!superseded.empty())
|
||||||
report_stall("create", builder.error(), tick);
|
bridge->dropped(superseded, true);
|
||||||
|
if (!batch_builder) {
|
||||||
|
auto created = server::CellularSessionBatchBuilder::create(
|
||||||
|
*state, host.committed()->head);
|
||||||
|
if (created) {
|
||||||
|
batch_builder.emplace(std::move(*created));
|
||||||
|
batch_builder->set_tuning_resolver(host.tuning_resolver());
|
||||||
|
} else
|
||||||
|
report_stall("create", created.error(), tick);
|
||||||
|
}
|
||||||
|
if (!batch_builder) {
|
||||||
bridge->dropped(actions, true);
|
bridge->dropped(actions, true);
|
||||||
} else {
|
} else {
|
||||||
auto appended = builder->append_with_birth_refusals(
|
// Births only ever enter a fresh batch on the durable head. Queued
|
||||||
tick, baseline, actions, held_births, host.queued_mutations());
|
// mutation choices (ADR-0121 amendment, schema 59) bind at the next
|
||||||
|
// tick simulated, unless this batch or the commit in flight has them.
|
||||||
|
const bool fresh =
|
||||||
|
batch_builder->batch().ticks.empty() && !host.commit_in_flight();
|
||||||
|
const std::span<const server::CellularTickIntents::Birth> births =
|
||||||
|
fresh ? std::span<const server::CellularTickIntents::Birth>{held_births}
|
||||||
|
: std::span<const server::CellularTickIntents::Birth>{};
|
||||||
|
auto unbound = host.unbound_mutations();
|
||||||
|
std::erase_if(unbound, [&](const auto& queued) {
|
||||||
|
return std::ranges::any_of(
|
||||||
|
batch_builder->mutation_actions(), [&](const auto& bound) {
|
||||||
|
return bound.account == queued.account &&
|
||||||
|
bound.action_id == queued.action_id;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const std::span<const persistence::CellularMutationReservation> mutations =
|
||||||
|
unbound;
|
||||||
|
// ADR-0182: queued admin commands not already in this batch, and at
|
||||||
|
// most one tuning adoption per batch (its successor names its rules).
|
||||||
|
auto admin = host.unbound_admin_commands();
|
||||||
|
std::erase_if(admin, [&](const auto& queued) {
|
||||||
|
return std::ranges::any_of(
|
||||||
|
batch_builder->batch().ticks, [&](const auto& previous) {
|
||||||
|
return std::ranges::find(previous.admin, queued.id,
|
||||||
|
&server::CellularAdminCommand::id) !=
|
||||||
|
previous.admin.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
bool adopting = std::ranges::any_of(
|
||||||
|
batch_builder->batch().ticks, [](const auto& previous) {
|
||||||
|
return std::ranges::any_of(previous.admin, [](const auto& c) {
|
||||||
|
return c.kind == server::CellularAdminKind::adopt_tuning;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
std::erase_if(admin, [&](const auto& queued) {
|
||||||
|
if (queued.kind != server::CellularAdminKind::adopt_tuning)
|
||||||
|
return false;
|
||||||
|
if (adopting)
|
||||||
|
return true;
|
||||||
|
adopting = true;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
const auto admin_before = batch_builder->admin_results().size();
|
||||||
|
auto appended = batch_builder->append_with_birth_refusals(
|
||||||
|
tick, baseline, actions, births, mutations, admin);
|
||||||
if (!appended && !actions.empty()) {
|
if (!appended && !actions.empty()) {
|
||||||
// ADR-0127: one account's unusable action (its life died, or it
|
// ADR-0127: one account's unusable action (its life died, or it
|
||||||
// names an unperceived patch) refuses only that action, never the
|
// names an unperceived patch) refuses only that action, never the
|
||||||
// tick for every other player.
|
// tick for every other player.
|
||||||
std::vector<network::CarriedAction> usable, refused;
|
std::vector<network::CarriedAction> usable, refused;
|
||||||
for (const auto& action : actions)
|
for (const auto& action : actions)
|
||||||
(server::prepare_cellular_session_tick(*state, tick, baseline,
|
(server::prepare_cellular_session_tick(*current, tick, baseline,
|
||||||
std::span{&action, 1})
|
std::span{&action, 1})
|
||||||
? usable
|
? usable
|
||||||
: refused)
|
: refused)
|
||||||
.push_back(action);
|
.push_back(action);
|
||||||
bridge->dropped(refused, true);
|
bridge->dropped(refused, true);
|
||||||
actions = std::move(usable);
|
actions = std::move(usable);
|
||||||
appended = builder->append_with_birth_refusals(
|
appended = batch_builder->append_with_birth_refusals(
|
||||||
tick, baseline, actions, held_births, host.queued_mutations());
|
tick, baseline, actions, births, mutations, admin);
|
||||||
}
|
}
|
||||||
if (!appended) {
|
if (!appended) {
|
||||||
const auto lives = builder->last_lives_error();
|
const auto lives = batch_builder->last_lives_error();
|
||||||
report_stall("append", appended.error(), tick,
|
report_stall("append", appended.error(), tick,
|
||||||
lives ? static_cast<int>(*lives) : -1);
|
lives ? static_cast<int>(*lives) : -1);
|
||||||
|
if (appended.error() == server::CellularSessionBatchError::mutation)
|
||||||
|
host.recheck_mutations();
|
||||||
bridge->dropped(actions, true);
|
bridge->dropped(actions, true);
|
||||||
|
flush(); // Commit what is good; the next tick starts afresh.
|
||||||
} else {
|
} else {
|
||||||
stalled.reset();
|
stalled.reset();
|
||||||
awaiting_outcomes.insert(awaiting_outcomes.end(), actions.begin(),
|
awaiting_outcomes.insert(awaiting_outcomes.end(), actions.begin(),
|
||||||
actions.end());
|
actions.end());
|
||||||
auto published = host.publish(builder->batch(), builder->actions(),
|
batch_actions.insert(batch_actions.end(), actions.begin(),
|
||||||
builder->mutation_actions());
|
actions.end());
|
||||||
if (published)
|
const auto results = batch_builder->admin_results();
|
||||||
host.refuse_births(builder->refused_births());
|
for (std::size_t i = admin_before; i < results.size(); ++i)
|
||||||
if (!published && host.status().phase != server::HostPhase::resolving) {
|
std::printf("cellular admin command=%llu tick=%llu %s\n",
|
||||||
bridge->dropped(actions, true);
|
static_cast<unsigned long long>(results[i].id),
|
||||||
std::erase_if(awaiting_outcomes, [&](const auto& action) {
|
static_cast<unsigned long long>(tick),
|
||||||
return std::ranges::find(actions, action) != actions.end();
|
results[i].applied ? "applied" : "refused");
|
||||||
});
|
const bool prompt =
|
||||||
}
|
!births.empty() || !mutations.empty() || !admin.empty();
|
||||||
deliver_finalized();
|
if (prompt || batch_builder->batch().ticks.size() >= flush_ticks)
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only a confirmed head consumes pacing debt. Retry failures with bounded
|
// Unappended work keeps its pacing debt; retry with bounded frequency.
|
||||||
// frequency while retaining debt; never reset a deadline to now + quantum.
|
const auto* after = batch_builder ? &batch_builder->candidate() : host.state();
|
||||||
if (!host.state() || host.state()->tick() < tick)
|
if (!after || after->tick() < tick)
|
||||||
schedule.defer(monotonic_us());
|
schedule.defer(monotonic_us());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (const auto* committed_state = host.state(); committed_state)
|
if (const auto* committed_state = host.state(); committed_state)
|
||||||
bridge->replicate(*committed_state);
|
bridge->replicate(batch_builder ? batch_builder->candidate() : *committed_state,
|
||||||
|
committed_state);
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
std::this_thread::sleep_for(2ms);
|
std::this_thread::sleep_for(2ms);
|
||||||
}
|
}
|
||||||
@@ -1220,7 +1474,8 @@ int main(int argc, char** argv) {
|
|||||||
"--session-cert F --session-key F --session-grant-key F "
|
"--session-cert F --session-key F --session-grant-key F "
|
||||||
"--session-grant-ledger F --session-environment dev]] [--m10-listen "
|
"--session-grant-ledger F --session-environment dev]] [--m10-listen "
|
||||||
"ADDRESS:PORT --m10-cert F --m10-key F --m10-issuer F "
|
"ADDRESS:PORT --m10-cert F --m10-key F --m10-issuer F "
|
||||||
"--m10-environment dev|stage|world0 --session-window ACTIVATION:UTC_EXPIRY "
|
"--m10-environment dev|stage|world0 (--session-window ACTIVATION:UTC_EXPIRY | "
|
||||||
|
"--session-window-source db) "
|
||||||
"[--m10-max-grant-lifetime 60..14400] [--m10-area X0,Y0,X1,Y1] "
|
"[--m10-max-grant-lifetime 60..14400] [--m10-area X0,Y0,X1,Y1] "
|
||||||
"[--m10-handoff-key F [--m10-neighbour "
|
"[--m10-handoff-key F [--m10-neighbour "
|
||||||
"REGION=X0,Y0,X1,Y1=HOST:PORT=NAME=PUBFILE]...] "
|
"REGION=X0,Y0,X1,Y1=HOST:PORT=NAME=PUBFILE]...] "
|
||||||
|
|||||||
+192
-23
@@ -10,7 +10,7 @@
|
|||||||
// evo-world-clone check-store --world W --region R --pg-* ... --objects DIR
|
// evo-world-clone check-store --world W --region R --pg-* ... --objects DIR
|
||||||
// [--reserve-mib N]
|
// [--reserve-mib N]
|
||||||
// evo-world-clone provision --world W --region R --opening
|
// evo-world-clone provision --world W --region R --opening
|
||||||
// development-v1|primitive-v1|cellular-v1 to cellular-v8
|
// development-v1|primitive-v1|cellular-v1 to cellular-v10
|
||||||
// --pg-* ... --objects DIR --build HEX [--commit HEX32] [--retain-build]
|
// --pg-* ... --objects DIR --build HEX [--commit HEX32] [--retain-build]
|
||||||
// primitive-v1 also requires --frame N --source-id N, every --funding-*-* channel,
|
// primitive-v1 also requires --frame N --source-id N, every --funding-*-* channel,
|
||||||
// and one or more ordered --site X,Y values.
|
// and one or more ordered --site X,Y values.
|
||||||
@@ -25,6 +25,14 @@
|
|||||||
// --patch: one or more --pool X,Y,RADIUS,SOURCE,ENERGY,C,N,P,O (centres, any micrometre)
|
// --patch: one or more --pool X,Y,RADIUS,SOURCE,ENERGY,C,N,P,O (centres, any micrometre)
|
||||||
// and/or --motes COUNT,SOURCE,ENERGY,C,N,P,O (bubbles per channel amount, scattered
|
// and/or --motes COUNT,SOURCE,ENERGY,C,N,P,O (bubbles per channel amount, scattered
|
||||||
// from the --commit bytes, so a genesis is reproducible).
|
// from the --commit bytes, so a genesis is reproducible).
|
||||||
|
// cellular-v8 (ADR-0176) also requires --light-pj N. cellular-v9 (rules 12, ADR-0177)
|
||||||
|
// is cellular-v8 followed by the liquid upgrade: it also requires --tuning FILE (the Git
|
||||||
|
// tuning file, whose region size must match --width-um/--height-um) and accepts
|
||||||
|
// --current-seed N (default: derived from the --commit bytes). cellular-v10 (rules 13,
|
||||||
|
// ADR-0179) is cellular-v9 followed by the revamp upgrade: it also requires
|
||||||
|
// --revamp-tuning FILE (the Git revamp tuning file).
|
||||||
|
// A nonzero playtest.starting_wildlife_cells (ADR-0180) additionally requires
|
||||||
|
// --playtest-wildlife-first-id N: an audited unused range below --life-allocator-start.
|
||||||
// primitive-v1 and cellular-v1/v2/v3 accept --life-allocator-start N
|
// primitive-v1 and cellular-v1/v2/v3 accept --life-allocator-start N
|
||||||
// (ADR-0123): the world's life-identity allocator is created once at the operator-audited
|
// (ADR-0123): the world's life-identity allocator is created once at the operator-audited
|
||||||
// start N; a later run leaves it untouched and refuses one that is below N.
|
// start N; a later run leaves it untouched and refuses one that is below N.
|
||||||
@@ -70,6 +78,7 @@
|
|||||||
// Exit: 0 done, 2 usage, 3 source/history/database failure, 4 target/objects refused,
|
// Exit: 0 done, 2 usage, 3 source/history/database failure, 4 target/objects refused,
|
||||||
// 5 target unknown, 6 compared histories differ.
|
// 5 target unknown, 6 compared histories differ.
|
||||||
#include "evo/biology/cellular_habitat.hpp"
|
#include "evo/biology/cellular_habitat.hpp"
|
||||||
|
#include "evo/biology/cellular_revamp_tuning.hpp"
|
||||||
#include "evo/persistence/checkpoint_store.hpp"
|
#include "evo/persistence/checkpoint_store.hpp"
|
||||||
#include "evo/persistence/region_clone.hpp"
|
#include "evo/persistence/region_clone.hpp"
|
||||||
#include "evo/persistence/sha256.hpp"
|
#include "evo/persistence/sha256.hpp"
|
||||||
@@ -84,6 +93,8 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <span>
|
#include <span>
|
||||||
@@ -118,13 +129,28 @@ struct Options {
|
|||||||
std::vector<biology::CellularPatch> cellular_patches;
|
std::vector<biology::CellularPatch> cellular_patches;
|
||||||
std::vector<biology::CellularPatch> cellular_pools; // cellular-v7
|
std::vector<biology::CellularPatch> cellular_pools; // cellular-v7
|
||||||
std::optional<biology::CellularMoteField> cellular_motes; // cellular-v7 and v8
|
std::optional<biology::CellularMoteField> cellular_motes; // cellular-v7 and v8
|
||||||
std::optional<std::uint64_t> light_pj; // cellular-v8: pJ per square um per tick
|
std::optional<biology::CellularMoteField> cellular_mixed; // Mixed bubbles (v7 and later)
|
||||||
|
std::optional<std::uint64_t> light_pj; // cellular-v8/v9: pJ per square um per tick
|
||||||
|
std::optional<std::string> tuning_path; // cellular-v9: the Git tuning file
|
||||||
|
std::optional<std::uint64_t> current_seed;
|
||||||
|
std::optional<biology::CellularTuning> tuning; // Parsed from tuning_path.
|
||||||
|
std::optional<std::string> revamp_tuning_path; // cellular-v10
|
||||||
|
std::optional<biology::CellularRevampTuning> revamp_tuning; // Parsed from it.
|
||||||
|
std::optional<std::uint64_t> playtest_wildlife_first_id; // Audited DEV-only reserved range.
|
||||||
std::optional<std::uint64_t> life_allocator_start;
|
std::optional<std::uint64_t> life_allocator_start;
|
||||||
std::optional<persistence::Sha256Digest> build;
|
std::optional<persistence::Sha256Digest> build;
|
||||||
bool retain_build{};
|
bool retain_build{};
|
||||||
bool crash{};
|
bool crash{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The openings that declare light: cellular-v8, cellular-v9 which adds the liquid upgrade, and
|
||||||
|
// cellular-v10 which adds the revamp upgrade after it.
|
||||||
|
bool lit_opening(std::string_view opening) {
|
||||||
|
return opening == "cellular-v8" || opening == "cellular-v9" || opening == "cellular-v10";
|
||||||
|
}
|
||||||
|
bool liquid_opening(std::string_view opening) {
|
||||||
|
return opening == "cellular-v9" || opening == "cellular-v10";
|
||||||
|
}
|
||||||
std::optional<std::uint64_t> number(std::string_view text) {
|
std::optional<std::uint64_t> number(std::string_view text) {
|
||||||
std::uint64_t value{};
|
std::uint64_t value{};
|
||||||
const auto [end, error] = std::from_chars(text.data(), text.data() + text.size(), value);
|
const auto [end, error] = std::from_chars(text.data(), text.data() + text.size(), value);
|
||||||
@@ -336,10 +362,22 @@ std::optional<Options> parse(int argc, char** argv) {
|
|||||||
(value == "development-v1" || value == "primitive-v1" || value == "cellular-v1" ||
|
(value == "development-v1" || value == "primitive-v1" || value == "cellular-v1" ||
|
||||||
value == "cellular-v2" || value == "cellular-v3" || value == "cellular-v4" ||
|
value == "cellular-v2" || value == "cellular-v3" || value == "cellular-v4" ||
|
||||||
value == "cellular-v5" || value == "cellular-v6" || value == "cellular-v7" ||
|
value == "cellular-v5" || value == "cellular-v6" || value == "cellular-v7" ||
|
||||||
value == "cellular-v8"))
|
value == "cellular-v8" || value == "cellular-v9" || value == "cellular-v10"))
|
||||||
o.opening = value;
|
o.opening = value;
|
||||||
else if (o.command == "provision" && flag == "--light-pj" && n && *n > 0)
|
else if (o.command == "provision" && flag == "--mixed-motes" && cellular_motes(value))
|
||||||
|
o.cellular_mixed = cellular_motes(value);
|
||||||
|
else if (o.command == "provision" && flag == "--revamp-tuning" && !value.empty())
|
||||||
|
o.revamp_tuning_path = std::string{value};
|
||||||
|
else if (o.command == "provision" && flag == "--playtest-wildlife-first-id") {
|
||||||
|
o.playtest_wildlife_first_id = number(value);
|
||||||
|
if (!o.playtest_wildlife_first_id || *o.playtest_wildlife_first_id == 0)
|
||||||
|
return std::nullopt;
|
||||||
|
} else if (o.command == "provision" && flag == "--light-pj" && n && *n > 0)
|
||||||
o.light_pj = n;
|
o.light_pj = n;
|
||||||
|
else if (o.command == "provision" && flag == "--tuning" && !value.empty())
|
||||||
|
o.tuning_path = std::string{value};
|
||||||
|
else if (o.command == "provision" && flag == "--current-seed" && n)
|
||||||
|
o.current_seed = n;
|
||||||
else if (o.command == "provision" && flag == "--frame" && n)
|
else if (o.command == "provision" && flag == "--frame" && n)
|
||||||
o.primitive_frame = n;
|
o.primitive_frame = n;
|
||||||
else if (o.command == "provision" && flag == "--source-id" && n)
|
else if (o.command == "provision" && flag == "--source-id" && n)
|
||||||
@@ -423,11 +461,63 @@ std::optional<Options> parse(int argc, char** argv) {
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
if (cellular_options)
|
if (cellular_options)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
} else if (o.opening == "cellular-v7" || o.opening == "cellular-v8") {
|
} else if (o.opening == "cellular-v7" || lit_opening(o.opening)) {
|
||||||
// Pools and bubbles only: square patches belong to the earlier openings. Only
|
// Pools and bubbles only: square patches belong to the earlier openings. Only
|
||||||
// cellular-v8 (ADR-0176) declares light.
|
// cellular-v8 to v10 (ADR-0176) declare light; v9 and v10 take a tuning file, and
|
||||||
if ((o.opening == "cellular-v8") != o.light_pj.has_value())
|
// v10 the revamp tuning file.
|
||||||
|
if (lit_opening(o.opening) != o.light_pj.has_value() ||
|
||||||
|
liquid_opening(o.opening) != o.tuning_path.has_value() ||
|
||||||
|
(o.opening == "cellular-v10") != o.revamp_tuning_path.has_value() ||
|
||||||
|
(o.current_seed && !liquid_opening(o.opening)))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
if (o.revamp_tuning_path) {
|
||||||
|
std::ifstream file(*o.revamp_tuning_path, std::ios::binary);
|
||||||
|
const std::string text{std::istreambuf_iterator<char>(file),
|
||||||
|
std::istreambuf_iterator<char>()};
|
||||||
|
if (!file.good() && !file.eof()) {
|
||||||
|
std::printf("revamp tuning file unreadable: %s\n",
|
||||||
|
o.revamp_tuning_path->c_str());
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
auto parsed = biology::parse_cellular_revamp_tuning(text);
|
||||||
|
if (!parsed) {
|
||||||
|
std::printf("revamp tuning file refused at line %zu (%s): %s\n",
|
||||||
|
parsed.error().line, parsed.error().key.c_str(),
|
||||||
|
std::string{biology::describe(parsed.error().kind)}.c_str());
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
o.revamp_tuning = *parsed;
|
||||||
|
const auto count = parsed->playtest_starting_wildlife_cells;
|
||||||
|
if (count != 0 && (!o.playtest_wildlife_first_id || !o.life_allocator_start ||
|
||||||
|
*o.playtest_wildlife_first_id == 0 ||
|
||||||
|
*o.playtest_wildlife_first_id >= *o.life_allocator_start ||
|
||||||
|
static_cast<std::uint64_t>(count) >
|
||||||
|
*o.life_allocator_start - *o.playtest_wildlife_first_id))
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
if (o.tuning_path) {
|
||||||
|
std::ifstream file(*o.tuning_path, std::ios::binary);
|
||||||
|
const std::string text{std::istreambuf_iterator<char>(file),
|
||||||
|
std::istreambuf_iterator<char>()};
|
||||||
|
auto parsed = biology::parse_cellular_tuning(text);
|
||||||
|
if (!file.good() && !file.eof()) {
|
||||||
|
std::printf("tuning file unreadable: %s\n", o.tuning_path->c_str());
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
if (!parsed) {
|
||||||
|
std::printf("tuning file refused at line %zu (%s): %s\n", parsed.error().line,
|
||||||
|
parsed.error().key.c_str(),
|
||||||
|
std::string{biology::describe(parsed.error().kind)}.c_str());
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
if (!o.cellular_width_um || !o.cellular_height_um ||
|
||||||
|
parsed->region_width_um != *o.cellular_width_um ||
|
||||||
|
parsed->region_height_um != *o.cellular_height_um) {
|
||||||
|
std::puts("tuning region size differs from --width-um/--height-um");
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
o.tuning = *parsed;
|
||||||
|
}
|
||||||
if (!o.primitive_frame || *o.primitive_frame == 0 || !o.primitive_source ||
|
if (!o.primitive_frame || *o.primitive_frame == 0 || !o.primitive_source ||
|
||||||
*o.primitive_source == 0 || o.primitive_sites.empty() ||
|
*o.primitive_source == 0 || o.primitive_sites.empty() ||
|
||||||
!std::ranges::all_of(o.primitive_funding,
|
!std::ranges::all_of(o.primitive_funding,
|
||||||
@@ -458,6 +548,8 @@ std::optional<Options> parse(int argc, char** argv) {
|
|||||||
return std::nullopt; // The development opening has no lives to allocate.
|
return std::nullopt; // The development opening has no lives to allocate.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (o.playtest_wildlife_first_id && o.opening != "cellular-v10")
|
||||||
|
return std::nullopt;
|
||||||
if (!complete(o.source) || (needs_builds && o.retained.empty()) ||
|
if (!complete(o.source) || (needs_builds && o.retained.empty()) ||
|
||||||
(clone && !complete(o.target)))
|
(clone && !complete(o.target)))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@@ -548,21 +640,52 @@ std::vector<std::uint8_t> probe_bytes() {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cellular-v9 (rules 12): the liquid rules from the tuning file, for the opening's area and
|
||||||
|
// a current seed (given, or derived from the genesis commit's bytes 8-15).
|
||||||
|
std::optional<server::CellularLiquidRules> liquid_rules(const Options& o) {
|
||||||
|
if (!liquid_opening(o.opening) || !o.tuning || !o.cellular_width_um || !o.cellular_height_um)
|
||||||
|
return std::nullopt;
|
||||||
|
std::uint64_t seed = o.current_seed.value_or(0);
|
||||||
|
if (!o.current_seed) {
|
||||||
|
const auto commit = o.commit.value_or(persistence::Uuid{});
|
||||||
|
for (std::size_t i = 8; i < 16; ++i)
|
||||||
|
seed = (seed << 8U) | commit.at(i);
|
||||||
|
}
|
||||||
|
return server::cellular_liquid_rules(*o.tuning, {*o.cellular_width_um, *o.cellular_height_um},
|
||||||
|
seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// cellular-v10 (rules 13): the revamp rules from the revamp tuning file.
|
||||||
|
std::optional<server::CellularRevampRules> revamp_rules(const Options& o) {
|
||||||
|
if (o.opening != "cellular-v10" || !o.revamp_tuning)
|
||||||
|
return std::nullopt;
|
||||||
|
return server::cellular_revamp_rules(*o.revamp_tuning);
|
||||||
|
}
|
||||||
|
|
||||||
// ADR-0176 cellular-v8: a cellular-v7 genesis taken through one empty tick and the durable
|
// ADR-0176 cellular-v8: a cellular-v7 genesis taken through one empty tick and the durable
|
||||||
// bundle 9 -> 10 -> 11 -> 12 -> 13 upgrades, declaring the region's light. Resumable: it
|
// bundle 9 -> 10 -> 11 -> 12 -> 13 upgrades, declaring the region's light. cellular-v9 adds the
|
||||||
// continues from whichever bundle the head has reached, and does nothing at bundle 13.
|
// 13 -> 14 liquid upgrade and cellular-v10 the 14 -> 15 revamp upgrade. Resumable: it continues
|
||||||
|
// from whichever bundle the head has reached, and does nothing at its target bundle.
|
||||||
int finish_photosynthesis_opening(const Options& o, persistence::Postgres& db,
|
int finish_photosynthesis_opening(const Options& o, persistence::Postgres& db,
|
||||||
const persistence::FilesystemObjectStore& store,
|
const persistence::FilesystemObjectStore& store,
|
||||||
std::uint64_t frame, const persistence::Sha256Digest& build,
|
std::uint64_t frame, const persistence::Sha256Digest& build,
|
||||||
std::uint64_t light_pj) {
|
std::uint64_t light_pj,
|
||||||
|
const std::optional<server::CellularLiquidRules>& liquid,
|
||||||
|
const std::optional<server::CellularRevampRules>& revamp) {
|
||||||
const auto& key = o.source.key;
|
const auto& key = o.source.key;
|
||||||
|
std::uint32_t wildlife_count{};
|
||||||
|
if (o.revamp_tuning)
|
||||||
|
wildlife_count =
|
||||||
|
static_cast<std::uint32_t>(o.revamp_tuning->playtest_starting_wildlife_cells);
|
||||||
|
const auto target = revamp ? persistence::cellular_v15_versions
|
||||||
|
: liquid ? persistence::cellular_v14_versions
|
||||||
|
: persistence::cellular_v13_versions;
|
||||||
// A finished opening needs no lease: a rerun (every Argo sync's provision hook) runs
|
// A finished opening needs no lease: a rerun (every Argo sync's provision hook) runs
|
||||||
// while the region server holds it, and must report the region rather than fail.
|
// while the region server holds it, and must report the region rather than fail.
|
||||||
if (const auto current = persistence::load_region_checkpoint(db, key, timeout); current) {
|
if (const auto current = persistence::load_region_checkpoint(db, key, timeout); current) {
|
||||||
const auto manifest = persistence::decode_manifest(current->manifest);
|
const auto manifest = persistence::decode_manifest(current->manifest);
|
||||||
if (manifest && manifest->profile == persistence::CheckpointProfile::cellular_lives_v1 &&
|
if (manifest && manifest->profile == persistence::CheckpointProfile::cellular_lives_v1 &&
|
||||||
manifest->frame == frame &&
|
manifest->frame == frame && manifest->cellular_versions == target)
|
||||||
manifest->cellular_versions == persistence::cellular_v13_versions)
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
auto lease =
|
auto lease =
|
||||||
@@ -580,13 +703,13 @@ int finish_photosynthesis_opening(const Options& o, persistence::Postgres& db,
|
|||||||
auto head = persistence::load_region_checkpoint(db, key, timeout);
|
auto head = persistence::load_region_checkpoint(db, key, timeout);
|
||||||
if (!head)
|
if (!head)
|
||||||
return finish(3);
|
return finish(3);
|
||||||
for (unsigned step = 0; step < 6; ++step) {
|
for (unsigned step = 0; step < 8; ++step) {
|
||||||
const auto manifest = persistence::decode_manifest(head->manifest);
|
const auto manifest = persistence::decode_manifest(head->manifest);
|
||||||
if (!manifest || manifest->profile != persistence::CheckpointProfile::cellular_lives_v1 ||
|
if (!manifest || manifest->profile != persistence::CheckpointProfile::cellular_lives_v1 ||
|
||||||
manifest->frame != frame)
|
manifest->frame != frame)
|
||||||
return finish(4);
|
return finish(4);
|
||||||
const auto& versions = manifest->cellular_versions;
|
const auto& versions = manifest->cellular_versions;
|
||||||
if (versions == persistence::cellular_v13_versions)
|
if (versions == target)
|
||||||
return finish(0);
|
return finish(0);
|
||||||
const auto id = [&] {
|
const auto id = [&] {
|
||||||
persistence::Uuid made{};
|
persistence::Uuid made{};
|
||||||
@@ -637,6 +760,13 @@ int finish_photosynthesis_opening(const Options& o, persistence::Postgres& db,
|
|||||||
upgraded = persistence::migrate_cellular_photosynthesis_profile(
|
upgraded = persistence::migrate_cellular_photosynthesis_profile(
|
||||||
db, store, *lease, *head, id, build,
|
db, store, *lease, *head, id, build,
|
||||||
{light_pj, 1, {std::numeric_limits<std::uint64_t>::max() / 2}}, timeout);
|
{light_pj, 1, {std::numeric_limits<std::uint64_t>::max() / 2}}, timeout);
|
||||||
|
else if (versions == persistence::cellular_v13_versions && liquid)
|
||||||
|
upgraded = persistence::migrate_cellular_liquid_profile(db, store, *lease, *head, id,
|
||||||
|
build, *liquid, timeout);
|
||||||
|
else if (versions == persistence::cellular_v14_versions && liquid && revamp)
|
||||||
|
upgraded = persistence::migrate_cellular_revamp_profile(
|
||||||
|
db, store, *lease, *head, id, build, *revamp, timeout, {}, wildlife_count,
|
||||||
|
wildlife_count == 0 ? 0 : o.playtest_wildlife_first_id.value_or(0));
|
||||||
else
|
else
|
||||||
return finish(4);
|
return finish(4);
|
||||||
if (!upgraded) {
|
if (!upgraded) {
|
||||||
@@ -654,7 +784,7 @@ int provision(const Options& o) {
|
|||||||
const bool cellular = o.opening == "cellular-v1" || o.opening == "cellular-v2" ||
|
const bool cellular = o.opening == "cellular-v1" || o.opening == "cellular-v2" ||
|
||||||
o.opening == "cellular-v3" || o.opening == "cellular-v4" ||
|
o.opening == "cellular-v3" || o.opening == "cellular-v4" ||
|
||||||
o.opening == "cellular-v5" || o.opening == "cellular-v6" ||
|
o.opening == "cellular-v5" || o.opening == "cellular-v6" ||
|
||||||
o.opening == "cellular-v7" || o.opening == "cellular-v8";
|
o.opening == "cellular-v7" || lit_opening(o.opening);
|
||||||
const auto primitive_frame = o.primitive_frame.value_or(0);
|
const auto primitive_frame = o.primitive_frame.value_or(0);
|
||||||
if ((primitive || cellular) && primitive_frame == 0)
|
if ((primitive || cellular) && primitive_frame == 0)
|
||||||
return 2;
|
return 2;
|
||||||
@@ -749,13 +879,41 @@ int provision(const Options& o) {
|
|||||||
habitat_config.width_um = cellular_width_um;
|
habitat_config.width_um = cellular_width_um;
|
||||||
habitat_config.height_um = cellular_height_um;
|
habitat_config.height_um = cellular_height_um;
|
||||||
habitat_config.patches = o.cellular_patches;
|
habitat_config.patches = o.cellular_patches;
|
||||||
if (o.opening == "cellular-v7" || o.opening == "cellular-v8") {
|
if (o.opening == "cellular-v7" || lit_opening(o.opening)) {
|
||||||
// ADR-0136 step A: pools and bubbles scattered from the genesis commit's bytes.
|
// ADR-0136 step A: pools and bubbles scattered from the genesis commit's bytes.
|
||||||
auto field = o.cellular_motes.value_or(biology::CellularMoteField{0, 1, {}, 0});
|
auto field = o.cellular_motes.value_or(biology::CellularMoteField{0, 1, {}, 0});
|
||||||
|
if (const auto& mixed = o.cellular_mixed) {
|
||||||
|
// Mixed bubbles hold every nutrient of the --mixed-motes amounts at once.
|
||||||
|
if (!o.cellular_motes)
|
||||||
|
field.source = mixed->source;
|
||||||
|
field.mixed_count = mixed->count;
|
||||||
|
field.mixed = mixed->amount;
|
||||||
|
}
|
||||||
|
// Liquid openings: a pool rests in still water, never in a current.
|
||||||
|
auto pools = o.cellular_pools;
|
||||||
|
if (const auto liquid = liquid_rules(o)) {
|
||||||
|
const auto& c = liquid->currents;
|
||||||
|
const auto flow = biology::CellularFlowField::generate(
|
||||||
|
{c.seed, c.width_um, c.height_um, c.pitch_um, c.min_count, c.max_count,
|
||||||
|
c.min_route_width_um, c.max_route_width_um, c.min_speed_um_per_s,
|
||||||
|
c.max_speed_um_per_s});
|
||||||
|
if (!flow) {
|
||||||
|
std::puts("cellular currents refused");
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
for (auto& pool : pools) {
|
||||||
|
const auto moved =
|
||||||
|
biology::cellular_still_centre(*flow, pool.address, pool.radius_um);
|
||||||
|
if (moved != pool.address)
|
||||||
|
std::printf("pool %u,%u moved out of a current to %u,%u\n",
|
||||||
|
pool.address.x_um, pool.address.y_um, moved.x_um, moved.y_um);
|
||||||
|
pool.address = moved;
|
||||||
|
}
|
||||||
|
}
|
||||||
const auto commit = o.commit.value_or(persistence::Uuid{});
|
const auto commit = o.commit.value_or(persistence::Uuid{});
|
||||||
for (std::size_t i = 0; i < 8; ++i)
|
for (std::size_t i = 0; i < 8; ++i)
|
||||||
field.seed = (field.seed << 8U) | commit.at(i);
|
field.seed = (field.seed << 8U) | commit.at(i);
|
||||||
auto scattered = biology::scatter_deposits(habitat_config, o.cellular_pools, field);
|
auto scattered = biology::scatter_deposits(habitat_config, pools, field);
|
||||||
if (!scattered) {
|
if (!scattered) {
|
||||||
std::printf("cellular habitat refused %u\n",
|
std::printf("cellular habitat refused %u\n",
|
||||||
static_cast<unsigned>(scattered.error()));
|
static_cast<unsigned>(scattered.error()));
|
||||||
@@ -771,7 +929,7 @@ int provision(const Options& o) {
|
|||||||
auto opening = server::CellularLives::create(
|
auto opening = server::CellularLives::create(
|
||||||
*primitive_opening, std::move(*habitat),
|
*primitive_opening, std::move(*habitat),
|
||||||
{{cellular_width_um, cellular_height_um}, 0, cellular_temperature_mk},
|
{{cellular_width_um, cellular_height_um}, 0, cellular_temperature_mk},
|
||||||
o.opening == "cellular-v7" || o.opening == "cellular-v8"
|
o.opening == "cellular-v7" || lit_opening(o.opening)
|
||||||
? server::CellularLivesProfile::foraging
|
? server::CellularLivesProfile::foraging
|
||||||
: o.opening == "cellular-v6" ? server::CellularLivesProfile::reproduction
|
: o.opening == "cellular-v6" ? server::CellularLivesProfile::reproduction
|
||||||
: o.opening == "cellular-v5" ? server::CellularLivesProfile::balance
|
: o.opening == "cellular-v5" ? server::CellularLivesProfile::balance
|
||||||
@@ -815,7 +973,7 @@ int provision(const Options& o) {
|
|||||||
std::puts("provision refused existing profile/frame mismatch");
|
std::puts("provision refused existing profile/frame mismatch");
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
if (o.opening == "cellular-v8") {
|
if (lit_opening(o.opening)) {
|
||||||
if (manifest->sequence == 0 &&
|
if (manifest->sequence == 0 &&
|
||||||
!persistence::provision_cellular_region(*db, *store, o.source.key,
|
!persistence::provision_cellular_region(*db, *store, o.source.key,
|
||||||
primitive_frame, *cellular_opening,
|
primitive_frame, *cellular_opening,
|
||||||
@@ -825,7 +983,8 @@ int provision(const Options& o) {
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
if (const auto finished = finish_photosynthesis_opening(
|
if (const auto finished = finish_photosynthesis_opening(
|
||||||
o, *db, *store, primitive_frame, build, o.light_pj.value_or(0));
|
o, *db, *store, primitive_frame, build, o.light_pj.value_or(0),
|
||||||
|
liquid_rules(o), revamp_rules(o));
|
||||||
finished != 0)
|
finished != 0)
|
||||||
return finished;
|
return finished;
|
||||||
auto head = persistence::load_region_checkpoint(*db, o.source.key, timeout);
|
auto head = persistence::load_region_checkpoint(*db, o.source.key, timeout);
|
||||||
@@ -877,9 +1036,10 @@ int provision(const Options& o) {
|
|||||||
static_cast<unsigned>(made.error().kind));
|
static_cast<unsigned>(made.error().kind));
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
if (o.opening == "cellular-v8") {
|
if (lit_opening(o.opening)) {
|
||||||
if (const auto finished = finish_photosynthesis_opening(o, *db, *store, primitive_frame,
|
if (const auto finished = finish_photosynthesis_opening(
|
||||||
build, o.light_pj.value_or(0));
|
o, *db, *store, primitive_frame, build, o.light_pj.value_or(0), liquid_rules(o),
|
||||||
|
revamp_rules(o));
|
||||||
finished != 0)
|
finished != 0)
|
||||||
return finished;
|
return finished;
|
||||||
auto head = persistence::load_region_checkpoint(*db, o.source.key, timeout);
|
auto head = persistence::load_region_checkpoint(*db, o.source.key, timeout);
|
||||||
@@ -1026,6 +1186,15 @@ int summary(const Options& o) {
|
|||||||
static_cast<unsigned long long>(play->unrecorded),
|
static_cast<unsigned long long>(play->unrecorded),
|
||||||
static_cast<unsigned long long>(play->owned_deaths),
|
static_cast<unsigned long long>(play->owned_deaths),
|
||||||
static_cast<unsigned long long>(play->wildlife_deaths));
|
static_cast<unsigned long long>(play->wildlife_deaths));
|
||||||
|
std::printf("revamp merged=%llu emerged=%llu organisms=%llu largest=%llu offers_pending=%llu "
|
||||||
|
"offers_earned=%llu spent_fg=%llu\n",
|
||||||
|
static_cast<unsigned long long>(play->merged),
|
||||||
|
static_cast<unsigned long long>(play->emerged),
|
||||||
|
static_cast<unsigned long long>(play->organisms),
|
||||||
|
static_cast<unsigned long long>(play->largest_organism),
|
||||||
|
static_cast<unsigned long long>(play->offers_pending),
|
||||||
|
static_cast<unsigned long long>(play->offers_earned),
|
||||||
|
static_cast<unsigned long long>(play->spent_matter_fg));
|
||||||
std::printf("lifespan_ticks min=%llu median=%llu max=%llu\n",
|
std::printf("lifespan_ticks min=%llu median=%llu max=%llu\n",
|
||||||
static_cast<unsigned long long>(play->lifespan_min),
|
static_cast<unsigned long long>(play->lifespan_min),
|
||||||
static_cast<unsigned long long>(play->lifespan_median),
|
static_cast<unsigned long long>(play->lifespan_median),
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
# M8.4 dev workload project (replaces deploy/argocd/project.yaml.example). Apply by hand
|
# M8.4 dev workload project (replaces deploy/argocd/project.yaml.example). Apply by hand
|
||||||
# (kubectl apply -f deploy/argocd/dev/project.yaml): Argo CD does not manage its own
|
# (kubectl apply -f deploy/argocd/dev/project.yaml): Argo CD does not manage its own
|
||||||
# projects here. One namespace, no cluster kinds; ServiceAccounts only for the
|
# projects here. One namespace, no cluster kinds; ServiceAccounts only for the
|
||||||
# foundation proof Job (the platform owns the environment's service accounts).
|
# foundation proof Job (the platform owns the environment's service accounts). ConfigMaps
|
||||||
|
# carry only Git-managed, non-secret configuration such as the rules-12 tuning file.
|
||||||
apiVersion: argoproj.io/v1alpha1
|
apiVersion: argoproj.io/v1alpha1
|
||||||
kind: AppProject
|
kind: AppProject
|
||||||
metadata:
|
metadata:
|
||||||
@@ -16,6 +17,7 @@ spec:
|
|||||||
namespace: evolution-dev
|
namespace: evolution-dev
|
||||||
clusterResourceWhitelist: []
|
clusterResourceWhitelist: []
|
||||||
namespaceResourceWhitelist:
|
namespaceResourceWhitelist:
|
||||||
|
- {group: "", kind: ConfigMap}
|
||||||
- {group: "", kind: ServiceAccount}
|
- {group: "", kind: ServiceAccount}
|
||||||
- {group: "", kind: Service}
|
- {group: "", kind: Service}
|
||||||
- {group: apps, kind: Deployment}
|
- {group: apps, kind: Deployment}
|
||||||
|
|||||||
@@ -145,13 +145,14 @@ RUN cmake --preset release -B build/postgres -DCMAKE_CXX_COMPILER=g++-14 \
|
|||||||
-DCMAKE_C_COMPILER=gcc-14 -DEVO_BUILD_NETWORK=ON \
|
-DCMAKE_C_COMPILER=gcc-14 -DEVO_BUILD_NETWORK=ON \
|
||||||
-DEVO_BUILD_QUIC=ON -DEVO_BUILD_POSTGRES=ON \
|
-DEVO_BUILD_QUIC=ON -DEVO_BUILD_POSTGRES=ON \
|
||||||
-DPostgreSQL_ROOT=/source/.cache/postgres/install \
|
-DPostgreSQL_ROOT=/source/.cache/postgres/install \
|
||||||
&& cmake --build build/postgres --target evo-server evo-session-probe evo-world-clone evo-grant-broker --parallel "${PG_BUILD_JOBS}"
|
&& cmake --build build/postgres --target evo-server evo-session-probe evo-world-clone evo-grant-broker \
|
||||||
|
evo-admin-api --parallel "${PG_BUILD_JOBS}"
|
||||||
|
|
||||||
FROM postgres-build AS postgres-test-build
|
FROM postgres-build AS postgres-test-build
|
||||||
ARG PG_BUILD_JOBS=6
|
ARG PG_BUILD_JOBS=6
|
||||||
# PostgreSQL-only test changes skip the native checks job (tools/ci/ci-paths.sh), so the
|
# PostgreSQL-only test changes skip the native checks job (tools/ci/ci-paths.sh), so the
|
||||||
# repository format check also runs here.
|
# repository format check also runs here.
|
||||||
RUN cmake -DFORMATTER=clang-format-19 -DSOURCE_ROOT=/source -P tools/check-format.cmake
|
RUN cmake -DFORMATTER=/usr/bin/clang-format-19 -DSOURCE_ROOT=/source -P tools/check-format.cmake
|
||||||
RUN cmake --build build/postgres --target evo-postgres-tests --parallel "${PG_BUILD_JOBS}"
|
RUN cmake --build build/postgres --target evo-postgres-tests --parallel "${PG_BUILD_JOBS}"
|
||||||
RUN cmake --preset analysis -B build/postgres-analysis -DCMAKE_CXX_COMPILER=clang++-19 \
|
RUN cmake --preset analysis -B build/postgres-analysis -DCMAKE_CXX_COMPILER=clang++-19 \
|
||||||
-DCMAKE_C_COMPILER=clang-19 -DEVO_BUILD_NETWORK=ON \
|
-DCMAKE_C_COMPILER=clang-19 -DEVO_BUILD_NETWORK=ON \
|
||||||
@@ -202,6 +203,9 @@ COPY --from=postgres-build /source/build/postgres/evo-server /usr/local/bin/evo-
|
|||||||
COPY --from=postgres-build /source/build/postgres/evo-world-clone /usr/local/bin/evo-world-clone
|
COPY --from=postgres-build /source/build/postgres/evo-world-clone /usr/local/bin/evo-world-clone
|
||||||
# ADR-0131 grant broker (Keycloak tokens to session grants); its own Deployment.
|
# ADR-0131 grant broker (Keycloak tokens to session grants); its own Deployment.
|
||||||
COPY --from=postgres-build /source/build/postgres/evo-grant-broker /usr/local/bin/evo-grant-broker
|
COPY --from=postgres-build /source/build/postgres/evo-grant-broker /usr/local/bin/evo-grant-broker
|
||||||
|
# ADR-0182 read-only admin API and the portal's static files; its own Deployment.
|
||||||
|
COPY --from=postgres-build /source/build/postgres/evo-admin-api /usr/local/bin/evo-admin-api
|
||||||
|
COPY apps/evo-admin-api/portal/ /usr/local/share/evo-admin-portal/
|
||||||
COPY --from=postgres-build /source/.cache/postgres/install/lib/libpq.so* /opt/postgres/lib/
|
COPY --from=postgres-build /source/.cache/postgres/install/lib/libpq.so* /opt/postgres/lib/
|
||||||
COPY --from=postgres-build /source/build/postgres/msquic/bin/Release/libmsquic.so* /opt/msquic/lib/
|
COPY --from=postgres-build /source/build/postgres/msquic/bin/Release/libmsquic.so* /opt/msquic/lib/
|
||||||
COPY --from=postgres-build /source/.cache/postgres/postgresql-18.6/COPYRIGHT /usr/share/doc/evo-postgres/COPYRIGHT
|
COPY --from=postgres-build /source/.cache/postgres/postgresql-18.6/COPYRIGHT /usr/share/doc/evo-postgres/COPYRIGHT
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
# ADR-0182 admin API and portal. One replica; it holds no state but a short view
|
||||||
|
# cache. The realm's public signing key is pinned below (ADMIN_JWKS, the same key as the grant
|
||||||
|
# broker's); a Keycloak key rotation needs a Git update in both.
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: evo-admin-portal
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "2" # After migration (schema v61).
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
app.kubernetes.io/component: admin-portal
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
progressDeadlineSeconds: 180
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
app.kubernetes.io/component: admin-portal
|
||||||
|
app.kubernetes.io/part-of: aevolution
|
||||||
|
spec:
|
||||||
|
serviceAccountName: aevolution-admin-portal
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 10001
|
||||||
|
runAsGroup: 10001
|
||||||
|
fsGroup: 10001
|
||||||
|
seccompProfile: {type: RuntimeDefault}
|
||||||
|
containers:
|
||||||
|
- name: evo-admin-api
|
||||||
|
image: aevolution-server
|
||||||
|
command: ["/bin/bash", "-c"]
|
||||||
|
args:
|
||||||
|
- |
|
||||||
|
set -eu
|
||||||
|
regions=()
|
||||||
|
for region in $ADMIN_REGIONS; do regions+=(--region "$region"); done
|
||||||
|
exec /usr/local/bin/evo-admin-api --listen 0.0.0.0:8080 --world "$ADMIN_WORLD" \
|
||||||
|
--jwks "$ADMIN_JWKS" --oidc-issuer "$ADMIN_OIDC_ISSUER" \
|
||||||
|
--audience aevolution-admin --client aevolution-admin-portal \
|
||||||
|
--role aevolution-admin --assets /usr/local/share/evo-admin-portal \
|
||||||
|
--pg-service /run/postgres/pg_service.conf --pg-passfile /run/postgres/pgpass \
|
||||||
|
--baseline-tuning /etc/evo/tuning/cellular-revamp.tuning \
|
||||||
|
--region-tuning /etc/evo/tuning/cellular.tuning \
|
||||||
|
--deploy-config /run/deploy "${regions[@]}"
|
||||||
|
env:
|
||||||
|
- {name: ADMIN_WORLD, value: "100"}
|
||||||
|
# Space-separated REGION=HOST:PORT: each region's operations address for /admin/view.
|
||||||
|
- {name: ADMIN_REGIONS, value: "16=evo-region-ops:9100"}
|
||||||
|
- {name: ADMIN_OIDC_ISSUER, value: "https://auth.aeternalisgames.com/realms/aeternalis"}
|
||||||
|
# Public RS256 signing key(s) of realm aeternalis, from its JWKS endpoint.
|
||||||
|
- name: ADMIN_JWKS
|
||||||
|
value: '{"keys":[{"alg":"RS256","e":"AQAB","kid":"NGQG4QzQuBCIHVEomUPy-OoWOTVQIuyf3RXqeNbP8JI","kty":"RSA","n":"vvOpu1xxdyH_mB8LkJG6cwc6UVmmAj6mwQi1oEwrpJDLerBI2OZr2kpgMAUJ3-hMIkz5tRtSjHieMFteVrpDDQaCViIPCIvJTL3T7ujTGFNReSE6ho7h0DB_kybFeEWVpLqm6SSXWFYls5TKo6_t8Hw4G3njiRW9pX_NxyaBHqLkrCi63EyIGHOkdgUczg2d4pM4JTt-q25bcFSlYz8bhD3WEORQmbp-bU7aPPluCqCEAZRrbzf8Iy7svNemP5daDdlWQ3LaNy-ixC2HRjiPZdqK5BgAE800BigI-l1dkyJ4X172TLIPVPLW1WKlvdm3kHOpBXwACYiy8boSNDW7gQ","use":"sig"}]}'
|
||||||
|
ports:
|
||||||
|
- {name: http, containerPort: 8080, protocol: TCP}
|
||||||
|
readinessProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 1
|
||||||
|
livenessProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 2
|
||||||
|
failureThreshold: 3
|
||||||
|
resources:
|
||||||
|
requests: {cpu: 10m, memory: 16Mi}
|
||||||
|
limits: {memory: 128Mi}
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities: {drop: [ALL]}
|
||||||
|
volumeMounts:
|
||||||
|
- {name: connection, mountPath: /run/postgres, readOnly: true}
|
||||||
|
# The revamp tuning file the regions opened with: the portal's baseline until the
|
||||||
|
# first tuning revision (ADR-0182 section 13); the region tuning file, shown read only.
|
||||||
|
- {name: tuning, mountPath: /etc/evo/tuning, readOnly: true}
|
||||||
|
# ADR-0182 section 15: the Gitea and Argo CD settings and tokens that let the portal
|
||||||
|
# open a region, one file per key; without the Secret that feature stays off.
|
||||||
|
- {name: deploy, mountPath: /run/deploy, readOnly: true}
|
||||||
|
volumes:
|
||||||
|
- name: deploy
|
||||||
|
secret:
|
||||||
|
secretName: aevolution-admin
|
||||||
|
optional: true
|
||||||
|
defaultMode: 0440
|
||||||
|
items:
|
||||||
|
- {key: GITEA_BASE_URL, path: GITEA_BASE_URL}
|
||||||
|
- {key: GITEA_REPOSITORY, path: GITEA_REPOSITORY}
|
||||||
|
- {key: GITEA_TOKEN, path: GITEA_TOKEN}
|
||||||
|
- {key: ARGOCD_SERVER, path: ARGOCD_SERVER}
|
||||||
|
- {key: ARGOCD_APPLICATION, path: ARGOCD_APPLICATION}
|
||||||
|
- {key: ARGOCD_TOKEN, path: ARGOCD_TOKEN}
|
||||||
|
- {key: ARGOCD_TLS_VERIFY, path: ARGOCD_TLS_VERIFY}
|
||||||
|
- name: tuning
|
||||||
|
configMap:
|
||||||
|
name: cellular-tuning
|
||||||
|
defaultMode: 0444
|
||||||
|
items:
|
||||||
|
- {key: cellular-revamp.tuning, path: cellular-revamp.tuning}
|
||||||
|
- {key: cellular.tuning, path: cellular.tuning}
|
||||||
|
- name: connection
|
||||||
|
secret:
|
||||||
|
secretName: aevolution-admin-pg
|
||||||
|
defaultMode: 0440
|
||||||
|
items:
|
||||||
|
- {key: pg_service.conf, path: pg_service.conf}
|
||||||
|
- {key: pgpass, path: pgpass}
|
||||||
|
- {key: ca.crt, path: ca.crt}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# ADR-0182 read-only admin API and portal for evolution-dev ONLY: verifies Keycloak access
|
||||||
|
# tokens (realm aeternalis, realm role aevolution-admin, audience aevolution-admin) and reads
|
||||||
|
# world 100 through the schema v61 views and region 16's /admin/view.
|
||||||
|
# Public route, 443 only: https://srs.aeternalisgames.com -> ingress-nginx (TLS; Ingress
|
||||||
|
# created out of band, since the aevolution-dev Argo project admits none) -> ClusterIP
|
||||||
|
# Service evo-admin-portal:8080, in-cluster only.
|
||||||
|
# Out-of-band Secret in evolution-dev: aevolution-admin-pg (pg_service.conf, pgpass, ca.crt
|
||||||
|
# for a login in the runtime group, as aevolution-grant-broker-pg).
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
resources:
|
||||||
|
- serviceaccount.yaml
|
||||||
|
- deployment.yaml
|
||||||
|
- service.yaml
|
||||||
|
- networkpolicy.yaml
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Admin portal traffic on top of the namespace default-deny. Admins reach it only at
|
||||||
|
# https://srs.aeternalisgames.com on 443, where ingress-nginx terminates TLS; port 8080 is
|
||||||
|
# admitted from the ingress-nginx pods and nothing else. Egress: PostgreSQL on pg-forge-01,
|
||||||
|
# the region's operations port (9100) for /admin/view, and for opening a region (ADR-0182
|
||||||
|
# section 15, approved 2026-10-28) Gitea through the node's ingress (git.aeternalisgames.com,
|
||||||
|
# 172.10.1.160:443) and the argocd-server pods (8080, behind the Service's 443).
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: evo-admin-portal
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-1"
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
policyTypes: [Ingress, Egress]
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: rke2-ingress-nginx
|
||||||
|
ports:
|
||||||
|
- {protocol: TCP, port: 8080}
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 172.10.1.127/32
|
||||||
|
ports:
|
||||||
|
- {protocol: TCP, port: 5432}
|
||||||
|
- to:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: evo-region
|
||||||
|
ports:
|
||||||
|
- {protocol: TCP, port: 9100}
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 172.10.1.160/32
|
||||||
|
ports:
|
||||||
|
- {protocol: TCP, port: 443}
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: argocd
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: argocd-server
|
||||||
|
ports:
|
||||||
|
- {protocol: TCP, port: 8080}
|
||||||
|
---
|
||||||
|
# The region's operations port also admits the admin portal (alongside Prometheus,
|
||||||
|
# evo-region-scrape). Only 9100: never the session port.
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: evo-region-admin-view
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-1"
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: evo-region
|
||||||
|
policyTypes: [Ingress]
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
ports:
|
||||||
|
- {protocol: TCP, port: 9100}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Cluster-internal; the Ingress for srs.aeternalisgames.com terminates TLS and forwards here.
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: evo-admin-portal
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "2"
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: evo-admin-portal
|
||||||
|
ports:
|
||||||
|
- {name: http, port: 8080, targetPort: http, protocol: TCP}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: aevolution-admin-portal
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "-1"
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
# Create this pull-only Secret separately in evolution-dev; never commit credentials.
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: harbor-pull
|
||||||
@@ -12,5 +12,5 @@ resources:
|
|||||||
images:
|
images:
|
||||||
- name: evo-sim
|
- name: evo-sim
|
||||||
newName: registry.aeternalisgames.com/aeternalis/aevolution
|
newName: registry.aeternalisgames.com/aeternalis/aevolution
|
||||||
# Verified Gitea run 1399; source commit 8ab48d3a5639121693f5881b600482e870b49f05.
|
# Verified Harbor publish from source commit 477ea8980bb0b7ecd5de16cedf149060f4f92bac.
|
||||||
digest: sha256:0c6c6e1ac28de2ce0648fd0992ca694963e303ef5c9414fe5ac668937136800d
|
digest: sha256:72a779906e06d5080dcfc03de7692bd1f8c7c8ff6b31893925533b13c2c9a103
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ spec:
|
|||||||
- {name: BROKER_WORLD, value: "100"}
|
- {name: BROKER_WORLD, value: "100"}
|
||||||
- {name: BROKER_FRAME, value: "9"}
|
- {name: BROKER_FRAME, value: "9"}
|
||||||
# New accounts start here; an account with a live life goes to its region.
|
# New accounts start here; an account with a live life goes to its region.
|
||||||
- {name: BROKER_DEFAULT_REGION, value: "9"}
|
- {name: BROKER_DEFAULT_REGION, value: "16"}
|
||||||
# Space-separated REGION=HOST:PORT=TLS_NAME, every region a grant may name.
|
# Space-separated REGION=HOST:PORT=TLS_NAME, every region a grant may name.
|
||||||
- {name: BROKER_ROUTES, value: "9=void.aeternalisgames.com:7400=void.aeternalisgames.com"}
|
- {name: BROKER_ROUTES, value: "16=void.aeternalisgames.com:7400=void.aeternalisgames.com"}
|
||||||
# Must not exceed the region's REGION_M10_MAX_GRANT_LIFETIME.
|
# Must not exceed the region's REGION_M10_MAX_GRANT_LIFETIME.
|
||||||
- {name: BROKER_GRANT_LIFETIME, value: "600"}
|
- {name: BROKER_GRANT_LIFETIME, value: "600"}
|
||||||
- {name: BROKER_OIDC_ISSUER, value: "https://auth.aeternalisgames.com/realms/aeternalis"}
|
- {name: BROKER_OIDC_ISSUER, value: "https://auth.aeternalisgames.com/realms/aeternalis"}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ spec:
|
|||||||
if [ -n "$REGION_SESSION" ]; then
|
if [ -n "$REGION_SESSION" ]; then
|
||||||
m10=(--m10-listen "$REGION_SESSION_LISTEN" --m10-cert /run/session/server.pem
|
m10=(--m10-listen "$REGION_SESSION_LISTEN" --m10-cert /run/session/server.pem
|
||||||
--m10-key /run/session/server.key --m10-issuer /run/session/issuer.pub
|
--m10-key /run/session/server.key --m10-issuer /run/session/issuer.pub
|
||||||
--m10-environment "$REGION_SESSION" --session-window "$REGION_SESSION_WINDOW")
|
--m10-environment "$REGION_SESSION" --session-window-source db)
|
||||||
grant=(--m10-max-grant-lifetime "$REGION_M10_MAX_GRANT_LIFETIME")
|
grant=(--m10-max-grant-lifetime "$REGION_M10_MAX_GRANT_LIFETIME")
|
||||||
fi
|
fi
|
||||||
# Lineage keeps its 20 s drain. Both profiles take the overlay grant ceiling;
|
# Lineage keeps its 20 s drain. Both profiles take the overlay grant ceiling;
|
||||||
@@ -100,8 +100,6 @@ spec:
|
|||||||
# Session listener address; the policy check allows only this loopback value
|
# Session listener address; the policy check allows only this loopback value
|
||||||
# outside region/dev-session-route.
|
# outside region/dev-session-route.
|
||||||
- {name: REGION_SESSION_LISTEN, value: "127.0.0.1:7400"}
|
- {name: REGION_SESSION_LISTEN, value: "127.0.0.1:7400"}
|
||||||
# Absolute UTC expiry; route overlays must provide activation-id:unix-seconds.
|
|
||||||
- {name: REGION_SESSION_WINDOW, value: ""}
|
|
||||||
# DEV-only grant ceiling; overlays must keep this within the server contract.
|
# DEV-only grant ceiling; overlays must keep this within the server contract.
|
||||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "300"}
|
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "300"}
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# With the route, the opt-in M10 QUIC listener binds the pod interface. The absolute
|
# With the route, the opt-in M10 QUIC listener binds the pod interface. Its session window
|
||||||
# expiry is committed so a delayed Argo sync fails closed (ADR-0087).
|
# is not in Git: the region reads it from SQL, set in the admin portal (ADR-0087 amendment).
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -12,7 +12,6 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- {name: REGION_SESSION, value: "dev"}
|
- {name: REGION_SESSION, value: "dev"}
|
||||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261020T221544-e8dbeb83:1792548944"}
|
|
||||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
||||||
ports:
|
ports:
|
||||||
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Region host for evolution-dev: world 100, region 9, frame 9 (cellular-v8 opening, ADR-0176).
|
# Region host for evolution-dev: world 100, region 16, frame 9 (cellular-v10 opening, rules 13).
|
||||||
# The server image digest appears twice on purpose: as the image and as the build
|
# The server image digest appears twice on purpose: as the image and as the build
|
||||||
# identity the region records in every commit. The policy check requires they match.
|
# identity the region records in every commit. The policy check requires they match.
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
@@ -9,10 +9,22 @@ resources:
|
|||||||
components:
|
components:
|
||||||
- ../dev-session-route
|
- ../dev-session-route
|
||||||
- ../../grant-broker-dev
|
- ../../grant-broker-dev
|
||||||
|
- ../../admin-portal-dev
|
||||||
- ../../worker-only-dev
|
- ../../worker-only-dev
|
||||||
images:
|
images:
|
||||||
- name: aevolution-server
|
- name: aevolution-server
|
||||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
||||||
digest: sha256:f1183f4476bac87c09504a574112df4663931f67e88cc38dc08f867ce98ff726
|
# Gitea run 576 (9de55e3): one action per account a tick.
|
||||||
|
digest: sha256:9ba0d78a0db2cd4016711b1c4a621f3945b4b4895d3c4a420389f281bbb781a5
|
||||||
patches:
|
patches:
|
||||||
- path: region-values.yaml
|
- path: region-values.yaml
|
||||||
|
# The Git tuning files for the provision Job's liquid (rules 12) and revamp (rules 13)
|
||||||
|
# upgrades. A fixed name: a change updates the ConfigMap in place (the Job is a sync hook and
|
||||||
|
# reads it afresh every sync), so no superseded copies are left for Argo to report.
|
||||||
|
configMapGenerator:
|
||||||
|
- name: cellular-tuning
|
||||||
|
files:
|
||||||
|
- tuning/cellular.tuning
|
||||||
|
- tuning/cellular-revamp.tuning
|
||||||
|
options:
|
||||||
|
disableNameSuffixHash: true
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
# Region identity and build (the server image digest without "sha256:").
|
# Region identity and build (the server image digest without "sha256:").
|
||||||
# Producer playtests (ADR-0175/0176): region 9 holds a cellular-v8 opening, region 8's
|
# Revamp playtests (rules 13, ADR-0179): region 16 holds a cellular-v10 opening, a 60 x 60 mm
|
||||||
# cellular-v7 food and nursery taken durably to rules 11 (photosynthesis) with light at the
|
# cellular-v7 genesis taken durably to rules 11 with light (trial 40 pJ per square um per
|
||||||
# trial 40 pJ per square um per tick. Regions 1-8 stay in the stores untouched; they are
|
# tick), to rules 12 with the currents, handling and moving food of the Git tuning file
|
||||||
# simply not served while dev runs region 9.
|
# (tuning/cellular.tuning), and to rules 13 with the revamp rules of
|
||||||
|
# tuning/cellular-revamp.tuning. Regions 1-15 stay in the stores untouched; they are simply
|
||||||
|
# not served while dev runs region 16. A region keeps the tuning it opened with, so a new
|
||||||
|
# region opens when the tuning changes (until live retuning exists).
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -14,13 +17,13 @@ spec:
|
|||||||
- name: evo-server
|
- name: evo-server
|
||||||
env:
|
env:
|
||||||
- {name: REGION_WORLD, value: "100"}
|
- {name: REGION_WORLD, value: "100"}
|
||||||
- {name: REGION_ID, value: "9"}
|
- {name: REGION_ID, value: "16"}
|
||||||
- {name: REGION_BUILD, value: f1183f4476bac87c09504a574112df4663931f67e88cc38dc08f867ce98ff726}
|
- {name: REGION_BUILD, value: 9ba0d78a0db2cd4016711b1c4a621f3945b4b4895d3c4a420389f281bbb781a5}
|
||||||
- {name: REGION_PROFILE, value: cellular}
|
- {name: REGION_PROFILE, value: cellular}
|
||||||
# The whole world's catalog: dev world 100 has only this region.
|
# The whole world's catalog: dev world 100 has only this region.
|
||||||
- {name: REGION_LIFE_ROUTES, value: "9=void.aeternalisgames.com:7400=void.aeternalisgames.com"}
|
- {name: REGION_LIFE_ROUTES, value: "16=void.aeternalisgames.com:7400=void.aeternalisgames.com"}
|
||||||
# Keep the currently promoted build plus prior committed builds recoverable.
|
# Keep the currently promoted build plus prior committed builds recoverable.
|
||||||
- {name: REGION_RETAINED, value: "815153514ca4a53967932bb46456ff4cb4e1784f9db247bc3b613b7e8365c59f 21507d4369cebef83ee05152daea5ac2f581ea86a9dc85276ef54e3f9f6388c5 5a77cf9e96e7a0e40ea07e9394a3fa458184ce54f8f774a8fb59cbec1db75c54 e17c62bc8dbad089da57e8b30adc391ff8b947cc7182b3160f5e2709103ded78 6c96629eb3c26513d55207b109fe2a9873a58f43510bd067b7d5422572e3fb42 7952185d5ef96504b5793b76fe72e42cbe9c9ac19149bf912adb2c3a735f8dbf f378a43d6146eeed864110b90848df0bec9672fa4c9941a2d04de249068a4a09 ecac8f9f2489c547ce58f12ed01baaa3939c8adbf8aed05c313abbf422cdc855 4af7209941643e0c6a100e2b4e2fef8a959b87fdbfac2173b7867cfc1808bd66 edb39f956df1f481d7ba724cac4ceb3a4fe494efc02f994d31d6c96dfae04a78 0ded41070dd3e0c0daa43e13dadc58c449865eec00530cfceff3c1579c66e916 754446fe4e5f33e9c0d5a1a74a02444a01de1700673442c90827c708aba62cee c597c0bac8b4a796e1e8b70344f9866cb047cc90cfb15af774d38860594ea27a e83c333a87056c678b5e835947647ef42370b43dbfc31997744f28d993f9c4aa db2b0e6a6071502381a768d70fd9bab8c08c64e4717fc23da45dbe8adc5fa3d6 cdc10712ff8bf956f8f5900709500046493523b51dc670d5b2d01eaf604bcd38 028571f257b485acafbe79b704a80f273d899485c4bb264d9c8137bf51e33217 566c29329433934f1436faf94652a7b925df8b4587ab04470322172f47c31c02 1dd640eba3e9dbdd10106698215a0a06df89c5cdf801c53c4c26fb923116552a faeb26fc5db5c4aae9ae9eb4388e807ab4d59499d7639fcab3d878843a740037 5e13e0096eb4010253c270ab98f0e9bbc11571c221eb779d428333e8cd63c955 e891f9427d5ec81b32595d70be9d00bb66c6d8223b4747d12be8c388c2fc0c8e 58aab8aaa538c0c6e5ad7281fd27e50374b489942aa317296dbf9c2ec5ca3434 4a8b0a9dc9f6be491e9eacb464aa7ef7c0d449de3018c4172c01448ce39a5108 3e5b8cef06838821113c8bba064e9415e8c627bca552fb978f830d40027b80f2"}
|
- {name: REGION_RETAINED, value: "f1183f4476bac87c09504a574112df4663931f67e88cc38dc08f867ce98ff726 815153514ca4a53967932bb46456ff4cb4e1784f9db247bc3b613b7e8365c59f 21507d4369cebef83ee05152daea5ac2f581ea86a9dc85276ef54e3f9f6388c5 5a77cf9e96e7a0e40ea07e9394a3fa458184ce54f8f774a8fb59cbec1db75c54 e17c62bc8dbad089da57e8b30adc391ff8b947cc7182b3160f5e2709103ded78 6c96629eb3c26513d55207b109fe2a9873a58f43510bd067b7d5422572e3fb42 7952185d5ef96504b5793b76fe72e42cbe9c9ac19149bf912adb2c3a735f8dbf f378a43d6146eeed864110b90848df0bec9672fa4c9941a2d04de249068a4a09 ecac8f9f2489c547ce58f12ed01baaa3939c8adbf8aed05c313abbf422cdc855 4af7209941643e0c6a100e2b4e2fef8a959b87fdbfac2173b7867cfc1808bd66 edb39f956df1f481d7ba724cac4ceb3a4fe494efc02f994d31d6c96dfae04a78 0ded41070dd3e0c0daa43e13dadc58c449865eec00530cfceff3c1579c66e916 754446fe4e5f33e9c0d5a1a74a02444a01de1700673442c90827c708aba62cee c597c0bac8b4a796e1e8b70344f9866cb047cc90cfb15af774d38860594ea27a e83c333a87056c678b5e835947647ef42370b43dbfc31997744f28d993f9c4aa db2b0e6a6071502381a768d70fd9bab8c08c64e4717fc23da45dbe8adc5fa3d6 cdc10712ff8bf956f8f5900709500046493523b51dc670d5b2d01eaf604bcd38 028571f257b485acafbe79b704a80f273d899485c4bb264d9c8137bf51e33217 566c29329433934f1436faf94652a7b925df8b4587ab04470322172f47c31c02 1dd640eba3e9dbdd10106698215a0a06df89c5cdf801c53c4c26fb923116552a faeb26fc5db5c4aae9ae9eb4388e807ab4d59499d7639fcab3d878843a740037 5e13e0096eb4010253c270ab98f0e9bbc11571c221eb779d428333e8cd63c955 e891f9427d5ec81b32595d70be9d00bb66c6d8223b4747d12be8c388c2fc0c8e 58aab8aaa538c0c6e5ad7281fd27e50374b489942aa317296dbf9c2ec5ca3434 4a8b0a9dc9f6be491e9eacb464aa7ef7c0d449de3018c4172c01448ce39a5108 3e5b8cef06838821113c8bba064e9415e8c627bca552fb978f830d40027b80f2 67e6bb3d138e7d489850ac99b5915ef8659178a68140b963e282b24020a288e2 f178f7f44251fdc9ae9ccaaecc5ea6f10aa534caa25d506abc3fbde21c69db17 6532f97e9b7d1492f1a17d1228ce7e563016c2187735f44e58ff1e9f786019aa 7c5462391a9bff4f7c25f2761098e7189b7ae204af0a7be61a652e4482f63e6a 9ba005f9216a2211491afd0e335ac5c6f20af1166fbb7518bcc8cec2e536f5ce 7eb84318234e23c223d4279ac01e925ba0b08d6d6950f7ba328f0ce909af8307 0fcdbf1518b677829322dc18e1feebd354a6e39700bd9cdb60ab47dc0465c3a6 801a9ae4fe1049dd27cfd9c356f21f29c6e07238448c201c08d288b5cc8e7e9a f0869be511179866f9a71a63a6a5f65e577e851fd7851184734bb5c56940b1a6 178cd8ffcdfe9fe14f39084d78341a8705ca72e78947bada31ab0356508fc232 0fd4807f67ab317561f115f12c0d8540e04596fdea389d7c2104e97dda5a0351 effea9180d802e50abed76a5da665374f3591eda8aeb99c0fff085ed6df618ae 7a35cc170b935508b9b88379f4fb581acb852ebe769ac269f1596861aca2ffa7 2d1307493202464773734b0a2d33f4a737b0a897cb179de05bdf433cbdb1aec1 a5b70d945b63618a2897a848320e9af6b73a1a4f3bf8fb052d8286a93f6f8ada 222fa3dea0cb25335234678fa0d628222fc92c9ff38a1869330d973b8c4b4e53 f235d14aa06924010ac9e1a4cfad6148ed24447eafb33ef2df968a285f467457 1dd1ea052376c2c5daf2b0a910b1a5972474c836672f9cb61b32ecae58dabfd1 c7347c2d7aa2ea0e5d00665da81cd7d710b109e4e306dd7e09562463d33a5d8f d4b62521c57323025ed611b6873cffa5da49b84acda38081758e8a23b7b8d981 82e248426f5cb31cfe8ddc3aea84982d2fcfd34d12fbf78204de2ccffdbf2a2a 03ce069df16244e47d4c7b7ceac699949c099168f9c531f1ece08d2111d286e5 db67827962bd96ec8c19f4dbb039d29e897592db9d8e9da9ddf00bc0770a0b5f de1b4b32ef7d38785efc562a3288ed066b0be9398e4a64551d12adf423aac31f ec473b40c5958e1cd38765dcf3f52027f39ef29e5b776ba9ad03a6a25af31819 9f76430c33a33d246384dc198b4df3d7e4abf28277a2f435cce25696d01a4863 12e62108f7b920bea0b91f50b21fcabd2463af6f1e94242140bbde786e42eee5 a8edb67c9b69edb5c2c750a068c6d89553691fccc47a4241c67c12f3f9e2a0b2 2f2d5c2bd6baa68163d81cbdd75496e200e8446cf806f443834cd03bdb6eb828 87d607f5bc1cb6b8673767ad44d62d773fac4116b1f952cdb80fac61625b1d02 a7ab3f34b18c06ce17f374d662f57a19d2754f079d899fe29d4262c5b26f7855 441c25a5d728f37d257c4b7bde6d15736aa66d16b07ea088d2d1838eb01a5c55 1d0585ef57e70ab0ab8ea67a780f2a4680101a854bfab46dbb2a5092e7f2251b"}
|
||||||
---
|
---
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
@@ -33,35 +36,54 @@ spec:
|
|||||||
- name: provision
|
- name: provision
|
||||||
env:
|
env:
|
||||||
- {name: REGION_WORLD, value: "100"}
|
- {name: REGION_WORLD, value: "100"}
|
||||||
- {name: REGION_ID, value: "9"}
|
- {name: REGION_ID, value: "16"}
|
||||||
- {name: REGION_BUILD, value: f1183f4476bac87c09504a574112df4663931f67e88cc38dc08f867ce98ff726}
|
- {name: REGION_BUILD, value: 9ba0d78a0db2cd4016711b1c4a621f3945b4b4895d3c4a420389f281bbb781a5}
|
||||||
# Region 9 (ADR-0176): region 8's cellular-v7 opening as cellular-v8, 30 x 30 mm at 20 C,
|
# Region 16 (rules 13): cellular-v10, 60 x 60 mm at 20 C, taken through one empty tick,
|
||||||
# taken through one empty tick and the durable upgrades to rules 11 with light. Food is
|
# the durable upgrades to rules 11 with light, the liquid upgrade from the mounted
|
||||||
# region 7's total, half in 9 pools (500 um radius; a pool feeds at a quarter rate)
|
# tuning file (whose region size must match) and the revamp upgrade from the mounted
|
||||||
# and half in 1,800 single-nutrient bubbles scattered from the genesis commit (360
|
# revamp tuning file. 9 pools (500 um radius; a pool feeds at a quarter rate; any in a
|
||||||
# per channel: 7e7 pJ energy, 4.2e6 fg C, 9.4e5 N, 4.9e5 P, 2e6 other each). The
|
# current moves to the nearest still water), 1,200 single-nutrient bubbles (240 per
|
||||||
# nursery funds 64 primitive founders at 9 spawn sites.
|
# channel: 2.1e8 pJ energy, 1.26e7 fg C, 2.82e6 N, 1.47e6 P, 6e6 other each) and 2,400
|
||||||
# Genesis is written once: keep --commit stable so every sync resolves it. The world 100
|
# mixed bubbles holding every nutrient in the founder recipe's proportions (4.2e7 pJ,
|
||||||
|
# 2.52e6 fg C, 7.56e5 N, 2.52e5 P, 1.512e6 other), scattered from the genesis commit:
|
||||||
|
# three times region 14's food in every pool and bubble. The format-2 genesis holds
|
||||||
|
# at most 4,096 deposits. The current seed comes from the commit. The nursery funds
|
||||||
|
# 256 primitive founders' worth (100 go to the seeded wildlife, the rest to player
|
||||||
|
# births, each new life included); rules-12 founders start at random spots (the 9
|
||||||
|
# sites, 3 mm from pools, are the fallback).
|
||||||
|
# Genesis is written once: keep --commit stable so every sync resolves it.
|
||||||
|
# ADR-0180: region 14 used IDs 900000003584-900000003615 for its 32 seeded wildlife;
|
||||||
|
# region 15 used 900000003616-900000003715; region 16 reserves
|
||||||
|
# 900000003716-900000003815 for its 100. Their
|
||||||
|
# resources come from the nursery, leaving its remainder for players. The
|
||||||
# life allocator starts far above the unserved lineage region 1 identities (ADR-0123).
|
# life allocator starts far above the unserved lineage region 1 identities (ADR-0123).
|
||||||
- {name: REGION_OPENING, value: cellular-v8}
|
- {name: REGION_OPENING, value: cellular-v10}
|
||||||
- name: REGION_OPENING_ARGS
|
- name: REGION_OPENING_ARGS
|
||||||
value: >-
|
value: >-
|
||||||
--frame 9 --source-id 1 --commit 6a6cdbfca8e3fc777110ed677de9dc2a --light-pj 40
|
--frame 9 --source-id 1 --commit c3a29d5e1f2b3a4c6d8e0f1a2b3c4d5f --light-pj 40
|
||||||
--life-allocator-start 1000000000000
|
--tuning /etc/evo/tuning/cellular.tuning
|
||||||
--width-um 30000 --height-um 30000 --ambient-temperature-mk 293150
|
--revamp-tuning /etc/evo/tuning/cellular-revamp.tuning
|
||||||
--funding-energy-pj 528588800 --funding-carbon-fg 385024000
|
--life-allocator-start 1000000000000 --playtest-wildlife-first-id 900000003716
|
||||||
--funding-nitrogen-fg 86016000 --funding-phosphorus-fg 44032000
|
--width-um 60000 --height-um 60000 --ambient-temperature-mk 293150
|
||||||
--funding-other-fg 181248000
|
--funding-energy-pj 2114355200 --funding-carbon-fg 1540096000
|
||||||
--site 4500,4500 --site 4500,15000 --site 4500,25500 --site 15000,4500
|
--funding-nitrogen-fg 344064000 --funding-phosphorus-fg 176128000
|
||||||
--site 15000,15000 --site 15000,25500 --site 25500,4500 --site 25500,15000
|
--funding-other-fg 724992000
|
||||||
--site 25500,25500
|
--site 12000,12000 --site 12000,27000 --site 12000,42000 --site 27000,12000 --site 27000,27000 --site 27000,42000 --site 42000,12000 --site 42000,27000 --site 42000,42000
|
||||||
--pool 7500,7500,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 15000,15000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 7500,15000,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 15000,30000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 7500,22500,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 15000,45000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 15000,7500,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 30000,15000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 15000,15000,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 30000,30000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 15000,22500,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 30000,45000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 22500,7500,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 45000,15000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 22500,15000,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 45000,30000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--pool 22500,22500,500,2,2800000000,167000000,38000000,19600000,80000000
|
--pool 45000,45000,500,2,8400000000,501000000,114000000,58800000,240000000
|
||||||
--motes 1800,2,70000000,4200000,940000,490000,2000000
|
--motes 1200,2,210000000,12600000,2820000,1470000,6000000
|
||||||
|
--mixed-motes 2400,2,42000000,2520000,756000,252000,1512000
|
||||||
|
volumeMounts:
|
||||||
|
- {name: tuning, mountPath: /etc/evo/tuning, readOnly: true}
|
||||||
|
volumes:
|
||||||
|
- name: tuning
|
||||||
|
configMap:
|
||||||
|
name: cellular-tuning
|
||||||
|
defaultMode: 0444
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# 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.
|
||||||
|
# Mounted for new-region provisioning; an existing region retains its 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
|
||||||
|
# Energy cycle (ADR-0182 section 14; optional, 0 when absent): the share of the region's heat
|
||||||
|
# (energy its cells used) returned to the spent pool every tick before the drip, and whether a
|
||||||
|
# drip at the deposit limit (8,192) joins an existing bubble instead of waiting.
|
||||||
|
spent.heat_recycle_per_mille = 1_000 # all of it: energy cycles back like matter
|
||||||
|
spent.drip_absorb = 1
|
||||||
|
|
||||||
|
# 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 = 500 # the offspring's share of a mutation split
|
||||||
|
reproduction.split_min_growth_per_mille = 500 # a cell splits once half grown
|
||||||
|
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)
|
||||||
|
reproduction.wildlife_cap = 200 # wildlife buds refused at this many lives: the rest are for players
|
||||||
|
|
||||||
|
# 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
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# Cellular trial tuning (Cellular_Region_Movement_Plan.md, tuning file).
|
||||||
|
# Every value here is a trial value for playtesting, not a locked rule. Edit, commit,
|
||||||
|
# push and run a full Argo sync; the region refuses an invalid file at startup.
|
||||||
|
# Format: `key = value`, integers only, `_` may separate digits. Every key is required.
|
||||||
|
# Region shape (width, height, currents) applies when a region opens; the rest applies
|
||||||
|
# when the region restarts and is recorded from that tick.
|
||||||
|
|
||||||
|
tuning.version = 1
|
||||||
|
|
||||||
|
# Region shape and capacity.
|
||||||
|
region.width_um = 60_000
|
||||||
|
region.height_um = 60_000
|
||||||
|
region.organism_cap = 2_000 # births are refused at the cap
|
||||||
|
region.deposit_limit = 8_192 # food bubbles and pools
|
||||||
|
region.perception_radius_um = 5_000
|
||||||
|
|
||||||
|
# Founder handling. Top speed = thrust / drag rate: about 190 um/s here.
|
||||||
|
founder.thrust_um_per_s2 = 400
|
||||||
|
founder.reverse_thrust_um_per_s2 = 400 # braking and reversing
|
||||||
|
founder.drag_ppm_per_tick = 95_163 # k = 2 /s: 0.5 s time constant
|
||||||
|
founder.lateral_drag_ppm_per_tick = 95_163
|
||||||
|
founder.turn_heading_per_s = 65_536 # 65,536 = one full turn per second
|
||||||
|
founder.thrust_cost_per_mille = 250 # thrust energy: a quarter of the full-speed metabolic cost
|
||||||
|
|
||||||
|
# Currents: 0.3x-1.5x founder speed, so the strongest cannot be swum against.
|
||||||
|
currents.min_count = 2
|
||||||
|
currents.max_count = 4
|
||||||
|
currents.min_width_um = 3_000
|
||||||
|
currents.max_width_um = 6_000
|
||||||
|
currents.min_speed_um_per_s = 60
|
||||||
|
currents.max_speed_um_per_s = 300
|
||||||
|
currents.grid_pitch_um = 250
|
||||||
|
|
||||||
|
# Moving food.
|
||||||
|
food.merged_bubble_cap_multiple = 8 # merged bubbles stop growing at 8x a scattered bubble
|
||||||
|
food.visible_moving_bubbles = 256 # per update, nearest first
|
||||||
|
food.induced_drift_radius_um = 200 # passing cells push bubbles within this distance
|
||||||
|
food.induced_drift_max_um_per_s = 100
|
||||||
|
food.induced_drift_decay_ppm_per_tick = 95_163
|
||||||
|
|
||||||
|
# Thermal map and biology, in millikelvin (273_150 = 0 C).
|
||||||
|
thermal.ambient_min_mk = 278_150 # 5 C
|
||||||
|
thermal.ambient_max_mk = 313_150 # 40 C
|
||||||
|
founder.preferred_mk = 293_150 # 20 C
|
||||||
|
founder.comfort_band_mk = 5_000 # +/- 5 C without extra cost
|
||||||
|
founder.body_tau_ms = 20_000 # body temperature lag
|
||||||
|
founder.lethal_cold_mk = 273_150 # body at or below 0 C dies
|
||||||
|
founder.lethal_heat_mk = 318_150 # body at or above 45 C dies
|
||||||
|
thermal.off_preference_per_mille_per_k = 80 # 0.08 per degree beyond the comfort band
|
||||||
|
thermal.transition_per_mille_per_k = 40 # 0.04 per degree of body-ambient difference
|
||||||
|
thermal.multiplier_cap_per_mille = 8_000 # survival cost at most 8x
|
||||||
|
|
||||||
|
# Lifecycle.
|
||||||
|
lifecycle.logout_delay_ms = 10_000 # vulnerable delay before the protected anchor
|
||||||
|
|
||||||
|
# Mutation offers.
|
||||||
|
mutation.step_points = 5 # +/- reference points per tuning selection
|
||||||
|
mutation.paired_points = 2 # paired change on the competing axis
|
||||||
|
mutation.recovery_floor_per_mille = 100 # weight floor for recovering a below-base trait
|
||||||
|
mutation.offer_interval_ms = 25_000 # of productive active play
|
||||||
|
mutation.offer_options = 3
|
||||||
@@ -38,6 +38,8 @@ spec:
|
|||||||
- {name: PGSERVICEFILE, value: /run/postgres/pg_service.conf}
|
- {name: PGSERVICEFILE, value: /run/postgres/pg_service.conf}
|
||||||
- {name: EVO_PGPASS_SOURCE, value: /run/postgres/pgpass}
|
- {name: EVO_PGPASS_SOURCE, value: /run/postgres/pgpass}
|
||||||
- {name: EVO_PG_RUNTIME_ROLE, value: set-by-overlay}
|
- {name: EVO_PG_RUNTIME_ROLE, value: set-by-overlay}
|
||||||
|
# ADR-0182: the admin API's group role; empty grants no admin functions.
|
||||||
|
- {name: EVO_PG_ADMIN_ROLE, value: ""}
|
||||||
resources:
|
resources:
|
||||||
requests: {cpu: 100m, memory: 64Mi}
|
requests: {cpu: 100m, memory: 64Mi}
|
||||||
limits: {memory: 128Mi}
|
limits: {memory: 128Mi}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ resources:
|
|||||||
images:
|
images:
|
||||||
- name: aevolution-postgres-tools
|
- name: aevolution-postgres-tools
|
||||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-postgres-tools
|
newName: registry.aeternalisgames.com/aeternalis/aevolution-postgres-tools
|
||||||
# Gitea CI run 471 for 2efb01d (schema v57, rules 11); server image from the same run.
|
# Gitea CI run 576 for 9de55e3 (schema v69: one action per account a tick; bundle 15).
|
||||||
digest: sha256:d3b8e520b20e5de939b71350c5f5a16482de49ca6a34088c3128cff1a008e5da
|
digest: sha256:c200bd438376abf49292c63691bca8cd8adc097a9e1f94cf926250f50be1fba8
|
||||||
- name: aevolution-server
|
- name: aevolution-server
|
||||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
||||||
digest: sha256:f1183f4476bac87c09504a574112df4663931f67e88cc38dc08f867ce98ff726
|
digest: sha256:9ba0d78a0db2cd4016711b1c4a621f3945b4b4895d3c4a420389f281bbb781a5
|
||||||
patches:
|
patches:
|
||||||
- target:
|
- target:
|
||||||
kind: Job
|
kind: Job
|
||||||
@@ -23,3 +23,7 @@ patches:
|
|||||||
- op: replace
|
- op: replace
|
||||||
path: /spec/template/spec/containers/0/env/3/value
|
path: /spec/template/spec/containers/0/env/3/value
|
||||||
value: aevolution_runtime
|
value: aevolution_runtime
|
||||||
|
# Operator-created NOLOGIN group of the admin portal's login (ADR-0182).
|
||||||
|
- op: replace
|
||||||
|
path: /spec/template/spec/containers/0/env/4/value
|
||||||
|
value: aevolution_admin
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ requirements. See [the architecture](architecture/SYSTEM_OVERVIEW.md),
|
|||||||
|---|---|
|
|---|---|
|
||||||
| Absolute permadeath | Dead organisms never resume. A fresh life after death starts as a primitive cell with no account-age advantage. Voluntary one-way succession into living newborn offspring at birth is distinct from a fresh life; no return to the NPC parent or fallback after the child's death. |
|
| Absolute permadeath | Dead organisms never resume. A fresh life after death starts as a primitive cell with no account-age advantage. Voluntary one-way succession into living newborn offspring at birth is distinct from a fresh life; no return to the NPC parent or fallback after the child's death. |
|
||||||
| Persistent ancestry | At birth the player stays as the parent or continues as the child; the other organism is independent wildlife. A relinquished parent retains its established behavior and reproductive plan. Independent relatives survive player logout/death and face ordinary ecology. Extinct genomes remain in history. |
|
| Persistent ancestry | At birth the player stays as the parent or continues as the child; the other organism is independent wildlife. A relinquished parent retains its established behavior and reproductive plan. Independent relatives survive player logout/death and face ordinary ecology. Extinct genomes remain in history. |
|
||||||
| Structural inheritance | Body-plan changes are expressed in offspring; retain the parent's existing anatomy separately from its heritable offspring plan. Capability and construction costs remain real. |
|
| Structural inheritance | Body-plan changes of a single cell are expressed in offspring; retain the parent's existing anatomy separately from its heritable offspring plan. A multicellular organism, one body of many cells, expresses an accepted change as a whole, funded from its reserve (maintainer, 2026-10-23; ADR-0179). Capability and construction costs remain real. |
|
||||||
| Player-origin biology | A world can start with geology and chemistry but no life. Every lineage must ultimately reference a player-influenced founder. Do not silently seed prebuilt wildlife. |
|
| Player-origin biology | A world can start with geology and chemistry but no life. Every lineage must ultimately reference a player-influenced founder. Do not silently seed prebuilt wildlife. |
|
||||||
| Ecological progression | No classes, mandatory intelligence endgame, linear mutation tree, or cell-to-human ladder. Mixed and unfamiliar strategies are valid. |
|
| Ecological progression | No classes, mandatory intelligence endgame, linear mutation tree, or cell-to-human ladder. Mixed and unfamiliar strategies are valid. |
|
||||||
| Biological costs | Traits change physical/developmental parameters. Energy, matter, nutrients and environmental constraints determine consequences. |
|
| Biological costs | Traits change physical/developmental parameters. Energy, matter, nutrients and environmental constraints determine consequences. |
|
||||||
@@ -35,6 +35,10 @@ requirements. See [the architecture](architecture/SYSTEM_OVERVIEW.md),
|
|||||||
|
|
||||||
## Recommendations versus experiments
|
## Recommendations versus experiments
|
||||||
|
|
||||||
|
The maintainer's 2026-10-26 test request permits opt-in randomized wildlife roots
|
||||||
|
only in disposable DEV openings ([ADR-0180](adr/0180-dev-starting-wildlife.md)).
|
||||||
|
This fixture exception does not change the player-origin requirement for product worlds.
|
||||||
|
|
||||||
The maintainer clarified structural inheritance, birth-time control choice and
|
The maintainer clarified structural inheritance, birth-time control choice and
|
||||||
NPC-parent continuity on 2026-10-19 in
|
NPC-parent continuity on 2026-10-19 in
|
||||||
[ADR-0163](adr/0163-structural-inheritance-and-offspring-succession.md). These are
|
[ADR-0163](adr/0163-structural-inheritance-and-offspring-succession.md). These are
|
||||||
|
|||||||
+150
@@ -1,5 +1,155 @@
|
|||||||
# Project status and next steps
|
# Project status and next steps
|
||||||
|
|
||||||
|
## One action per account a tick - 2026-10-29
|
||||||
|
|
||||||
|
Region 16 playtest: a bud was shown, then undone, and several were "refused". The client
|
||||||
|
scheduled a bud at the server tick plus its lead, while movement had run ahead of that after the
|
||||||
|
lead shrank, so both named one tick. A tick takes one action per account, so the region refused
|
||||||
|
the whole tick and dropped every player's actions on it (`tick stalled ... error=4`). The region
|
||||||
|
now keeps each account's discrete action (else its newest) and refuses only the others; the client
|
||||||
|
schedules a discrete action after every tick it already sent and holds movement off that tick.
|
||||||
|
Failed commits now log their category and SQLSTATE.
|
||||||
|
|
||||||
|
## Ending a stranded life - 2026-10-29
|
||||||
|
|
||||||
|
The portal's account page can end a published life whose reservation was never ended, which
|
||||||
|
refused every new birth ("Existing cell is already bound to this account"). The admin API first
|
||||||
|
checks the region's live view for any cell holding the account; schema 69 records who ended it
|
||||||
|
and why. A region with no ticking cells now still applies queued admin commands, such as a
|
||||||
|
spawn. See [ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 18.
|
||||||
|
|
||||||
|
## Larger region ticks for testing - 2026-10-28
|
||||||
|
|
||||||
|
A region tick may hold up to 4,096 lives (was 256), for testing limits only, and
|
||||||
|
`reproduction.organism_cap` accepts up to 4,096; the DEV file keeps 256. Schema 68 raises the
|
||||||
|
database's per-tick trace counts and lets one spawn command place 256 wildlife. The region page
|
||||||
|
shows the lineage archive's fill, which stops a region at 65,536 births. See
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 17.
|
||||||
|
|
||||||
|
## Testing a full region - 2026-10-28
|
||||||
|
|
||||||
|
The Bud button follows a tuning adoption at once (the region's bud-cost cache was keyed by
|
||||||
|
genome only). `reproduction.wildlife_cap` keeps lives above it for players' buds. Two admin
|
||||||
|
commands (schema 67): take reserve from a cell, and remove all wildlife; the region map marks
|
||||||
|
cells (shift+click, shift+drag) for bulk removal. See
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 16.
|
||||||
|
|
||||||
|
## Opening regions from the portal - 2026-10-28
|
||||||
|
|
||||||
|
The Regions page can open a fresh region in place of the one DEV serves: the admin API
|
||||||
|
commits the region switch to `main` as aevolution-bot (through Secret `aevolution-admin`) and
|
||||||
|
runs a full Argo sync, and the page follows the sync until the new region is live. See
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 15.
|
||||||
|
|
||||||
|
## Guided tuning editor - 2026-10-28
|
||||||
|
|
||||||
|
The Tuning page is a guided editor: pick a section, edit a setting's value (units and plain
|
||||||
|
readings shown), review the changes and apply. Only the changed values are sent and applied to
|
||||||
|
the newest revision on the server, which keeps the file's comments and refuses a stale base;
|
||||||
|
the whole-file text editor remains as Text mode.
|
||||||
|
|
||||||
|
## Energy cycle - 2026-10-28
|
||||||
|
|
||||||
|
Energy now cycles like matter: the heat cells produce (upkeep, motion, growth, feeding and
|
||||||
|
predation losses) returns to the spent pool every tick and drips back as bubbles, and a drip at
|
||||||
|
the deposit limit joins an existing bubble. Both are optional rules-13 tuning keys
|
||||||
|
(`spent.heat_recycle_per_mille`, `spent.drip_absorb`), adoptable live; the DEV revamp file
|
||||||
|
turns them on. See [ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 14.
|
||||||
|
|
||||||
|
## Admin region page - 2026-10-28
|
||||||
|
|
||||||
|
The admin portal's region page is reorganized around the map: a KPI strip (tick pace,
|
||||||
|
population, deposit capacity, region energy and matter, spent pool, next drip), a map with
|
||||||
|
layer toggles, zoom and a scale, and tabs for inspecting cells and deposits, the region's
|
||||||
|
resources (where every channel sits, the spent pool and its drip), actions, the running
|
||||||
|
tuning and session access. The region view adds complete counts and totals and the drip
|
||||||
|
rules; the portal has light and dark themes. See
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 13.
|
||||||
|
|
||||||
|
## Live tuning - 2026-10-27
|
||||||
|
|
||||||
|
The admin portal's Tuning page edits the world's rules-13 tuning (the Git revamp file
|
||||||
|
format) and adopts it in every region at a recorded tick, without a new image or region:
|
||||||
|
upkeep, burn, feeding, predation, the spent-pool drip, mutation offers and costs,
|
||||||
|
reproduction and organisms. Revisions are append-only with author and reason (schema 66);
|
||||||
|
the reproduction safety revision stays fixed. See
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 13.
|
||||||
|
|
||||||
|
## Resource schedules - 2026-10-27
|
||||||
|
|
||||||
|
The admin portal can schedule recurring bubbles (the game source), spent-pool releases and
|
||||||
|
wildlife spawns per region, every 1 s to 24 h, and stop or restart them. Each run is an
|
||||||
|
ordinary recorded admin command (schema 65). See
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 12.
|
||||||
|
|
||||||
|
## Account administration: bans, logout, time played - 2026-10-27
|
||||||
|
|
||||||
|
The admin portal can ban (and unban) an account, which also logs it out and stops new
|
||||||
|
grants; log an account out; and shows time played, sessions, last seen and living
|
||||||
|
offspring (wildlife descended from its lives). Schema 64; see
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 11.
|
||||||
|
|
||||||
|
## Admin commands: spawn wildlife, resources, remove and grant - 2026-10-27
|
||||||
|
|
||||||
|
The admin portal can now spawn wildlife, add bubbles, add to or release the spent pool,
|
||||||
|
remove a cell and grant a cell's reserve, live. Commands are queued in SQL (schema 63) and
|
||||||
|
the region applies each once, recording it in its history (trace 5) so replay and recovery
|
||||||
|
reproduce it. Imports are counted in the region's boundary ledger. No new region is needed.
|
||||||
|
See [ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 10 and
|
||||||
|
[validation](engineering/VALIDATION.md).
|
||||||
|
|
||||||
|
## Session windows from the admin portal - 2026-10-27
|
||||||
|
|
||||||
|
The dev session window now lives in SQL (schema 62) instead of Git: the admin portal opens,
|
||||||
|
extends (up to four hours from now) and closes it, and the region applies the change within
|
||||||
|
about five seconds without a push, sync or restart. A closed window refuses every new
|
||||||
|
session and the region keeps running. The admin API moves to its own database role. See the
|
||||||
|
[ADR-0087 amendment](adr/0087-dev-session-route.md) and [validation](engineering/VALIDATION.md).
|
||||||
|
|
||||||
|
## Read-only admin portal - 2026-10-27
|
||||||
|
|
||||||
|
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) records the admin portal direction
|
||||||
|
(world tuning in SQL adopted per tick, admin commands, data-defined mutations) and delivers
|
||||||
|
its read-only first step: `evo-admin-api` and the portal at `https://srs.aeternalisgames.com`
|
||||||
|
behind the Keycloak realm role `aevolution-admin`. It lists accounts (session, status,
|
||||||
|
lives, deaths, resets, mutation choices), one account's lives, the world's regions, and a
|
||||||
|
live 2D view of a region's cells, wildlife, pools and bubbles from the region's new
|
||||||
|
`/admin/view` ops route. Schema 61 adds only read functions. Nothing in the simulation,
|
||||||
|
wire protocol or checkpoints changed. Not yet deployed: it needs a new server image, the
|
||||||
|
Keycloak client, an Ingress and a database Secret. See [validation](engineering/VALIDATION.md).
|
||||||
|
|
||||||
|
## 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
|
||||||
|
headings and action buttons fixed as live messages change. Field notes, Vitals
|
||||||
|
and Nearby have a dedicated drag handle, session anchoring, viewport clamping
|
||||||
|
and double-click position reset. See [controls](engineering/CLIENT_VISUAL_REFRESH.md)
|
||||||
|
and [executed validation](engineering/VALIDATION.md). No biological or wire rule changed.
|
||||||
|
|
||||||
|
## DEV startup wildlife and Bud controls - 2026-10-26
|
||||||
|
|
||||||
|
[ADR-0180](adr/0180-dev-starting-wildlife.md) implements opt-in, nursery-funded
|
||||||
|
random-genome roots at a fresh rules-13 opening, with deterministic durable
|
||||||
|
recovery and no replenishment on restart. The DEV trial prepares region 14 with
|
||||||
|
32 cells, 25% faster funded growth and the existing per-channel budding fee knobs.
|
||||||
|
Bud disables on resource shortfall and explains all five channels on hover; the
|
||||||
|
server projection includes the inherited plan and fee. See [tuning and promotion
|
||||||
|
limits](engineering/CELLULAR_PLAYTEST_TUNING.md) and [validation](engineering/VALIDATION.md).
|
||||||
|
Source/configuration preparation is distinct from image promotion and deployment.
|
||||||
|
|
||||||
## Photosynthesis producers (ADR-0136 step C) - 2026-10-19
|
## Photosynthesis producers (ADR-0136 step C) - 2026-10-19
|
||||||
|
|
||||||
[ADR-0175](adr/0175-photosynthesis-producers.md) adds genome schema 5's photosynthesis
|
[ADR-0175](adr/0175-photosynthesis-producers.md) adds genome schema 5's photosynthesis
|
||||||
|
|||||||
@@ -70,3 +70,13 @@ add labels outside these APIs; review must keep debug overlays out of player UI.
|
|||||||
## Consequences
|
## Consequences
|
||||||
M9.7 builds `OrganismPresentation` from server views. Any new visual parameter
|
M9.7 builds `OrganismPresentation` from server views. Any new visual parameter
|
||||||
must derive from biology and update this ADR, tests and ORGANISM_RENDERING.md.
|
must derive from biology and update this ADR, tests and ORGANISM_RENDERING.md.
|
||||||
|
|
||||||
|
## Presentation amendment, 2026-10-22
|
||||||
|
|
||||||
|
The native microscope now layers translucent cyan membranes and cytoplasm, amber
|
||||||
|
metabolic organelles and a violet centre. Existing phenotype mappings for extent,
|
||||||
|
wall thickness, flagella, conversion and producer chloroplasts remain in force.
|
||||||
|
Identical biology receives the same palette; the controlled cell differs only by
|
||||||
|
its existing focus ring. Dead outlines remain broken and stale opacity is applied
|
||||||
|
to organelles as well as the membrane. No new biological parameter is introduced.
|
||||||
|
See [the visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md).
|
||||||
|
|||||||
@@ -131,3 +131,28 @@ at 13 px.
|
|||||||
- **Applying it.** The scale goes to ImGui's `FontScaleMain` and to `ScaleAllSizes`,
|
- **Applying it.** The scale goes to ImGui's `FontScaleMain` and to `ScaleAllSizes`,
|
||||||
taken from the unscaled style. Panel sizes are given in logical units at that scale.
|
taken from the unscaled style. Panel sizes are given in logical units at that scale.
|
||||||
Movable panels return to their default place and size once, at each new scale.
|
Movable panels return to their default place and size once, at each new scale.
|
||||||
|
|
||||||
|
## Amendment (2026-10-26): stable, anchored cellular HUD cards
|
||||||
|
|
||||||
|
At the maintainer's request, Field notes, Vitals and Nearby use a distinct drag
|
||||||
|
handle beside minimize. Client-session normalized positions remain anchored on
|
||||||
|
release, including through viewport/UI-scale changes, and clamp inside the new
|
||||||
|
viewport. Double-clicking the handle resets its position. This supersedes the
|
||||||
|
scale-reset behavior above for these three cards; no layout is saved to disk.
|
||||||
|
|
||||||
|
Their expanded outer sizes and the action dock size depend only on viewport and
|
||||||
|
UI scale. Scrollable bodies reserve scrollbar gutters and wrap live text; the
|
||||||
|
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.
|
||||||
|
|||||||
@@ -197,3 +197,34 @@ the pod-side checks (ready, listener bound) could not show this. Decision:
|
|||||||
Service UDP 7400 -> NetworkPolicy UDP 7400 -> evo-region M10 listener`, with the dev CA
|
Service UDP 7400 -> NetworkPolicy UDP 7400 -> evo-region M10 listener`, with the dev CA
|
||||||
and issuer key read from the authorized cluster Secret without printing or persisting
|
and issuer key read from the authorized cluster Secret without printing or persisting
|
||||||
them. Until that is recorded in VALIDATION.md the route is not declared working.
|
them. Until that is recorded in VALIDATION.md the route is not declared working.
|
||||||
|
|
||||||
|
## Amendment 2026-10-27: Session windows in SQL, opened from the admin portal
|
||||||
|
|
||||||
|
Maintainer decision (ADR-0182 discussion). Committing the window to Git meant a push and a
|
||||||
|
full Argo sync for every opening or extension, and an expired window made the region exit
|
||||||
|
and crash-loop until the next sync. The window moves to the database:
|
||||||
|
|
||||||
|
- **Record.** Schema 62 adds the append-only `evolution.session_windows` (world, region,
|
||||||
|
activation id, absolute UTC expiry or none, author, reason, time written). A row with an
|
||||||
|
expiry opens or replaces the window until then; a row without one closes it. The table
|
||||||
|
refuses updates, deletes and truncation, and a window may end at most **four hours** after
|
||||||
|
it is written (the maximum is unchanged).
|
||||||
|
- **Writing.** Only the admin group role, through `admin_set_session_window_v1`, from the
|
||||||
|
admin portal (Open or Extend for 30 min to 4 h, Close). The author is the signed-in
|
||||||
|
admin's email and Keycloak subject. The runtime group may only read the newest row
|
||||||
|
(`load_session_window_v1`).
|
||||||
|
- **Reading.** The cellular region runs with `--session-window-source db` and reads the newest
|
||||||
|
row every 5 s on its session-ledger connection. A newer activation replaces the window
|
||||||
|
without disturbing open sessions; a closing, expired, over-long or missing row closes it.
|
||||||
|
Each admitted window keeps its own absolute deadline, a window once closed never reopens
|
||||||
|
(only a newer activation opens sessions again), and an unreadable database leaves the
|
||||||
|
current window to close at its deadline.
|
||||||
|
- **Closed means closed.** While no window is open, every Hello is refused with `shutdown`
|
||||||
|
before signature work, and closing closes the open sessions. Previously the cellular
|
||||||
|
bridge closed the sessions once at expiry but still admitted new ones. The region keeps
|
||||||
|
running while closed instead of exiting.
|
||||||
|
- **Git.** `REGION_SESSION_WINDOW` and the pre-push refresh are removed; the policy check
|
||||||
|
requires `--session-window-source db` and refuses a committed window. A fixed
|
||||||
|
`--session-window` remains for the lineage/primitive bridge and process tests.
|
||||||
|
|
||||||
|
The elapsed-time guard of the 2026-10-08 clock amendment is still pending.
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ amends the target gameplay with offspring-only structural expression, birth-time
|
|||||||
one-way control succession and NPC-parent continuity. The decisions below retain
|
one-way control succession and NPC-parent continuity. The decisions below retain
|
||||||
their historical M11 implementation meaning until a new version is qualified.
|
their historical M11 implementation meaning until a new version is qualified.
|
||||||
|
|
||||||
|
2026-10-21: [ADR-0177](0177-cellular-regions-world-linkage.md) amends decision 4
|
||||||
|
for new cellular rules: logout takes effect after a delay during which the cell
|
||||||
|
stays vulnerable; afterwards it is anchored in place, cannot be engulfed, is not
|
||||||
|
moved by currents, and its metabolism and thermal response are frozen. This
|
||||||
|
replaces the vulnerable linger. A fresh life is also offered a choice of region.
|
||||||
|
|
||||||
Accepted for M11 (2026-10-09). M11.1 records these decisions; nothing is implemented
|
Accepted for M11 (2026-10-09). M11.1 records these decisions; nothing is implemented
|
||||||
yet. The maintainer chose each one from presented options on 2026-10-09. They are game
|
yet. The maintainer chose each one from presented options on 2026-10-09. They are game
|
||||||
rules for the first playable loop, and changing one needs a new decision.
|
rules for the first playable loop, and changing one needs a new decision.
|
||||||
|
|||||||
@@ -131,3 +131,28 @@ the later 11.4d client action and review UI are complete.
|
|||||||
extends v10 before any v10 server reaches DEV; v1-v9 are unchanged.
|
extends v10 before any v10 server reaches DEV; v1-v9 are unchanged.
|
||||||
- Remaining after this: the client choice and review UI (maintainer) and the
|
- Remaining after this: the client choice and review UI (maintainer) and the
|
||||||
11.4d playtest notes.
|
11.4d playtest notes.
|
||||||
|
|
||||||
|
## Amendment: durable mutation queue (schema 59, 2026-10-22)
|
||||||
|
|
||||||
|
The exact-tick rule above assumed that reserving a choice and committing a batch were
|
||||||
|
serialized on one connection, one tick at a time. Rules-12 regions commit a batch of
|
||||||
|
ticks on a background thread while the next batch is simulated (ADR-0178 follow-up), so
|
||||||
|
a choice reserved for "head + 1" could land in ticks already simulated or being
|
||||||
|
committed. The batch was then refused (losing its ticks), or, when the commit's check ran
|
||||||
|
before the reservation committed, the reservation was left for a tick that had passed
|
||||||
|
and stalled the region on DEV (tick 9752).
|
||||||
|
|
||||||
|
- A reservation's tick is now the earliest tick the choice may bind at. The region
|
||||||
|
binds a queued choice at the first tick it simulates after admitting it; the
|
||||||
|
mutation record carries the tick it bound at, and the rest of its input must equal
|
||||||
|
the reservation's. Stored rows are unchanged, so a reservation whose tick already
|
||||||
|
passed binds at the next commit that carries it.
|
||||||
|
- The "omits a reserved mutation" refusals are removed: an unbound reservation waits in
|
||||||
|
the queue. The host keeps every unbound reservation queued (and reloads them on
|
||||||
|
recovery), and the open batch binds those the commit in flight does not carry.
|
||||||
|
- A choice can outlive its life while it waits. Its selection then names a life that is
|
||||||
|
gone; the owner records `life_died` and changes nothing, and trace matching and
|
||||||
|
recovery accept such a selection when no life with its ID remains.
|
||||||
|
- Recovery takes each bound choice's tick from its trace selection, not from the stored
|
||||||
|
input.
|
||||||
|
- Births still enter only a fresh batch on the durable head.
|
||||||
|
|||||||
@@ -187,3 +187,12 @@ Existing regions keep their rules versions and are never migrated in place
|
|||||||
- **ADR-0120:** in the new rules version, square patches and the intake target become
|
- **ADR-0120:** in the new rules version, square patches and the intake target become
|
||||||
pools, bubbles and contact feeding.
|
pools, bubbles and contact feeding.
|
||||||
- **ADR-0124:** detritus becomes bubbles.
|
- **ADR-0124:** detritus becomes bubbles.
|
||||||
|
|
||||||
|
## Presentation amendment, 2026-10-22
|
||||||
|
|
||||||
|
The maintainer requested nutrient silhouettes, a thin enclosing pool membrane and
|
||||||
|
a more colorful liquid scene. The native client now uses nutrient-specific glyphs
|
||||||
|
inside the unchanged contact discs, with a zero-stock channel absent. These are
|
||||||
|
presentation symbols, not new chemical species, resource identities or membrane
|
||||||
|
physics. The existing single-channel deposit and contact-feeding contracts remain
|
||||||
|
unchanged. See [the scoped visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md).
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ owner (12.5b) implements. It extends ADR-0136 step B, ADR-0144 and ADR-0157/0165
|
|||||||
No default/live version, durable profile, SQL schema, photosynthesis, atmosphere
|
No default/live version, durable profile, SQL schema, photosynthesis, atmosphere
|
||||||
or M6 fixture change. ADR-0136 step C remains proposed design input.
|
or M6 fixture change. ADR-0136 step C remains proposed design input.
|
||||||
|
|
||||||
|
Amended by [ADR-0177](0177-cellular-regions-world-linkage.md) for new cellular
|
||||||
|
rules: habitats are linked to a world area instead of one voxel; currents and the
|
||||||
|
thermal map are environmental conditions, not stock; regions cap their organism
|
||||||
|
count; emergence is a recorded export with a scaled world credit; logged-out
|
||||||
|
controlled cells are anchored, protected and frozen. Single ownership, individual
|
||||||
|
reserves and recorded boundary crossings are unchanged.
|
||||||
|
|
||||||
## Maintainer clarification
|
## Maintainer clarification
|
||||||
|
|
||||||
- **One owner per patch of space, at any moment.** It is not one global owner.
|
- **One owner per patch of space, at any moment.** It is not one global owner.
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ Accepted portable M12.5b evidence, 2026-10-19. Extends ADR-0172 and the populati
|
|||||||
batches of ADR-0142/0144/0171. No durable admission, SQL schema, checkpoint profile,
|
batches of ADR-0142/0144/0171. No durable admission, SQL schema, checkpoint profile,
|
||||||
automatic scheduling or live/default rule change.
|
automatic scheduling or live/default rule change.
|
||||||
|
|
||||||
|
Amended by [ADR-0177](0177-cellular-regions-world-linkage.md) for new cellular
|
||||||
|
rules: emergence adds a recorded export flow; currents and the thermal map are
|
||||||
|
re-derived from configuration and add no flows; refused births at the region cap
|
||||||
|
and protected anchored offline cells must be reproduced by replay.
|
||||||
|
|
||||||
## Decision
|
## Decision
|
||||||
|
|
||||||
Joint batch 1 (`AEVOEBT1`) carries one complete, unchanged population batch (format
|
Joint batch 1 (`AEVOEBT1`) carries one complete, unchanged population batch (format
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
# ADR-0177: Cellular regions, world linkage and emergence
|
||||||
|
|
||||||
|
## Status and authority
|
||||||
|
|
||||||
|
Accepted product direction, 2026-10-21, from the maintainer's region review
|
||||||
|
decisions in chat. Implementation is pending. Amends ADR-0172 (habitat geometry,
|
||||||
|
environmental conditions, boundary crossings, offline treatment) and ADR-0173
|
||||||
|
(recorded flows and unattended intervals) for new cellular rules. Companion design:
|
||||||
|
[Cellular region changes](../../Cellular_Region_Changes.md) and
|
||||||
|
[Cellular movement draft](../../Cellular_movement_draft.md). Historical rules,
|
||||||
|
envelopes, checkpoints, tests and currently running worlds retain their meanings.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
ADR-0172 places each cellular habitat inside one environmental voxel and accounts
|
||||||
|
every environmental quantity as owned stock. The region review needs larger
|
||||||
|
habitats with procedural currents and a thermal map, a defined exit from the 2D
|
||||||
|
cellular stage into the 3D world, a bounded population per region and a simpler
|
||||||
|
logout rule. It also selects simplifications so these can be playtested on the
|
||||||
|
DEV system without full fluid or thermal energy accounting.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
### Cellular regions belong to a world, not to a voxel
|
||||||
|
|
||||||
|
A cellular region is its own habitat linked to a world. It is not located in one
|
||||||
|
world voxel and its size is not limited by voxel extent. Each region maps to an
|
||||||
|
area of its world. The region's thermal map is that world area's thermal map,
|
||||||
|
scaled down to the habitat. The same mapping is used to select emergence targets.
|
||||||
|
|
||||||
|
Regions do not grow. Each region has a hard cap on its organism count; the world
|
||||||
|
adds regions instead. Whether demand creates another region for the same world or
|
||||||
|
attaches a region to a new world is a later equation, not selected here.
|
||||||
|
|
||||||
|
### Currents and the thermal map are environmental conditions
|
||||||
|
|
||||||
|
Procedural currents are a fixed environmental condition, like incident light.
|
||||||
|
They are not stock, carry no mechanical energy accounting, and add no ledger
|
||||||
|
entries. Drifting never credits usable E, and no process harvests flow energy.
|
||||||
|
|
||||||
|
The thermal map is a static maintained condition derived from the world map. It
|
||||||
|
is not owned thermal energy and is not derived from accumulated waste heat. The
|
||||||
|
existing heat compartment and radiative export keep their meanings. Owned thermal
|
||||||
|
energy with heat capacity is deferred until gameplay needs changing temperatures.
|
||||||
|
|
||||||
|
### Births stop at the region cap
|
||||||
|
|
||||||
|
At the hard cap, births in that region are refused. Engulfment and death return
|
||||||
|
matter to the region and reopen slots. When a region stays at the cap with no
|
||||||
|
active players for an extended period, an operator may cull wildlife through an
|
||||||
|
admin interface. Culling is an explicit, recorded operator action, never an
|
||||||
|
automatic despawn presented as selection.
|
||||||
|
|
||||||
|
### Region choice for a fresh life
|
||||||
|
|
||||||
|
A fresh cell is offered a choice of region when it begins, so friends can share
|
||||||
|
one. Recognition of friends stays a separate design question (ADR-0098).
|
||||||
|
|
||||||
|
### Emergence into the world
|
||||||
|
|
||||||
|
An organism that evolves out of the 2D stage leaves its cellular region. Its
|
||||||
|
matter is a recorded export from the region and is lost to the cellular scale.
|
||||||
|
The organism enters the world at a value scaled to world quantities. This is an
|
||||||
|
explicit scale conversion, not a one-to-one conserved transfer. The conversion
|
||||||
|
depends on the number of regions per world and the matter per region and is not
|
||||||
|
yet selected.
|
||||||
|
|
||||||
|
Target selection uses the region's mapped world area. Several candidate locations
|
||||||
|
closest to the organism's preferred temperature with the nutrients it needs are
|
||||||
|
ranked, and one is chosen at random. Crowding is not otherwise prevented: finite
|
||||||
|
world resources penalize popular sites.
|
||||||
|
|
||||||
|
The emerging organism chooses **individual** or **bulk** emergence. Bulk places it
|
||||||
|
in a selection queue; organisms emerging together with the same or close biology
|
||||||
|
receive one shared target choice.
|
||||||
|
|
||||||
|
### Logout anchors and freezes the controlled cell
|
||||||
|
|
||||||
|
Logout takes effect after a delay. During the delay the cell remains in play and
|
||||||
|
vulnerable; logging out while about to be engulfed does not prevent it. After the
|
||||||
|
delay the cell is anchored in place: it cannot be engulfed, is not moved by
|
||||||
|
currents, and its metabolism and thermal response are frozen. This replaces the
|
||||||
|
vulnerable linger of ADR-0098 for these rules. Offline fairness is unchanged:
|
||||||
|
an offline controlled organism does not move, feed, reproduce, mutate or progress.
|
||||||
|
|
||||||
|
### Disposable DEV worlds
|
||||||
|
|
||||||
|
New cellular rules start in new DEV worlds. Existing DEV worlds need not be
|
||||||
|
migrated; this does not authorize any World0 action.
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
- ADR-0172's one-voxel habitat geometry does not apply to the new rules. Its
|
||||||
|
single-owner principle, individual reserves and recorded open-boundary crossings
|
||||||
|
still apply.
|
||||||
|
- Currents and the thermal map need seeded, versioned configuration so replay and
|
||||||
|
restore reproduce them exactly, but no new joint-batch flows.
|
||||||
|
- Emergence adds a new recorded export flow to joint batches; the world-side
|
||||||
|
credit belongs to the world owner's own import record.
|
||||||
|
- The birth cap changes population outcomes and must be recorded in replay.
|
||||||
|
- Anchored offline cells are excluded from engulfment and flow in replay.
|
||||||
|
- Open: the emergence conversion scale, the region-or-world creation equation,
|
||||||
|
cap values, logout delay duration, bulk-queue timing and similarity threshold.
|
||||||
|
|
||||||
|
## Alternatives
|
||||||
|
|
||||||
|
Growing a single region to fit demand was rejected: capped regions scale by count.
|
||||||
|
Owned mechanical and thermal energy accounting for playtests was rejected as cost
|
||||||
|
without gameplay benefit at this stage. A vulnerable offline linger was replaced by
|
||||||
|
a logout delay followed by a protected anchor.
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# ADR-0178: Durable liquid regions and session v13
|
||||||
|
|
||||||
|
## Status and scope
|
||||||
|
|
||||||
|
Accepted 2026-10-21. Implements phases 1-2 of the
|
||||||
|
[region and movement plan](../../Cellular_Region_Movement_Plan.md) under
|
||||||
|
[ADR-0177](0177-cellular-regions-world-linkage.md): rules 12 on the raw profile-4 path,
|
||||||
|
schema 58, the `cellular-v9` opening and session protocol v13. Trial numbers come from the
|
||||||
|
Git tuning file. DEV-only; no World0 operation.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
**Biology.** Genome schema 6 carries the movement arrangement (001-010, 100 = founder);
|
||||||
|
development 6 and founder 5 use it. A shared integer motion step (velocity relative to the
|
||||||
|
liquid, heading, funded thrust and braking, drag to exactly zero, sub-micrometre carry)
|
||||||
|
runs identically on server and client. Seeded looping currents are a condition, not stock.
|
||||||
|
Habitat format 3 moves bubbles with the current and the drift moving cells induce, merges
|
||||||
|
touching bubbles up to a cap, keeps pools fixed and addresses unique.
|
||||||
|
|
||||||
|
**Owner format 10, rules 12.** An explicit no-tick format-9/rules-11 upgrade declares the
|
||||||
|
liquid rules (current configuration, founder handling, deposit motion) taken from the
|
||||||
|
tuning file and a seed when the region opens; the server never reads the file. See
|
||||||
|
[schemas/cellular-lives-v10.md](../../schemas/cellular-lives-v10.md). Brake is a step
|
||||||
|
intent valid only under rules 12, carried in raw trace 4 as flag bit 1.
|
||||||
|
|
||||||
|
**Bundle 14, schema 58.** Bundle 14 `(12, 10, 2, 1, 1, 6, 5, 2, 1)` is admitted by
|
||||||
|
parser-local normalization to bundle 13, with bundle 12/13's births and mutation results,
|
||||||
|
and an exact fenced 13 -> 14 upgrade whose only input, the liquid rules, recovery reads
|
||||||
|
from the target. Schema 58 also widens the canonical action input: byte 13 bit 0 is brake.
|
||||||
|
Population, census and migration profiles do not admit bundle 14 (raw path only, per the
|
||||||
|
maintainer).
|
||||||
|
|
||||||
|
**Opening `cellular-v9`.** `cellular-v8` followed by the 13 -> 14 upgrade, with
|
||||||
|
`--tuning FILE` (region size must match) and an optional `--current-seed`; resumable and
|
||||||
|
idempotent at bundle 14. DEV mounts the tuning file into the provision Job as a generated
|
||||||
|
ConfigMap.
|
||||||
|
|
||||||
|
**Session v13.** v12 plus liquid motion in the owner's perception (velocity, heading and
|
||||||
|
the current configuration), deposit world velocities and a brake on cellular actions. See
|
||||||
|
[schemas/network/session-v13-cellular-liquid.md](../../schemas/network/session-v13-cellular-liquid.md).
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
DEV region 10 (60 x 60 mm) replaces region 9 as the served region; regions 1-9 stay stored.
|
||||||
|
The v13 client draws currents and carries bubbles between perceptions. Remaining from the
|
||||||
|
plan: client-side prediction of the owner's motion with the shared step, the thermal map
|
||||||
|
(phase 3), movement mutations (phase 4), wildlife that plans with inertia (phase 5), logout
|
||||||
|
and region capacity (phase 6), and live retuning without reopening a region.
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
# ADR-0179: Cellular gameplay revamp
|
||||||
|
|
||||||
|
## Status and scope
|
||||||
|
|
||||||
|
Accepted product direction, 2026-10-22, from the maintainer's decisions in chat.
|
||||||
|
Implementation pending; see the [build plan](../../Cellular_Revamp_Build_Plan.md).
|
||||||
|
New rules (13) only: historical rules, checkpoints, tests and running worlds keep their
|
||||||
|
meanings. Every number is a trial value in the Git tuning file. DEV-only; no World0
|
||||||
|
operation.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
Playtests of rules 11-12 showed that reproduction had no purpose for the player and
|
||||||
|
that mutations were uniform draws over 32 generic operators unrelated to play. The
|
||||||
|
maintainer reviewed the cellular drafts (movement, feeding, energy and photosynthesis,
|
||||||
|
defense, the 150-entry mutation catalog) and settled each gameplay system in turn.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
The system plans are the decision. In summary:
|
||||||
|
|
||||||
|
- **Mutations** ([plan](../../Cellular_mutation_plan.md)): a named catalog of 49 with a
|
||||||
|
pro and a con each. Per-cell affinity scores, raised and lowered by behaviour
|
||||||
|
triggers, inherited and never drifting, set each mutation's chance of appearing in
|
||||||
|
an offer between a 0.001% floor and a 70% cap. Three distinct options per offer by a
|
||||||
|
seeded draw that honors those chances. Per-mutation tunable cost, reclaimed by the
|
||||||
|
region as random bubbles.
|
||||||
|
- **Reproduction** ([plan](../../Cellular_reproduction_plan.md)): on-demand buds with a
|
||||||
|
stay-or-become choice; accepting a mutation splits the cell, both halves carry the
|
||||||
|
mutation in their heritable plan, only the offspring expresses it, and the player
|
||||||
|
chooses which cell to continue as. Litter gives up to 10 offspring per bud. Adhesion
|
||||||
|
forms a multicellular organism (one genome, one reserve) whose goal is emergence.
|
||||||
|
- **Feeding and energy** ([plan](../../Cellular_feeding_energy_plan.md)): per-channel
|
||||||
|
collection rates; reserve matter stands in for energy at a worse rate; burned matter
|
||||||
|
goes to a region spent pool that drips back as bubbles; reserve matter counts toward
|
||||||
|
mass for movement.
|
||||||
|
- **Predation and defense** ([plan](../../Cellular_predation_defense_plan.md)): instant
|
||||||
|
engulfment for everyone, with engulf capacity and membrane points; a kill's remainder
|
||||||
|
is split between bubbles and the spent pool. Armor and live capture are postponed.
|
||||||
|
- **Body and maintenance** ([plan](../../Cellular_body_maintenance_plan.md)): size,
|
||||||
|
density, a heritable body recipe, upkeep efficiency above an essential floor, growth
|
||||||
|
speed and bud share.
|
||||||
|
- **Postponed:** temperature, sensing, multicellular mutations, damage, draft groups
|
||||||
|
071-150.
|
||||||
|
|
||||||
|
## Conflicts with locked requirements (resolved 2026-10-23)
|
||||||
|
|
||||||
|
The project vision is the product authority. The maintainer settled both conflicts:
|
||||||
|
|
||||||
|
1. **Whole-organism mutations: accepted.** The vision's structural-inheritance rule now
|
||||||
|
applies to single cells. A multicellular organism, one body grown from many cells,
|
||||||
|
expresses an accepted mutation as a whole, funded from its shared reserve
|
||||||
|
([PROJECT_VISION.md](../PROJECT_VISION.md) amended).
|
||||||
|
2. **Emergence before the 3D world: accepted.** Emerge records the organism's matter as
|
||||||
|
an export from the region and ends the cellular life with an "emerged" outcome; the
|
||||||
|
player then starts a fresh life. This lets the full cellular loop be played several
|
||||||
|
times before work on the 3D space.
|
||||||
|
|
||||||
|
## Durable form (2026-10-26)
|
||||||
|
|
||||||
|
- **Bundle 15** `{13, 11, 2, 1, 1, 7, 6, 2, 1}`: rules 13 on owner format 11, development 7,
|
||||||
|
founder 6, raw trace 4. Schema 60 admits it raw-only, as bundle 14 is: the manifest, births
|
||||||
|
and profile-migration parsers normalize it to bundle 14; a bundle-15 trace selection's byte
|
||||||
|
34 is its become flag; mutation results 0-6 (an organism's applied, life died, insufficient
|
||||||
|
funding, declined, split applied, split refused); the action input's become, emerge and
|
||||||
|
exclusion bits.
|
||||||
|
- **Opening `cellular-v10`.** `cellular-v9` followed by the durable 14 -> 15 revamp upgrade,
|
||||||
|
with `--revamp-tuning FILE` (the Git revamp tuning file); resumable and idempotent at bundle
|
||||||
|
15. Recovery re-derives the target from the source and the rules it declares.
|
||||||
|
- **Session v14.** See
|
||||||
|
[schemas/network/session-v14-cellular-revamp.md](../../schemas/network/session-v14-cellular-revamp.md).
|
||||||
|
|
||||||
|
## Alternatives
|
||||||
|
|
||||||
|
- Keep the generic operator catalog and add weights (ADR-0135's rules-7 proposal):
|
||||||
|
rejected; operators carried no pro or con and no behaviour link.
|
||||||
|
- Burning matter into energy through bound chemical potential (feeding draft):
|
||||||
|
rejected as a new hidden resource; matter instead stands in for energy, so no energy
|
||||||
|
is created.
|
||||||
|
- Colonies of separate cells (ADR-0135 rules 8-9): replaced by one organism with one
|
||||||
|
genome and one reserve.
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
- Benefits: reproduction drives evolution; mutations follow play; more variation
|
||||||
|
between lives; a defined path toward emergence.
|
||||||
|
- Costs: genome schema 7 with many new fields, a new owner format, session protocol
|
||||||
|
and client screens; 49 triggers' counters per cell.
|
||||||
|
- Risks: matter-as-energy may make starvation rare; the energy-kept rule cuts founder
|
||||||
|
income to 40% unless bubble energy is retuned; one deploy at the end of the build.
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# ADR-0180: Opt-in starting wildlife for disposable playtests
|
||||||
|
|
||||||
|
Accepted scoped experiment, 2026-10-26, requested by the maintainer in chat.
|
||||||
|
|
||||||
|
The vision requires player-origin lineages. Random founding wildlife conflicts with
|
||||||
|
that rule. Resolve this only for explicitly opted-in disposable DEV openings; this
|
||||||
|
does not change the product rule or authorize a World0 operation.
|
||||||
|
|
||||||
|
The optional revamp tuning key `playtest.starting_wildlife_cells` defaults to zero
|
||||||
|
and accepts 0–255, below the region's organism cap. Provisioning a nonzero count
|
||||||
|
also requires `--playtest-wildlife-first-id`, an operator-audited unused identity
|
||||||
|
range below `--life-allocator-start`. As with ADR-0123, the operator owns the
|
||||||
|
world-wide identity audit. Never use this range in another region or restored branch
|
||||||
|
of the same world. The DEV example reserves 900000003584–900000003615 for region 14.
|
||||||
|
|
||||||
|
Seeding is an explicit input to the bundle 14 -> 15 opening upgrade. It requires an
|
||||||
|
empty region at tick 1, spends nursery resources including construction heat, and
|
||||||
|
fails atomically on inadequate funding or placement. Roots are unowned test
|
||||||
|
organisms, with no fabricated player ancestry. Each begins fully grown, undamaged,
|
||||||
|
with zero spare matter and 30 seconds of full demand as energy, using the same
|
||||||
|
founder provisioning formula as players. Genome variation uses seeded, bounded
|
||||||
|
reference indices around the founder, with no acquired modules or free mutations.
|
||||||
|
|
||||||
|
The existing format-11 archive and organism records store the entire result.
|
||||||
|
Recovery first tries the historical upgrade, then, only for an empty tick-1 source,
|
||||||
|
reconstructs the fixture from the target's count and first identity and requires
|
||||||
|
byte equality. No per-tick rule, checkpoint encoding, wire version or golden
|
||||||
|
changes. Older readers can decode these checkpoints but cannot qualify this new
|
||||||
|
opening operation; retain the writing build. Existing non-fixture upgrades retain
|
||||||
|
their exact meaning. Restart and repeated provision never replenish wildlife.
|
||||||
|
|
||||||
|
Alternatives: silently seed product worlds (violates the vision); inject on every
|
||||||
|
worker start (duplicates stock and breaks history); add a general administrator
|
||||||
|
spawn protocol (unnecessary scope). Costs: an explicit exception to the no-biology
|
||||||
|
upgrade convention, extra replay qualification, and finite nursery consumption.
|
||||||
|
This is fixture coverage, not ecological balance or production qualification.
|
||||||
|
|
||||||
|
The Bud HUD consumes the server's current offspring-plan cost plus the configured
|
||||||
|
fee. Internal-cell litter displays a conservative maximum because its random draw
|
||||||
|
occurs at action time. No new simulation or wire version is needed for correcting
|
||||||
|
this derived presentation. Growth and fee changes remain new-region trial inputs.
|
||||||
@@ -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.
|
||||||
@@ -0,0 +1,473 @@
|
|||||||
|
# ADR-0182: Admin portal, world tuning in SQL and per-tick amendments
|
||||||
|
|
||||||
|
## Status and scope
|
||||||
|
|
||||||
|
Accepted direction, 2026-10-27, from the maintainer's decisions in chat; delivered in parts
|
||||||
|
(sections 8-13). DEV (world 100) only; stage and World0 need their own review. Supersedes, for
|
||||||
|
rules-13 regions, ADR-0181's "Git tuning affects future openings only. No live retune": since
|
||||||
|
schema 66 (section 13) a running rules-13 region adopts tuning revisions at recorded ticks.
|
||||||
|
Regions on older rules keep their recorded rules.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
Every balance change so far has meant a Git tuning edit, a new image or ConfigMap and a new
|
||||||
|
DEV region (regions 14, 15 and 16 in a week). The maintainer wants an admin portal to review
|
||||||
|
accounts, act on regions and tune the cellular game while it runs. This is a game, not a
|
||||||
|
pure simulation: designer-controlled resource sources are acceptable when they are named and
|
||||||
|
counted.
|
||||||
|
|
||||||
|
The constraint is determinism. A region's history must replay to the same state, so nothing
|
||||||
|
may change a running region except an event recorded at a tick.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
### 1. World tuning lives in SQL
|
||||||
|
|
||||||
|
- Schema 63 adds append-only `world_tuning_revisions(world, revision, parent_revision,
|
||||||
|
format, canonical_text, digest, author_subject, reason, created_at)`. A revision is the
|
||||||
|
complete canonical tuning text (`encode_cellular_revamp_tuning`), never a diff, so the
|
||||||
|
existing parser and validator are the only interpretation.
|
||||||
|
- All regions of a world share its tuning and mutation definitions (maintainer decision).
|
||||||
|
Per-region values are not offered.
|
||||||
|
- Revisions are immutable. Undo is a new revision whose text equals an earlier one.
|
||||||
|
- Git keeps the seed file for creating a world and the test fixtures. It is not consulted
|
||||||
|
by a running region, and Argo no longer carries tuning for regions on the new format.
|
||||||
|
|
||||||
|
### 2. Amendments are recorded per tick
|
||||||
|
|
||||||
|
- A region polls for a newer world revision on its existing database connection, bounded
|
||||||
|
and off the tick path (at most once a second).
|
||||||
|
- It validates the revision with its own parser. If it can parse it, it adopts it at its next
|
||||||
|
tick boundary and records `tuning_adopted(revision, digest)` at that tick in its own
|
||||||
|
history, published with that tick. If it cannot, for example because the revision uses
|
||||||
|
keys its image does not know, it keeps its current revision and reports `tuning_refused`
|
||||||
|
with the revision number. The portal shows each region's adopted revision.
|
||||||
|
- Replay and recovery read the recorded revision by number and digest, never "the latest".
|
||||||
|
- Amendments change future calculations only. Heritable values already in a genome are not
|
||||||
|
rewritten (for example, a new `mutation.min_points` does not change existing traits).
|
||||||
|
- Every tuning key is classified **live** or **opening-only**. Opening-only keys (geometry
|
||||||
|
and size, tick rate, world/frame, liquid profile structure) can be revised, but a running
|
||||||
|
region ignores them and the portal labels them "next opening".
|
||||||
|
|
||||||
|
### 3. Admin commands
|
||||||
|
|
||||||
|
- Schema 63 adds `admin_commands(world, region, command_id, kind, payload, author_subject,
|
||||||
|
reason, created_at, applied_tick, outcome)`. The admin API inserts and the region host
|
||||||
|
drains them at tick boundaries in id order, publishing each with that tick. This is the
|
||||||
|
same pattern as the durable mutation queue (schema 59).
|
||||||
|
- Kinds:
|
||||||
|
- `kill_cell(life)`: the cell dies with an "admin" outcome. Its body and reserve go to
|
||||||
|
the spent pool and drip back.
|
||||||
|
- `grant_reserve(life, inventory)`: a **game-source import** into that cell's reserve.
|
||||||
|
- `add_region_bubbles(inventory, count)`: a game-source import as bubbles at random
|
||||||
|
spots, at most the region's bubble limit per tick; the rest follows on later ticks.
|
||||||
|
- `add_pool(inventory)`: a game-source import into the spent pool.
|
||||||
|
- `release_pool(inventory)`: moves pool matter into the region through the drip settings
|
||||||
|
below, so a large release is spread over drips, never one tick.
|
||||||
|
- **Game source** is a named import in the region's accounting, like emergence is a named
|
||||||
|
export. Conservation still holds: every unit is either from the starting stock, imported
|
||||||
|
by a recorded source or exported by a recorded sink.
|
||||||
|
|
||||||
|
### 4. Drip and source settings
|
||||||
|
|
||||||
|
The spent-pool drip (today: interval, largest energy bubble, largest matter bubble per
|
||||||
|
channel) becomes one settings group used by both the pool drip and the game-source spawn:
|
||||||
|
|
||||||
|
| Setting | Meaning |
|
||||||
|
|---|---|
|
||||||
|
| `drip.interval_ticks` | how often a drip happens (0: never) |
|
||||||
|
| `drip.bubbles_per_drip` | the most bubbles one drip creates |
|
||||||
|
| `drip.bubble_max.<channel>` | the most of that channel one bubble may carry (energy pj; carbon, nitrogen, phosphorus, other fg) |
|
||||||
|
| `drip.scale_percent.<channel>` | per channel, how much faster or slower that channel is released |
|
||||||
|
| `source.per_drip.<channel>` | game-source import per drip and channel (0: none) |
|
||||||
|
|
||||||
|
For the pool, scale changes how quickly the pool drains; it never releases more than the
|
||||||
|
pool holds. For the source, scale multiplies the import.
|
||||||
|
|
||||||
|
### 5. Data-defined mutations
|
||||||
|
|
||||||
|
- Mutation definitions move from the compiled catalog into the world revision:
|
||||||
|
`mutation.<key>.*` gains the definition itself (name, description, effect, primary and
|
||||||
|
paired traits, steps, costs, triggers and requirements), not only overrides.
|
||||||
|
- A definition may use only effects, traits, triggers and requirement predicates the image
|
||||||
|
implements. Requirements come from a fixed predicate set (carbon burned, buds made, a
|
||||||
|
trait at or above a value, a mutation held). New behaviour needs code and a new image;
|
||||||
|
the region then refuses revisions using it until promoted.
|
||||||
|
- The per-cell affinity scores become a vector keyed by mutation id. New entries start at
|
||||||
|
zero. This is part of the new owner format.
|
||||||
|
- Mutations are never deleted from a running world. `enabled = 0` stops new offers;
|
||||||
|
applied mutations stay applied because their effect already changed the genome.
|
||||||
|
Replacement is disable plus a new definition.
|
||||||
|
- Session protocol: the client receives definitions (name, description, costs) instead of
|
||||||
|
using compiled names.
|
||||||
|
|
||||||
|
### 6. Accounts
|
||||||
|
|
||||||
|
- **Status**: logged in (an open session interval), banned, alive or dead, the region of
|
||||||
|
the active life, and current mutations (applied mutation results along the life's line).
|
||||||
|
- **Ban**: `account_bans(account, author_subject, reason, created_at, lifted_at)`. The grant
|
||||||
|
broker refuses a banned account (`403 account_banned`) and the ban runs the existing
|
||||||
|
logout (`revoke_account_grants`), so a live session closes within 5 s.
|
||||||
|
- **Log out**: the existing `revoke_account_grants`.
|
||||||
|
- **Grant resource**: `grant_reserve` against the account's active life.
|
||||||
|
- **Death count**: the account's lives with a death outcome.
|
||||||
|
- **Reset count**: the account's founder births after its first (a new life after death).
|
||||||
|
- **Living offspring**: living wildlife descended from any of the account's lives, using
|
||||||
|
the parent links kept since format 5.
|
||||||
|
- **Time played**: `session_intervals(account, region, started_at, ended_at)` written by the
|
||||||
|
region host on session open and close. Intervals still open at a region start are closed
|
||||||
|
at that start. History begins with this schema; earlier play is not recoverable.
|
||||||
|
|
||||||
|
### 7. Admin API and portal
|
||||||
|
|
||||||
|
- `evo-admin-api`: a C++ service built like the grant broker. It verifies Keycloak access
|
||||||
|
tokens against the realm keys pinned in Git, requires audience `aevolution-admin`,
|
||||||
|
authorized party `aevolution-admin-portal` and realm role `aevolution-admin`, and serves
|
||||||
|
one configured world. Its component exists only in the evolution-dev overlay; World0 and
|
||||||
|
stage have no admin portal (World0 has no fixed world id to refuse in code).
|
||||||
|
- Every write records the token subject and a reason.
|
||||||
|
- The region view: the region host's internal ops port gains a bounded snapshot route (cell
|
||||||
|
id, position, extent, wildlife/player and account, bubbles), reachable only from the admin
|
||||||
|
API by NetworkPolicy. The admin API serves it to the portal at up to 1 Hz.
|
||||||
|
- The portal is a static browser application at `https://srs.aeternalisgames.com`
|
||||||
|
(section **Cellular** now, **3D** later) using authorization code with PKCE. It is plain
|
||||||
|
HTML, CSS and JavaScript with no third-party code, so no dependency evaluation is needed.
|
||||||
|
- Keycloak (maintainer setup): realm role `aevolution-admin`; public client
|
||||||
|
`aevolution-admin-portal` with standard flow and PKCE S256, redirect URI
|
||||||
|
`https://srs.aeternalisgames.com/*`, web origin `https://srs.aeternalisgames.com` and
|
||||||
|
post-logout redirect `https://srs.aeternalisgames.com/`; an audience mapper adding
|
||||||
|
`aevolution-admin`; MFA required for the role.
|
||||||
|
|
||||||
|
### 8. Read-only portal (delivered first, schema 61)
|
||||||
|
|
||||||
|
- **Schema 61** adds three bounded, read-only SECURITY DEFINER functions, executable by the
|
||||||
|
runtime group and listed in the privilege audit: `admin_accounts_v1(world)` (every account
|
||||||
|
with its identity, session control, lives, deaths, active life and mutation-choice count),
|
||||||
|
`admin_account_lives_v1(world, account)` (its life requests and endings) and
|
||||||
|
`admin_regions_v1(world)` (leases and heads). No table or existing function changes. The
|
||||||
|
runtime group still has no table privilege. DEV's admin API logs in with its own login in
|
||||||
|
that group, as the grant broker does; a dedicated read role is a later least-privilege step.
|
||||||
|
- **Derived values.** A life is a published, unrefused reservation; a death is an ended one;
|
||||||
|
resets are lives after the first; logged in means the session control has not expired.
|
||||||
|
- **Region view.** `GET /admin/view` on the cellular region's ops port renders the committed
|
||||||
|
in-memory owner (`render_cellular_admin_view`): every cell (life and organism ids as
|
||||||
|
strings, account, footprint, extent, wildlife/connected/lingering/suspended flags,
|
||||||
|
members, reserve, body mass) and every pool and bubble, bounded to 4,096 cells and 16,384
|
||||||
|
deposits with totals. It reads without changing anything; the ops server's response
|
||||||
|
bound becomes configurable (4 MiB for this port), default 16 KiB elsewhere.
|
||||||
|
- **Portal files and headers.** The image ships the portal under
|
||||||
|
`/usr/local/share/evo-admin-portal`. Files go out with a strict Content-Security-Policy
|
||||||
|
(`'self'` scripts and styles, connections only to this origin and the realm), `nosniff`,
|
||||||
|
`no-referrer` and `DENY` framing; every answer is `no-store`. The access token stays in
|
||||||
|
page memory and the rotating refresh token in the tab's sessionStorage.
|
||||||
|
- **Not yet available** (they need the schema-63 records): time played, bans, current
|
||||||
|
mutations and living offspring.
|
||||||
|
|
||||||
|
### 9. Session windows and the admin role (schema 62)
|
||||||
|
|
||||||
|
The dev session window moves from Git to SQL and is opened, extended and closed from the
|
||||||
|
portal; see the [ADR-0087 amendment](0087-dev-session-route.md). Schema 62 also moves the
|
||||||
|
admin functions to a dedicated, operator-created NOLOGIN group role (`aevolution_admin` in
|
||||||
|
DEV, `EVO_PG_ADMIN_ROLE` for the migration): every migration run grants it exactly the admin
|
||||||
|
functions and audits it like the runtime group (no table privilege, no privileged
|
||||||
|
attribute, no membership outside it, not the runtime role). Schema 61's read views are
|
||||||
|
revoked from the runtime group. The admin API logs in with its own login in that group.
|
||||||
|
Writes go through POST without a body (`?minutes=M&reason=R`); the bearer token in the
|
||||||
|
`Authorization` header, never a cookie, is the only credential.
|
||||||
|
|
||||||
|
### 10. Admin commands (delivered, schema 63, trace 5)
|
||||||
|
|
||||||
|
The commands of section 3 are delivered without a new owner format or region opening:
|
||||||
|
|
||||||
|
- **Trace 5.** A rules-13 batch may record operator commands: trace 4 plus 64-byte records
|
||||||
|
(id, kind, count, target, energy and four matter amounts) counted in the tick header's last
|
||||||
|
word, which trace 4 keeps zero. A batch without commands stays trace 4, so builds before
|
||||||
|
this one still replay it; only commits that carry commands need this build or later.
|
||||||
|
Bundle 15 admits trace 5 (`cellular_checkpoint_trace_admits`); the manifest is unchanged.
|
||||||
|
- **Application.** `CellularLives::admin_candidate` applies a tick's commands after its
|
||||||
|
births, by ascending id, each on a copy kept only if it applies and still closes:
|
||||||
|
`remove_cell` (body and reserve to the spent pool, a corpse with the new `removed` cause;
|
||||||
|
a player's life then ends as any death does), `grant_reserve`, `add_bubbles` and
|
||||||
|
`add_pool` (imports in the boundary ledger), `release_pool` (moves at most what the pool
|
||||||
|
holds into bubbles) and `spawn_wildlife` (1-64 randomized founder roots, the ADR-0180 seed
|
||||||
|
with an exact import for their reserve, body and construction). A command whose target is
|
||||||
|
gone, or that does not fit (region cap, deposit limit, a taken identity), is refused and
|
||||||
|
changes nothing.
|
||||||
|
- **Queue and binding.** `admin_enqueue_command_v1` (admin role) stores the exact command;
|
||||||
|
spawning reserves its identities from the world's life allocator. The region reads
|
||||||
|
`load_pending_admin_commands_v1` every 2 s and appends up to 16 per tick. Both cellular
|
||||||
|
publishers bind every recorded command to its queue row exactly once, in the publishing
|
||||||
|
transaction; a differing or already-applied command refuses the publication. The SQL trace
|
||||||
|
parsers read a trace 5 through its trace-4 normal form, after binding the real trace to
|
||||||
|
the manifest.
|
||||||
|
- **Portal.** Region actions (spawn wildlife, add bubbles, add to or release the spent pool),
|
||||||
|
per-cell Remove and Grant reserve, and the command history with the tick each applied at.
|
||||||
|
Amounts are entered in µJ and ng.
|
||||||
|
|
||||||
|
### 11. Account administration (delivered, schema 64)
|
||||||
|
|
||||||
|
- **Bans.** Append-only `account_bans` rows; the newest per account decides. A banned
|
||||||
|
account's grant request fails with SQLSTATE EVL20 (the broker answers 403
|
||||||
|
`account_banned`), and banning also revokes its grants, so a live session closes at its
|
||||||
|
next control renewal. Lifting a ban is another row.
|
||||||
|
- **Logout.** `admin_logout_account_v1` revokes by account id, as the player's own logout
|
||||||
|
does by Keycloak identity.
|
||||||
|
- **Time played.** The session-control functions keep their signatures and also record
|
||||||
|
`session_intervals`: a claim opens one, a renewal moves its last-seen time, a release ends
|
||||||
|
it; an unreleased session ends at its last renewal. History starts with schema 64.
|
||||||
|
- **Living offspring.** The region view adds each cell's lineage root; the portal counts
|
||||||
|
living wildlife whose root is one of the account's lives.
|
||||||
|
|
||||||
|
### 12. Resource schedules (delivered, schema 65)
|
||||||
|
|
||||||
|
The game source of section 4 without a new owner format: a schedule repeats an
|
||||||
|
`add_bubbles`, `release_pool` or `spawn_wildlife` command (count, amounts per resource)
|
||||||
|
every 1 s to 24 h while enabled. When the region reads its pending commands, each due
|
||||||
|
schedule queues its next command as an operator would, so it is recorded in the trace and
|
||||||
|
bound once; a schedule never has two commands waiting, so an idle region (no living cells,
|
||||||
|
no ticks) accumulates nothing. Versions are append-only; the newest decides.
|
||||||
|
|
||||||
|
The spent pool's own drip (interval, bubble caps, bubbles per drip, per-channel scale) is a
|
||||||
|
rules setting and stays with the tuning amendments.
|
||||||
|
|
||||||
|
### 13. Tuning amendments (delivered, schema 66)
|
||||||
|
|
||||||
|
Sections 1-2 are delivered without a new owner format or opening, so running rules-13 regions
|
||||||
|
(region 16 included) can be retuned:
|
||||||
|
|
||||||
|
- **Revisions.** Append-only `tuning_revisions(revision, world, text, rules_sha256, author,
|
||||||
|
reason, created_at)`. The text is the Git revamp tuning file format, kept as the admin wrote
|
||||||
|
it (comments included); `rules_sha256` is the SHA-256 of `encode_cellular_revamp_rules` for
|
||||||
|
the rules it produces, the same canonical bytes the owner snapshot stores. The admin API
|
||||||
|
parses and validates the text (`parse_cellular_revamp_tuning`, `cellular_revamp_rules`,
|
||||||
|
`cellular_revamp_valid`) before storing it, and `admin_set_tuning_v1` queues the adoption
|
||||||
|
in every region of the world in the same transaction.
|
||||||
|
- **Adoption is an admin command.** Kind 7 `adopt_tuning` carries the revision as its target
|
||||||
|
and the rules digest in its four amount words (little-endian; `other` zero). It is queued
|
||||||
|
only through a revision, never by kind. The region fetches the revision's text
|
||||||
|
(`load_tuning_revision_v1`), rebuilds the rules with its own parser and appends the command
|
||||||
|
only when the digest matches; a text it cannot parse or a mismatch is logged and the command
|
||||||
|
stays pending (section 2's `tuning_refused`). Applied at a tick after births, the command
|
||||||
|
replaces the region's rules; it is recorded in trace 5 and bound once like any command.
|
||||||
|
- **Replay and recovery.** Applying or replaying an adoption needs whoever does it to name
|
||||||
|
the rules for that revision and digest (`CellularTuningResolver`): the host from its
|
||||||
|
verified revisions, the publisher and recovery from the successor state, checked against
|
||||||
|
the recorded digest. A batch carries at most one adoption, so its successor names exactly
|
||||||
|
one set of rules. Nothing reads "the latest" revision.
|
||||||
|
- **What cannot change live.** `reproduction.safety_version` is a law of the opening
|
||||||
|
(ADR-0181): the admin API refuses a text that changes it, and a region would refuse the
|
||||||
|
command. `playtest.*` only matters when a region opens. Heritable values already in genomes
|
||||||
|
are not rewritten.
|
||||||
|
- **Portal.** A Tuning page: the editor starts from the newest revision or the baseline file
|
||||||
|
the regions opened with (`--baseline-tuning`, the mounted Git revamp file), Check reports
|
||||||
|
the line, key and kind of a problem, Adopt stores the revision with a reason, the revision
|
||||||
|
list shows how many regions adopted each, and each region shows which revision its live
|
||||||
|
rules match (`rules_sha256` in the region view).
|
||||||
|
- **Guided editor (2026-10-28).** The Tuning page edits by section: each setting as a field
|
||||||
|
with its unit, a reading in plain units and its comment, changed values listed against the
|
||||||
|
base. `POST /api/tuning?base=baseline|REV` takes only the changed `key = value` lines and
|
||||||
|
applies them to the baseline file or to revision REV, which must be the newest (409
|
||||||
|
`stale_base` otherwise), keeping the base's comments; the result is checked and stored as
|
||||||
|
any full text. DEV's ingress admits request bodies of about 1 KB, below a whole revamp
|
||||||
|
file, so the full-text editor (kept as Text mode) reports that proxy refusal plainly.
|
||||||
|
- **Region page (2026-10-28).** The region view also carries the rules-13 drip
|
||||||
|
(`drip`: interval, energy and matter bubble caps) and, over every life and deposit whatever
|
||||||
|
the listing limits, `counts` (players, wildlife, patches, pools, bubbles) and `totals`
|
||||||
|
(reserve, body, patch, pool and bubble stock). The region page shows where the region's
|
||||||
|
stock sits, the spent pool with each channel's next drip and time to empty, a countdown to
|
||||||
|
the next drip at the measured tick pace, the deposit capacity (8,192) and whether the tick
|
||||||
|
is advancing. Its Tuning tab lists the settings the region runs (the matching revision or
|
||||||
|
baseline text) and the region tuning file (`--region-tuning`, the mounted `cellular.tuning`,
|
||||||
|
read only). The portal has light and dark themes.
|
||||||
|
|
||||||
|
Live today: everything the revamp file holds, including the drip (`spent.drip_interval_ticks`,
|
||||||
|
`spent.drip_bubble_pj`, `spent.drip_bubble_fg`). Section 4's new drip settings (bubbles per
|
||||||
|
drip, per-channel scale) are new rules fields, so they need a rules format change; the
|
||||||
|
resource schedules of section 12 cover the game source meanwhile.
|
||||||
|
|
||||||
|
Still pending from this ADR: section 4's new drip settings,
|
||||||
|
data-defined mutations (section 5) and the account's current mutations; opening new regions
|
||||||
|
or worlds from the portal (a later gate: Git-generated manifests through the Gitea API and an
|
||||||
|
Argo sync for one more region in the world; several concurrent regions or worlds need
|
||||||
|
per-region Deployments, volumes and routes).
|
||||||
|
|
||||||
|
### 14. Energy cycle (delivered 2026-10-28, live-tunable)
|
||||||
|
|
||||||
|
Matter a cell burns returns to the spent pool and drips back; energy it uses (upkeep, motion,
|
||||||
|
growth, mutation rebuilds, the share of a bubble lost in feeding, predation losses) went to the
|
||||||
|
region's heat store and never came back. Light is the only new energy, so a region without
|
||||||
|
photosynthesizers drained into heat: region 16's wildlife ate the region's energy and starved,
|
||||||
|
its spent pool held only matter, and the matter-only bubbles it dripped filled the 8,192
|
||||||
|
deposits.
|
||||||
|
|
||||||
|
- **Heat recycling.** `spent.heat_recycle_per_mille` (rules field `heat_recycle_per_thousand`,
|
||||||
|
0..1,000): at the end of every tick, before the drip, that share of the region's whole heat
|
||||||
|
store moves to the spent pool. 1,000 closes the loop, and adopting it also returns the heat
|
||||||
|
a region built up before. Energy is conserved as before (heat and spent are both region
|
||||||
|
stock). Below 1,000 the heat returns more slowly; nothing is lost.
|
||||||
|
- **Absorbing drip.** `spent.drip_absorb` (0/1): a drip at the deposit limit adds its amount
|
||||||
|
to an existing bubble, the first at or after its seeded spot in address order (wrapping),
|
||||||
|
instead of waiting. A habitat with no bubble at all still waits.
|
||||||
|
- **Encoding.** Both fields use the reserved word after the offer interval (the recycle share
|
||||||
|
in the low 16 bits, the absorbing drip in bit 16), so rules without them keep their exact
|
||||||
|
bytes, digests, checkpoints and replays. Both keys are optional in the tuning file and can be
|
||||||
|
adopted live as a tuning revision; the DEV file sets 1,000 and 1.
|
||||||
|
- **View and portal.** The region view reports `heat` and the drip's recycle share and absorb
|
||||||
|
flag; the region page counts heat in the region's energy and its ledger, and says when energy
|
||||||
|
is being lost as heat.
|
||||||
|
|
||||||
|
Not changed: a region with no living cell does not tick, so it neither recycles nor drips; an
|
||||||
|
empty region needs a spawn or a player before the cycle restarts.
|
||||||
|
|
||||||
|
### 15. Opening a region from the portal (delivered 2026-10-28, DEV)
|
||||||
|
|
||||||
|
The portal opens a fresh region in place of the one DEV serves, as was done by hand for
|
||||||
|
regions 14, 15 and 16. Concurrent regions and new worlds remain later work (per-region
|
||||||
|
Deployments, routes and ports; a multi-world admin API and broker).
|
||||||
|
|
||||||
|
- **Decisions (2026-10-28).** Replace the served region; commit straight to `main` and run a
|
||||||
|
full Argo sync at once (CI runs on the commit afterwards); the admin portal pod may reach
|
||||||
|
Gitea and argocd-server; the in-cluster Argo hop may skip TLS verification
|
||||||
|
(`ARGOCD_TLS_VERIFY=false`).
|
||||||
|
- **Credentials.** Secret `aevolution-admin` (created by the operator: Gitea base URL,
|
||||||
|
repository and repository-scoped token for `aevolution-bot`; Argo CD server, Application and
|
||||||
|
token) is mounted read-only as files at `/run/deploy` (`--deploy-config`), never as
|
||||||
|
environment; optional, so the portal runs without it and the feature stays off. Tokens travel
|
||||||
|
only in request headers and are never logged.
|
||||||
|
- **The change.** Four files, read at one commit of `main` with their blob shas
|
||||||
|
(`region_switch_paths`): the region overlay's `region-values.yaml` (REGION_ID for the
|
||||||
|
Deployment and the provision Job, REGION_LIFE_ROUTES, the opening's `--commit` and
|
||||||
|
`--playtest-wildlife-first-id`, and a one-line note above the opening), its kustomization
|
||||||
|
header, and the region named in the grant broker's routes and the portal's `ADMIN_REGIONS`.
|
||||||
|
Nothing else changes; a file whose expected lines are missing, repeated or inconsistent is
|
||||||
|
refused. The next region is one above every region with a lease in the world; its seeded
|
||||||
|
wildlife range follows the previous one by `playtest.starting_wildlife_cells`; its genesis
|
||||||
|
commit is 16 random bytes. One Gitea multi-file commit (the shas guard concurrent edits),
|
||||||
|
then `POST /api/v1/applications/<app>/sync` for exactly that commit with prune: the
|
||||||
|
provision hook opens the region before the region host restarts on it.
|
||||||
|
- **Guards.** The request names the region the portal showed (409 if another is next now);
|
||||||
|
a running Argo operation refuses (409); the portal asks the admin to type the number. The
|
||||||
|
earlier region stays in the stores, unserved; a new region's session window starts closed.
|
||||||
|
- **Network.** The portal's NetworkPolicy adds egress to 172.10.1.160:443 (Gitea through the
|
||||||
|
node's ingress) and to the argocd-server pods on 8080.
|
||||||
|
|
||||||
|
### 16. Testing a full region (delivered 2026-10-28, schema 67)
|
||||||
|
|
||||||
|
Playtesting region 16 (230 spawned wildlife under the 256-life cap) found three gaps.
|
||||||
|
|
||||||
|
- **Stale bud costs.** The region host caches each genome's bud cost for the client's Bud
|
||||||
|
button. The cache was keyed by genome only, so after a tuning adoption players saw the old
|
||||||
|
cost (or "cannot bud") until the region restarted. The cache now clears when the rules'
|
||||||
|
encoding changes.
|
||||||
|
- **Wildlife cap.** Wildlife bud whenever they can pay, so at the organism cap every slot a
|
||||||
|
death freed went to a wildlife bud before a player's bud arrived; the player saw "no space".
|
||||||
|
`reproduction.wildlife_cap` (rules field `wildlife_cap`, 0..organism cap, 0 = the organism
|
||||||
|
cap) refuses buds of a parent without an account at that many lives, keeping the slots above
|
||||||
|
it for players. Spawning still answers to the organism cap. It takes bits 17-31 of the
|
||||||
|
word holding the energy cycle (section 14), so rules without it keep their bytes and digests;
|
||||||
|
the key is optional, adoptable live, and the DEV file sets 200. The region view reports
|
||||||
|
both caps (`caps`), and the region page's Population shows lives against the cap.
|
||||||
|
- **Take and cull.** Two admin command kinds: `take_reserve` (8) moves up to the given amounts
|
||||||
|
from one life's reserve to the spent pool, per channel never more than it holds (the inverse
|
||||||
|
of `grant_reserve`); `remove_wildlife` (9) removes every life without an account in one
|
||||||
|
command, each as `remove_cell` does (body and reserve to the spent pool, a removed corpse).
|
||||||
|
Schema 67 widens the kind check and `admin_enqueue_command_v1`. The portal adds Take reserve
|
||||||
|
to the cell inspector, Remove all wildlife to Actions, and marking on the map (shift+click,
|
||||||
|
shift+drag a box) to remove the marked cells, one `remove_cell` each.
|
||||||
|
|
||||||
|
The organism cap itself is section 17.
|
||||||
|
|
||||||
|
### 17. Larger region ticks for testing (delivered 2026-10-28, schema 68)
|
||||||
|
|
||||||
|
The region/movement plan set a 2,000-organism region cap, but the rules-12 key it became
|
||||||
|
(`region.organism_cap`) was parsed and never enforced. The real bound was the engine's
|
||||||
|
`max_cellular_tick_lives = 256`, a per-tick safety bound from ADR-0106 that the batch trace,
|
||||||
|
checkpoints and database trace checks were sized from; rules 13's `reproduction.organism_cap`
|
||||||
|
was capped at it.
|
||||||
|
|
||||||
|
- **Decision (2026-10-28).** The tick bound is 4,096 lives, for testing limits only; regions
|
||||||
|
are not meant to run that many. The DEV tuning file keeps 256.
|
||||||
|
- **Split bound.** `max_cellular_tick_lives` (4,096) bounds the raw region path: the step, the
|
||||||
|
owner state, the batch trace (`cellular_batch_bytes_for`) and current checkpoint traces.
|
||||||
|
`max_cellular_frozen_lives` (256) keeps the formats whose database checks are fixed: cohort
|
||||||
|
populations, population batches, migration traces and pre-v3 cellular traces. Rules 12 and
|
||||||
|
13 never use those paths.
|
||||||
|
- **Tuning.** `reproduction.organism_cap` and `reproduction.wildlife_cap` accept up to 4,096.
|
||||||
|
- **Schema 68.** The trace checker under the current publishers (schema 43's, renamed
|
||||||
|
`cellular_births_v45` by schema 46) accepts up to 4,096 intents, births and mutation choices
|
||||||
|
per tick; `spawn_wildlife` takes up to 256 cells a command (sixteen commands fill a tick).
|
||||||
|
- **Archive.** The lineage archive never forgets: a region stops ticking at 65,536 recorded
|
||||||
|
births or 4,096 genomes. The region view reports both (`archive`) and the portal's
|
||||||
|
Population shows the fuller one, warning at 80%. A crowded region reaches them sooner.
|
||||||
|
- **Not changed.** Performance: region 16 ran at about 5 of 20 ticks per second with about
|
||||||
|
250 lives, so a region near the bound will run far below real time. The client snapshot is
|
||||||
|
budgeted (nearest changes first), so it degrades rather than fails.
|
||||||
|
|
||||||
|
### 18. Ending a stranded life (delivered 2026-10-29, schema 69)
|
||||||
|
|
||||||
|
Region 16 playtest: the region refused every birth for an account with "Existing cell is
|
||||||
|
already bound to this account", although no cell in it held the account. The database refuses
|
||||||
|
a birth while the account has an open life reservation anywhere in the world; this one was
|
||||||
|
published and never ended. How it was left open is not yet known. Until 2026-10-29 the only
|
||||||
|
remedy was `tools/ops/end-account-life.sql` as the database owner.
|
||||||
|
|
||||||
|
- **Account action.** `POST /api/accounts/<uuid>/end-life?request=N[&reason=R]`. The admin API
|
||||||
|
reads the life's region from the account's lives, fetches that region's live view and refuses
|
||||||
|
(409 `life_in_region`) while any listed cell holds the account, including a bud, a split's
|
||||||
|
offspring or an organism that control moved to. It also refuses a region it cannot view, a
|
||||||
|
view that does not list every cell, a request never published (404) and a life no longer open
|
||||||
|
(409 `not_open`).
|
||||||
|
- **Schema 69.** `admin_end_account_life_v1` (admin role only) ends the reservation at the
|
||||||
|
region's latest commit, as `end_cellular_lives` does, and appends who and why to
|
||||||
|
`admin_life_endings` (immutable). Unpublished reservations stay with the region, which still
|
||||||
|
holds them as queued births. Checkpoints and history are unchanged.
|
||||||
|
- **Safety.** If the check were wrong, the region still refuses a birth for an account that holds
|
||||||
|
a cell in its state (`life_exists`), which records an existing-life refusal.
|
||||||
|
- **Existing-life refusals are recorded.** That refusal could never be recorded:
|
||||||
|
`reject_primitive_life` (schema 15) accepted only reasons 1 to 3, and existing_life is 4.
|
||||||
|
The region dropped the birth from its queue but left the reservation open and unpublished,
|
||||||
|
which then refused every later birth for the account. Schema 69 accepts 4, both in the
|
||||||
|
function and in its C++ wrapper.
|
||||||
|
- **Portal.** The account page shows an End life button for each published life that has not
|
||||||
|
ended.
|
||||||
|
- **Idle regions take commands.** A region ticks only while something needs it: a player, a
|
||||||
|
waiting birth, a cell not suspended, or ecological work. A command queued in an empty region,
|
||||||
|
such as a spawn of wildlife, waited until something else woke it. A queued admin command now
|
||||||
|
keeps the region ticking until it is applied.
|
||||||
|
|
||||||
|
## Delivery order
|
||||||
|
|
||||||
|
1. Read-only portal: login, accounts (from existing data), regions, region view (schema 61,
|
||||||
|
section 8).
|
||||||
|
2. Schema 63 and the new owner format: world revisions, adoption records, admin commands,
|
||||||
|
game source, drip settings, the score vector, session intervals and bans. One new
|
||||||
|
opening on that format.
|
||||||
|
3. Admin commands and account actions in the portal.
|
||||||
|
4. Live tuning in the portal.
|
||||||
|
5. Data-defined mutations in the portal.
|
||||||
|
|
||||||
|
## Deferred
|
||||||
|
|
||||||
|
- **Cell migration between regions.** With world-shared tuning and mutations it no longer
|
||||||
|
meets per-region mismatches, but still needs the paired transfer extended to the new
|
||||||
|
format and to player lives, and a client handoff.
|
||||||
|
- **New matter types.** `accounting::Element` has four channels throughout accounting,
|
||||||
|
traits, bubbles, the protocol and the client. A later decision; a fixed number of matter
|
||||||
|
slots is the expected approach.
|
||||||
|
|
||||||
|
## Alternatives
|
||||||
|
|
||||||
|
- **Export portal changes to Git and reopen regions.** Rejected: more steps for the same
|
||||||
|
result, and not live.
|
||||||
|
- **Change values in a running region's memory.** Rejected: replay and recovery would diverge.
|
||||||
|
- **Per-region tuning.** Rejected: all regions of a world share rules.
|
||||||
|
- **Database push instead of polling.** Not needed at one adoption check per second.
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
- Balance changes become data: no image, ConfigMap or region per change.
|
||||||
|
- Balance history moves from Git review to the revision table (author, reason, full text).
|
||||||
|
It is covered by database backups and history domains (ADR-0155).
|
||||||
|
- Argo no longer shows tuning drift for new-format regions; the portal shows each region's
|
||||||
|
adopted revision instead.
|
||||||
|
- One more opening is required, for the new owner format.
|
||||||
@@ -1,5 +1,17 @@
|
|||||||
# Architecture decision records
|
# Architecture decision records
|
||||||
|
|
||||||
|
- [ADR-0182: Admin portal, world tuning in SQL and per-tick amendments](0182-admin-portal-and-world-tuning.md) - accepted direction: world tuning revisions in SQL adopted per tick and recorded in region history, admin commands with a named game source, drip/source settings, data-defined mutations, bans and session intervals, and a Keycloak-gated admin API and portal; the read-only portal (schema 61 read views and the region view) comes first; migration and new matter types deferred.
|
||||||
|
|
||||||
|
- [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.
|
||||||
|
|
||||||
|
- [ADR-0178: Durable liquid regions and session v13](0178-durable-liquid-region.md) - rules 12 on owner format 10 (currents, moving food, liquid motion), raw bundle 14 and schema 58 with a 13 -> 14 upgrade from the Git tuning file, the `cellular-v9` opening and session v13 (motion, currents, brake).
|
||||||
|
|
||||||
|
- [ADR-0177: Cellular regions, world linkage and emergence](0177-cellular-regions-world-linkage.md) - maintainer-accepted direction: regions map to a world area rather than a voxel, currents and the thermal map are conditions not stock, capped regions refuse births, scaled emergence export, protected anchored logout; implementation pending.
|
||||||
|
|
||||||
- [ADR-0176: Durable photosynthesis regions and session v12](0176-durable-photosynthesis-region.md) - schema 57 raw bundle 13 (rules 11, owner format 9) with a light-declaring 12 -> 13 upgrade, the resumable `cellular-v8` opening and session v12 (captured light, visible producers, photosynthesis offers).
|
- [ADR-0176: Durable photosynthesis regions and session v12](0176-durable-photosynthesis-region.md) - schema 57 raw bundle 13 (rules 11, owner format 9) with a light-declaring 12 -> 13 upgrade, the resumable `cellular-v8` opening and session v12 (captured light, visible producers, photosynthesis offers).
|
||||||
|
|
||||||
- [ADR-0175: Photosynthesis producers](0175-photosynthesis-producers.md) - genome schema 5 photosynthesis with trial organelle costs, founder 4/rules 11, light booked by the cell owner (format 9) from recorded intentions, light-aware wildlife; earlier bytes unchanged.
|
- [ADR-0175: Photosynthesis producers](0175-photosynthesis-producers.md) - genome schema 5 photosynthesis with trial organelle costs, founder 4/rules 11, light booked by the cell owner (format 9) from recorded intentions, light-aware wildlife; earlier bytes unchanged.
|
||||||
|
|||||||
@@ -104,3 +104,30 @@ markers and stock cards use copied sensor data only. A final birth refusal permi
|
|||||||
an explicit new request even before a perception arrives; pending/unknown requests
|
an explicit new request even before a perception arrives; pending/unknown requests
|
||||||
retain their ID and an existing-life result waits for that life. These are app
|
retain their ID and an existing-life result waits for that life. These are app
|
||||||
presentation/control policies, not biological rules.
|
presentation/control policies, not biological rules.
|
||||||
|
|
||||||
|
The [2026-10-22 visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md) stays
|
||||||
|
inside the existing native app/toolkit boundary. Its local map consumes replicated
|
||||||
|
observations only; optical liquid shading is not a thermal field. Body temperature,
|
||||||
|
ambient temperature and directional heat guidance remain pending authoritative
|
||||||
|
phase-3 state and a negotiated perception contract. Existing public library and
|
||||||
|
wire interfaces are unchanged.
|
||||||
|
|
||||||
|
The [DEV playtest tuning](../engineering/CELLULAR_PLAYTEST_TUNING.md) Bud control
|
||||||
|
uses the current server-projected charge, including the inherited plan and fee.
|
||||||
|
Insufficient funding disables it, with a hover tooltip listing required and held
|
||||||
|
energy, carbon, nitrogen, phosphorus and other matter. Internal-cell litter shows
|
||||||
|
the maximum possible charge. The server remains authoritative at execution time.
|
||||||
|
|
||||||
|
The cellular HUD cards use client-owned session placement in `FormBuffers`.
|
||||||
|
Only each heading's drag handle moves its card; normalized anchors are retained
|
||||||
|
through redraws, collapse/restore and viewport/scale changes, with on-screen
|
||||||
|
clamping and a double-click reset. Fixed outer dimensions and scrollable bodies
|
||||||
|
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.
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
# 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
|
||||||
|
then retains its recorded rules. Editing the file does not retune an existing
|
||||||
|
region. Open a fresh disposable region for a changed trial. See [ADR-0180](../adr/0180-dev-starting-wildlife.md).
|
||||||
|
|
||||||
|
| Key | Current DEV value | Meaning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `playtest.starting_wildlife_cells` | 32 | Initial random-genome cells; 0 disables; max 255 and below the organism cap. Omission defaults to 0 for older files. |
|
||||||
|
| `body.growth_per_tick_centi_mille` | 625 | 6.25 per thousand per tick at growth speed 100, up from 5: 25% faster when funded. |
|
||||||
|
| `reproduction.bud_fee_e_pj` | 250000 | Additional energy fee per bud action. |
|
||||||
|
| `reproduction.bud_fee_c_fg` | 100000 | Additional carbon fee. |
|
||||||
|
| `reproduction.bud_fee_n_fg` | 30000 | Additional nitrogen fee. |
|
||||||
|
| `reproduction.bud_fee_p_fg` | 10000 | Additional phosphorus fee. |
|
||||||
|
| `reproduction.bud_fee_o_fg` | 60000 | Additional other-matter fee. |
|
||||||
|
| `reproduction.bud_fee_scale_percent` | 100 | Percentage of the listed fee charged; 0 disables it. |
|
||||||
|
|
||||||
|
The fee controls already existed; this change activates and documents them and
|
||||||
|
corrects the displayed cost to include them. Offspring tissue and starting reserve
|
||||||
|
remain funded biological costs. Faster growth spends the same resources in less
|
||||||
|
time; insufficient nutrients can still hold it back.
|
||||||
|
|
||||||
|
The DEV manifest prepares world 100, region 14, with a new stable genesis commit
|
||||||
|
and `--playtest-wildlife-first-id 900000003584` below
|
||||||
|
`--life-allocator-start 1000000000000`. This declares a reserved fixture range;
|
||||||
|
operators must audit its uniqueness across the world's other retained regions.
|
||||||
|
Regions 1–13 remain stored. Counts other than 32 need a correspondingly audited
|
||||||
|
range and enough nursery stock. The fixture spends the nursery rather than
|
||||||
|
minting resources; player founders draw its remainder.
|
||||||
|
|
||||||
|
Each cell uses founder-6 capabilities and full growth, no damage or spare matter,
|
||||||
|
30 seconds of its own full demand as reserve energy, and a seeded genome with
|
||||||
|
75–125-point body, collection, burn, engulfment and movement indices. It has no
|
||||||
|
acquired modules, player account or fabricated ancestry. Randomness is stable
|
||||||
|
for world, region and identity. Normal autonomous wildlife control takes over.
|
||||||
|
Recovery and repeated provisioning retain the saved population, including deaths;
|
||||||
|
they do not top it up.
|
||||||
|
|
||||||
|
Bud uses the current expressed parent and inherited offspring plan, plus the fee;
|
||||||
|
internal-cell litter conservatively shows its largest possible charge. Hover a
|
||||||
|
grey Bud button to inspect every required/available channel. A resource-ready
|
||||||
|
button still submits an intention: growth, placement, regional capacity and
|
||||||
|
changes before execution can affect the authoritative outcome.
|
||||||
|
|
||||||
|
The region-14 configuration requires an image built from this change before
|
||||||
|
manual Argo sync. The currently pinned image is not claimed to support the new
|
||||||
|
opening flag. Build promotion, deployment, live playtesting and identity auditing
|
||||||
|
against production stores were not performed by these local checks. No World0
|
||||||
|
operation is involved.
|
||||||
|
|
||||||
|
Focused durable verification in a new private local PostgreSQL cluster:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bash tools/ci/postgres-check.sh --starting-wildlife-only "$PWD/build/playtest-postgres/evo-postgres-tests"
|
||||||
|
```
|
||||||
@@ -88,7 +88,7 @@ provision a region.
|
|||||||
Sent/admitted are distinct from committed. A committed engulf/bud intention
|
Sent/admitted are distinct from committed. A committed engulf/bud intention
|
||||||
does not itself prove biological success; the tick feedback reports its effect.
|
does not itself prove biological success; the tick feedback reports its effect.
|
||||||
|
|
||||||
The dark teal UI uses the existing embedded scalable font. At narrow sizes the
|
The blue-green UI uses the existing embedded scalable font. At narrow sizes the
|
||||||
Evolution panel becomes the **Life** tab; panels remain within the viewport and
|
Evolution panel becomes the **Life** tab; panels remain within the viewport and
|
||||||
scroll vertically. Existing Ctrl+= / Ctrl+- scaling and rebindable movement apply.
|
scroll vertically. Existing Ctrl+= / Ctrl+- scaling and rebindable movement apply.
|
||||||
Food patches have a thin contact boundary and a stock marker, with amber for the
|
Food patches have a thin contact boundary and a stock marker, with amber for the
|
||||||
@@ -212,3 +212,13 @@ unload behavior and qualification evidence are documented in VALIDATION.md.
|
|||||||
Headless defaults keep both `EVO_BUILD_CLIENT` and `EVO_BUILD_CLIENT_PROBE` OFF.
|
Headless defaults keep both `EVO_BUILD_CLIENT` and `EVO_BUILD_CLIENT_PROBE` OFF.
|
||||||
No prepared SDL sources, display or client runtime are needed for `evo-sim` or
|
No prepared SDL sources, display or client runtime are needed for `evo-sim` or
|
||||||
server tests. No Kubernetes deployment change belongs to this desktop gate.
|
server tests. No Kubernetes deployment change belongs to this desktop gate.
|
||||||
|
|
||||||
|
## 2026-10-22 liquid presentation
|
||||||
|
|
||||||
|
[The native visual refresh](CLIENT_VISUAL_REFRESH.md) adds blue-green optical
|
||||||
|
texture, flowing current ribbons, nutrient silhouettes, thin pool membranes,
|
||||||
|
a shared brighter cell palette and colored action buttons. Field notes, Vitals
|
||||||
|
and Nearby can minimize and restore. Nearby is a camera-centred map of received
|
||||||
|
observations with a local-axis compass; it never reveals hidden food. Temperature
|
||||||
|
readouts remain explicitly unavailable until phase 3 and a session contract carry
|
||||||
|
real body/ambient observations. No simulation or protocol version changes.
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
# Cellular liquid presentation refresh
|
||||||
|
|
||||||
|
Scope: native client presentation, 2026-10-22, requested by the maintainer using
|
||||||
|
the screenshots, two recordings and visual references in `Aevolution-Client-SS`.
|
||||||
|
This is a procedural first pass using the existing SDL3/ImGui renderer, not the
|
||||||
|
photorealistic lighting of the reference images. No asset or runtime dependency
|
||||||
|
is added. Headless libraries, biological rules, persistence and wire formats are
|
||||||
|
unchanged.
|
||||||
|
|
||||||
|
## Visual language
|
||||||
|
|
||||||
|
- Blue-green liquid illumination replaces the black eyepiece interior. A fixed
|
||||||
|
caustic mesh gives optical texture; it carries no environmental measurement.
|
||||||
|
Current ribbons and travelling highlights follow the replicated flow field.
|
||||||
|
A maximum 30 by 30 sample grid bounds cost even in a tall viewport.
|
||||||
|
- Nutrients keep their established colors and gain distinct silhouettes: gold
|
||||||
|
lobes for energy, umber facets for carbon, blue vesicles for nitrogen, rose
|
||||||
|
rosettes for phosphorus, pale angular fragments for other matter. These are
|
||||||
|
readable symbols, not asserted chemical structures. At very small sizes they
|
||||||
|
simplify to solid marks. The legend uses the same shapes.
|
||||||
|
- Pools have a thin circular membrane on their contact disc, containing those
|
||||||
|
same nutrient symbols. A zero channel emits no shapes. Entire deposits remain
|
||||||
|
owned and removed by the server; the client does not consume or split them.
|
||||||
|
The decorative membrane neither blocks a cell nor changes collision geometry.
|
||||||
|
- All living cells share cyan membranes, translucent cytoplasm, amber metabolic
|
||||||
|
organelles and a violet centre. Wall thickness, motility, conversion and green
|
||||||
|
producer organelles retain their existing phenotype mappings. The viewer's
|
||||||
|
own cell has only its existing focus ring, not a different biological palette.
|
||||||
|
Dead cells keep their broken outline; stale scenes freeze cosmetic motion and
|
||||||
|
dim observed objects.
|
||||||
|
|
||||||
|
## Controls and navigation
|
||||||
|
|
||||||
|
Buttons share a rounded, bordered treatment with distinct hover, pressed and
|
||||||
|
disabled states. The action dock uses mint for feeding, blue for engulfing and
|
||||||
|
violet for budding. Labels and authoritative enable/disable logic remain intact;
|
||||||
|
color alone does not communicate affordability or success. Existing bindings
|
||||||
|
remain authoritative; decorative shortcut numbers are not invented.
|
||||||
|
|
||||||
|
Field notes, Vitals and Nearby have explicit minus/plus buttons and a separate
|
||||||
|
`::` drag handle. Drag the handle to place a card; releasing anchors its position.
|
||||||
|
Double-click the handle to restore the responsive default. Collapsing Vitals
|
||||||
|
retains energy. Placement and collapse state last for the client session and are
|
||||||
|
not saved to disk. Anchors use normalized viewport coordinates and are clamped
|
||||||
|
inside the window when it is resized or the UI scale changes.
|
||||||
|
|
||||||
|
Expanded card sizes depend on viewport/scale, not the current text. Overflow
|
||||||
|
scrolls inside a body with a reserved vertical scrollbar gutter; headings stay
|
||||||
|
fixed and long text wraps at the body width. Minimize/restore intentionally
|
||||||
|
changes a card's height. The action dock likewise keeps its buttons fixed above
|
||||||
|
a scrollable details area. Changing nutrient values, growth warnings, pending
|
||||||
|
results, region-edge notices and stale observations cannot resize or re-anchor
|
||||||
|
these panels. The responsive compact layout keeps the dock and map within the viewport.
|
||||||
|
|
||||||
|
Resource-table rows also have stable single-line geometry: names and formatted
|
||||||
|
quantities never inherit prose wrapping. The amount column reserves the widest
|
||||||
|
supported energy/mass readout at the current font/scale, including the full u64
|
||||||
|
range, independently of live values. A growth-limiting nutrient shows `*` in its
|
||||||
|
existing dot slot, with the same bar outline; the marker never lengthens an amount.
|
||||||
|
This prevents transitions such as `714 fg` to `1.54 pg` from shifting later rows.
|
||||||
|
|
||||||
|
Nearby is a camera-centred observation map with a fixed six-millimetre radius.
|
||||||
|
It reads the received food and organism views only, including observations
|
||||||
|
outside the viewport. Empty space means unknown, not confirmed empty. Rings
|
||||||
|
denote pools, dots nutrients and triangles cells; the controlled cell has a ring.
|
||||||
|
The compass labels local +Y/-Y and +X/-X, consistent with the camera. Planetary
|
||||||
|
north and a global explored-world map have not been defined by this gate.
|
||||||
|
Disconnected data is explicitly stale. The map is read-only and cannot issue
|
||||||
|
movement or reveal unobserved resources.
|
||||||
|
|
||||||
|
## Temperature contract gap and proposed follow-up
|
||||||
|
|
||||||
|
Inspection found an architectural dependency: session v13 has reserves, motion,
|
||||||
|
currents and observed food, but no body or ambient temperature observations.
|
||||||
|
[ADR-0178](../adr/0178-durable-liquid-region.md) and phase 3 of the
|
||||||
|
[region/movement plan](../../Cellular_Region_Movement_Plan.md) explicitly leave
|
||||||
|
the thermal field and per-cell thermal state pending. A client-only gradient
|
||||||
|
or body temperature would fabricate game state. Implementation of that affected
|
||||||
|
feature stops here.
|
||||||
|
|
||||||
|
Vitals reserves a `Body -- / Water --` readout with an explanation on hover.
|
||||||
|
No heat colors, danger thresholds or warmer/colder arrows are emitted.
|
||||||
|
|
||||||
|
Proposed resolution, not an accepted protocol or biological rule:
|
||||||
|
|
||||||
|
1. Complete phase 3's authoritative body/ambient model and its versioned
|
||||||
|
persistence/replay contract.
|
||||||
|
2. Add bounded, perception-filtered body and local ambient temperatures with
|
||||||
|
units, freshness and availability to a new negotiated session version.
|
||||||
|
3. Define the spatial sampling distance and visible-neighbour coverage for
|
||||||
|
warmer/colder guidance. No client extrapolation into hidden regions.
|
||||||
|
4. Render measured body/water values and a separate thermal overlay. A direction
|
||||||
|
arrow requires sufficient current samples; equal, missing or stale samples
|
||||||
|
suppress it. Comfort and harm use observed phenotype limits, not UI constants.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
limits. The supplied reference art is design input, not a runtime asset or a
|
||||||
|
claim of achieved photorealism.
|
||||||
@@ -10090,3 +10090,487 @@ works, and Begin a new life works.
|
|||||||
Executed locally: WSL clang-19 `client-probe` with clang-tidy 14/14 plus the Xvfb
|
Executed locally: WSL clang-19 `client-probe` with clang-tidy 14/14 plus the Xvfb
|
||||||
X11 lifecycle check; MSVC `client-package` 18/18; clang-format 19. Screenshots of
|
X11 lifecycle check; MSVC `client-package` 18/18; clang-format 19. Screenshots of
|
||||||
the HUD at three sizes, the evolution window and the end of a life were reviewed.
|
the HUD at three sizes, the evolution window and the end of a life were reviewed.
|
||||||
|
|
||||||
|
## 2026-10-21 - Cellular mutation discussion draft
|
||||||
|
|
||||||
|
Added the root-level `Cellular_mutation_draft.md`: 150 proposed adaptations with
|
||||||
|
benefits, drawbacks, availability prerequisites, and positive/negative offer
|
||||||
|
weight signals. Selection costs, active-play pacing, colony opportunity
|
||||||
|
protection, conservation, offspring expression, and future developmental
|
||||||
|
dependencies are explicitly draft design rather than implemented rules.
|
||||||
|
|
||||||
|
Executed locally with PowerShell: checked exactly 150 unique sequential catalog
|
||||||
|
IDs, seven populated fields per row (1,050 total), eight resolving local source
|
||||||
|
links, 29 unique valid initial-subset IDs, and no trailing whitespace. These are
|
||||||
|
document integrity checks, not gameplay or balance qualification.
|
||||||
|
|
||||||
|
No application code or public contracts changed. CMake/CTest, clang-format,
|
||||||
|
clang-tidy, and sanitizers were not run for this documentation-only segment;
|
||||||
|
there is no new executable behavior to validate. No runtime or ecological
|
||||||
|
pacing result is claimed. The required ADR-0087 pre-push session-window refresh
|
||||||
|
changes desired Git configuration only; no deployment or live reachability is
|
||||||
|
claimed.
|
||||||
|
|
||||||
|
### 2026-10-21 - Two mutation routes discussion addition
|
||||||
|
|
||||||
|
Expanded the draft with Evolve now (funded division and immediate offspring
|
||||||
|
succession) and Prepare offspring (scheduled birth, observation, and optional
|
||||||
|
succession at a later birth). Documented roughly half-body allocation, permanent
|
||||||
|
identities, retained parental plans, no free undo, and divergence costs based on
|
||||||
|
actual development rather than trait count. Ordinary reproduction remains
|
||||||
|
independent of mutation offers. The 150 catalog entries are unchanged.
|
||||||
|
|
||||||
|
Validation for this documentation segment: catalog rows compared verbatim with
|
||||||
|
the preceding committed draft; sequential IDs, populated fields, local links,
|
||||||
|
and whitespace checked. No application code, public contract, or runtime behavior
|
||||||
|
changes; CMake/CTest, clang-format, clang-tidy, and sanitizers are not applicable
|
||||||
|
to this prose addition and were not run. Design viability and balance remain
|
||||||
|
unqualified. The AGENTS.md-required pre-push window update is desired Git
|
||||||
|
configuration only, not a deployment.
|
||||||
|
|
||||||
|
## 2026-10-22 - Native liquid UI refresh
|
||||||
|
|
||||||
|
Scope: `apps/evo-client` scene/HUD, the private platform theme, and native panel
|
||||||
|
regressions. See [visual design and the thermal contract gap](CLIENT_VISUAL_REFRESH.md).
|
||||||
|
No biological, persistence or wire version changed. Existing unrelated drafts and
|
||||||
|
server work were preserved.
|
||||||
|
|
||||||
|
Executed:
|
||||||
|
|
||||||
|
- MSVC 19.44 / toolset 14.44, Release with NDEBUG: configured/built `client` and
|
||||||
|
`client-network` through `tools/windows-check.ps1`. Client CTest 10/10; final
|
||||||
|
`client-network` CTest 18/18 with local loopback access outside the sandbox.
|
||||||
|
- Ubuntu/WSL Clang 19: configured from the `client` preset in `build/m12-ui-clang`
|
||||||
|
with `EVO_ENABLE_TIDY=ON`, built all client preset targets, CTest client label
|
||||||
|
10/10. Changed production sources and panel tests passed clang-tidy with warnings
|
||||||
|
as errors. Xvfb/X11 lifecycle executable exited 0.
|
||||||
|
- `asan` preset in `build/client-asan`, client enabled: rebuilt client, panel and
|
||||||
|
lifecycle targets; ASan+UBSan panel, lifecycle and smoke CTests 3/3.
|
||||||
|
- clang-format-19 dry-run with `--Werror` passed for the five changed C++ files.
|
||||||
|
- Production panel renderer exercised at 640x480, 960x640 and 1280x800: window
|
||||||
|
bounds, non-overlap with the action dock, minimize/restore with input capture,
|
||||||
|
and existing hover/mutation/affordability/bud/restart paths. World draw-list
|
||||||
|
checks verify each nutrient disappears independently at zero and stale food
|
||||||
|
retains dimmed silhouettes. No golden or simulation version was changed.
|
||||||
|
- Native BMP review frames (including Evolution and death) were generated in
|
||||||
|
ignored `build/ui-review/final` and visually inspected. The final fixture cell
|
||||||
|
was moved clear of HUD panels and its pool stocked to inspect the new shapes;
|
||||||
|
the panel suite was rerun after that fixture-only adjustment. These images
|
||||||
|
are local fixtures, not a live DEV session or performance benchmark.
|
||||||
|
|
||||||
|
Environmental limits and initial failures:
|
||||||
|
|
||||||
|
- Windows tests initially could not save bindings in the sandbox's default temp
|
||||||
|
directory. Setting TMP and TEMP to `build/ui-review/tmp` resolved both bindings
|
||||||
|
and control-save checks.
|
||||||
|
- The sandboxed network run was 13/18: five loopback connection tests could not
|
||||||
|
establish sessions. The same final production build passed all 18 outside the
|
||||||
|
sandbox. No production endpoint or World0 was contacted by those checks.
|
||||||
|
- Physical DPI, GPU rendering, motion comfort, accessibility and low-spec frame
|
||||||
|
cost still require interactive hardware review. This procedural rendering does
|
||||||
|
not implement the photographic lighting/blur of the supplied concept images.
|
||||||
|
- Two local MP4s were reviewed through sampled frame sheets. An imageio-ffmpeg
|
||||||
|
decoder was installed only in ignored `build/ui-review-tools` for that analysis;
|
||||||
|
it is not a repository or client dependency.
|
||||||
|
- Body/ambient readings and thermal direction remain unavailable because session
|
||||||
|
v13 carries neither. The UI shows dashes and explains the missing observations;
|
||||||
|
the proposed phase-3 follow-up is documented rather than fabricated client state.
|
||||||
|
|
||||||
|
The AGENTS.md-required pre-push session-window refresh is desired Git configuration
|
||||||
|
only. No deployment, live reachability, World0 mutation or world reset is claimed.
|
||||||
|
|
||||||
|
## 2026-10-26 - DEV starting wildlife and resource-aware Bud
|
||||||
|
|
||||||
|
Scope: ADR-0180's explicit disposable DEV fixture, cellular opening/recovery,
|
||||||
|
server-projected budding requirements, native Bud control, and new-region tuning.
|
||||||
|
Existing unrelated drafts and untracked files were preserved. No golden, per-tick
|
||||||
|
simulation version, checkpoint encoding or wire layout changed.
|
||||||
|
|
||||||
|
Executed:
|
||||||
|
|
||||||
|
- GCC 14.2 Release with NDEBUG, configured from the release preset with client and
|
||||||
|
network enabled in build/playtest-release: complete CTest suite 122/122 passed.
|
||||||
|
Final focused UI-model/owner checks passed 2/2 after a test-only optional-access
|
||||||
|
cleanup and formatting-only correction in the affected revamp module.
|
||||||
|
- MSVC 19.44 client preset build succeeded; client CTest 10/10 passed. The final
|
||||||
|
UI-model cleanup was rebuilt and its test passed again. TMP/TEMP were directed
|
||||||
|
to ignored build/playtest-windows-tmp for local bindings-file checks.
|
||||||
|
- Clang 19 ASan+UBSan, existing asan-preset build/client-asan: focused tuning,
|
||||||
|
owner, UI-model and native panel checks 4/4 passed; final UI-model cleanup 1/1.
|
||||||
|
- PostgreSQL 18.6, GCC 14 Release with the existing prepared dependency:
|
||||||
|
tools/ci/postgres-check.sh --starting-wildlife-only against
|
||||||
|
build/playtest-postgres/evo-postgres-tests passed in a fresh private local
|
||||||
|
cluster. It published an empty genesis and all prerequisite upgrades, seeded
|
||||||
|
32 funded roots, replaced the lease, recovered byte-identical state, published
|
||||||
|
a real wildlife tick and replayed it identically without adding more cells.
|
||||||
|
- Parser/owner coverage includes optional count default zero, count bounds,
|
||||||
|
deterministic genome/placement, ordinary founder endowment rules, exact
|
||||||
|
conservation, refusal on inadequate nursery stock, invalid identities and
|
||||||
|
repeated seeding, and restored continuation. Cost checks include the fee;
|
||||||
|
UI checks cover all five shortfall channels and exact affordability equality.
|
||||||
|
- Native panels exercise 640x480, 960x640 and 1280x800, including the production
|
||||||
|
disabled Bud hover tooltip, refusal to click while short, and funded clicking.
|
||||||
|
A cost-aware fixture exposed Vitals gaining horizontal overflow after restore;
|
||||||
|
fixed content width and a reserved vertical scrollbar resolved it.
|
||||||
|
- Repository format-check passed with clang-format 19. A pre-existing formatting
|
||||||
|
violation in the affected cellular_revamp.cpp was corrected. git diff --check
|
||||||
|
passed. Rendered deployment policy passed (75 source objects, 140 rendered
|
||||||
|
objects, 17 overlays); its 50-case fail-closed self-test passed.
|
||||||
|
|
||||||
|
Limits and initial failures:
|
||||||
|
|
||||||
|
- The Windows debug build stopped with MSVC C1902 (program-database manager
|
||||||
|
mismatch) before compiling the changed code; the Windows Release client build
|
||||||
|
and Linux Release/sanitizer builds succeeded. No debug pass is claimed.
|
||||||
|
- Initial compiler and static-analysis failures (a missing draft initializer and
|
||||||
|
optional-access checks), plus the native layout/hover fixture failures, were
|
||||||
|
corrected before the successful checks above. An initial sanitizer compile
|
||||||
|
overlapped a header formatting write; the stable-source rerun passed.
|
||||||
|
- These are local fixtures, not live gameplay, ecological balance, hardware
|
||||||
|
performance, or production-store identity-audit evidence. DEV region 14 needs
|
||||||
|
a compatible image promotion before manual Argo sync. No deployment, live
|
||||||
|
reachability, World0 change, reset or pruning was performed. The AGENTS.md
|
||||||
|
pre-push session-window refresh is desired Git configuration only.
|
||||||
|
|
||||||
|
Final static analysis: the analysis preset in build/playtest-analysis built the
|
||||||
|
changed lifecycle, tuning, persistence, bootstrap and client targets, plus their
|
||||||
|
regressions, with clang-tidy 19 and warnings as errors. Its focused CTests passed
|
||||||
|
5/5 and the isolated PostgreSQL opening/recovery check passed again. A pre-existing
|
||||||
|
unchecked optional access in the touched UI-model test was rewritten through its
|
||||||
|
existing checked helper. Changed C++ files also passed clang-format 19 dry-run.
|
||||||
|
The actual QUIC-enabled evo-server also built successfully in build/tidy-postgres.
|
||||||
|
A separate clang-tidy-19 run on its main translation unit, with an explicit
|
||||||
|
cellular_bridge.hpp header filter and warnings as errors, passed. It required a
|
||||||
|
pre-existing optional-feedback access to be made local before checking/reading.
|
||||||
|
The bridge header passed the Linux clang-format 19 dry-run (minor formatter
|
||||||
|
versions differ on an existing multiline lambda's wrapping).
|
||||||
|
|
||||||
|
Publication limit: the scoped commit was created locally, but the configured HTTPS
|
||||||
|
remote rejected git push with an authentication failure. Git Credential Manager
|
||||||
|
is configured; no stored credential was deleted or changed. A user-authorized retry uses credentials supplied outside the repository. Unrelated drafts and untracked files
|
||||||
|
remain outside the commit.
|
||||||
|
|
||||||
|
## 2026-10-26 - Stable HUD geometry and anchored panel dragging
|
||||||
|
|
||||||
|
Scope: apps/evo-client panel drawing/state and native panel regression, with the
|
||||||
|
ADR-0084 presentation amendment. No simulation, server, wire, dependency or
|
||||||
|
persistent-settings format changed. Unrelated drafts and untracked work remain
|
||||||
|
untouched.
|
||||||
|
|
||||||
|
Executed:
|
||||||
|
|
||||||
|
- GCC 14.2 Release/NDEBUG in the existing release-preset build/playtest-release:
|
||||||
|
rebuilt evo-client, panel and UI-model targets; client CTests excluding the
|
||||||
|
panel test passed 9/9. The final production panel executable passed separately
|
||||||
|
with SDL_VIDEO_DRIVER=dummy, SDL_RENDER_DRIVER=software and review output in
|
||||||
|
ignored build/hud-review. Earlier panel CTest runs also passed during iteration.
|
||||||
|
- MSVC 19.44: tools/windows-check.ps1 -Preset client -Action check passed; all
|
||||||
|
10/10 client CTests passed with TMP/TEMP in ignored build/playtest-windows-tmp.
|
||||||
|
- Clang 19 analysis-preset build/playtest-analysis: rebuilt evo-client and its
|
||||||
|
panel regression with clang-tidy and warnings as errors; build passed.
|
||||||
|
- Clang 19 ASan+UBSan, existing asan-preset build/client-asan: rebuilt the final
|
||||||
|
native panel test and its production panels; focused CTest passed 1/1.
|
||||||
|
- Repository format-check passed with clang-format 19, including a dry run of
|
||||||
|
the changed app header through the same formatter; git diff --check passed.
|
||||||
|
- Native coverage at 640x480, 960x640 and 1280x800 changes diagnostics/membership,
|
||||||
|
growth warnings, sunlight, edge/stale/census text and expanded notes on each
|
||||||
|
of 16 consecutive frames. Outer position/size and child content width must
|
||||||
|
remain identical, with zero horizontal overflow. Action details exercise both
|
||||||
|
fitting and vertically overflowing content without changing the button row.
|
||||||
|
- Real SDL pointer events drag all three card handles, release and retain their
|
||||||
|
anchors, minimize/restore a moved card, resize the viewport, drag far outside
|
||||||
|
bounds and double-click the reset handle. Bounds and pointer capture prevent
|
||||||
|
world clicks. Existing Bud/tooltip, evolution, death/restart and panel capture
|
||||||
|
checks remain in the same native regression.
|
||||||
|
- Generated native BMPs for normal, overflowing and moved panels in
|
||||||
|
build/hud-review. Reviewed PNG conversions at 640x480, 960x640 and 1280x800.
|
||||||
|
The first review showed the nutrient legend breaking a word in its narrower
|
||||||
|
scrolling body; a tighter two-column legend with unwrapped names fixed it,
|
||||||
|
followed by the final Release, Windows, analysis and sanitizer checks above.
|
||||||
|
|
||||||
|
Limits: positions/collapse state are client-session preferences, not saved across
|
||||||
|
application restarts. Hardware DPI, accessibility, touch interaction and motion
|
||||||
|
comfort still need interactive review. No deployment, live session, World0 change,
|
||||||
|
reset or prune occurred. The required pre-push session-window refresh is desired
|
||||||
|
Git configuration only.
|
||||||
|
|
||||||
|
## 2026-10-26 - String-length stability inside nutrient tables
|
||||||
|
|
||||||
|
Reviewed the supplied Recording 2026-10-26 171124.mp4 locally (420x428, 5.83 s).
|
||||||
|
The outer Vitals card was already fixed; its carbon amount changed from
|
||||||
|
714 fg * to 1.54 pg *, wrapping the marker and shifting later nutrient rows.
|
||||||
|
The prior outer-geometry regression did not check those inner row baselines.
|
||||||
|
|
||||||
|
Changes: quantity/name cells explicitly disable prose wrapping; a font/scale-based
|
||||||
|
fixed amount-column width covers the largest supported energy and mass readouts.
|
||||||
|
The growth-limiting * occupies the existing nutrient-dot slot, with unchanged
|
||||||
|
bar outline and explanatory legend. No number formatting, simulation rule,
|
||||||
|
checkpoint, protocol, dependency or public API changed. The shared table also
|
||||||
|
serves mutation cost readouts.
|
||||||
|
|
||||||
|
Executed:
|
||||||
|
|
||||||
|
- First added the native table-geometry regression without the fix. It failed
|
||||||
|
at the baseline/height assertion on the old renderer, reproducing the recording.
|
||||||
|
- GCC 14.2 Release/NDEBUG, build/playtest-release: rebuilt evo-client and native
|
||||||
|
panel tests. Focused panel CTest passed; the final executable also passed with
|
||||||
|
review screenshots under SDL_VIDEO_DRIVER=dummy and SDL_RENDER_DRIVER=software.
|
||||||
|
- Regression spans 714, 999, 1000, 1540, 9999, 10000 and higher unit boundaries,
|
||||||
|
zero and UINT64_MAX. It checks unchanged last-row baseline, total table height,
|
||||||
|
amount-column width and zero horizontal overflow. Viewports are 640x480,
|
||||||
|
960x640, 1280x800 and 1600x1008; the latter exercises the recording's 1.4 scale.
|
||||||
|
Existing dragging, anchoring, Bud, mutation and death/restart paths still run.
|
||||||
|
- MSVC 19.44 client preset check: build succeeded and client CTests passed 10/10.
|
||||||
|
TMP/TEMP used ignored build/playtest-windows-tmp.
|
||||||
|
- Clang 19 analysis-preset build/playtest-analysis: production client and panel
|
||||||
|
regression built with clang-tidy and warnings as errors.
|
||||||
|
- Clang 19 ASan+UBSan build/client-asan: focused native panel CTest passed 1/1.
|
||||||
|
- Changed C++ files passed clang-format 19 dry-run. The full format-check initially
|
||||||
|
found an existing wrapping violation in cellular_revamp.cpp; normalized those
|
||||||
|
lines only, verified identical non-whitespace text, and the full gate passed.
|
||||||
|
git diff --check passed. No server behavior changed by that formatting correction.
|
||||||
|
- Visually reviewed generated Vitals crops for 714 fg, 1.54 pg and UINT64_MAX at
|
||||||
|
1.4 scale in ignored build/string-bounce-review/fixed/stock-comparison.png.
|
||||||
|
All four rows stay aligned and the full formatted maximum remains visible.
|
||||||
|
Video decoding used the existing ignored review-tool FFmpeg, not a new runtime
|
||||||
|
or repository dependency.
|
||||||
|
|
||||||
|
Limits: local software-renderer fixtures do not replace interactive hardware DPI
|
||||||
|
and accessibility review. No deployment, World0 change, reset or pruning was
|
||||||
|
performed. Existing unrelated drafts and untracked files were preserved; the
|
||||||
|
required pre-push session-window update is desired Git configuration only.
|
||||||
|
|
||||||
|
Publication limit: the scoped commit was created locally, but the configured
|
||||||
|
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.
|
||||||
|
|
||||||
|
Publication history: the initial push followed the required session-window
|
||||||
|
refresh but the remote rejected authentication ("Failed to authenticate user").
|
||||||
|
The maintainer subsequently supplied an external local credential file and
|
||||||
|
authorized a retry. An authenticated read-only remote check passed. The retry
|
||||||
|
uses per-command askpass credentials with the stored helper disabled for that
|
||||||
|
command, and another unique session activation expiring four hours ahead. No
|
||||||
|
credential values, credential file, remote URL change or credential-store change
|
||||||
|
are included in the repository; temporary helpers stay in ignored build output.
|
||||||
|
No deployment or live-reachability claim follows from publication.
|
||||||
|
|
||||||
|
## 2026-10-27 - Read-only admin portal (ADR-0182 step 1, schema 61)
|
||||||
|
|
||||||
|
Scope: ADR-0182's read-only first step. `evo-admin-api` (Keycloak realm role
|
||||||
|
`aevolution-admin`, audience `aevolution-admin`, client `aevolution-admin-portal`) serves
|
||||||
|
the static portal and read-only JSON for world 100; schema 61 adds three bounded
|
||||||
|
SECURITY DEFINER read functions; the cellular region's ops port gains `/admin/view`.
|
||||||
|
The token verifier gains an optional realm-role rule and returns the email; the ops
|
||||||
|
server's response bound becomes configurable (default unchanged). No simulation rule,
|
||||||
|
checkpoint, manifest, wire protocol, genome or golden changed; `extent_of` reads the
|
||||||
|
existing phenotype budget.
|
||||||
|
|
||||||
|
Also fixed a pre-existing PostgreSQL failure (`region store test line 826`, also seen in
|
||||||
|
Gitea run 542): since 054e485 the DEV revamp tuning file seeds 100 wildlife, which
|
||||||
|
`evo-world-clone provision` refuses without an audited `--playtest-wildlife-first-id`
|
||||||
|
range. The cellular-v10 provisioning test now provisions the Git file's rules with its
|
||||||
|
DEV opening fixture set to zero; seeded wildlife keeps its own suite. Earlier push builds
|
||||||
|
skipped the PostgreSQL gate, and the 09:00 nightly (run 539) stopped at the format check,
|
||||||
|
so the failure had not surfaced.
|
||||||
|
|
||||||
|
Executed (WSL Ubuntu, GCC 14.2 Release/NDEBUG, existing build/m97-postgres with network,
|
||||||
|
QUIC and PostgreSQL):
|
||||||
|
|
||||||
|
- Built evo-server, evo-world-clone, evo-grant-broker, evo-admin-api, evo-postgres-tests
|
||||||
|
and evo-cellular-admin-view-tests with -Werror (two missing-field-initializer errors
|
||||||
|
from the new aggregate members were fixed with default initializers).
|
||||||
|
- `cellular-admin-view-contracts` passed: header, totals, every cell row (id strings,
|
||||||
|
account text, position, extent, connected flag, members), the cell and deposit limits
|
||||||
|
keeping the lowest ids, empty lists, and an unchanged owner snapshot after rendering.
|
||||||
|
- `tools/ci/postgres-check.sh --suite-only` passed after the fixes above: token role
|
||||||
|
checks (required role present, absent, wrong shape; email), the admin API over world
|
||||||
|
9831 (public files with CSP/nosniff headers, `/config.json`, 405 for POST, 401 without or
|
||||||
|
with a foreign token, 403 without the role, no database contact before verification,
|
||||||
|
accounts with session/status/lives/resets, one account, 404s, regions, the view cache,
|
||||||
|
unviewable and unreachable regions, an offline database as 503, and the runtime role
|
||||||
|
still refused direct table reads), the migration path to schema 61 with the privilege
|
||||||
|
audit's new fenced functions, and the updated migration history expectation.
|
||||||
|
- `tools/ci/postgres-check.sh --full` passed (634 s: suite, migration partitions, life
|
||||||
|
reservations, backup, DR, upgrade, migration history, permission audit, checksum drift).
|
||||||
|
Two CI scripts that pin the newest schema were updated: history-domain-check's schema-50
|
||||||
|
rewind now drops the three schema-61 functions first, and the unknown-future-version
|
||||||
|
probe moves from 61 to 62.
|
||||||
|
- clang-tidy 19 with warnings as errors on every new or changed source passed after one
|
||||||
|
unchecked-optional fix in the view test; clang-format 19.1.5 applied to changed C++.
|
||||||
|
- Deploy suite (deploy-policy-check 80 objects / 150 rendered in 17 overlays, selftest,
|
||||||
|
ops-lib-check) passed with the new admin-portal-dev component.
|
||||||
|
- Local process smoke of the built evo-admin-api with the realm's pinned JWKS and a
|
||||||
|
placeholder (unreachable) database: `/`, `/app.js`, `/style.css`, `/config.json`,
|
||||||
|
`/healthz` answered 200 with the expected types and security headers, `/api/accounts`
|
||||||
|
401 for a malformed token, `/missing` 404; no arguments exit 2 with usage.
|
||||||
|
- `node --check` on the portal script.
|
||||||
|
|
||||||
|
Limits: no Keycloak sign-in, browser session or live region view was exercised (the
|
||||||
|
Keycloak client, Ingress, Secret and a new server image are not in place yet); account
|
||||||
|
lives and deaths were checked only on accounts without lives. The MSVC and sanitizer
|
||||||
|
presets and the image build/smoke were not run locally. Nothing was deployed, pushed or
|
||||||
|
synced; no World0, stage or live database operation occurred.
|
||||||
|
|
||||||
|
## 2026-10-27 - Session windows in SQL and the admin role (schema 62)
|
||||||
|
|
||||||
|
Scope: the ADR-0087 amendment and ADR-0182 section 9. Schema 62 adds the append-only
|
||||||
|
`session_windows` table, `load_session_window_v1` (runtime), `admin_set_session_window_v1`
|
||||||
|
and `admin_session_windows_v1` (admin), and moves schema 61's views to the optional
|
||||||
|
operator-created admin group role, granted and audited on every migration run. The cellular
|
||||||
|
region reads the window every 5 s with `--session-window-source db`; `RegionSessions` gains
|
||||||
|
an admission switch so a closed window refuses Hellos before signature work (previously new
|
||||||
|
sessions were still admitted after expiry). The portal opens, extends and closes windows.
|
||||||
|
Git no longer carries `REGION_SESSION_WINDOW`. No simulation, checkpoint or wire change.
|
||||||
|
|
||||||
|
Executed (WSL Ubuntu, GCC 14.2 Release/NDEBUG, build/m97-postgres):
|
||||||
|
|
||||||
|
- Full build of the tree with -Werror (one -Wshadow fix in the new test).
|
||||||
|
- CTest `session`: 5/5 passed, including the new SessionWindowFeed cases (no record, open,
|
||||||
|
same-record no-op, extension by a newer activation, own deadline, no reopening, closing
|
||||||
|
row, expired and over-long refusals, a vanished record).
|
||||||
|
- `tools/ci/postgres-check.sh --full` passed (637 s, every phase). The admin API tests now
|
||||||
|
log in as the new admin login: open with reason, history and author, extend, close,
|
||||||
|
regions list state, 400s for bad minutes and reasons, 403 without the role, 405 on other
|
||||||
|
POST paths, 503 for an unknown region; the runtime role reads only the current window and
|
||||||
|
can no longer call the admin views or the writer; the table refuses UPDATE, DELETE and a
|
||||||
|
window over four hours. The test cluster gained an admin group role and login; the
|
||||||
|
private verify-backup cluster ignores the admin role; the schema-50 rewind and the
|
||||||
|
future-version probe move up to 62/63.
|
||||||
|
- clang-tidy 19 (warnings as errors) on the changed sources; one unchecked-optional fix in
|
||||||
|
the window test. A pre-existing finding in region_sessions.cpp:291 under the standalone
|
||||||
|
invocation is outside this change. clang-format 19.1.5 applied; `node --check` on the
|
||||||
|
portal script.
|
||||||
|
- Deploy suite passed: the policy check now requires `--session-window-source db` and
|
||||||
|
refuses a committed `REGION_SESSION_WINDOW` (self-test cases added for both).
|
||||||
|
|
||||||
|
Limits: no live region has read a SQL window yet, and no process test drives the database
|
||||||
|
window through a real session; the elapsed-time guard of the 2026-10-08 clock amendment is
|
||||||
|
still pending. Applying it needs the DEV `aevolution_admin` role and the admin portal's own
|
||||||
|
login first.
|
||||||
|
|
||||||
|
## 2026-10-27 - Admin commands in trace 5 (schema 63)
|
||||||
|
|
||||||
|
Scope: ADR-0182 section 10. Operators queue commands in the admin portal (remove a cell,
|
||||||
|
grant a reserve, add bubbles, add to or release the spent pool, spawn wildlife); the
|
||||||
|
cellular region applies each once after a tick's births and records it in trace 5, which
|
||||||
|
bundle 15 admits beside trace 4. Publication binds each recorded command to its queue row
|
||||||
|
in the same transaction. No owner format, rules, manifest bundle, genome, wire version or
|
||||||
|
golden changed; a corpse may carry the new `removed` cause (refused by older readers).
|
||||||
|
The ADR-0180 seeding loop moved into a shared helper with identical draws.
|
||||||
|
|
||||||
|
Executed (WSL Ubuntu, GCC 14.2 Release/NDEBUG, build/m97-postgres):
|
||||||
|
|
||||||
|
- `cellular-revamp-owner-contracts`: new case applying all six kinds plus a refused one
|
||||||
|
(missing target): results, closure through the boundary ledger, the exact spent pool,
|
||||||
|
bubble counts, the removed corpse, spawned wildlife, restore, determinism, trace-5
|
||||||
|
round trip and replay equality, trace 4 refusing commands; the existing starting-wildlife
|
||||||
|
and trace cases still pass after the seeding refactor.
|
||||||
|
- `tools/ci/postgres-check.sh --full` passed (637 s, every phase). New PostgreSQL cases: on
|
||||||
|
the starting-wildlife region, commands queued through `admin_enqueue_command_v1` (spawn
|
||||||
|
identities from the life allocator), a tampered trace-5 batch refused by the binding, the
|
||||||
|
exact batch published with three bindings at its tick and no pending commands left,
|
||||||
|
recovery equal to the applied state, and a second publication of the same commands
|
||||||
|
refused; admin API command endpoints (shape refusals, unknown region, author/reason,
|
||||||
|
history order, runtime role limited to the pending read, rows immutable).
|
||||||
|
- An existing test bug surfaced: the starting-wildlife publication test did not advance its
|
||||||
|
head after its tick commit; it now does before the command batch.
|
||||||
|
- clang-tidy 19 (warnings as errors) on the changed sources after narrowing the command kind
|
||||||
|
to a byte (the trace keeps a u16 and refuses values over 255); clang-format 19.1.5;
|
||||||
|
`node --check` on the portal script.
|
||||||
|
|
||||||
|
Limits: no live region has applied a command yet; the portal's command forms were not
|
||||||
|
driven in a browser.
|
||||||
|
|
||||||
|
## 2026-10-27 - Account administration (schema 64)
|
||||||
|
|
||||||
|
Scope: ADR-0182 section 11. Bans (append-only, a ban also revokes grants), an admin logout,
|
||||||
|
time played from session intervals recorded by the unchanged-signature control functions,
|
||||||
|
the broker's 403 `account_banned`, and each cell's lineage root in the region view for the
|
||||||
|
portal's living-offspring count. No simulation, trace, checkpoint or wire change.
|
||||||
|
|
||||||
|
Executed (WSL Ubuntu, GCC 14.2 Release/NDEBUG, build/m97-postgres): full build; CTest
|
||||||
|
119/119; `tools/ci/postgres-check.sh --full` passed (637 s, every phase, including the
|
||||||
|
schema-50 rewind restoring the four wrapped control and grant functions, the permission
|
||||||
|
audit and checksum drift with the probe at 65). New PostgreSQL cases: sessions recorded from
|
||||||
|
the broker test's control claims, ban with reason (listed in the account and its history),
|
||||||
|
`issue_account_grant` refused with the banned error while banned and allowed after lifting,
|
||||||
|
admin logout, refused shapes (bad flag, unknown action, POST on the account itself).
|
||||||
|
|
||||||
|
Limits: no live ban or logout was exercised against a connected client; time played starts
|
||||||
|
at this schema.
|
||||||
|
|
||||||
|
## 2026-10-27 - Resource schedules (schema 65)
|
||||||
|
|
||||||
|
Scope: ADR-0182 section 12. Recurring add_bubbles, release_pool and spawn_wildlife commands
|
||||||
|
queued by the pending-command read when due (one outstanding per schedule); append-only
|
||||||
|
schedule versions; admin API and portal card. No C++ simulation, trace or wire change.
|
||||||
|
|
||||||
|
Executed (WSL Ubuntu, GCC 14.2 Release/NDEBUG): full build; CTest 119/119;
|
||||||
|
`tools/ci/postgres-check.sh --full` passed (639 s, every phase; the schema-50 rewind restores
|
||||||
|
the pending-command read, and the probe moves to 66). New PostgreSQL cases: refused shapes
|
||||||
|
(disallowed kind, zero and over-long intervals, missing amounts, unknown schedule), a due
|
||||||
|
schedule queuing exactly one command across repeated reads, its run count and author in the
|
||||||
|
listings, and stopping it by a new version.
|
||||||
|
|
||||||
|
Limits: no live schedule has run on a region yet.
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ void capacity(std::uint32_t count) {
|
|||||||
std::chrono::duration_cast<std::chrono::nanoseconds>(Clock::now() - start).count()));
|
std::chrono::duration_cast<std::chrono::nanoseconds>(Clock::now() - start).count()));
|
||||||
require(population->state().lives().size() == count, "capacity silently culled a life");
|
require(population->state().lives().size() == count, "capacity silently culled a life");
|
||||||
}
|
}
|
||||||
if (count == biology::max_cellular_tick_lives) {
|
if (count == biology::max_cellular_frozen_lives) {
|
||||||
const auto before = population->state().snapshot();
|
const auto before = population->state().snapshot();
|
||||||
LifeRequest request{};
|
LifeRequest request{};
|
||||||
request.account.front() = 1;
|
request.account.front() = 1;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <expected>
|
#include <expected>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
// M11.5 budding (ADR-0098 decision 1, ADR-0125): a funded proposal, detached from any
|
// M11.5 budding (ADR-0098 decision 1, ADR-0125): a funded proposal, detached from any
|
||||||
// owner. The parent pays its ADR-0032 reproduction investment and a starting provision
|
// owner. The parent pays its ADR-0032 reproduction investment and a starting provision
|
||||||
@@ -50,6 +51,29 @@ fund_offspring(const Genome& parent, const Genome& offspring, GrowthState parent
|
|||||||
[[nodiscard]] std::optional<accounting::Inventory>
|
[[nodiscard]] std::optional<accounting::Inventory>
|
||||||
offspring_cost(const Genome& parent, const Genome& offspring, std::uint32_t temperature_millikelvin,
|
offspring_cost(const Genome& parent, const Genome& offspring, std::uint32_t temperature_millikelvin,
|
||||||
std::uint32_t share = 1);
|
std::uint32_t share = 1);
|
||||||
|
// Rules 13 (ADR-0179; Cellular_reproduction_plan.md section 4): a mutation split. The parent's
|
||||||
|
// body and reserve divide per channel, the offspring taking `share_per_thousand` (rounded
|
||||||
|
// down); each cell then develops the largest growth its own genome builds from its part of the
|
||||||
|
// body, and matter beyond that joins its reserve. Nothing is built, burned or lost: on every
|
||||||
|
// channel the two bodies and reserves sum to the parent's. Refused, changing nothing, when
|
||||||
|
// the parent is below `min_growth` or damaged, or either part builds no cell at all.
|
||||||
|
struct SplitTransition {
|
||||||
|
GrowthState parent_growth{}, child_growth{};
|
||||||
|
accounting::Inventory parent_body{}, parent_reserve{}, child_body{}, child_reserve{};
|
||||||
|
auto operator<=>(const SplitTransition&) const = default;
|
||||||
|
};
|
||||||
|
[[nodiscard]] std::expected<SplitTransition, BuddingError>
|
||||||
|
split_cell(const Genome& parent, const Genome& child, GrowthState growth,
|
||||||
|
const accounting::Inventory& body, const accounting::Inventory& reserve,
|
||||||
|
std::uint32_t temperature_millikelvin, std::uint32_t share_per_thousand,
|
||||||
|
std::uint32_t min_growth, const BodyTuning& tuning = default_body_tuning);
|
||||||
|
// Rules 13: the largest growth whose body `genome` builds within `matter` on every channel and
|
||||||
|
// that body; nothing when even the smallest does not fit.
|
||||||
|
[[nodiscard]] std::expected<std::optional<std::pair<GrowthState, accounting::Inventory>>,
|
||||||
|
BuddingError>
|
||||||
|
largest_growth_within(const Genome& genome, const accounting::Inventory& matter,
|
||||||
|
std::uint32_t temperature_millikelvin,
|
||||||
|
const BodyTuning& tuning = default_body_tuning);
|
||||||
// What one bud takes from a fully grown, undamaged parent of this genome at this temperature
|
// What one bud takes from a fully grown, undamaged parent of this genome at this temperature
|
||||||
// (ADR-0129 amendment): investment matter per channel, and construction energy plus the
|
// (ADR-0129 amendment): investment matter per channel, and construction energy plus the
|
||||||
// bud's provision; exactly what `fund_bud` charges such a parent. Nullopt when the genome
|
// bud's provision; exactly what `fund_bud` charges such a parent. Nullopt when the genome
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/accounting/ledger.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <compare>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
// Matter as energy (rules 13, ADR-0179; Cellular_feeding_energy_plan.md section 3). When an
|
||||||
|
// energy cost is larger than the reserve's energy, reserve matter stands in for the rest at
|
||||||
|
// each channel's burn rate. The matter is not converted: it leaves the cell as spent matter,
|
||||||
|
// which the region owner keeps in its spent pool. No energy is created, so a cost paid with
|
||||||
|
// matter adds no heat.
|
||||||
|
namespace evo::biology {
|
||||||
|
inline constexpr std::size_t cellular_matter_channels = 4; // C, N, P, other.
|
||||||
|
|
||||||
|
struct CellularBurn {
|
||||||
|
// Picojoules 1,000 fg of each matter channel stands in for, after the cell's burn
|
||||||
|
// efficiency. Zero means the channel cannot be burned.
|
||||||
|
std::array<std::uint64_t, cellular_matter_channels> pj_per_kfg{};
|
||||||
|
// Bit c set: the player keeps channel c (C = bit 0). Upkeep may override it.
|
||||||
|
std::uint8_t excluded{};
|
||||||
|
auto operator<=>(const CellularBurn&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The burn rates of a cell: each base rate times its burn efficiency index over 100.
|
||||||
|
[[nodiscard]] CellularBurn
|
||||||
|
cellular_burn(const std::array<std::uint64_t, cellular_matter_channels>& base_pj_per_kfg,
|
||||||
|
const std::array<std::uint16_t, cellular_matter_channels>& efficiency,
|
||||||
|
std::uint8_t excluded) noexcept;
|
||||||
|
|
||||||
|
// Energy the reserve could pay: its energy plus what its burnable matter stands in for.
|
||||||
|
// `override_exclusions` also counts excluded channels (upkeep).
|
||||||
|
[[nodiscard]] std::uint64_t cellular_payable_energy(const accounting::Inventory& reserve,
|
||||||
|
const CellularBurn& burn,
|
||||||
|
bool override_exclusions) noexcept;
|
||||||
|
|
||||||
|
// Pays `cost` from `reserve`: its energy first, then matter from the largest burnable channel
|
||||||
|
// (ties C, N, P, O), the next largest when that runs out. Returns the energy paid and the
|
||||||
|
// matter spent, and leaves `reserve` debited; nothing changes when the whole cost cannot be
|
||||||
|
// paid. A channel pays whole femtograms, so matter may cover slightly more than the cost.
|
||||||
|
struct CellularPayment {
|
||||||
|
std::uint64_t energy{};
|
||||||
|
accounting::Inventory spent{}; // Matter only.
|
||||||
|
auto operator<=>(const CellularPayment&) const = default;
|
||||||
|
};
|
||||||
|
[[nodiscard]] std::optional<CellularPayment> cellular_pay(accounting::Inventory& reserve,
|
||||||
|
std::uint64_t cost,
|
||||||
|
const CellularBurn& burn,
|
||||||
|
bool override_exclusions) noexcept;
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/accounting/ledger.hpp"
|
||||||
|
#include "evo/biology/genome.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <compare>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
// The named mutation catalog of rules 13 (ADR-0179; Cellular_mutation_plan.md sections 5-9).
|
||||||
|
// Each entry edits a genome's plan within bounds; what triggers raise or lower its chance and
|
||||||
|
// how offers are drawn live in cellular_triggers.hpp and cellular_offers.hpp. IDs are stable.
|
||||||
|
namespace evo::biology {
|
||||||
|
// What a mutation edits. Point-based traits move in fixed reference points: one point is a
|
||||||
|
// hundredth of the founder's value, whatever the trait's unit.
|
||||||
|
enum class CellularTrait : std::uint8_t {
|
||||||
|
none,
|
||||||
|
move_output,
|
||||||
|
move_efficiency,
|
||||||
|
move_steering,
|
||||||
|
move_streamlining,
|
||||||
|
move_braking,
|
||||||
|
move_coasting,
|
||||||
|
collect_energy,
|
||||||
|
collect_carbon,
|
||||||
|
collect_nitrogen,
|
||||||
|
collect_phosphorus,
|
||||||
|
collect_other,
|
||||||
|
intake, // Ingestion capability, femtograms per second.
|
||||||
|
energy_kept, // Energy conversion capability, per thousand.
|
||||||
|
burn_carbon,
|
||||||
|
burn_nitrogen,
|
||||||
|
burn_phosphorus,
|
||||||
|
burn_other,
|
||||||
|
light, // Photosynthesis capability, per thousand.
|
||||||
|
membrane, // Nanometres.
|
||||||
|
engulf_capacity,
|
||||||
|
kill_absorption,
|
||||||
|
size, // Target size, femtograms.
|
||||||
|
recipe_carbon,
|
||||||
|
recipe_nitrogen,
|
||||||
|
recipe_phosphorus,
|
||||||
|
recipe_other,
|
||||||
|
upkeep_efficiency,
|
||||||
|
growth_speed,
|
||||||
|
density,
|
||||||
|
bud_share, // Reproduction capability, per thousand.
|
||||||
|
litter, // Hundredths of an extra offspring; moves in its own units, not points.
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CellularEffect : std::uint8_t {
|
||||||
|
adjust, // Primary by the primary step, paired by the paired step, spread.
|
||||||
|
recipe, // Recipe: primary loses the recipe step, the other three share it.
|
||||||
|
acquire_light, // Photosynthesis at the founder reference, with the paired edit.
|
||||||
|
shed_light, // Photosynthesis removed.
|
||||||
|
acquire_adhesion, // Adhesion set.
|
||||||
|
};
|
||||||
|
// A spread lowers each other channel of the primary's group by the spread step.
|
||||||
|
enum class CellularSpread : std::uint8_t { none, collect_matter, burn };
|
||||||
|
|
||||||
|
// Extra eligibility beyond staying within bounds.
|
||||||
|
enum class CellularAvailability : std::uint8_t {
|
||||||
|
always,
|
||||||
|
light_absent_after_carbon, // No photosynthesis, and enough carbon burned.
|
||||||
|
light_present,
|
||||||
|
adhesion_absent_after_buds, // No adhesion, and enough on-demand buds.
|
||||||
|
};
|
||||||
|
|
||||||
|
// What a cell does that a trigger counts. Flags are 0 or 1 per tick; amounts are pJ or fg.
|
||||||
|
enum class CellularSignal : std::uint8_t {
|
||||||
|
thrust, // Thrust applied this tick.
|
||||||
|
drifting, // No thrust this tick.
|
||||||
|
brake_press, // Brake pressed this tick and not the last.
|
||||||
|
fed, // Anything collected.
|
||||||
|
intake_limited, // Matter collection held by a limit.
|
||||||
|
energy_limited, // Energy collection held by its limit.
|
||||||
|
energy_collected, // Amount of energy collected.
|
||||||
|
collected_carbon, // Amounts of matter collected, by channel, and in total.
|
||||||
|
collected_nitrogen,
|
||||||
|
collected_phosphorus,
|
||||||
|
collected_other,
|
||||||
|
collected_matter,
|
||||||
|
burned_carbon, // Amounts of matter burned for energy, by channel, and in total.
|
||||||
|
burned_nitrogen,
|
||||||
|
burned_phosphorus,
|
||||||
|
burned_other,
|
||||||
|
burned_matter,
|
||||||
|
burned_not_carbon,
|
||||||
|
energy_upkeep, // Energy spent on upkeep, on movement, and in total.
|
||||||
|
energy_movement,
|
||||||
|
energy_spent,
|
||||||
|
larger_contact, // Touching a cell over 1.5 times this cell's mass.
|
||||||
|
engulf_attempt, // An engulf was asked for.
|
||||||
|
engulf_success,
|
||||||
|
engulf_too_large, // Failed: prey too large.
|
||||||
|
engulf_too_large_or_membrane, // Failed: prey too large or membrane too thick.
|
||||||
|
reserve_over_body, // More matter in the reserve than in the body.
|
||||||
|
regrowing, // Growing toward full size.
|
||||||
|
fully_grown,
|
||||||
|
blocked_carbon, // Growth or a bud held back by this channel.
|
||||||
|
blocked_nitrogen,
|
||||||
|
blocked_phosphorus,
|
||||||
|
blocked_other,
|
||||||
|
bud_done, // An on-demand bud was made.
|
||||||
|
bud_refused, // An on-demand bud was refused for lack of resources.
|
||||||
|
bud_lost_early, // One of this cell's buds was engulfed within 2 minutes of birth.
|
||||||
|
bud_with_surplus, // A bud made with the reserve covering twice its cost.
|
||||||
|
};
|
||||||
|
inline constexpr std::size_t cellular_signal_count = 37;
|
||||||
|
|
||||||
|
enum class CellularTriggerKind : std::uint8_t {
|
||||||
|
accumulate, // Fires each time the signal has been present for `ticks` ticks in total.
|
||||||
|
absence, // Fires when the signal has been absent for `ticks` ticks running.
|
||||||
|
count, // Fires when the signal happened `count` times within `ticks` (0: any time).
|
||||||
|
event, // Fires each time the signal happens.
|
||||||
|
share, // Every `ticks` ticks: fires if signal / denominator >= per_thousand.
|
||||||
|
regular, // Fires when the signal recurred with gaps of at most `gap` for `ticks`.
|
||||||
|
straight, // Fires after `ticks` thrust ticks within `angle` of one heading.
|
||||||
|
turns, // Fires after `count` turns of more than `angle` within `ticks`.
|
||||||
|
};
|
||||||
|
struct CellularTriggerSpec {
|
||||||
|
CellularTriggerKind kind{};
|
||||||
|
CellularSignal signal{};
|
||||||
|
std::uint32_t ticks{};
|
||||||
|
std::uint32_t count{};
|
||||||
|
CellularSignal denominator{}; // share only.
|
||||||
|
std::uint32_t per_thousand{}; // share only.
|
||||||
|
std::uint32_t gap{}; // regular only.
|
||||||
|
std::uint16_t angle{}; // straight and turns: heading units (65,536 per turn).
|
||||||
|
auto operator<=>(const CellularTriggerSpec&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellularMutationSpec {
|
||||||
|
std::uint16_t id{};
|
||||||
|
std::string_view key, name, pro, con;
|
||||||
|
CellularEffect effect{};
|
||||||
|
CellularTrait primary{}, paired{};
|
||||||
|
std::int8_t primary_sign{}, paired_sign{};
|
||||||
|
CellularSpread spread{};
|
||||||
|
CellularAvailability available{};
|
||||||
|
CellularTriggerSpec increase{}, decrease{};
|
||||||
|
std::uint32_t base_weight{100};
|
||||||
|
std::uint32_t primary_step{5}; // Default primary step in its units (points; recipe 20).
|
||||||
|
};
|
||||||
|
inline constexpr std::size_t cellular_catalog_size = 49;
|
||||||
|
[[nodiscard]] std::span<const CellularMutationSpec> cellular_catalog() noexcept;
|
||||||
|
[[nodiscard]] const CellularMutationSpec* cellular_mutation(std::uint16_t id) noexcept;
|
||||||
|
|
||||||
|
// One mutation's tunables (Cellular_mutation_plan.md sections 3-4); defaults from its spec.
|
||||||
|
struct CellularMutationTuning {
|
||||||
|
bool enabled{true};
|
||||||
|
std::uint32_t base_weight{100};
|
||||||
|
std::int32_t increase_points{100}, decrease_points{100};
|
||||||
|
std::uint32_t primary_step{5}, paired_step{2}, spread_step{1};
|
||||||
|
accounting::Inventory cost{};
|
||||||
|
std::uint32_t cost_scale_percent{};
|
||||||
|
std::uint32_t increase_ticks{}, decrease_ticks{}; // 0: the spec's threshold.
|
||||||
|
auto operator<=>(const CellularMutationTuning&) const = default;
|
||||||
|
};
|
||||||
|
// Bounds and gates shared by every mutation.
|
||||||
|
struct CellularCatalogBounds {
|
||||||
|
std::uint32_t min_points{25}, max_points{1'000};
|
||||||
|
std::uint32_t recipe_min_share{20}; // Per thousand; the founder's phosphorus is 50.
|
||||||
|
std::uint32_t max_litter{900}; // 10 offspring per bud.
|
||||||
|
std::uint64_t carbon_for_light{}; // Femtograms of carbon burned before photosynthesis.
|
||||||
|
std::uint32_t buds_for_adhesion{5};
|
||||||
|
auto operator<=>(const CellularCatalogBounds&) const = default;
|
||||||
|
};
|
||||||
|
// Lineage progress the gates read.
|
||||||
|
struct CellularLineageProgress {
|
||||||
|
std::uint64_t carbon_burned{};
|
||||||
|
std::uint32_t buds{};
|
||||||
|
auto operator<=>(const CellularLineageProgress&) const = default;
|
||||||
|
};
|
||||||
|
[[nodiscard]] CellularMutationTuning
|
||||||
|
cellular_default_tuning(const CellularMutationSpec& spec) noexcept;
|
||||||
|
|
||||||
|
// The successor plan the mutation makes from `plan` (a schema-7 genome), or nothing when it is
|
||||||
|
// not available: a gate is closed, the trait is absent, or an edit would leave its bounds. The
|
||||||
|
// successor has one parent, `plan`, and identity `successor_id` from `origin_event`.
|
||||||
|
[[nodiscard]] std::optional<GenomeDraft>
|
||||||
|
apply_cellular_mutation(const Genome& plan, const CellularMutationSpec& spec,
|
||||||
|
const CellularMutationTuning& tuning, const CellularCatalogBounds& bounds,
|
||||||
|
const CellularLineageProgress& progress, std::uint64_t successor_id,
|
||||||
|
std::uint64_t origin_event);
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/biology/cellular_habitat.hpp"
|
||||||
|
#include "evo/biology/cellular_kinematics.hpp"
|
||||||
|
|
||||||
|
#include <compare>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <expected>
|
||||||
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Procedural currents (Cellular_Region_Changes.md, flows; ADR-0177): a fixed environmental
|
||||||
|
// condition, not stock. A seeded configuration generates 2-n closed looping routes inside the
|
||||||
|
// region, each with its own width, speed and direction, rasterized once into a Q10 velocity
|
||||||
|
// grid. Integer-only, so the client regenerates the identical field from the same
|
||||||
|
// configuration.
|
||||||
|
namespace evo::biology {
|
||||||
|
inline constexpr std::uint32_t max_cellular_current_pitch_um = 10'000;
|
||||||
|
inline constexpr std::size_t max_cellular_current_nodes = 1'048'576;
|
||||||
|
inline constexpr std::size_t cellular_current_route_points = 32;
|
||||||
|
|
||||||
|
struct CellularCurrentConfig {
|
||||||
|
std::uint64_t seed{};
|
||||||
|
std::uint32_t width_um{}, height_um{}, pitch_um{};
|
||||||
|
std::uint32_t min_count{}, max_count{};
|
||||||
|
std::uint32_t min_route_width_um{}, max_route_width_um{};
|
||||||
|
std::uint32_t min_speed_um_per_s{}, max_speed_um_per_s{};
|
||||||
|
auto operator<=>(const CellularCurrentConfig&) const = default;
|
||||||
|
};
|
||||||
|
struct CellularRoutePoint {
|
||||||
|
std::int64_t x_um{}, y_um{};
|
||||||
|
auto operator<=>(const CellularRoutePoint&) const = default;
|
||||||
|
};
|
||||||
|
// A closed loop; points are in flow order (the last joins the first).
|
||||||
|
struct CellularCurrentRoute {
|
||||||
|
std::vector<CellularRoutePoint> points;
|
||||||
|
std::uint32_t width_um{}, speed_um_per_s{};
|
||||||
|
bool clockwise{};
|
||||||
|
auto operator<=>(const CellularCurrentRoute&) const = default;
|
||||||
|
};
|
||||||
|
enum class CellularCurrentError : std::uint8_t { invalid_config, region_too_small };
|
||||||
|
|
||||||
|
class CellularFlowField {
|
||||||
|
public:
|
||||||
|
[[nodiscard]] static std::expected<CellularFlowField, CellularCurrentError>
|
||||||
|
generate(const CellularCurrentConfig& config);
|
||||||
|
// The same field, generated once per process and shared: fields are immutable and fully
|
||||||
|
// determined by their configuration, and restoring an owner must not regenerate one.
|
||||||
|
[[nodiscard]] static std::expected<std::shared_ptr<const CellularFlowField>,
|
||||||
|
CellularCurrentError>
|
||||||
|
shared(const CellularCurrentConfig& config);
|
||||||
|
// Liquid velocity at a point, clamped into the region; bilinear between grid nodes.
|
||||||
|
[[nodiscard]] CellularFlowSample sample(std::int64_t x_um, std::int64_t y_um) const noexcept;
|
||||||
|
// At the centre of a square footprint whose lower-left corner is `position`.
|
||||||
|
[[nodiscard]] CellularFlowSample at_footprint(CellularPosition position,
|
||||||
|
std::uint32_t extent_um) const noexcept;
|
||||||
|
[[nodiscard]] const CellularCurrentConfig& config() const noexcept {
|
||||||
|
return config_;
|
||||||
|
}
|
||||||
|
[[nodiscard]] std::span<const CellularCurrentRoute> routes() const noexcept {
|
||||||
|
return routes_;
|
||||||
|
}
|
||||||
|
[[nodiscard]] std::span<const CellularFlowSample> nodes() const noexcept {
|
||||||
|
return nodes_;
|
||||||
|
}
|
||||||
|
[[nodiscard]] std::size_t columns() const noexcept {
|
||||||
|
return columns_;
|
||||||
|
}
|
||||||
|
[[nodiscard]] std::size_t rows() const noexcept {
|
||||||
|
return rows_;
|
||||||
|
}
|
||||||
|
// Fingerprint of the generated grid, for comparing server and client fields.
|
||||||
|
[[nodiscard]] std::uint64_t digest() const noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CellularFlowField() = default;
|
||||||
|
CellularCurrentConfig config_{};
|
||||||
|
std::vector<CellularCurrentRoute> routes_;
|
||||||
|
std::vector<CellularFlowSample> nodes_;
|
||||||
|
std::size_t columns_{}, rows_{};
|
||||||
|
};
|
||||||
|
// A pool (a fixed deposit) cannot sit in a current. The nearest centre to the pool's within the
|
||||||
|
// region whose whole disc is in still water (no current at its centre, rim or half-rim), or
|
||||||
|
// the pool's own centre when it already is or none is found within 30 mm.
|
||||||
|
[[nodiscard]] CellularPatchAddress cellular_still_centre(const CellularFlowField& field,
|
||||||
|
CellularPatchAddress centre,
|
||||||
|
std::uint32_t radius_um) noexcept;
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/biology/cellular_currents.hpp"
|
||||||
|
#include "evo/biology/cellular_habitat.hpp"
|
||||||
|
|
||||||
|
#include <compare>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <expected>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
|
// Moving food (Cellular_Region_Movement_Plan.md, moving food; rules 12). After each tick's
|
||||||
|
// lives have fed against the deposits where they were, every bubble moves with the local flow
|
||||||
|
// plus the drift that passing cells induced, bubbles that touch merge (stock is summed, never
|
||||||
|
// created), and addresses are made unique again. Pools stay where they were placed.
|
||||||
|
namespace evo::biology {
|
||||||
|
// A living cell's world velocity this tick, for the drift it induces on nearby bubbles.
|
||||||
|
struct CellularWake {
|
||||||
|
CellularPosition position;
|
||||||
|
std::uint32_t extent_um{};
|
||||||
|
std::int32_t velocity_x_q10{}, velocity_y_q10{};
|
||||||
|
auto operator<=>(const CellularWake&) const = default;
|
||||||
|
};
|
||||||
|
struct CellularDepositMotionRules {
|
||||||
|
std::uint32_t drift_radius_um{}; // Cells push bubbles closer than this.
|
||||||
|
std::int32_t max_drift_q10{}; // Largest induced drift speed.
|
||||||
|
std::uint32_t drift_decay_ppm{}; // Induced drift lost per tick.
|
||||||
|
std::uint16_t merged_cap{}; // Bubbles stop merging at this many scattered ones.
|
||||||
|
std::uint32_t bubble_radius_um{}; // Radius of one unmerged bubble.
|
||||||
|
auto operator<=>(const CellularDepositMotionRules&) const = default;
|
||||||
|
};
|
||||||
|
struct CellularDepositMotionReport {
|
||||||
|
std::uint32_t moved{}, merges{}, nudged{};
|
||||||
|
auto operator<=>(const CellularDepositMotionReport&) const = default;
|
||||||
|
};
|
||||||
|
struct CellularDepositMotion {
|
||||||
|
CellularHabitatConfig config;
|
||||||
|
CellularDepositMotionReport report;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Radius of a bubble holding `merged` scattered bubbles: area grows with the count.
|
||||||
|
[[nodiscard]] std::uint32_t cellular_merged_radius(std::uint32_t bubble_radius_um,
|
||||||
|
std::uint16_t merged) noexcept;
|
||||||
|
|
||||||
|
// Detached: returns the next format-3 configuration, or an error when the input is not a
|
||||||
|
// format-3 habitat matching the field's area. `wakes` must be ordered by stable life id.
|
||||||
|
[[nodiscard]] std::expected<CellularDepositMotion, CellularHabitatError>
|
||||||
|
advect_cellular_deposits(const CellularHabitatConfig& config, const CellularFlowField& field,
|
||||||
|
std::span<const CellularWake> wakes,
|
||||||
|
const CellularDepositMotionRules& rules);
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -21,11 +21,19 @@ inline constexpr std::uint32_t cellular_habitat_format = 1;
|
|||||||
// ADR-0136 step A: format 2 holds deposits (pools and bubbles) at free micrometre centres,
|
// ADR-0136 step A: format 2 holds deposits (pools and bubbles) at free micrometre centres,
|
||||||
// each with a stable id, a radius and a kind, and the next id to give a new deposit.
|
// each with a stable id, a radius and a kind, and the next id to give a new deposit.
|
||||||
inline constexpr std::uint32_t cellular_habitat_deposit_format = 2;
|
inline constexpr std::uint32_t cellular_habitat_deposit_format = 2;
|
||||||
|
// Format 3 (rules 12, Cellular_Region_Movement_Plan.md): format 2 deposits that move. Each
|
||||||
|
// record adds the deposit's induced drift, its sub-micrometre carry and how many scattered
|
||||||
|
// bubbles merged into it. Addresses stay unique: they change between ticks, never within one.
|
||||||
|
inline constexpr std::uint32_t cellular_habitat_liquid_format = 3;
|
||||||
|
inline constexpr std::size_t max_cellular_liquid_deposits = 8'192;
|
||||||
inline constexpr std::size_t cellular_habitat_header_bytes = 72;
|
inline constexpr std::size_t cellular_habitat_header_bytes = 72;
|
||||||
inline constexpr std::size_t cellular_patch_record_bytes = 56;
|
inline constexpr std::size_t cellular_patch_record_bytes = 56;
|
||||||
inline constexpr std::size_t cellular_deposit_record_bytes = 64;
|
inline constexpr std::size_t cellular_deposit_record_bytes = 64;
|
||||||
|
inline constexpr std::size_t cellular_liquid_record_bytes = cellular_deposit_record_bytes + 20;
|
||||||
inline constexpr std::size_t max_cellular_habitat_bytes =
|
inline constexpr std::size_t max_cellular_habitat_bytes =
|
||||||
cellular_habitat_header_bytes + cellular_deposit_record_bytes * max_cellular_patches + 8;
|
cellular_habitat_header_bytes + cellular_liquid_record_bytes * max_cellular_liquid_deposits + 8;
|
||||||
|
// Carry below one micrometre, in Q10 velocity-microseconds (as CellularMotionState).
|
||||||
|
inline constexpr std::uint32_t cellular_deposit_carry_limit = 1'024U * 1'000'000U;
|
||||||
// A bubble's contact radius (tunable); pools carry their own.
|
// A bubble's contact radius (tunable); pools carry their own.
|
||||||
inline constexpr std::uint32_t cellular_mote_radius_um = 30;
|
inline constexpr std::uint32_t cellular_mote_radius_um = 30;
|
||||||
inline constexpr std::uint32_t max_cellular_deposit_radius_um = 5'000;
|
inline constexpr std::uint32_t max_cellular_deposit_radius_um = 5'000;
|
||||||
@@ -45,6 +53,11 @@ struct CellularPatch {
|
|||||||
accounting::Inventory stock{};
|
accounting::Inventory stock{};
|
||||||
std::uint32_t id{}, radius_um{};
|
std::uint32_t id{}, radius_um{};
|
||||||
CellularDepositKind kind{};
|
CellularDepositKind kind{};
|
||||||
|
// Format 3 only (zero otherwise): drift induced by passing cells (Q10 velocity), the
|
||||||
|
// sub-micrometre carry, and the scattered bubbles merged into this one (1 when unmerged).
|
||||||
|
std::int32_t drift_x_q10{}, drift_y_q10{};
|
||||||
|
std::uint32_t carry_x{}, carry_y{};
|
||||||
|
std::uint16_t merged{};
|
||||||
auto operator<=>(const CellularPatch&) const = default;
|
auto operator<=>(const CellularPatch&) const = default;
|
||||||
};
|
};
|
||||||
struct CellularHabitatConfig {
|
struct CellularHabitatConfig {
|
||||||
@@ -71,6 +84,12 @@ struct CellularPatchPerception {
|
|||||||
// Whether a cell's square footprint touches a patch (format 1 square) or a deposit's disc.
|
// Whether a cell's square footprint touches a patch (format 1 square) or a deposit's disc.
|
||||||
[[nodiscard]] bool cellular_patch_contact(CellularPosition position, std::uint32_t extent_um,
|
[[nodiscard]] bool cellular_patch_contact(CellularPosition position, std::uint32_t extent_um,
|
||||||
const CellularPatch& patch) noexcept;
|
const CellularPatch& patch) noexcept;
|
||||||
|
// Whether a footprint moving in a straight line from `from` to `to` touches the deposit at any
|
||||||
|
// point, sampled no further apart than half the smaller of the deposit's radius and the
|
||||||
|
// footprint, so a fast cell cannot pass over food.
|
||||||
|
[[nodiscard]] bool cellular_path_contact(CellularPosition from, CellularPosition to,
|
||||||
|
std::uint32_t extent_um,
|
||||||
|
const CellularPatch& patch) noexcept;
|
||||||
enum class CellularHabitatError : std::uint8_t {
|
enum class CellularHabitatError : std::uint8_t {
|
||||||
invalid_config,
|
invalid_config,
|
||||||
invalid_patch,
|
invalid_patch,
|
||||||
@@ -94,6 +113,10 @@ struct CellularMoteField {
|
|||||||
std::uint64_t source{};
|
std::uint64_t source{};
|
||||||
accounting::Inventory amount{}; // Per bubble, per channel.
|
accounting::Inventory amount{}; // Per bubble, per channel.
|
||||||
std::uint64_t seed{};
|
std::uint64_t seed{};
|
||||||
|
// Mixed bubbles, each holding all of `mixed` (every nutrient at once), scattered after the
|
||||||
|
// single-nutrient ones from the same stream. None leaves the stream unchanged.
|
||||||
|
std::uint32_t mixed_count{};
|
||||||
|
accounting::Inventory mixed{};
|
||||||
};
|
};
|
||||||
// A format-2 habitat of the given pools (centre, radius, source and stock; their ids and kind
|
// A format-2 habitat of the given pools (centre, radius, source and stock; their ids and kind
|
||||||
// are assigned) and the scattered bubbles, sorted by address with ids 1..n.
|
// are assigned) and the scattered bubbles, sorted by address with ids 1..n.
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/accounting/ledger.hpp"
|
||||||
|
#include "evo/biology/cellular_motion.hpp"
|
||||||
|
|
||||||
|
#include <compare>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <expected>
|
||||||
|
|
||||||
|
// Liquid-relative cellular motion (Cellular_movement_draft.md, numeric representation;
|
||||||
|
// Cellular_Region_Movement_Plan.md phase 1). Integer-only and shared by the region server
|
||||||
|
// and the client predictor, so both produce identical trajectories.
|
||||||
|
namespace evo::biology {
|
||||||
|
// Velocities are Q10: 1/1024 micrometre per second.
|
||||||
|
inline constexpr std::int64_t cellular_velocity_q10_per_um_s = 1'024;
|
||||||
|
// Relative or flow velocity components are bounded to +/- 1 m/s, so squared magnitudes fit
|
||||||
|
// comfortably in 64 bits.
|
||||||
|
inline constexpr std::int32_t cellular_velocity_limit_q10 = 1'000'000 * 1'024;
|
||||||
|
// Headings: 65,536 per turn, 0 along +x, counterclockwise.
|
||||||
|
inline constexpr std::uint32_t cellular_heading_turn = 65'536;
|
||||||
|
// Sine and cosine are Q14.
|
||||||
|
inline constexpr std::int32_t cellular_trig_one = 16'384;
|
||||||
|
// Drag rates are parts per million of velocity per tick, below one whole.
|
||||||
|
inline constexpr std::uint32_t cellular_drag_ppm_limit = 1'000'000;
|
||||||
|
|
||||||
|
// Per-cell motion state persisted with the organism.
|
||||||
|
struct CellularMotionState {
|
||||||
|
std::int32_t velocity_x_q10{}, velocity_y_q10{}; // Relative to the liquid.
|
||||||
|
std::uint16_t heading{};
|
||||||
|
// Sub-micrometre carry in 1/1024 micrometre-microseconds, below one micrometre.
|
||||||
|
std::int64_t remainder_x{}, remainder_y{};
|
||||||
|
auto operator<=>(const CellularMotionState&) const = default;
|
||||||
|
};
|
||||||
|
// Local liquid velocity at the cell, sampled by the caller from the region's flow field.
|
||||||
|
struct CellularFlowSample {
|
||||||
|
std::int32_t x_q10{}, y_q10{};
|
||||||
|
auto operator<=>(const CellularFlowSample&) const = default;
|
||||||
|
};
|
||||||
|
// An organism's handling, derived from its body; all amounts are per 50 ms tick.
|
||||||
|
struct CellularHandling {
|
||||||
|
std::uint32_t thrust_q10{}; // Velocity gained per tick at full forward throttle.
|
||||||
|
std::uint32_t reverse_thrust_q10{}; // Velocity gained per tick reversing or braking.
|
||||||
|
std::uint32_t forward_drag_ppm{}, lateral_drag_ppm{};
|
||||||
|
std::uint16_t turn{}; // Largest heading change per tick.
|
||||||
|
accounting::Picojoules thrust_cost{}, reverse_cost{}; // At full output for one tick.
|
||||||
|
auto operator<=>(const CellularHandling&) const = default;
|
||||||
|
};
|
||||||
|
// Player or controller command: a direction with throttle (the intent magnitude), or a brake.
|
||||||
|
// Braking opposes relative velocity and takes precedence over the direction.
|
||||||
|
struct CellularPropulsion {
|
||||||
|
CellularIntent direction;
|
||||||
|
bool brake{};
|
||||||
|
auto operator<=>(const CellularPropulsion&) const = default;
|
||||||
|
};
|
||||||
|
enum class CellularThrustStatus : std::uint8_t { idle, applied, unfunded };
|
||||||
|
struct CellularKinematicsResult {
|
||||||
|
CellularPosition position;
|
||||||
|
CellularMotionState state;
|
||||||
|
accounting::Picojoules cost{}; // Never more than the energy offered.
|
||||||
|
CellularThrustStatus thrust{CellularThrustStatus::idle};
|
||||||
|
std::uint64_t path_um{}; // Conservative straight-line distance travelled.
|
||||||
|
auto operator<=>(const CellularKinematicsResult&) const = default;
|
||||||
|
};
|
||||||
|
enum class CellularKinematicsError : std::uint8_t {
|
||||||
|
invalid_area,
|
||||||
|
invalid_extent,
|
||||||
|
outside_area,
|
||||||
|
invalid_intent,
|
||||||
|
invalid_state,
|
||||||
|
invalid_handling,
|
||||||
|
invalid_flow
|
||||||
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] std::int32_t cellular_cos_q14(std::uint16_t heading) noexcept;
|
||||||
|
[[nodiscard]] std::int32_t cellular_sin_q14(std::uint16_t heading) noexcept;
|
||||||
|
// Integer atan2 (CORDIC); the zero vector returns 0.
|
||||||
|
[[nodiscard]] std::uint16_t cellular_heading_of(std::int64_t x, std::int64_t y) noexcept;
|
||||||
|
|
||||||
|
// One 50 ms tick: turn toward the commanded direction, apply thrust that `available_energy`
|
||||||
|
// can fund (otherwise none, and the cell coasts), apply drag toward exactly zero, add the
|
||||||
|
// local flow and carry the displacement. Region edges stop motion into them.
|
||||||
|
[[nodiscard]] std::expected<CellularKinematicsResult, CellularKinematicsError>
|
||||||
|
step_cellular_kinematics(CellularArea area, CellularPosition position, std::uint32_t extent_um,
|
||||||
|
const CellularMotionState& state, CellularPropulsion propulsion,
|
||||||
|
const CellularHandling& handling, CellularFlowSample flow,
|
||||||
|
accounting::Picojoules available_energy) noexcept;
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <compare>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Mutation offers (rules 13, ADR-0179; Cellular_mutation_plan.md section 3): a mutation's
|
||||||
|
// weight from its affinity score, every eligible mutation's chance of appearing in an offer
|
||||||
|
// (floored and capped, summing to the number of options), and a systematic draw whose
|
||||||
|
// inclusion frequencies equal those chances. Chances are parts per million (1,000,000 = 100%).
|
||||||
|
namespace evo::biology {
|
||||||
|
inline constexpr std::uint32_t cellular_chance_whole = 1'000'000;
|
||||||
|
|
||||||
|
struct CellularOfferRules {
|
||||||
|
std::uint32_t options{3};
|
||||||
|
std::uint32_t floor_ppm{10}; // 0.001%.
|
||||||
|
std::uint32_t cap_ppm{700'000}; // 70%.
|
||||||
|
std::int32_t score_min{-1'000}, score_max{1'000};
|
||||||
|
std::uint32_t max_multiplier_per_mille{10'000}; // At score_max: 10x.
|
||||||
|
std::uint32_t min_multiplier_per_mille{0}; // At score_min: 0x.
|
||||||
|
auto operator<=>(const CellularOfferRules&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
// base_weight times the score's multiplier: 1 at score 0, rising linearly to the maximum at
|
||||||
|
// score_max and falling to the minimum at score_min.
|
||||||
|
[[nodiscard]] std::uint64_t cellular_offer_weight(std::uint32_t base_weight, std::int32_t score,
|
||||||
|
const CellularOfferRules& rules) noexcept;
|
||||||
|
|
||||||
|
// Each weight's chance: clamp(k x weight, floor, cap) with k chosen so the chances sum to
|
||||||
|
// `options` x 100%, in the weights' order. Nothing when no such allocation exists (too few
|
||||||
|
// mutations for the cap, too many for the floor, or weights too large).
|
||||||
|
[[nodiscard]] std::optional<std::vector<std::uint32_t>>
|
||||||
|
cellular_offer_chances(std::span<const std::uint64_t> weights, const CellularOfferRules& rules);
|
||||||
|
|
||||||
|
// Systematic draw over chances summing to `options` x 100%: the indices at
|
||||||
|
// u, u + 100%, u + 200%, ... along the cumulative chances, `u` in [0, 100%). Distinct by
|
||||||
|
// construction; each index appears with exactly its chance over uniform `u`.
|
||||||
|
[[nodiscard]] std::vector<std::size_t>
|
||||||
|
cellular_systematic_draw(std::span<const std::uint32_t> chances, std::uint32_t options,
|
||||||
|
std::uint32_t u) noexcept;
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -2,20 +2,66 @@
|
|||||||
|
|
||||||
#include "evo/biology/cellular_step.hpp"
|
#include "evo/biology/cellular_step.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <compare>
|
#include <compare>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <expected>
|
#include <expected>
|
||||||
|
#include <optional>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace evo::biology {
|
namespace evo::biology {
|
||||||
inline constexpr std::size_t max_cellular_tick_lives = 256;
|
// Lives one region tick may hold (ADR-0182 section 17: 4,096 for testing; regions run far
|
||||||
|
// fewer). Formats frozen at the original 256 (cohort populations, migration traces and the
|
||||||
|
// pre-v3 cellular traces) keep max_cellular_frozen_lives.
|
||||||
|
inline constexpr std::size_t max_cellular_tick_lives = 4'096;
|
||||||
|
inline constexpr std::size_t max_cellular_frozen_lives = 256;
|
||||||
|
|
||||||
// ADR-0124 (rules 3): a predator needs total mass >= ratio x prey total mass, with the
|
// ADR-0124 (rules 3): a predator needs total mass >= ratio x prey total mass, with the
|
||||||
// ratio in thousandths per micrometre of prey membrane (tunable; 1.5 for 1 um).
|
// ratio in thousandths per micrometre of prey membrane (tunable; 1.5 for 1 um).
|
||||||
inline constexpr std::uint64_t cellular_engulf_ratio_milli_per_membrane_um = 1'500;
|
inline constexpr std::uint64_t cellular_engulf_ratio_milli_per_membrane_um = 1'500;
|
||||||
|
|
||||||
|
// Rules 13 (ADR-0179; feeding and energy, predation and defense plans): region-declared
|
||||||
|
// feeding, energy and predation values. All trial values from the revamp tuning file.
|
||||||
|
struct CellularRevampStepRules {
|
||||||
|
// Collection changes by this many per mille per membrane point away from the founder's 100
|
||||||
|
// (thicker collects slower), bounded to 10%-200%.
|
||||||
|
std::uint32_t membrane_collection_per_mille_per_point{};
|
||||||
|
// A predator needs engulf mass x capacity / 100 >= prey engulf mass x ratio / 1000 x prey
|
||||||
|
// membrane points / 100.
|
||||||
|
std::uint32_t engulf_ratio_milli{1'500};
|
||||||
|
// Share of reserve matter that counts toward engulf mass, per cent.
|
||||||
|
std::uint32_t engulf_reserve_percent{100};
|
||||||
|
// Share of a kill's remainder left as bubbles at the prey; the rest goes to the spent pool.
|
||||||
|
std::uint32_t kill_bubble_per_thousand{500};
|
||||||
|
// Every collection limit, per cent of the body's own (100: unchanged).
|
||||||
|
std::uint32_t collection_percent{100};
|
||||||
|
// Matter from one food source is split evenly between the nutrients it holds: all of the
|
||||||
|
// shared matter limit to a carbon-only bubble, half each to carbon and phosphorus, and so
|
||||||
|
// on (each share then scaled by the cell's collection trait). Off: per-nutrient limits in
|
||||||
|
// the body's proportions.
|
||||||
|
bool split_evenly{};
|
||||||
|
auto operator<=>(const CellularRevampStepRules&) const = default;
|
||||||
|
};
|
||||||
|
// Rules 13: engulf mass is the body plus the declared share of reserve matter.
|
||||||
|
[[nodiscard]] std::uint64_t cellular_engulf_mass(std::uint64_t body_mass,
|
||||||
|
const accounting::Inventory& reserve,
|
||||||
|
const CellularRevampStepRules& rules) noexcept;
|
||||||
|
// Rules 13: whether a hunter of this engulf mass and capacity may take prey of this engulf mass
|
||||||
|
// and membrane (nanometres), exactly as the region step decides.
|
||||||
|
[[nodiscard]] bool cellular_engulfable(std::uint64_t hunter_mass, std::uint16_t engulf_capacity,
|
||||||
|
std::uint64_t prey_mass, std::uint32_t prey_membrane_nm,
|
||||||
|
const CellularRevampStepRules& rules) noexcept;
|
||||||
|
// Rules 13: one life's heritable feeding, energy and predation values, from its genome.
|
||||||
|
struct CellularRevampLifeInput {
|
||||||
|
CellularBurn burn{};
|
||||||
|
std::array<std::uint16_t, 5> collection{100, 100, 100, 100, 100}; // E, C, N, P, O.
|
||||||
|
std::uint32_t energy_kept_per_thousand{1'000}; // Of each energy bubble; the rest is heat.
|
||||||
|
std::uint32_t membrane_nm{1'000};
|
||||||
|
std::uint16_t engulf_capacity{100}, kill_absorption{100};
|
||||||
|
auto operator<=>(const CellularRevampLifeInput&) const = default;
|
||||||
|
};
|
||||||
struct CellularRegionRules {
|
struct CellularRegionRules {
|
||||||
// Rules 3: engulfment, and every corpse's inventory deposited as patch detritus.
|
// Rules 3: engulfment, and every corpse's inventory deposited as patch detritus.
|
||||||
// Rules 2 (false) is the original trial: engulf intents are ignored and starvation
|
// Rules 2 (false) is the original trial: engulf intents are ignored and starvation
|
||||||
@@ -25,6 +71,8 @@ struct CellularRegionRules {
|
|||||||
// its intake rate, with no intake target; pools yield at most a quarter of that rate.
|
// its intake rate, with no intake target; pools yield at most a quarter of that rate.
|
||||||
// A dead life's detritus becomes one bubble per non-empty channel.
|
// A dead life's detritus becomes one bubble per non-empty channel.
|
||||||
bool contact_feeding{};
|
bool contact_feeding{};
|
||||||
|
// Rules 13: present exactly when every life carries its revamp input.
|
||||||
|
std::optional<CellularRevampStepRules> revamp{};
|
||||||
auto operator<=>(const CellularRegionRules&) const = default;
|
auto operator<=>(const CellularRegionRules&) const = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,6 +87,11 @@ struct CellularLifeStepInput {
|
|||||||
MetabolicBudget budget;
|
MetabolicBudget budget;
|
||||||
std::uint32_t membrane_um{}; // Genome membrane thickness; contests engulfment (rules 3).
|
std::uint32_t membrane_um{}; // Genome membrane thickness; contests engulfment (rules 3).
|
||||||
std::uint64_t source{}; // Provenance for a detritus patch this life creates (rules 3).
|
std::uint64_t source{}; // Provenance for a detritus patch this life creates (rules 3).
|
||||||
|
// Rules 12: liquid motion, required exactly when the habitat is format 3. The movement
|
||||||
|
// intent becomes the propulsion command.
|
||||||
|
std::optional<CellularLiquidInput> liquid{};
|
||||||
|
// Rules 13 (ADR-0179), required exactly when the region rules declare revamp.
|
||||||
|
std::optional<CellularRevampLifeInput> revamp{};
|
||||||
auto operator<=>(const CellularLifeStepInput&) const = default;
|
auto operator<=>(const CellularLifeStepInput&) const = default;
|
||||||
};
|
};
|
||||||
enum class CellularEngulfStatus : std::uint8_t {
|
enum class CellularEngulfStatus : std::uint8_t {
|
||||||
@@ -64,7 +117,16 @@ struct CellularPatchStockUpdate {
|
|||||||
auto operator<=>(const CellularPatchStockUpdate&) const = default;
|
auto operator<=>(const CellularPatchStockUpdate&) const = default;
|
||||||
};
|
};
|
||||||
// Unrecorded: a corpse from a checkpoint format that kept no cause (before format 4).
|
// Unrecorded: a corpse from a checkpoint format that kept no cause (before format 4).
|
||||||
enum class CellularDeathCause : std::uint8_t { unrecorded = 0, starved = 1, engulfed = 2 };
|
// Rules 13 (ADR-0179): merged, a single cell that became a multicellular organism (its body and
|
||||||
|
// reserve moved into the organism); emerged, an organism that left the region for the world.
|
||||||
|
enum class CellularDeathCause : std::uint8_t {
|
||||||
|
unrecorded = 0,
|
||||||
|
starved = 1,
|
||||||
|
engulfed = 2,
|
||||||
|
merged = 3,
|
||||||
|
emerged = 4,
|
||||||
|
removed = 5 // ADR-0182: an operator removed the cell (rules 13).
|
||||||
|
};
|
||||||
struct CellularCorpseCandidate {
|
struct CellularCorpseCandidate {
|
||||||
std::uint64_t life_id{};
|
std::uint64_t life_id{};
|
||||||
CellularPosition position;
|
CellularPosition position;
|
||||||
@@ -85,6 +147,9 @@ struct CellularRegionStepCandidate {
|
|||||||
// Rules 3 detritus patches created at empty cells, sorted by address.
|
// Rules 3 detritus patches created at empty cells, sorted by address.
|
||||||
std::vector<CellularPatch> new_patches;
|
std::vector<CellularPatch> new_patches;
|
||||||
accounting::Picojoules heat_released{};
|
accounting::Picojoules heat_released{};
|
||||||
|
// Rules 13: everything for the region's spent pool this tick: matter every life burned in
|
||||||
|
// place of energy (also in its own step candidate) and the spent share of kill remainders.
|
||||||
|
accounting::Inventory spent{};
|
||||||
auto operator<=>(const CellularRegionStepCandidate&) const = default;
|
auto operator<=>(const CellularRegionStepCandidate&) const = default;
|
||||||
};
|
};
|
||||||
enum class CellularRegionStepError : std::uint8_t {
|
enum class CellularRegionStepError : std::uint8_t {
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#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
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/biology/cellular_burn.hpp"
|
||||||
#include "evo/biology/cellular_habitat.hpp"
|
#include "evo/biology/cellular_habitat.hpp"
|
||||||
|
#include "evo/biology/cellular_kinematics.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -18,6 +20,15 @@ struct CellularStepIntent {
|
|||||||
// ADR-0128: the owner is offline; the cell does nothing this tick (no maintenance,
|
// ADR-0128: the owner is offline; the cell does nothing this tick (no maintenance,
|
||||||
// movement, intake or heat) but can still be engulfed. Exclusive with every other field.
|
// movement, intake or heat) but can still be engulfed. Exclusive with every other field.
|
||||||
bool frozen{};
|
bool frozen{};
|
||||||
|
// Rules 12: oppose relative velocity instead of following `movement`.
|
||||||
|
bool brake{};
|
||||||
|
// Rules 13 (ADR-0179): matter channels the player keeps from being burned for anything but
|
||||||
|
// upkeep, bit 0 carbon to bit 3 other matter. Wildlife keeps nothing.
|
||||||
|
std::uint8_t exclude{};
|
||||||
|
// Rules 13: with `bud`, the player continues as the (first) bud; the parent becomes wildlife.
|
||||||
|
bool become{};
|
||||||
|
// Rules 13: an organism at the emergence threshold leaves the region for the world.
|
||||||
|
bool emerge{};
|
||||||
auto operator<=>(const CellularStepIntent&) const = default;
|
auto operator<=>(const CellularStepIntent&) const = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,12 +59,38 @@ struct CellularStepCandidate {
|
|||||||
CellularMovementStatus movement_status{CellularMovementStatus::not_requested};
|
CellularMovementStatus movement_status{CellularMovementStatus::not_requested};
|
||||||
CellularIntakeStatus intake_status{CellularIntakeStatus::not_requested};
|
CellularIntakeStatus intake_status{CellularIntakeStatus::not_requested};
|
||||||
std::optional<CellularPatchUptakeProposal> intake;
|
std::optional<CellularPatchUptakeProposal> intake;
|
||||||
|
// Rules 12 (liquid motion): the motion state after the tick and the path travelled.
|
||||||
|
CellularMotionState motion{};
|
||||||
|
std::uint64_t path_um{};
|
||||||
|
// Rules 13 (ADR-0179): reserve matter burned in place of energy, for the region's spent
|
||||||
|
// pool. Costs paid this way add no heat.
|
||||||
|
accounting::Inventory spent{};
|
||||||
|
// Rules 13: a collection limit held matter (or energy) back while food was left.
|
||||||
|
bool matter_limited{}, energy_limited{};
|
||||||
auto operator<=>(const CellularStepCandidate&) const = default;
|
auto operator<=>(const CellularStepCandidate&) const = default;
|
||||||
};
|
};
|
||||||
|
// Rules 12: liquid-relative motion inputs for one life (Cellular_Region_Movement_Plan.md).
|
||||||
|
struct CellularLiquidInput {
|
||||||
|
CellularMotionState motion;
|
||||||
|
CellularHandling handling;
|
||||||
|
CellularFlowSample flow; // Sampled at the footprint centre by the caller.
|
||||||
|
bool brake{};
|
||||||
|
auto operator<=>(const CellularLiquidInput&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
[[nodiscard]] std::expected<CellularStepCandidate, CellularStepError>
|
[[nodiscard]] std::expected<CellularStepCandidate, CellularStepError>
|
||||||
propose_cellular_step(std::uint64_t begin_tick, CellularArea area, CellularPosition position,
|
propose_cellular_step(std::uint64_t begin_tick, CellularArea area, CellularPosition position,
|
||||||
std::uint32_t extent_um, CellularStepIntent intent,
|
std::uint32_t extent_um, CellularStepIntent intent,
|
||||||
accounting::Inventory reserve, accounting::Inventory heat,
|
accounting::Inventory reserve, accounting::Inventory heat,
|
||||||
const MetabolicBudget& budget, const CellularHabitat& habitat) noexcept;
|
const MetabolicBudget& budget, const CellularHabitat& habitat) noexcept;
|
||||||
|
// Rules 12: maintenance first, then one kinematic tick funded from what is left; thrust it
|
||||||
|
// cannot fund is not applied and the cell coasts with the flow. No targeted intake: liquid
|
||||||
|
// regions feed by contact in the region step. Rules 13 pass `burn`: reserve matter stands in
|
||||||
|
// for missing energy, any channel for maintenance and only unexcluded ones for thrust.
|
||||||
|
[[nodiscard]] std::expected<CellularStepCandidate, CellularStepError>
|
||||||
|
propose_liquid_cellular_step(std::uint64_t begin_tick, CellularArea area, CellularPosition position,
|
||||||
|
std::uint32_t extent_um, CellularIntent movement,
|
||||||
|
const CellularLiquidInput& liquid, accounting::Inventory reserve,
|
||||||
|
accounting::Inventory heat, const MetabolicBudget& budget,
|
||||||
|
const CellularBurn* burn = nullptr) noexcept;
|
||||||
} // namespace evo::biology
|
} // namespace evo::biology
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/biology/cellular_catalog.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <compare>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
// Behaviour triggers (rules 13, ADR-0179; Cellular_mutation_plan.md section 3): what a cell did
|
||||||
|
// each tick raises or lowers its affinity score for each mutation. Integer state only, advanced
|
||||||
|
// once per tick by the owner, so replay reproduces every score exactly.
|
||||||
|
namespace evo::biology {
|
||||||
|
// One tick of a cell's activity: flags are 0 or 1, amounts are pJ or fg (CellularSignal).
|
||||||
|
struct CellularActivity {
|
||||||
|
std::array<std::uint64_t, cellular_signal_count> signal{};
|
||||||
|
std::uint16_t heading{}; // The cell's heading after the tick (65,536 per turn).
|
||||||
|
[[nodiscard]] std::uint64_t operator[](CellularSignal s) const noexcept {
|
||||||
|
return signal[static_cast<std::size_t>(s)];
|
||||||
|
}
|
||||||
|
std::uint64_t& operator[](CellularSignal s) noexcept {
|
||||||
|
return signal[static_cast<std::size_t>(s)];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// One trigger's progress. Its meaning depends on the trigger kind; all fields start at zero.
|
||||||
|
struct CellularTriggerState {
|
||||||
|
std::uint64_t first{}, second{};
|
||||||
|
std::uint32_t ticks{};
|
||||||
|
std::uint16_t heading{};
|
||||||
|
std::uint8_t running{};
|
||||||
|
auto operator<=>(const CellularTriggerState&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Advances one trigger by one tick; true when it fires. `threshold` replaces the spec's tick
|
||||||
|
// threshold (or window) when non-zero.
|
||||||
|
[[nodiscard]] bool cellular_trigger_tick(const CellularTriggerSpec& spec, std::uint32_t threshold,
|
||||||
|
CellularTriggerState& state,
|
||||||
|
const CellularActivity& activity) noexcept;
|
||||||
|
|
||||||
|
// Affinity: every mutation's score, and its increase and decrease triggers' progress.
|
||||||
|
struct CellularAffinity {
|
||||||
|
std::array<std::int16_t, cellular_catalog_size> score{};
|
||||||
|
std::array<CellularTriggerState, cellular_catalog_size> increase{}, decrease{};
|
||||||
|
auto operator<=>(const CellularAffinity&) const = default;
|
||||||
|
};
|
||||||
|
// Bounds of every score.
|
||||||
|
struct CellularScoreBounds {
|
||||||
|
std::int32_t min{-1'000}, max{1'000};
|
||||||
|
auto operator<=>(const CellularScoreBounds&) const = default;
|
||||||
|
};
|
||||||
|
// Advances every mutation's triggers by one tick and applies their points to its score
|
||||||
|
// (`tuning` is indexed like the catalog). Disabled mutations do not move.
|
||||||
|
void cellular_affinity_tick(CellularAffinity& affinity, const CellularActivity& activity,
|
||||||
|
std::span<const CellularMutationTuning> tuning,
|
||||||
|
CellularScoreBounds bounds) noexcept;
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/biology/cellular_kinematics.hpp"
|
||||||
|
#include "evo/biology/metabolism.hpp"
|
||||||
|
|
||||||
|
#include <compare>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <expected>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Git-managed trial values (Cellular_Region_Movement_Plan.md, tuning file). The file is
|
||||||
|
// plain `key = value` lines with `#` comments and integer values; `_` may separate digits.
|
||||||
|
// Every key below is required exactly once and range-checked, so a typo fails loudly
|
||||||
|
// instead of running with a default.
|
||||||
|
namespace evo::biology {
|
||||||
|
inline constexpr std::int64_t cellular_tuning_version = 1;
|
||||||
|
inline constexpr std::size_t max_cellular_tuning_bytes = std::size_t{64} * 1'024;
|
||||||
|
|
||||||
|
struct CellularTuning {
|
||||||
|
std::int64_t version{};
|
||||||
|
// Region shape and capacity; shape applies when a region opens.
|
||||||
|
std::int64_t region_width_um{}, region_height_um{};
|
||||||
|
std::int64_t region_organism_cap{}, region_deposit_limit{}, region_perception_radius_um{};
|
||||||
|
// Founder handling.
|
||||||
|
std::int64_t founder_thrust_um_per_s2{}, founder_reverse_thrust_um_per_s2{};
|
||||||
|
std::int64_t founder_drag_ppm_per_tick{}, founder_lateral_drag_ppm_per_tick{};
|
||||||
|
std::int64_t founder_turn_heading_per_s{}; // 65,536 heading units per turn.
|
||||||
|
// Thrust energy as a share of the metabolic full-speed movement cost, per thousand.
|
||||||
|
std::int64_t founder_thrust_cost_per_mille{};
|
||||||
|
// Currents.
|
||||||
|
std::int64_t currents_min_count{}, currents_max_count{};
|
||||||
|
std::int64_t currents_min_width_um{}, currents_max_width_um{};
|
||||||
|
std::int64_t currents_min_speed_um_per_s{}, currents_max_speed_um_per_s{};
|
||||||
|
std::int64_t currents_grid_pitch_um{};
|
||||||
|
// Moving food.
|
||||||
|
std::int64_t food_merged_bubble_cap_multiple{}, food_visible_moving_bubbles{};
|
||||||
|
std::int64_t food_induced_drift_radius_um{}, food_induced_drift_max_um_per_s{};
|
||||||
|
std::int64_t food_induced_drift_decay_ppm_per_tick{};
|
||||||
|
// Thermal map and biology (temperatures in millikelvin).
|
||||||
|
std::int64_t thermal_ambient_min_mk{}, thermal_ambient_max_mk{};
|
||||||
|
std::int64_t founder_preferred_mk{}, founder_comfort_band_mk{}, founder_body_tau_ms{};
|
||||||
|
std::int64_t founder_lethal_cold_mk{}, founder_lethal_heat_mk{};
|
||||||
|
std::int64_t thermal_off_preference_per_mille_per_k{}, thermal_transition_per_mille_per_k{};
|
||||||
|
std::int64_t thermal_multiplier_cap_per_mille{};
|
||||||
|
// Lifecycle.
|
||||||
|
std::int64_t lifecycle_logout_delay_ms{};
|
||||||
|
// Mutation offers.
|
||||||
|
std::int64_t mutation_step_points{}, mutation_paired_points{};
|
||||||
|
std::int64_t mutation_recovery_floor_per_mille{};
|
||||||
|
std::int64_t mutation_offer_interval_ms{}, mutation_offer_options{};
|
||||||
|
auto operator<=>(const CellularTuning&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CellularTuningErrorKind : std::uint8_t {
|
||||||
|
too_large,
|
||||||
|
syntax,
|
||||||
|
unknown_key,
|
||||||
|
duplicate_key,
|
||||||
|
invalid_value,
|
||||||
|
out_of_range,
|
||||||
|
missing_key,
|
||||||
|
inconsistent,
|
||||||
|
unsupported_version
|
||||||
|
};
|
||||||
|
struct CellularTuningError {
|
||||||
|
CellularTuningErrorKind kind{};
|
||||||
|
std::size_t line{}; // 1-based; zero when not tied to a line.
|
||||||
|
std::string key;
|
||||||
|
auto operator<=>(const CellularTuningError&) const = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] std::expected<CellularTuning, CellularTuningError>
|
||||||
|
parse_cellular_tuning(std::string_view text);
|
||||||
|
// The shared line reader for Git tuning files: comments and blank lines dropped, each other
|
||||||
|
// line split into a valid key and its unparsed value text. Views point into `text`.
|
||||||
|
struct TuningLine {
|
||||||
|
std::size_t line{}; // 1-based.
|
||||||
|
std::string_view key, value;
|
||||||
|
};
|
||||||
|
[[nodiscard]] std::expected<std::vector<TuningLine>, CellularTuningError>
|
||||||
|
read_tuning_lines(std::string_view text, std::size_t max_bytes);
|
||||||
|
// Optional '-', then digits with single '_' separators between digits; at most 18 digits.
|
||||||
|
[[nodiscard]] std::optional<std::int64_t> parse_tuning_integer(std::string_view text) noexcept;
|
||||||
|
// Canonical text: every key once, in schema order, so equal tunings encode identically.
|
||||||
|
[[nodiscard]] std::string encode_cellular_tuning(const CellularTuning& tuning);
|
||||||
|
[[nodiscard]] std::string_view describe(CellularTuningErrorKind kind) noexcept;
|
||||||
|
|
||||||
|
// Founder handling per 50 ms tick, rounded down; costs are supplied by the metabolic budget.
|
||||||
|
[[nodiscard]] CellularHandling founder_cellular_handling(const CellularTuning& tuning,
|
||||||
|
accounting::Picojoules thrust_cost,
|
||||||
|
accounting::Picojoules reverse_cost);
|
||||||
|
|
||||||
|
enum class CellularHandlingError : std::uint8_t { unsupported_rate, overflow };
|
||||||
|
// Development 6: an organism's handling from its movement arrangement, scaled from the
|
||||||
|
// founder's tuned handling (index 100 = founder). Output scales thrust, braking scales
|
||||||
|
// reverse thrust, steering scales turning; streamlining lowers forward drag only and
|
||||||
|
// coasting lowers both, so a coasting body also tops out faster. Full-output costs per tick
|
||||||
|
// are the budget's full-speed movement cost times output (or braking) over efficiency.
|
||||||
|
// Without the movement capability or with shed output, the body cannot thrust or turn.
|
||||||
|
// A genome from before schema 6 has no arrangement and handles as the founder does.
|
||||||
|
[[nodiscard]] std::expected<CellularHandling, CellularHandlingError>
|
||||||
|
derive_cellular_handling(const Genome& genome, const MetabolicBudget& budget,
|
||||||
|
const CellularTuning& tuning);
|
||||||
|
// The same from the founder's per-tick handling directly; its costs are ignored.
|
||||||
|
[[nodiscard]] std::expected<CellularHandling, CellularHandlingError>
|
||||||
|
derive_cellular_handling(const Genome& genome, const MetabolicBudget& budget,
|
||||||
|
const CellularHandling& founder);
|
||||||
|
} // namespace evo::biology
|
||||||
@@ -32,10 +32,18 @@ inline constexpr std::uint64_t development_v2_rate_microseconds = 1'000'000;
|
|||||||
[[nodiscard]] constexpr std::uint64_t
|
[[nodiscard]] constexpr std::uint64_t
|
||||||
development_rate_microseconds(std::uint32_t development_version) noexcept {
|
development_rate_microseconds(std::uint32_t development_version) noexcept {
|
||||||
return development_version == 1 ? development_v1_tick_microseconds
|
return development_version == 1 ? development_v1_tick_microseconds
|
||||||
: development_version >= 2 && development_version <= 5
|
: development_version >= 2 && development_version <= 7
|
||||||
? development_v2_rate_microseconds // Versions 3-5 keep version 2's rates.
|
? development_v2_rate_microseconds // Versions 3-7 keep version 2's rates.
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
// Development version 7 (ADR-0179): region-declared body tuning. Upkeep is an essential
|
||||||
|
// share of the mass-based upkeep that no trait reduces, plus the rest divided by the
|
||||||
|
// genome's upkeep efficiency. Earlier versions ignore it.
|
||||||
|
struct BodyTuning {
|
||||||
|
std::uint32_t essential_upkeep_per_thousand{250}; // Trial (ADR-0179).
|
||||||
|
auto operator<=>(const BodyTuning&) const = default;
|
||||||
|
};
|
||||||
|
inline constexpr BodyTuning default_body_tuning{};
|
||||||
// Chosen constants, reviewable as a unit and selected by the genome's
|
// Chosen constants, reviewable as a unit and selected by the genome's
|
||||||
// development version. Declared model parameters, not balance.
|
// development version. Declared model parameters, not balance.
|
||||||
struct DevelopmentRules {
|
struct DevelopmentRules {
|
||||||
@@ -68,6 +76,7 @@ struct Phenotype {
|
|||||||
// built inside the cell. At efficiency p per thousand they add p/4 of the structural mass
|
// built inside the cell. At efficiency p per thousand they add p/4 of the structural mass
|
||||||
// as membrane mass (so they are upkept twice, like membrane) and slow movement by p/2 per
|
// as membrane mass (so they are upkept twice, like membrane) and slow movement by p/2 per
|
||||||
// thousand. Light itself is captured by the region's environment owner, never here.
|
// thousand. Light itself is captured by the region's environment owner, never here.
|
||||||
|
// Version 7 keeps the organelle mass but drops the speed penalty: mass slows the cell.
|
||||||
inline constexpr std::uint32_t photosynthesis_organelle_quarter = 4;
|
inline constexpr std::uint32_t photosynthesis_organelle_quarter = 4;
|
||||||
inline constexpr std::uint32_t photosynthesis_speed_halving = 2;
|
inline constexpr std::uint32_t photosynthesis_speed_halving = 2;
|
||||||
// A proposal. It reserves nothing, pays for nothing and commits nothing; the
|
// A proposal. It reserves nothing, pays for nothing and commits nothing; the
|
||||||
@@ -85,12 +94,14 @@ rules_for(std::uint32_t development_version);
|
|||||||
// Pure: a phenotype is recomputed from retained inputs rather than cached, so a
|
// Pure: a phenotype is recomputed from retained inputs rather than cached, so a
|
||||||
// cached copy can always be checked against a recomputation.
|
// cached copy can always be checked against a recomputation.
|
||||||
[[nodiscard]] std::expected<Phenotype, DevelopmentError>
|
[[nodiscard]] std::expected<Phenotype, DevelopmentError>
|
||||||
derive_phenotype(const Genome& genome, GrowthState growth, EnvironmentState environment);
|
derive_phenotype(const Genome& genome, GrowthState growth, EnvironmentState environment,
|
||||||
|
const BodyTuning& tuning = default_body_tuning);
|
||||||
// Advances realized growth toward the target by at most the rule step, reduced to
|
// Advances realized growth toward the target by at most the rule step, reduced to
|
||||||
// the largest step the available mass and energy admit. This bounds by total mass
|
// the largest step the available mass and energy admit. This bounds by total mass
|
||||||
// only: it cannot see which elements a step consumes, so it is a proposal and not
|
// only: it cannot see which elements a step consumes, so it is a proposal and not
|
||||||
// an affordability authority. `metabolic_budget` decides that, per channel, and
|
// an affordability authority. `metabolic_budget` decides that, per channel, and
|
||||||
// can only narrow this further. Never repairs damage.
|
// can only narrow this further. Never repairs damage.
|
||||||
[[nodiscard]] std::expected<DevelopmentPlan, DevelopmentError>
|
[[nodiscard]] std::expected<DevelopmentPlan, DevelopmentError>
|
||||||
plan_development(const Genome& genome, GrowthState growth, EnvironmentState environment);
|
plan_development(const Genome& genome, GrowthState growth, EnvironmentState environment,
|
||||||
|
const BodyTuning& tuning = default_body_tuning);
|
||||||
} // namespace evo::biology
|
} // namespace evo::biology
|
||||||
|
|||||||
@@ -37,6 +37,13 @@ inline constexpr FounderVersion primitive_founder_v3{genome_schema_v4, 4};
|
|||||||
// Founder 4 serves rules 11 (ADR-0175): founder 3 that can evolve photosynthesis. Founders
|
// Founder 4 serves rules 11 (ADR-0175): founder 3 that can evolve photosynthesis. Founders
|
||||||
// start without it; the capability is only ever earned through mutation.
|
// start without it; the capability is only ever earned through mutation.
|
||||||
inline constexpr FounderVersion primitive_founder_v4{genome_schema_v5, 5};
|
inline constexpr FounderVersion primitive_founder_v4{genome_schema_v5, 5};
|
||||||
|
// Founder 5 serves rules 12 (Cellular_Region_Movement_Plan.md): founder 4 with the founder
|
||||||
|
// movement arrangement (every index at the 100-point reference).
|
||||||
|
inline constexpr FounderVersion primitive_founder_v5{genome_schema_v6, 6};
|
||||||
|
// Founder 6 serves rules 13 (ADR-0179): founder 5 on genome schema 7 and development 7, with
|
||||||
|
// the membrane in nanometres (1,000 nm, the same 1 um) and the founder's cellular traits.
|
||||||
|
inline constexpr FounderVersion primitive_founder_v6{genome_schema_v7, 7};
|
||||||
|
inline constexpr std::uint32_t founder_membrane_nanometres = 1'000;
|
||||||
inline constexpr std::uint32_t primitive_founder_development_version =
|
inline constexpr std::uint32_t primitive_founder_development_version =
|
||||||
primitive_founder_v1.development_version;
|
primitive_founder_v1.development_version;
|
||||||
// The founder genome under a world-scoped identity and its origin event. Fails only on
|
// The founder genome under a world-scoped identity and its origin event. Fails only on
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <expected>
|
#include <expected>
|
||||||
|
#include <optional>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -31,7 +32,8 @@ enum class Unit : std::uint8_t {
|
|||||||
femtograms_per_tick, // Schema 1: per 50 ms tick.
|
femtograms_per_tick, // Schema 1: per 50 ms tick.
|
||||||
millikelvin,
|
millikelvin,
|
||||||
micrometres_per_second, // Schema 2 (ADR-0099).
|
micrometres_per_second, // Schema 2 (ADR-0099).
|
||||||
femtograms_per_second // Schema 2 (ADR-0099).
|
femtograms_per_second, // Schema 2 (ADR-0099).
|
||||||
|
nanometres // Schema 7 membrane (ADR-0179).
|
||||||
};
|
};
|
||||||
struct CapabilitySpec {
|
struct CapabilitySpec {
|
||||||
Unit unit;
|
Unit unit;
|
||||||
@@ -87,6 +89,21 @@ inline constexpr std::array<CapabilitySpec, capability_count> capability_schema_
|
|||||||
CapabilitySpec{Unit::femtograms, 1, 1'000'000'000, true, 0},
|
CapabilitySpec{Unit::femtograms, 1, 1'000'000'000, true, 0},
|
||||||
CapabilitySpec{Unit::millikelvin, 1, 100'000, false, 0},
|
CapabilitySpec{Unit::millikelvin, 1, 100'000, false, 0},
|
||||||
CapabilitySpec{Unit::per_thousand, 1, 1000, false, capability_bit(Capability::membrane)}};
|
CapabilitySpec{Unit::per_thousand, 1, 1000, false, capability_bit(Capability::membrane)}};
|
||||||
|
// Schema 7 (ADR-0179): schema 5 with the membrane in nanometres, so it can change in 5%
|
||||||
|
// steps of the founder's 1 um (1,000 nm). Other units are unchanged; energy conversion is
|
||||||
|
// read as the share of bubble energy kept, reproduction as the bud's share of the body.
|
||||||
|
inline constexpr std::array<CapabilitySpec, capability_count> capability_schema_v7{
|
||||||
|
CapabilitySpec{Unit::per_thousand, 1, 1000, true, 0},
|
||||||
|
CapabilitySpec{Unit::nanometres, 1, 10'000'000, true, 0},
|
||||||
|
CapabilitySpec{Unit::micrometres_per_second, 0, 2'000'000, false,
|
||||||
|
capability_bit(Capability::membrane)},
|
||||||
|
CapabilitySpec{Unit::femtograms_per_second, 0, 20'000'000, false,
|
||||||
|
capability_bit(Capability::membrane)},
|
||||||
|
CapabilitySpec{Unit::per_thousand, 1, 1000, false,
|
||||||
|
capability_bit(Capability::energy_conversion)},
|
||||||
|
CapabilitySpec{Unit::femtograms, 1, 1'000'000'000, true, 0},
|
||||||
|
CapabilitySpec{Unit::millikelvin, 1, 100'000, false, 0},
|
||||||
|
CapabilitySpec{Unit::per_thousand, 1, 1000, false, capability_bit(Capability::membrane)}};
|
||||||
// The current schema's table.
|
// The current schema's table.
|
||||||
inline constexpr const auto& capability_schema = capability_schema_v2;
|
inline constexpr const auto& capability_schema = capability_schema_v2;
|
||||||
// Schema 1 rates are per tick of this quantum.
|
// Schema 1 rates are per tick of this quantum.
|
||||||
@@ -99,6 +116,37 @@ struct CapabilityRecord {
|
|||||||
std::uint32_t prerequisites{};
|
std::uint32_t prerequisites{};
|
||||||
auto operator<=>(const CapabilityRecord&) const = default;
|
auto operator<=>(const CapabilityRecord&) const = default;
|
||||||
};
|
};
|
||||||
|
// Schema 6 (Cellular_movement_draft.md 001-010): the body's movement arrangement as
|
||||||
|
// indices in reference points, where 100 is the founder's arrangement. Burst, anchor and
|
||||||
|
// colony drive are acquired modules: 0 means absent. Output 0 means propulsion was shed
|
||||||
|
// (009); independent propulsion also needs the movement capability.
|
||||||
|
struct MovementArrangement {
|
||||||
|
std::uint16_t output{}, efficiency{}, burst{}, steering{}, streamlining{}, braking{}, anchor{},
|
||||||
|
coasting{}, colony_drive{};
|
||||||
|
auto operator<=>(const MovementArrangement&) const = default;
|
||||||
|
};
|
||||||
|
inline constexpr std::uint16_t movement_reference_points = 100;
|
||||||
|
inline constexpr std::uint16_t max_movement_points = 1'000;
|
||||||
|
inline constexpr MovementArrangement founder_movement_arrangement{100, 100, 0, 100, 100,
|
||||||
|
100, 0, 100, 0};
|
||||||
|
// Schema 7 (ADR-0179): heritable cellular traits beyond the capability records. Indices are
|
||||||
|
// reference points where 100 is the founder; the recipe is per thousand of the body's
|
||||||
|
// structure in C, N, P and other matter (summing to 1000); litter is extra offspring per
|
||||||
|
// bud in hundredths (150 = one extra plus a 50% chance of a second); adhesion is 0 or 1.
|
||||||
|
struct CellularTraits {
|
||||||
|
std::uint16_t density{}, upkeep_efficiency{}, growth_speed{};
|
||||||
|
std::array<std::uint16_t, 5> collection{}; // E, C, N, P, O.
|
||||||
|
std::array<std::uint16_t, 4> burn{}; // C, N, P, O.
|
||||||
|
std::uint16_t engulf_capacity{}, kill_absorption{}, litter{};
|
||||||
|
std::array<std::uint16_t, 4> recipe{}; // C, N, P, O per thousand.
|
||||||
|
std::uint16_t adhesion{};
|
||||||
|
auto operator<=>(const CellularTraits&) const = default;
|
||||||
|
};
|
||||||
|
inline constexpr std::uint16_t max_trait_points = 1'000;
|
||||||
|
inline constexpr std::uint16_t max_litter = 9'900; // At most 100 offspring per bud.
|
||||||
|
inline constexpr CellularTraits founder_cellular_traits{
|
||||||
|
100, 100, 100, {100, 100, 100, 100, 100}, {100, 100, 100, 100},
|
||||||
|
100, 100, 0, {500, 150, 50, 300}, 0};
|
||||||
// Unvalidated input. Only Genome::create turns one into a record.
|
// Unvalidated input. Only Genome::create turns one into a record.
|
||||||
struct GenomeDraft {
|
struct GenomeDraft {
|
||||||
std::uint64_t id{};
|
std::uint64_t id{};
|
||||||
@@ -110,6 +158,10 @@ struct GenomeDraft {
|
|||||||
// literal keeps its meaning (rates per 50 ms tick); new records name schema 2. Last,
|
// literal keeps its meaning (rates per 50 ms tick); new records name schema 2. Last,
|
||||||
// so positional initialisers are unaffected.
|
// so positional initialisers are unaffected.
|
||||||
std::uint32_t schema_version{1};
|
std::uint32_t schema_version{1};
|
||||||
|
// Required from schema 6 and refused before it.
|
||||||
|
std::optional<MovementArrangement> movement_arrangement{};
|
||||||
|
// Required from schema 7 and refused before it.
|
||||||
|
std::optional<CellularTraits> cellular_traits{};
|
||||||
};
|
};
|
||||||
enum class GenomeError : std::uint8_t {
|
enum class GenomeError : std::uint8_t {
|
||||||
unsupported_version,
|
unsupported_version,
|
||||||
@@ -134,15 +186,22 @@ inline constexpr std::uint32_t genome_schema_v3 = 3;
|
|||||||
inline constexpr std::uint32_t genome_schema_v4 = 4;
|
inline constexpr std::uint32_t genome_schema_v4 = 4;
|
||||||
// Schema 5 (rules 11, ADR-0175): schema 4's steps with the photosynthesis capability.
|
// Schema 5 (rules 11, ADR-0175): schema 4's steps with the photosynthesis capability.
|
||||||
inline constexpr std::uint32_t genome_schema_v5 = 5;
|
inline constexpr std::uint32_t genome_schema_v5 = 5;
|
||||||
|
// Schema 6 (rules 12, Cellular_Region_Movement_Plan.md): schema 5's capabilities and steps
|
||||||
|
// plus the movement arrangement.
|
||||||
|
inline constexpr std::uint32_t genome_schema_v6 = 6;
|
||||||
|
// Schema 7 (rules 13, ADR-0179): schema 6 with the membrane in nanometres and the cellular
|
||||||
|
// traits. Its mutations are the named catalog, not the generic operators.
|
||||||
|
inline constexpr std::uint32_t genome_schema_v7 = 7;
|
||||||
// The newest schema. Older records stay valid and are never rewritten (ADR-0099).
|
// The newest schema. Older records stay valid and are never rewritten (ADR-0099).
|
||||||
inline constexpr std::uint32_t genome_schema_version = genome_schema_v5;
|
inline constexpr std::uint32_t genome_schema_version = genome_schema_v7;
|
||||||
// The capability table of a supported schema (1 to 5); nullptr otherwise.
|
// The capability table of a supported schema (1 to 7); nullptr otherwise.
|
||||||
[[nodiscard]] constexpr const std::array<CapabilitySpec, capability_count>*
|
[[nodiscard]] constexpr const std::array<CapabilitySpec, capability_count>*
|
||||||
capability_schema_for(std::uint32_t schema) noexcept {
|
capability_schema_for(std::uint32_t schema) noexcept {
|
||||||
return schema == genome_schema_v1 ? &capability_schema_v1
|
return schema == genome_schema_v1 ? &capability_schema_v1
|
||||||
: schema == genome_schema_v2 || schema == genome_schema_v3 || schema == genome_schema_v4
|
: schema == genome_schema_v2 || schema == genome_schema_v3 || schema == genome_schema_v4
|
||||||
? &capability_schema_v2
|
? &capability_schema_v2
|
||||||
: schema == genome_schema_v5 ? &capability_schema_v5
|
: schema == genome_schema_v5 || schema == genome_schema_v6 ? &capability_schema_v5
|
||||||
|
: schema == genome_schema_v7 ? &capability_schema_v7
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
inline constexpr std::size_t max_parents = 2;
|
inline constexpr std::size_t max_parents = 2;
|
||||||
@@ -182,6 +241,14 @@ class Genome {
|
|||||||
[[nodiscard]] std::span<const CapabilityRecord> capabilities() const noexcept {
|
[[nodiscard]] std::span<const CapabilityRecord> capabilities() const noexcept {
|
||||||
return capabilities_;
|
return capabilities_;
|
||||||
}
|
}
|
||||||
|
// Present exactly from schema 6.
|
||||||
|
[[nodiscard]] const std::optional<MovementArrangement>& movement_arrangement() const noexcept {
|
||||||
|
return movement_arrangement_;
|
||||||
|
}
|
||||||
|
// Present exactly from schema 7.
|
||||||
|
[[nodiscard]] const std::optional<CellularTraits>& cellular_traits() const noexcept {
|
||||||
|
return cellular_traits_;
|
||||||
|
}
|
||||||
[[nodiscard]] bool carries(Capability kind) const noexcept;
|
[[nodiscard]] bool carries(Capability kind) const noexcept;
|
||||||
[[nodiscard]] std::expected<std::uint32_t, GenomeError>
|
[[nodiscard]] std::expected<std::uint32_t, GenomeError>
|
||||||
parameter(Capability kind) const noexcept;
|
parameter(Capability kind) const noexcept;
|
||||||
@@ -206,6 +273,8 @@ class Genome {
|
|||||||
std::uint32_t development_version_{};
|
std::uint32_t development_version_{};
|
||||||
std::vector<std::uint64_t> parents_;
|
std::vector<std::uint64_t> parents_;
|
||||||
std::vector<CapabilityRecord> capabilities_;
|
std::vector<CapabilityRecord> capabilities_;
|
||||||
|
std::optional<MovementArrangement> movement_arrangement_;
|
||||||
|
std::optional<CellularTraits> cellular_traits_;
|
||||||
std::uint64_t digest_{};
|
std::uint64_t digest_{};
|
||||||
};
|
};
|
||||||
} // namespace evo::biology
|
} // namespace evo::biology
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
namespace evo::biology {
|
namespace evo::biology {
|
||||||
// Development version 4 (rules 7, ADR-0137): a bud is always this share of the parent's body.
|
// Development version 4 (rules 7, ADR-0137): a bud is always this share of the parent's body.
|
||||||
inline constexpr std::uint32_t bud_body_per_thousand_v4 = 500;
|
inline constexpr std::uint32_t bud_body_per_thousand_v4 = 500;
|
||||||
|
// Development version 7 (ADR-0179): the reproduction value is the bud's share of the body again,
|
||||||
|
// and the construction discount stays at the founder's level (500 per thousand: a quarter off).
|
||||||
|
inline constexpr std::uint32_t primitive_bud_skill_v7 = 500;
|
||||||
// Shares in thousandths over the ledger's C/N/P/other channels, summing to 1000.
|
// Shares in thousandths over the ledger's C/N/P/other channels, summing to 1000.
|
||||||
// The last channel absorbs the rounding remainder, so a split conserves mass.
|
// The last channel absorbs the rounding remainder, so a split conserves mass.
|
||||||
using Composition = std::array<std::uint16_t, 4>;
|
using Composition = std::array<std::uint16_t, 4>;
|
||||||
@@ -59,7 +62,8 @@ metabolic_rules_for(std::uint32_t development_version);
|
|||||||
// its versioned cadence. The default preserves earlier budget results exactly.
|
// its versioned cadence. The default preserves earlier budget results exactly.
|
||||||
[[nodiscard]] std::expected<MetabolicBudget, DevelopmentError>
|
[[nodiscard]] std::expected<MetabolicBudget, DevelopmentError>
|
||||||
metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState environment,
|
metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState environment,
|
||||||
std::uint32_t max_growth_per_thousand = 1000);
|
std::uint32_t max_growth_per_thousand = 1000,
|
||||||
|
const BodyTuning& tuning = default_body_tuning);
|
||||||
// An analysis, not a rule (ADR-0098 decision 7): whole seconds until feeding funds the
|
// An analysis, not a rule (ADR-0098 decision 7): whole seconds until feeding funds the
|
||||||
// budget's reproduction investment, channel by channel and in energy, when the organism
|
// budget's reproduction investment, channel by channel and in energy, when the organism
|
||||||
// takes in its full intake limit for `feeding_per_thousand` of the time and pays its
|
// takes in its full intake limit for `feeding_per_thousand` of the time and pays its
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ enum class Action : std::uint8_t {
|
|||||||
pan_right,
|
pan_right,
|
||||||
pan_up,
|
pan_up,
|
||||||
pan_down,
|
pan_down,
|
||||||
toggle_capture
|
toggle_capture,
|
||||||
|
brake // Rules 12: appended so earlier controls files keep their meaning.
|
||||||
};
|
};
|
||||||
inline constexpr std::size_t action_count = 9;
|
inline constexpr std::size_t action_count = 10;
|
||||||
using KeyCode = std::uint16_t; // HID usage; 0 means unbound.
|
using KeyCode = std::uint16_t; // HID usage; 0 means unbound.
|
||||||
inline constexpr KeyCode no_key = 0;
|
inline constexpr KeyCode no_key = 0;
|
||||||
inline constexpr KeyCode escape_key = 41; // Reserved: cancels binding capture.
|
inline constexpr KeyCode escape_key = 41; // Reserved: cancels binding capture.
|
||||||
|
|||||||
@@ -6,7 +6,18 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
namespace evo::client {
|
namespace evo::client {
|
||||||
enum class Key : std::uint8_t { left, right, up, down, pan_left, pan_right, pan_up, pan_down };
|
// `brake` (rules 12) opposes the cell's velocity relative to the liquid while held.
|
||||||
|
enum class Key : std::uint8_t {
|
||||||
|
left,
|
||||||
|
right,
|
||||||
|
up,
|
||||||
|
down,
|
||||||
|
pan_left,
|
||||||
|
pan_right,
|
||||||
|
pan_up,
|
||||||
|
pan_down,
|
||||||
|
brake
|
||||||
|
};
|
||||||
enum class InputError : std::uint8_t {
|
enum class InputError : std::uint8_t {
|
||||||
invalid_key,
|
invalid_key,
|
||||||
invalid_pointer,
|
invalid_pointer,
|
||||||
@@ -17,6 +28,7 @@ enum class InputError : std::uint8_t {
|
|||||||
struct Intention {
|
struct Intention {
|
||||||
std::uint64_t sequence{}, tick{};
|
std::uint64_t sequence{}, tick{};
|
||||||
std::int16_t move_x{}, move_y{}; // Signed unit vector *1000, local XY (+Y up).
|
std::int16_t move_x{}, move_y{}; // Signed unit vector *1000, local XY (+Y up).
|
||||||
|
bool brake{}; // Rules 12: held brake.
|
||||||
};
|
};
|
||||||
struct Navigation {
|
struct Navigation {
|
||||||
int x{}, y{};
|
int x{}, y{};
|
||||||
@@ -49,7 +61,7 @@ class InputState {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void clear() noexcept;
|
void clear() noexcept;
|
||||||
std::array<bool, 8> keys_{};
|
std::array<bool, 9> keys_{};
|
||||||
bool admitted_{false}, captured_{false};
|
bool admitted_{false}, captured_{false};
|
||||||
ScreenPoint pointer_{};
|
ScreenPoint pointer_{};
|
||||||
double wheel_{};
|
double wheel_{};
|
||||||
|
|||||||
@@ -59,20 +59,23 @@ class RegionSessionClient {
|
|||||||
// retries and reconnects). False unless established and sent.
|
// retries and reconnects). False unless established and sent.
|
||||||
[[nodiscard]] bool send_action(std::uint64_t action_id, network::ActionKind kind,
|
[[nodiscard]] bool send_action(std::uint64_t action_id, network::ActionKind kind,
|
||||||
std::uint64_t tick);
|
std::uint64_t tick);
|
||||||
// Protocol v7-v10. Reuse the exact same fields and action id after reconnect. `engulf`
|
// Protocol v7-v14. Reuse the exact same fields and action id after reconnect. `engulf`
|
||||||
// and `bud` (ADR-0124/0125) are exclusive and need a v10 session and no intake target.
|
// and `bud` (ADR-0124/0125) are exclusive and need a v10 session and no intake target.
|
||||||
|
// `brake` needs v13 or v14; `become` (with `bud`), `emerge` (alone) and `exclude` (matter
|
||||||
|
// channels kept from burning) need v14. Older sessions never send them.
|
||||||
[[nodiscard]] bool
|
[[nodiscard]] bool
|
||||||
send_cellular_action(std::uint64_t action_id, std::uint64_t tick, std::int16_t move_x,
|
send_cellular_action(std::uint64_t action_id, std::uint64_t tick, std::int16_t move_x,
|
||||||
std::int16_t move_y,
|
std::int16_t move_y,
|
||||||
std::optional<std::pair<std::uint32_t, std::uint32_t>> intake_target = {},
|
std::optional<std::pair<std::uint32_t, std::uint32_t>> intake_target = {},
|
||||||
bool engulf = false, bool bud = false);
|
bool engulf = false, bool bud = false, bool brake = false,
|
||||||
|
bool become = false, bool emerge = false, std::uint8_t exclude = 0);
|
||||||
// Protocol v10 (ADR-0121): choose one candidate of the life's outstanding offer. The
|
// Protocol v10 (ADR-0121): choose one candidate of the life's outstanding offer. The
|
||||||
// receipt names the tick it publishes with; the outcome follows that commit. `tick` is
|
// receipt names the tick it publishes with; the outcome follows that commit. `tick` is
|
||||||
// the client's latest simulated tick (after the offer); the server schedules the next.
|
// the client's latest simulated tick (after the offer); the server schedules the next.
|
||||||
[[nodiscard]] bool send_cellular_mutation(std::uint64_t action_id, std::uint64_t tick,
|
[[nodiscard]] bool send_cellular_mutation(std::uint64_t action_id, std::uint64_t tick,
|
||||||
std::uint64_t life_identity,
|
std::uint64_t life_identity,
|
||||||
std::uint64_t event_index, std::uint64_t offer_tick,
|
std::uint64_t event_index, std::uint64_t offer_tick,
|
||||||
std::uint16_t operator_id);
|
std::uint16_t operator_id, bool become = false);
|
||||||
[[nodiscard]] bool query_action(std::uint64_t action_id);
|
[[nodiscard]] bool query_action(std::uint64_t action_id);
|
||||||
// Primitive profile v5 only. The account and generation are always supplied by the
|
// Primitive profile v5 only. The account and generation are always supplied by the
|
||||||
// authenticated session; callers choose only a stable request id.
|
// authenticated session; callers choose only a stable request id.
|
||||||
|
|||||||
@@ -41,19 +41,39 @@ inline constexpr std::uint16_t session_protocol_v11 = 11;
|
|||||||
// v12 (ADR-0176) is v11 plus the owner's captured light and visible producers in its
|
// v12 (ADR-0176) is v11 plus the owner's captured light and visible producers in its
|
||||||
// perception, and the photosynthesis capability (7) in mutation offers.
|
// perception, and the photosynthesis capability (7) in mutation offers.
|
||||||
inline constexpr std::uint16_t session_protocol_v12 = 12;
|
inline constexpr std::uint16_t session_protocol_v12 = 12;
|
||||||
// v10, v11 and v12 share every cellular message but the perception's contents.
|
// v13 (rules 12, ADR-0177) is v12 plus liquid motion: the owner's velocity and heading and the
|
||||||
|
// region's current configuration in its perception, each deposit's world velocity, and a brake
|
||||||
|
// flag on cellular actions.
|
||||||
|
inline constexpr std::uint16_t session_protocol_v13 = 13;
|
||||||
|
// v14 (rules 13, ADR-0179) is v13 plus the cellular revamp: the body block in the perception,
|
||||||
|
// become, emerge and channel exclusions on actions, become on mutation choices, catalog offers
|
||||||
|
// and the emerged ending.
|
||||||
|
inline constexpr std::uint16_t session_protocol_v14 = 14;
|
||||||
|
// v10 to v14 share every cellular message but the perception's contents, v13's brake and v14's
|
||||||
|
// revamp fields.
|
||||||
[[nodiscard]] constexpr bool cellular_v10_family(std::uint16_t version) noexcept {
|
[[nodiscard]] constexpr bool cellular_v10_family(std::uint16_t version) noexcept {
|
||||||
return version == session_protocol_v10 || version == session_protocol_v11 ||
|
return version == session_protocol_v10 || version == session_protocol_v11 ||
|
||||||
version == session_protocol_v12;
|
version == session_protocol_v12 || version == session_protocol_v13 ||
|
||||||
|
version == session_protocol_v14;
|
||||||
}
|
}
|
||||||
// Versions whose perception lists pools and bubbles (ADR-0136) instead of square patches.
|
// Versions whose perception lists pools and bubbles (ADR-0136) instead of square patches.
|
||||||
[[nodiscard]] constexpr bool cellular_deposit_version(std::uint16_t version) noexcept {
|
[[nodiscard]] constexpr bool cellular_deposit_version(std::uint16_t version) noexcept {
|
||||||
return version == session_protocol_v11 || version == session_protocol_v12;
|
return version == session_protocol_v11 || version == session_protocol_v12 ||
|
||||||
|
version == session_protocol_v13 || version == session_protocol_v14;
|
||||||
|
}
|
||||||
|
// Versions that carry captured light and producers (ADR-0176).
|
||||||
|
[[nodiscard]] constexpr bool cellular_light_version(std::uint16_t version) noexcept {
|
||||||
|
return version == session_protocol_v12 || version == session_protocol_v13 ||
|
||||||
|
version == session_protocol_v14;
|
||||||
|
}
|
||||||
|
// Versions that carry liquid motion (rules 12).
|
||||||
|
[[nodiscard]] constexpr bool cellular_liquid_version(std::uint16_t version) noexcept {
|
||||||
|
return version == session_protocol_v13 || version == session_protocol_v14;
|
||||||
}
|
}
|
||||||
// The highest capability a version's mutation offers may name.
|
// The highest capability a version's mutation offers may name.
|
||||||
[[nodiscard]] constexpr std::uint8_t
|
[[nodiscard]] constexpr std::uint8_t
|
||||||
cellular_offer_capability_limit(std::uint16_t version) noexcept {
|
cellular_offer_capability_limit(std::uint16_t version) noexcept {
|
||||||
return version == session_protocol_v12 ? 7 : 6;
|
return cellular_light_version(version) ? 7 : 6;
|
||||||
}
|
}
|
||||||
inline constexpr std::size_t max_cellular_perceived_patches = 256;
|
inline constexpr std::size_t max_cellular_perceived_patches = 256;
|
||||||
inline constexpr std::size_t max_cellular_perceived_deposits = 512;
|
inline constexpr std::size_t max_cellular_perceived_deposits = 512;
|
||||||
@@ -198,6 +218,11 @@ struct CellularActionInput {
|
|||||||
std::uint32_t intake_x_um{}, intake_y_um{};
|
std::uint32_t intake_x_um{}, intake_y_um{};
|
||||||
bool engulf{};
|
bool engulf{};
|
||||||
bool bud{}; // Kind 3 (ADR-0125): fund one wildlife bud, zero coordinates, v10 only.
|
bool bud{}; // Kind 3 (ADR-0125): fund one wildlife bud, zero coordinates, v10 only.
|
||||||
|
bool brake{}; // Byte 13 bit 0 (schema 58, rules 12): oppose relative velocity.
|
||||||
|
// Schema 60 (rules 13): byte 13 bit 1 become the bud, bit 2 emerge; byte 14 the channels
|
||||||
|
// excluded from burning (bits 0-3: C, N, P, other).
|
||||||
|
bool become{}, emerge{};
|
||||||
|
std::uint8_t exclude{};
|
||||||
friend bool operator==(const CellularActionInput&, const CellularActionInput&) = default;
|
friend bool operator==(const CellularActionInput&, const CellularActionInput&) = default;
|
||||||
};
|
};
|
||||||
inline constexpr std::size_t cellular_action_input_bytes = 24;
|
inline constexpr std::size_t cellular_action_input_bytes = 24;
|
||||||
@@ -212,6 +237,12 @@ struct CellularAction {
|
|||||||
bool engulf{};
|
bool engulf{};
|
||||||
// v10 (ADR-0125): fund one wildlife bud; exclusive with intake and engulfment.
|
// v10 (ADR-0125): fund one wildlife bud; exclusive with intake and engulfment.
|
||||||
bool bud{};
|
bool bud{};
|
||||||
|
// v13 (rules 12): brake against relative velocity instead of following the movement.
|
||||||
|
bool brake{};
|
||||||
|
// v14 (rules 13): with `bud`, continue as the bud; leave the region as an organism at the
|
||||||
|
// threshold (no target); matter channels excluded from burning (bits 0-3).
|
||||||
|
bool become{}, emerge{};
|
||||||
|
std::uint8_t exclude{};
|
||||||
friend bool operator==(const CellularAction&, const CellularAction&) = default;
|
friend bool operator==(const CellularAction&, const CellularAction&) = default;
|
||||||
};
|
};
|
||||||
// v10 reliable choice. The server binds these values to the authenticated account and
|
// v10 reliable choice. The server binds these values to the authenticated account and
|
||||||
@@ -220,12 +251,16 @@ struct CellularMutationAction {
|
|||||||
std::uint64_t session{}, epoch{}, action_id{}, tick{};
|
std::uint64_t session{}, epoch{}, action_id{}, tick{};
|
||||||
std::uint64_t life_identity{}, event_index{}, offer_tick{};
|
std::uint64_t life_identity{}, event_index{}, offer_tick{};
|
||||||
std::uint16_t operator_id{};
|
std::uint16_t operator_id{};
|
||||||
|
bool become{}; // v14: continue as the offspring the choice splits off.
|
||||||
friend bool operator==(const CellularMutationAction&, const CellularMutationAction&) = default;
|
friend bool operator==(const CellularMutationAction&, const CellularMutationAction&) = default;
|
||||||
};
|
};
|
||||||
// v10 server-to-owner offer (ADR-0121, 11.4d): the life's outstanding earned offer, its
|
// v10 server-to-owner offer (ADR-0121, 11.4d): the life's outstanding earned offer, its
|
||||||
// candidates in stable operator order (never ranked). Each candidate states the successor's
|
// candidates in stable operator order (never ranked). Each candidate states the successor's
|
||||||
// actual tradeoffs: its capability value and its maintenance and total mass. No candidates
|
// actual tradeoffs: its capability value and its maintenance and total mass. No candidates
|
||||||
// (and zero event/offer) clears a consumed or absent offer.
|
// (and zero event/offer) clears a consumed or absent offer.
|
||||||
|
// v14 (rules 13) keeps the layout for a named catalog mutation: `operator_id` is its catalog
|
||||||
|
// id, `parameter` its chance of appearing in parts per million, capability, effect,
|
||||||
|
// maintenance and mass zero, and the cost its tuned cost. The client names it from the catalog.
|
||||||
struct CellularOfferedCandidate {
|
struct CellularOfferedCandidate {
|
||||||
std::uint16_t operator_id{};
|
std::uint16_t operator_id{};
|
||||||
std::uint8_t capability{}, effect{}; // biology::Capability, biology::MutationEffect.
|
std::uint8_t capability{}, effect{}; // biology::Capability, biology::MutationEffect.
|
||||||
@@ -245,8 +280,9 @@ struct CellularMutationOffer {
|
|||||||
friend bool operator==(const CellularMutationOffer&, const CellularMutationOffer&) = default;
|
friend bool operator==(const CellularMutationOffer&, const CellularMutationOffer&) = default;
|
||||||
};
|
};
|
||||||
// v10 (ADR-0129): the owner's life ended in `tick`. Cause 1 starved, 2 engulfed, 0 not
|
// v10 (ADR-0129): the owner's life ended in `tick`. Cause 1 starved, 2 engulfed, 0 not
|
||||||
// recorded (rules below 3). Death is final; a new life is a new request.
|
// recorded (rules below 3); v14 adds 3, the organism emerged. Death is final; a new life is a
|
||||||
enum class CellularDeathReason : std::uint8_t { unrecorded, starved, engulfed };
|
// new request.
|
||||||
|
enum class CellularDeathReason : std::uint8_t { unrecorded, starved, engulfed, emerged };
|
||||||
struct CellularLifeEnded {
|
struct CellularLifeEnded {
|
||||||
std::uint64_t tick{}, life_identity{};
|
std::uint64_t tick{}, life_identity{};
|
||||||
CellularDeathReason cause{};
|
CellularDeathReason cause{};
|
||||||
@@ -270,6 +306,8 @@ struct CellularPerceivedDeposit {
|
|||||||
CellularDepositShape shape{CellularDepositShape::bubble};
|
CellularDepositShape shape{CellularDepositShape::bubble};
|
||||||
bool drained{};
|
bool drained{};
|
||||||
std::array<std::uint16_t, 5> amount_codes{}; // Energy, then C, N, P, other.
|
std::array<std::uint16_t, 5> amount_codes{}; // Energy, then C, N, P, other.
|
||||||
|
// v13 only: world velocity in um/s (current plus induced drift); zero for pools.
|
||||||
|
std::int16_t velocity_x_um_s{}, velocity_y_um_s{};
|
||||||
friend bool operator==(const CellularPerceivedDeposit&,
|
friend bool operator==(const CellularPerceivedDeposit&,
|
||||||
const CellularPerceivedDeposit&) = default;
|
const CellularPerceivedDeposit&) = default;
|
||||||
};
|
};
|
||||||
@@ -339,6 +377,26 @@ struct CellularLifeDiagnostics {
|
|||||||
std::uint64_t bud_cost_energy_pj{};
|
std::uint64_t bud_cost_energy_pj{};
|
||||||
std::array<std::uint64_t, 4> bud_cost_matter_fg{};
|
std::array<std::uint64_t, 4> bud_cost_matter_fg{};
|
||||||
std::uint64_t light_pj{}; // v12 only (ADR-0176): light this cell captured last tick.
|
std::uint64_t light_pj{}; // v12 only (ADR-0176): light this cell captured last tick.
|
||||||
|
// v13 only (rules 12): velocity relative to the liquid (Q10 um/s) and heading (65,536 per
|
||||||
|
// turn), the authoritative motion state the client predictor reconciles against.
|
||||||
|
std::int32_t velocity_x_q10{}, velocity_y_q10{};
|
||||||
|
std::uint16_t heading{};
|
||||||
|
// v14 only (rules 13): cells in the organism and the emergence threshold, the exclusions
|
||||||
|
// in effect, whether Emerge is open, what the reserve can pay as energy with matter standing
|
||||||
|
// in, total mass, and the heritable body traits (biology::CellularTraits field order).
|
||||||
|
std::uint16_t members{}, emerge_members{};
|
||||||
|
std::uint8_t exclude{};
|
||||||
|
bool can_emerge{};
|
||||||
|
// How grown the body is (per thousand), and whether a mutation choice can split it now.
|
||||||
|
std::uint16_t growth_per_thousand{};
|
||||||
|
bool split_ready{};
|
||||||
|
// What held this tick's growth step back (0 nothing; 1 energy; 2-5 C, N, P, other; 6 no
|
||||||
|
// room), and the tick's flows by channel (energy, C, N, P, other): collected from food,
|
||||||
|
// built into the body, and burned in place of energy (matter only).
|
||||||
|
std::uint8_t growth_limit{};
|
||||||
|
std::array<std::uint64_t, 5> collected{}, into_growth{}, burned{};
|
||||||
|
std::uint64_t payable_energy_pj{}, total_mass_fg{};
|
||||||
|
std::array<std::uint16_t, 20> traits{};
|
||||||
friend bool operator==(const CellularLifeDiagnostics&,
|
friend bool operator==(const CellularLifeDiagnostics&,
|
||||||
const CellularLifeDiagnostics&) = default;
|
const CellularLifeDiagnostics&) = default;
|
||||||
};
|
};
|
||||||
@@ -350,6 +408,16 @@ struct CellularPerceivedProducer {
|
|||||||
friend bool operator==(const CellularPerceivedProducer&,
|
friend bool operator==(const CellularPerceivedProducer&,
|
||||||
const CellularPerceivedProducer&) = default;
|
const CellularPerceivedProducer&) = default;
|
||||||
};
|
};
|
||||||
|
// v13 (rules 12): the region's current configuration; the client regenerates the identical
|
||||||
|
// flow field from it (biology::CellularFlowField).
|
||||||
|
struct CellularCurrentsView {
|
||||||
|
std::uint64_t seed{};
|
||||||
|
std::uint32_t width_um{}, height_um{}, pitch_um{};
|
||||||
|
std::uint32_t min_count{}, max_count{};
|
||||||
|
std::uint32_t min_route_width_um{}, max_route_width_um{};
|
||||||
|
std::uint32_t min_speed_um_per_s{}, max_speed_um_per_s{};
|
||||||
|
friend bool operator==(const CellularCurrentsView&, const CellularCurrentsView&) = default;
|
||||||
|
};
|
||||||
struct CellularPerception {
|
struct CellularPerception {
|
||||||
std::uint64_t tick{}, life_identity{}; // zero life plus no patches clears the view.
|
std::uint64_t tick{}, life_identity{}; // zero life plus no patches clears the view.
|
||||||
std::vector<CellularPerceivedPatch> patches; // strictly ordered by (x_um, y_um).
|
std::vector<CellularPerceivedPatch> patches; // strictly ordered by (x_um, y_um).
|
||||||
@@ -360,6 +428,8 @@ struct CellularPerception {
|
|||||||
std::vector<CellularPerceivedDeposit> deposits{};
|
std::vector<CellularPerceivedDeposit> deposits{};
|
||||||
// v12 only: visible producers by ascending organism.
|
// v12 only: visible producers by ascending organism.
|
||||||
std::vector<CellularPerceivedProducer> producers{};
|
std::vector<CellularPerceivedProducer> producers{};
|
||||||
|
// v13 only, with an owner life in a liquid region.
|
||||||
|
std::optional<CellularCurrentsView> currents{};
|
||||||
friend bool operator==(const CellularPerception&, const CellularPerception&) = default;
|
friend bool operator==(const CellularPerception&, const CellularPerception&) = default;
|
||||||
};
|
};
|
||||||
struct IntentionReceipt {
|
struct IntentionReceipt {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
namespace evo::persistence {
|
namespace evo::persistence {
|
||||||
enum class AccountIdentityError : std::uint8_t {
|
enum class AccountIdentityError : std::uint8_t {
|
||||||
invalid, // Arguments refused.
|
invalid, // Arguments refused.
|
||||||
|
banned, // ADR-0182: the account is banned (schema 64); nothing changed.
|
||||||
store, // Other failure; nothing changed.
|
store, // Other failure; nothing changed.
|
||||||
unknown // May have executed: reconnect before relying on the serial.
|
unknown // May have executed: reconnect before relying on the serial.
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -286,6 +286,20 @@ migrate_cellular_photosynthesis_profile(Postgres&, const FilesystemObjectStore&,
|
|||||||
const Sha256Digest& build, server::CellularLight light,
|
const Sha256Digest& build, server::CellularLight light,
|
||||||
std::chrono::milliseconds timeout,
|
std::chrono::milliseconds timeout,
|
||||||
const PublishHooks& hooks = {});
|
const PublishHooks& hooks = {});
|
||||||
|
// Rules 12: explicit raw-only bundle 13 -> 14, declaring the region's liquid rules.
|
||||||
|
[[nodiscard]] std::expected<CommittedCheckpoint, CellularProfileMigrationFailure>
|
||||||
|
migrate_cellular_liquid_profile(Postgres&, const FilesystemObjectStore&, const LeaseGrant&,
|
||||||
|
const CommittedCheckpoint&, Uuid commit, const Sha256Digest& build,
|
||||||
|
const server::CellularLiquidRules& rules,
|
||||||
|
std::chrono::milliseconds timeout, const PublishHooks& hooks = {});
|
||||||
|
// Rules 13: explicit raw-only bundle 14 -> 15, declaring the region's revamp rules.
|
||||||
|
[[nodiscard]] std::expected<CommittedCheckpoint, CellularProfileMigrationFailure>
|
||||||
|
migrate_cellular_revamp_profile(Postgres&, const FilesystemObjectStore&, const LeaseGrant&,
|
||||||
|
const CommittedCheckpoint&, Uuid commit, const Sha256Digest& build,
|
||||||
|
const server::CellularRevampRules& rules,
|
||||||
|
std::chrono::milliseconds timeout, const PublishHooks& hooks = {},
|
||||||
|
std::uint32_t playtest_wildlife_count = 0,
|
||||||
|
std::uint64_t playtest_first_identity = 0);
|
||||||
// Verify the recorded no-tick operation under current authority, replaying its
|
// Verify the recorded no-tick operation under current authority, replaying its
|
||||||
// entire source/target payload. Version upgrades and profile transitions retain
|
// entire source/target payload. Version upgrades and profile transitions retain
|
||||||
// separate evidence; neither is inferred solely from the target tuple.
|
// separate evidence; neither is inferred solely from the target tuple.
|
||||||
|
|||||||
@@ -87,9 +87,14 @@ inline constexpr CellularVersionBundle cellular_v11_versions{9, 7, 2, 1, 1, 4, 3
|
|||||||
inline constexpr CellularVersionBundle cellular_v12_versions{10, 8, 2, 1, 1, 4, 3, 2, 1};
|
inline constexpr CellularVersionBundle cellular_v12_versions{10, 8, 2, 1, 1, 4, 3, 2, 1};
|
||||||
// ADR-0175/0176: rules 11 on owner format 9 (declared light), development 5, founder 4.
|
// ADR-0175/0176: rules 11 on owner format 9 (declared light), development 5, founder 4.
|
||||||
inline constexpr CellularVersionBundle cellular_v13_versions{11, 9, 2, 1, 1, 5, 4, 2, 1};
|
inline constexpr CellularVersionBundle cellular_v13_versions{11, 9, 2, 1, 1, 5, 4, 2, 1};
|
||||||
|
// Rules 12 on owner format 10 (liquid region), development 6, founder 5 (ADR-0177).
|
||||||
|
inline constexpr CellularVersionBundle cellular_v14_versions{12, 10, 2, 1, 1, 6, 5, 2, 1};
|
||||||
|
// Rules 13 on owner format 11 (the cellular revamp), development 7, founder 6 (ADR-0179).
|
||||||
|
inline constexpr CellularVersionBundle cellular_v15_versions{13, 11, 2, 1, 1, 7, 6, 2, 1};
|
||||||
// Raw-only retained-plan bundles, which use trace 4 and their own SQL admission.
|
// Raw-only retained-plan bundles, which use trace 4 and their own SQL admission.
|
||||||
[[nodiscard]] constexpr bool cellular_plan_bundle(const CellularVersionBundle& b) noexcept {
|
[[nodiscard]] constexpr bool cellular_plan_bundle(const CellularVersionBundle& b) noexcept {
|
||||||
return b == cellular_v12_versions || b == cellular_v13_versions;
|
return b == cellular_v12_versions || b == cellular_v13_versions || b == cellular_v14_versions ||
|
||||||
|
b == cellular_v15_versions;
|
||||||
}
|
}
|
||||||
// Zero means this bundle has no population representation.
|
// Zero means this bundle has no population representation.
|
||||||
[[nodiscard]] constexpr std::uint32_t
|
[[nodiscard]] constexpr std::uint32_t
|
||||||
@@ -113,6 +118,14 @@ cellular_checkpoint_trace_format(const CellularVersionBundle& b) noexcept {
|
|||||||
: server::cellular_batch_v2_format;
|
: server::cellular_batch_v2_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ADR-0182: a bundle-15 commit may carry admin commands in trace 5; every other format is
|
||||||
|
// exactly the bundle's.
|
||||||
|
[[nodiscard]] constexpr bool cellular_checkpoint_trace_admits(const CellularVersionBundle& b,
|
||||||
|
std::uint32_t format) noexcept {
|
||||||
|
return format == cellular_checkpoint_trace_format(b) ||
|
||||||
|
(format == server::cellular_batch_admin_format && b == cellular_v15_versions);
|
||||||
|
}
|
||||||
|
|
||||||
// Batch evidence bound by manifest v2 (ADR-0063); all zero at genesis.
|
// Batch evidence bound by manifest v2 (ADR-0063); all zero at genesis.
|
||||||
struct BatchDigests {
|
struct BatchDigests {
|
||||||
std::uint64_t trace_bytes{};
|
std::uint64_t trace_bytes{};
|
||||||
@@ -293,6 +306,31 @@ cellular_photosynthesis_upgrade_manifest(const CheckpointManifest& predecessor,
|
|||||||
cellular_photosynthesis_upgrade_payload(std::span<const std::uint8_t> payload,
|
cellular_photosynthesis_upgrade_payload(std::span<const std::uint8_t> payload,
|
||||||
const CheckpointManifest& predecessor,
|
const CheckpointManifest& predecessor,
|
||||||
const server::CellularLight& light);
|
const server::CellularLight& light);
|
||||||
|
// Rules 12: explicit raw-only bundle 13 -> 14 upgrade declaring the region's liquid rules. As
|
||||||
|
// with light, the rules are the only input; recovery reads them from the target.
|
||||||
|
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
|
||||||
|
cellular_liquid_upgrade_manifest(const CheckpointManifest& predecessor,
|
||||||
|
const Sha256Digest& predecessor_digest, Uuid commit,
|
||||||
|
const LeaseGrant& lease, const Sha256Digest& build,
|
||||||
|
std::uint64_t payload_bytes, const Sha256Digest& payload_sha256);
|
||||||
|
[[nodiscard]] std::expected<std::vector<std::uint8_t>, CheckpointError>
|
||||||
|
cellular_liquid_upgrade_payload(std::span<const std::uint8_t> payload,
|
||||||
|
const CheckpointManifest& predecessor,
|
||||||
|
const server::CellularLiquidRules& rules);
|
||||||
|
// Rules 13 (ADR-0179): explicit raw-only bundle 14 -> 15 upgrade declaring the revamp rules
|
||||||
|
// from the Git tuning file. ADR-0180 also admits an explicit empty-opening fixture;
|
||||||
|
// recovery reads its count/first identity from the target and re-derives every byte.
|
||||||
|
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
|
||||||
|
cellular_revamp_upgrade_manifest(const CheckpointManifest& predecessor,
|
||||||
|
const Sha256Digest& predecessor_digest, Uuid commit,
|
||||||
|
const LeaseGrant& lease, const Sha256Digest& build,
|
||||||
|
std::uint64_t payload_bytes, const Sha256Digest& payload_sha256);
|
||||||
|
[[nodiscard]] std::expected<std::vector<std::uint8_t>, CheckpointError>
|
||||||
|
cellular_revamp_upgrade_payload(std::span<const std::uint8_t> payload,
|
||||||
|
const CheckpointManifest& predecessor,
|
||||||
|
const server::CellularRevampRules& rules,
|
||||||
|
std::uint32_t playtest_wildlife_count = 0,
|
||||||
|
std::uint64_t playtest_first_identity = 0);
|
||||||
// ADR-0174: explicit one-way, no-tick profile 5 -> 6 transition. The payload wraps the
|
// ADR-0174: explicit one-way, no-tick profile 5 -> 6 transition. The payload wraps the
|
||||||
// identical population with its declared environment; bundle and policy are unchanged.
|
// identical population with its declared environment; bundle and policy are unchanged.
|
||||||
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
|
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ class JsonValue {
|
|||||||
[[nodiscard]] const JsonValue* member(std::string_view name) const;
|
[[nodiscard]] const JsonValue* member(std::string_view name) const;
|
||||||
[[nodiscard]] const std::vector<JsonValue>* array() const;
|
[[nodiscard]] const std::vector<JsonValue>* array() const;
|
||||||
|
|
||||||
// Whole-document parse; nullopt for anything malformed or out of bounds.
|
// Whole-document parse; nullopt for anything malformed or out of bounds. `limit` bounds
|
||||||
[[nodiscard]] static std::optional<JsonValue> parse(std::string_view text);
|
// the text: access tokens and keys keep the default; a service's answer may allow more.
|
||||||
|
[[nodiscard]] static std::optional<JsonValue> parse(std::string_view text,
|
||||||
|
std::size_t limit = max_json_bytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class JsonParser;
|
friend class JsonParser;
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "evo/persistence/postgres.hpp"
|
||||||
|
#include "evo/server/admin/https_client.hpp"
|
||||||
|
#include "evo/server/broker/access_token.hpp"
|
||||||
|
#include "evo/server/ops_http.hpp"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// ADR-0182 read-only admin API and portal host. One world; every /api route needs a Keycloak
|
||||||
|
// access token carrying the admin realm role. The portal's static files and its OIDC settings
|
||||||
|
// are public; they carry no secret.
|
||||||
|
//
|
||||||
|
// GET /healthz ok
|
||||||
|
// GET / and the portal's files the portal (index.html, app.js, style.css)
|
||||||
|
// GET /config.json issuer, client id and world for the portal's sign-in
|
||||||
|
// GET /api/me the signed-in admin's subject and email
|
||||||
|
// GET /api/accounts every account with session, lives, deaths and resets
|
||||||
|
// GET /api/accounts/<uuid> one account, its life requests and ban history
|
||||||
|
// POST /api/accounts/<uuid>/ban?banned=1|0[&reason=R] bans (and logs out) or lifts a ban
|
||||||
|
// POST /api/accounts/<uuid>/logout ends the account's sessions now
|
||||||
|
// POST /api/accounts/<uuid>/end-life?request=N[&reason=R]
|
||||||
|
// ends a stranded published life (its reservation was
|
||||||
|
// never ended), refused while a cell in its region still
|
||||||
|
// holds the account (ADR-0182 section 18)
|
||||||
|
// GET /api/regions the world's regions, leases and heads
|
||||||
|
// GET /api/regions/<n>/view the region's live view (render_cellular_admin_view)
|
||||||
|
// GET /api/regions/<n>/session-window the current session window and its last changes
|
||||||
|
// POST /api/regions/<n>/session-window?minutes=M[&reason=R]
|
||||||
|
// opens or extends the window for M (1..240) minutes
|
||||||
|
// from now, or closes it (M = 0), as the signed-in admin
|
||||||
|
// (ADR-0087 amendment). No request body.
|
||||||
|
// GET /api/regions/<n>/commands the region's last admin commands and where they applied
|
||||||
|
// POST /api/regions/<n>/commands?kind=K[&count=N][&target=ID][&energy=PJ][&carbon=FG]
|
||||||
|
// [&nitrogen=FG][&phosphorus=FG][&other=FG][&reason=R]
|
||||||
|
// queues a command (remove_cell, grant_reserve,
|
||||||
|
// add_bubbles, add_pool, release_pool, spawn_wildlife)
|
||||||
|
// GET /api/regions/<n>/schedules the region's resource schedules (schema 65)
|
||||||
|
// POST /api/regions/<n>/schedules?kind=K&count=N&interval=S[&id=ID][&enabled=0|1]
|
||||||
|
// [&energy=PJ][&carbon=FG]...[&reason=R]
|
||||||
|
// creates (no id) or replaces a schedule repeating
|
||||||
|
// add_bubbles, release_pool or spawn_wildlife
|
||||||
|
// GET /api/tuning the world's rules-13 tuning revisions, the newest text,
|
||||||
|
// the baseline file regions opened with (schema 66) and
|
||||||
|
// the region tuning file they restart with (read only)
|
||||||
|
// GET /api/tuning/<revision> one revision's text
|
||||||
|
// POST /api/tuning[?check=1][&reason=R] the request body is a tuning text (the Git
|
||||||
|
// revamp file format): checked, then stored as a new
|
||||||
|
// revision that every region of the world adopts at its
|
||||||
|
// next tick (check=1: checked only, nothing stored)
|
||||||
|
// POST /api/tuning?base=baseline|REV[&check=1][&reason=R] the body holds only changed
|
||||||
|
// `key = value` lines, applied to the baseline file or to
|
||||||
|
// revision REV (which must be the newest: 409 stale_base),
|
||||||
|
// keeping its comments; then as above
|
||||||
|
// GET /api/deploy[?argo=1] ADR-0182 section 15: whether opening a region is
|
||||||
|
// configured, the region Git main serves, the next region
|
||||||
|
// and its seeded wildlife range, and the Argo Application's
|
||||||
|
// sync (argo=1: the Argo status only)
|
||||||
|
// POST /api/deploy/region?region=N[&reason=R] opens region N (the next one) in place of
|
||||||
|
// the served region: one Gitea commit to the region,
|
||||||
|
// broker and portal files, then a full Argo sync
|
||||||
|
namespace evo::server::admin {
|
||||||
|
struct AdminAsset {
|
||||||
|
std::string path; // "/index.html", ...; "/" serves "/index.html".
|
||||||
|
std::string content_type, body;
|
||||||
|
};
|
||||||
|
struct AdminConfig {
|
||||||
|
std::uint64_t world{};
|
||||||
|
// The world's regions: their live view can be fetched and they adopt tuning revisions.
|
||||||
|
std::vector<std::uint64_t> view_regions;
|
||||||
|
// The revamp tuning file the world's regions opened with (empty: unknown).
|
||||||
|
std::string baseline_tuning;
|
||||||
|
// The region tuning file (shape, movement, currents) they read at startup (empty: unknown).
|
||||||
|
std::string region_tuning;
|
||||||
|
std::string portal_config_json; // Served at /config.json.
|
||||||
|
std::string content_security_policy; // Sent with every portal file.
|
||||||
|
std::chrono::milliseconds db_timeout{3000};
|
||||||
|
std::chrono::milliseconds view_cache{750}; // A fetched view answers repeats this long.
|
||||||
|
};
|
||||||
|
// ADR-0182 section 15: where the admin API commits a region switch and what it syncs. The
|
||||||
|
// tokens come from mounted Secret files and are only ever sent in request headers.
|
||||||
|
struct AdminDeployConfig {
|
||||||
|
std::string gitea_base; // https://git.example[:port][/prefix]
|
||||||
|
std::string gitea_repository; // owner/name
|
||||||
|
std::string gitea_token;
|
||||||
|
std::string branch{"main"};
|
||||||
|
std::string argo_server; // host:port, https assumed
|
||||||
|
std::string argo_application;
|
||||||
|
std::string argo_token;
|
||||||
|
bool argo_verify{true};
|
||||||
|
};
|
||||||
|
using AdminConnect = std::function<std::unique_ptr<persistence::Postgres>()>;
|
||||||
|
// The region's /admin/view body, or nullopt when it cannot be reached or is not ready.
|
||||||
|
using AdminRegionView = std::function<std::optional<std::string>(std::uint64_t region)>;
|
||||||
|
|
||||||
|
class AdminApi {
|
||||||
|
public:
|
||||||
|
AdminApi(AdminConfig config, broker::TokenVerifier verifier, AdminConnect connect,
|
||||||
|
AdminRegionView view, std::vector<AdminAsset> assets);
|
||||||
|
// `now_seconds` is wall time (token expiry); `now` paces the view cache.
|
||||||
|
[[nodiscard]] OpsResponse handle(const ApiRequest& request, std::uint64_t now_seconds,
|
||||||
|
std::chrono::steady_clock::time_point now);
|
||||||
|
// Turns on /api/deploy with the given services and transport (tests pass a fake).
|
||||||
|
void enable_deploy(AdminDeployConfig config, HttpsTransport transport);
|
||||||
|
|
||||||
|
private:
|
||||||
|
[[nodiscard]] OpsResponse api(std::string_view method, std::string_view path,
|
||||||
|
std::string_view query, std::string_view body,
|
||||||
|
const broker::AccessTokenClaims& admin,
|
||||||
|
std::chrono::steady_clock::time_point now);
|
||||||
|
[[nodiscard]] OpsResponse accounts(std::optional<std::string_view> account);
|
||||||
|
[[nodiscard]] OpsResponse account_action(std::string_view account, std::string_view action,
|
||||||
|
std::string_view query,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] OpsResponse end_life(std::string_view account, std::string_view query,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] OpsResponse regions();
|
||||||
|
[[nodiscard]] OpsResponse view(std::uint64_t region, std::chrono::steady_clock::time_point now);
|
||||||
|
[[nodiscard]] OpsResponse window(std::uint64_t region);
|
||||||
|
[[nodiscard]] OpsResponse commands(std::uint64_t region);
|
||||||
|
[[nodiscard]] OpsResponse schedules(std::uint64_t region);
|
||||||
|
[[nodiscard]] OpsResponse set_schedule(std::uint64_t region, std::string_view query,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] OpsResponse enqueue(std::uint64_t region, std::string_view query,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] OpsResponse set_window(std::uint64_t region, std::string_view query,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] OpsResponse tuning();
|
||||||
|
[[nodiscard]] OpsResponse tuning_text(std::uint64_t revision);
|
||||||
|
[[nodiscard]] OpsResponse set_tuning(std::string_view query, std::string_view text,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] OpsResponse deploy_status(std::string_view query);
|
||||||
|
[[nodiscard]] OpsResponse open_region(std::string_view query,
|
||||||
|
const broker::AccessTokenClaims& admin);
|
||||||
|
[[nodiscard]] std::optional<std::uint64_t> next_region(std::uint64_t served);
|
||||||
|
[[nodiscard]] std::optional<persistence::PgRows> query(const std::string& sql,
|
||||||
|
std::vector<std::string> parameters);
|
||||||
|
|
||||||
|
AdminConfig config_;
|
||||||
|
broker::TokenVerifier verifier_;
|
||||||
|
AdminConnect connect_;
|
||||||
|
AdminRegionView view_;
|
||||||
|
std::vector<AdminAsset> assets_;
|
||||||
|
std::optional<AdminDeployConfig> deploy_;
|
||||||
|
HttpsTransport https_;
|
||||||
|
std::unique_ptr<persistence::Postgres> db_;
|
||||||
|
struct CachedView {
|
||||||
|
std::chrono::steady_clock::time_point at;
|
||||||
|
std::string body;
|
||||||
|
};
|
||||||
|
std::map<std::uint64_t, CachedView> views_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Bounded blocking HTTP/1.1 GET of `path` from "host:port" (a name is resolved): the body of
|
||||||
|
// a 200 answer of at most `limit` bytes, or nullopt on any error, other status or timeout.
|
||||||
|
[[nodiscard]] std::optional<std::string> http_get(std::string_view address, std::string_view path,
|
||||||
|
std::chrono::milliseconds timeout,
|
||||||
|
std::size_t limit);
|
||||||
|
// JSON string literal (quotes included) with control characters escaped.
|
||||||
|
[[nodiscard]] std::string json_string(std::string_view text);
|
||||||
|
// The decoded value of `name` in a URL query ("a=1&b=x%20y"), or nullopt when absent or
|
||||||
|
// malformed (bad escape, a decoded control character, over `limit` bytes).
|
||||||
|
[[nodiscard]] std::optional<std::string> query_value(std::string_view query, std::string_view name,
|
||||||
|
std::size_t limit = 200);
|
||||||
|
} // namespace evo::server::admin
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// ADR-0182 section 15: a bounded, blocking HTTPS/1.1 client for the admin API's two outbound
|
||||||
|
// services (Gitea and Argo CD). One request per connection (Connection: close); the system
|
||||||
|
// trust store and host name check unless `verify` is false. Credentials travel only in the
|
||||||
|
// request headers and are never logged.
|
||||||
|
namespace evo::server::admin {
|
||||||
|
struct HttpsRequest {
|
||||||
|
std::string host;
|
||||||
|
std::uint16_t port{443};
|
||||||
|
std::string method{"GET"};
|
||||||
|
std::string target{"/"}; // Path and query, already percent-encoded.
|
||||||
|
std::vector<std::pair<std::string, std::string>> headers;
|
||||||
|
std::string body;
|
||||||
|
bool verify{true};
|
||||||
|
std::chrono::milliseconds timeout{10'000};
|
||||||
|
std::size_t limit{std::size_t{4} << 20U}; // Largest body accepted.
|
||||||
|
};
|
||||||
|
struct HttpsResponse {
|
||||||
|
int status{};
|
||||||
|
std::string body;
|
||||||
|
};
|
||||||
|
// The transport the admin API uses; tests substitute a fake.
|
||||||
|
using HttpsTransport = std::function<std::optional<HttpsResponse>(const HttpsRequest&)>;
|
||||||
|
|
||||||
|
// Sends `request` over TLS: the answer, or nullopt on any connection, TLS, timeout, size or
|
||||||
|
// framing failure.
|
||||||
|
[[nodiscard]] std::optional<HttpsResponse> https_request(const HttpsRequest& request);
|
||||||
|
// An HTTP/1.1 response read to the end of the connection: the status and the body (by
|
||||||
|
// Content-Length, chunked, or to the end), or nullopt when malformed or over `limit`.
|
||||||
|
[[nodiscard]] std::optional<HttpsResponse> parse_http_response(std::string_view raw,
|
||||||
|
std::size_t limit);
|
||||||
|
// "https://host[:port][/...]" split into host, port and the path prefix (no trailing slash).
|
||||||
|
struct HttpsBase {
|
||||||
|
std::string host;
|
||||||
|
std::uint16_t port{443};
|
||||||
|
std::string prefix;
|
||||||
|
};
|
||||||
|
[[nodiscard]] std::optional<HttpsBase> parse_https_base(std::string_view url);
|
||||||
|
} // namespace evo::server::admin
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <expected>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
// ADR-0182 section 15: the admin portal opens a fresh region in place of the one DEV serves.
|
||||||
|
// The change is four Git files edited in place: the region overlay's values (world, region,
|
||||||
|
// life routes, the opening's genesis commit and seeded wildlife range, both for the region
|
||||||
|
// Deployment and its provision Job), its kustomization header, and the region named by the
|
||||||
|
// grant broker's routes and the admin portal. Anything else is left exactly as it is; a file
|
||||||
|
// whose layout differs from the expected lines is refused rather than guessed at.
|
||||||
|
namespace evo::server::admin {
|
||||||
|
inline constexpr std::array<std::string_view, 4> region_switch_paths{
|
||||||
|
"deploy/kubernetes/region/dev/region-values.yaml",
|
||||||
|
"deploy/kubernetes/region/dev/kustomization.yaml",
|
||||||
|
"deploy/kubernetes/grant-broker-dev/deployment.yaml",
|
||||||
|
"deploy/kubernetes/admin-portal-dev/deployment.yaml",
|
||||||
|
};
|
||||||
|
// The four files' text, in region_switch_paths order.
|
||||||
|
using RegionSwitchFiles = std::array<std::string, 4>;
|
||||||
|
// What the files say DEV serves: the world and region, the opening's genesis commit (32
|
||||||
|
// lowercase hex digits) and the first seeded wildlife identity.
|
||||||
|
struct RegionLayout {
|
||||||
|
std::uint64_t world{}, region{};
|
||||||
|
std::string commit;
|
||||||
|
std::uint64_t wildlife_first{};
|
||||||
|
auto operator<=>(const RegionLayout&) const = default;
|
||||||
|
};
|
||||||
|
// The served layout, or the name of the line that is missing, repeated or inconsistent.
|
||||||
|
[[nodiscard]] std::expected<RegionLayout, std::string>
|
||||||
|
read_region_layout(const RegionSwitchFiles& files);
|
||||||
|
// The files serving `to` (same world) instead, with `note` (one line, no line breaks) recorded
|
||||||
|
// as a comment above the opening; or why the files or `to` cannot be switched.
|
||||||
|
[[nodiscard]] std::expected<RegionSwitchFiles, std::string>
|
||||||
|
switch_region(const RegionSwitchFiles& files, const RegionLayout& to, std::string_view note);
|
||||||
|
} // namespace evo::server::admin
|
||||||
@@ -17,10 +17,13 @@ struct AccessTokenRules {
|
|||||||
std::string audience; // Must appear in `aud` (string or array).
|
std::string audience; // Must appear in `aud` (string or array).
|
||||||
std::string authorized_party; // `azp`: the game's public client.
|
std::string authorized_party; // `azp`: the game's public client.
|
||||||
std::uint64_t leeway_seconds{30};
|
std::uint64_t leeway_seconds{30};
|
||||||
|
// ADR-0182: when set, the role must appear in `realm_access.roles` (the admin portal).
|
||||||
|
std::string realm_role{};
|
||||||
};
|
};
|
||||||
struct AccessTokenClaims {
|
struct AccessTokenClaims {
|
||||||
std::string issuer, subject;
|
std::string issuer, subject;
|
||||||
std::uint64_t expires_at{};
|
std::uint64_t expires_at{};
|
||||||
|
std::string email{}; // Empty when absent; shown to the admin, never used as identity.
|
||||||
};
|
};
|
||||||
enum class TokenError : std::uint8_t {
|
enum class TokenError : std::uint8_t {
|
||||||
malformed,
|
malformed,
|
||||||
@@ -34,7 +37,8 @@ enum class TokenError : std::uint8_t {
|
|||||||
expired,
|
expired,
|
||||||
not_yet_valid,
|
not_yet_valid,
|
||||||
unverified_email,
|
unverified_email,
|
||||||
missing_subject
|
missing_subject,
|
||||||
|
missing_role
|
||||||
};
|
};
|
||||||
inline constexpr std::size_t max_access_token_bytes = 6144;
|
inline constexpr std::size_t max_access_token_bytes = 6144;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <expected>
|
#include <expected>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <span>
|
#include <span>
|
||||||
@@ -114,6 +115,22 @@ class CellularRegionHost {
|
|||||||
[[nodiscard]] std::expected<std::optional<persistence::CommittedCheckpoint>,
|
[[nodiscard]] std::expected<std::optional<persistence::CommittedCheckpoint>,
|
||||||
CellularPublishFailure>
|
CellularPublishFailure>
|
||||||
advance_unattended(std::uint64_t due_ticks);
|
advance_unattended(std::uint64_t due_ticks);
|
||||||
|
// Write-behind commit (rules-12 regions, Cellular_Region_Movement_Plan.md): commits a raw
|
||||||
|
// batch on a worker thread with its own connection while the caller keeps simulating.
|
||||||
|
// `candidate` is the state the batch's builder already computed, so nothing is replayed.
|
||||||
|
// At most one commit is in flight; its result is applied on this thread by poll_publish.
|
||||||
|
[[nodiscard]] std::expected<void, CellularPublishFailure>
|
||||||
|
begin_publish(CellularBatch batch, std::vector<CellularActionRecord> actions,
|
||||||
|
std::vector<CellularMutationActionRecord> mutation_actions,
|
||||||
|
std::unique_ptr<CellularLives> candidate);
|
||||||
|
[[nodiscard]] bool commit_in_flight() const noexcept {
|
||||||
|
return in_flight_ != nullptr;
|
||||||
|
}
|
||||||
|
// The finished background commit's outcome, applied exactly as publish applies its own;
|
||||||
|
// nullopt while none has finished.
|
||||||
|
[[nodiscard]] std::optional<
|
||||||
|
std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>>
|
||||||
|
poll_publish();
|
||||||
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
|
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
|
||||||
publish(const CellularBatch& batch, std::span<const CellularActionRecord> actions = {},
|
publish(const CellularBatch& batch, std::span<const CellularActionRecord> actions = {},
|
||||||
std::span<const CellularMutationActionRecord> mutation_actions = {});
|
std::span<const CellularMutationActionRecord> mutation_actions = {});
|
||||||
@@ -123,11 +140,24 @@ class CellularRegionHost {
|
|||||||
std::uint64_t generation,
|
std::uint64_t generation,
|
||||||
std::uint64_t action_id,
|
std::uint64_t action_id,
|
||||||
const CellularMutationActionInput& input);
|
const CellularMutationActionInput& input);
|
||||||
// Reserved choices for the next tick, in reservation order; pass them to the builder.
|
// A queued choice the builder refused (its tick passed): reload the queue from the
|
||||||
|
// store, which keeps only reservations for the head's next tick.
|
||||||
|
void recheck_mutations() noexcept {
|
||||||
|
mutations_uncertain_ = true;
|
||||||
|
}
|
||||||
|
// Reserved choices, in reservation order (ADR-0121 amendment, schema 59: a durable
|
||||||
|
// queue; each binds at a tick at or after its reservation's).
|
||||||
[[nodiscard]] std::span<const persistence::CellularMutationReservation>
|
[[nodiscard]] std::span<const persistence::CellularMutationReservation>
|
||||||
queued_mutations() const noexcept {
|
queued_mutations() const noexcept {
|
||||||
return queued_mutations_;
|
return queued_mutations_;
|
||||||
}
|
}
|
||||||
|
// Queued choices not carried by the commit in flight: the open batch binds these.
|
||||||
|
[[nodiscard]] std::vector<persistence::CellularMutationReservation> unbound_mutations() const;
|
||||||
|
// ADR-0182: queued admin commands (rules 13) not carried by the commit in flight, oldest
|
||||||
|
// first, at most one tick's worth. Publication binds each to its queue row once.
|
||||||
|
[[nodiscard]] std::vector<CellularAdminCommand> unbound_admin_commands() const;
|
||||||
|
// ADR-0182: the tuning revisions this host fetched and verified, for adopt_tuning commands.
|
||||||
|
[[nodiscard]] CellularTuningResolver tuning_resolver() const;
|
||||||
[[nodiscard]] std::vector<FinalCellularMutation> take_finalized_mutations();
|
[[nodiscard]] std::vector<FinalCellularMutation> take_finalized_mutations();
|
||||||
// v5 requests allocate durably, then wait for the scheduler to include the exact
|
// v5 requests allocate durably, then wait for the scheduler to include the exact
|
||||||
// reservation in a profile-4 batch. Repeating the request is idempotent.
|
// reservation in a profile-4 batch. Repeating the request is idempotent.
|
||||||
@@ -160,6 +190,13 @@ class CellularRegionHost {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct Pending;
|
struct Pending;
|
||||||
|
struct InFlight;
|
||||||
|
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
|
||||||
|
finish_publication(const CellularBatch& batch, std::span<const CellularActionRecord> actions,
|
||||||
|
std::span<const CellularMutationActionRecord> mutation_actions,
|
||||||
|
std::unique_ptr<CellularLives> candidate,
|
||||||
|
std::expected<persistence::PublishedCellularBatch,
|
||||||
|
persistence::CellularPublicationFailure> published);
|
||||||
CellularRegionHost(CellularHostConfig config, CellularConnect connect,
|
CellularRegionHost(CellularHostConfig config, CellularConnect connect,
|
||||||
std::unique_ptr<persistence::FilesystemObjectStore> objects);
|
std::unique_ptr<persistence::FilesystemObjectStore> objects);
|
||||||
bool database();
|
bool database();
|
||||||
@@ -176,6 +213,7 @@ class CellularRegionHost {
|
|||||||
void finalize_births(std::span<const CellularTickIntents::Birth> births);
|
void finalize_births(std::span<const CellularTickIntents::Birth> births);
|
||||||
void queue_birth(const CellularTickIntents::Birth& birth);
|
void queue_birth(const CellularTickIntents::Birth& birth);
|
||||||
void reload_mutations();
|
void reload_mutations();
|
||||||
|
void reload_admin_commands();
|
||||||
// ADR-0127: owned lives that died record their ending so the account may start again.
|
// ADR-0127: owned lives that died record their ending so the account may start again.
|
||||||
void note_endings(const CellularLives& before, const CellularLives& after,
|
void note_endings(const CellularLives& before, const CellularLives& after,
|
||||||
const persistence::Uuid& commit);
|
const persistence::Uuid& commit);
|
||||||
@@ -190,6 +228,9 @@ class CellularRegionHost {
|
|||||||
CellularConnect connect_;
|
CellularConnect connect_;
|
||||||
std::unique_ptr<persistence::FilesystemObjectStore> objects_;
|
std::unique_ptr<persistence::FilesystemObjectStore> objects_;
|
||||||
std::unique_ptr<persistence::Postgres> db_;
|
std::unique_ptr<persistence::Postgres> db_;
|
||||||
|
// The write-behind commit and its own connection (libpq connections are not shared).
|
||||||
|
std::unique_ptr<InFlight> in_flight_;
|
||||||
|
std::unique_ptr<persistence::Postgres> commit_db_;
|
||||||
persistence::LeaseAuthority authority_;
|
persistence::LeaseAuthority authority_;
|
||||||
// Exactly one owner. The common interface is a const biological view, never
|
// Exactly one owner. The common interface is a const biological view, never
|
||||||
// a second independently spendable cellular copy alongside a population.
|
// a second independently spendable cellular copy alongside a population.
|
||||||
@@ -251,6 +292,9 @@ class CellularRegionHost {
|
|||||||
std::vector<CellularTickIntents::Birth> queued_births_;
|
std::vector<CellularTickIntents::Birth> queued_births_;
|
||||||
std::vector<CellularBirthRefusal> pending_birth_refusals_;
|
std::vector<CellularBirthRefusal> pending_birth_refusals_;
|
||||||
std::vector<persistence::CellularMutationReservation> queued_mutations_;
|
std::vector<persistence::CellularMutationReservation> queued_mutations_;
|
||||||
|
std::vector<CellularAdminCommand> queued_admin_;
|
||||||
|
std::map<std::uint64_t, CellularRevampRules> verified_tuning_; // By revision.
|
||||||
|
std::chrono::steady_clock::time_point next_admin_reload_{};
|
||||||
// A reservation may exist that the queue does not show; reload before publishing.
|
// A reservation may exist that the queue does not show; reload before publishing.
|
||||||
bool mutations_uncertain_{};
|
bool mutations_uncertain_{};
|
||||||
std::vector<FinalCellularMutation> finalized_mutations_;
|
std::vector<FinalCellularMutation> finalized_mutations_;
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ prepare_cellular_session_tick(
|
|||||||
std::span<const network::CarriedAction> actions,
|
std::span<const network::CarriedAction> actions,
|
||||||
std::span<const persistence::CellularMutationReservation> mutations = {});
|
std::span<const persistence::CellularMutationReservation> mutations = {});
|
||||||
|
|
||||||
|
// A tick takes one action per account. Keeps each account's discrete action (engulf, bud,
|
||||||
|
// become, emerge), else its newest (highest id), in `actions`, and returns the others, which
|
||||||
|
// the caller refuses. A client naming a tick it already sent a movement for then loses only
|
||||||
|
// that movement, not every player's actions on the tick.
|
||||||
|
[[nodiscard]] std::vector<network::CarriedAction>
|
||||||
|
keep_one_action_per_account(std::vector<network::CarriedAction>& actions);
|
||||||
|
|
||||||
// Builds one bounded publication from the last durable head. Its working copy is private;
|
// Builds one bounded publication from the last durable head. Its working copy is private;
|
||||||
// only the host may publish, and callers must discard it after uncertainty until the host
|
// only the host may publish, and callers must discard it after uncertainty until the host
|
||||||
// resolves that exact prepared batch.
|
// resolves that exact prepared batch.
|
||||||
@@ -58,7 +65,8 @@ class CellularSessionBatchBuilder {
|
|||||||
append(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
|
append(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
|
||||||
std::span<const network::CarriedAction> actions,
|
std::span<const network::CarriedAction> actions,
|
||||||
std::span<const CellularTickIntents::Birth> births = {},
|
std::span<const CellularTickIntents::Birth> births = {},
|
||||||
std::span<const persistence::CellularMutationReservation> mutations = {});
|
std::span<const persistence::CellularMutationReservation> mutations = {},
|
||||||
|
std::span<const CellularAdminCommand> admin = {});
|
||||||
// Scheduler path: expected placement/funding/existing-life refusals are reported
|
// Scheduler path: expected placement/funding/existing-life refusals are reported
|
||||||
// separately, so they cannot prevent other births or the ordinary tick. Unexpected
|
// separately, so they cannot prevent other births or the ordinary tick. Unexpected
|
||||||
// failures retain append's all-or-nothing behavior. Persist reports only after publish.
|
// failures retain append's all-or-nothing behavior. Persist reports only after publish.
|
||||||
@@ -66,13 +74,22 @@ class CellularSessionBatchBuilder {
|
|||||||
std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
|
std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
|
||||||
std::span<const network::CarriedAction> actions,
|
std::span<const network::CarriedAction> actions,
|
||||||
std::span<const CellularTickIntents::Birth> births = {},
|
std::span<const CellularTickIntents::Birth> births = {},
|
||||||
std::span<const persistence::CellularMutationReservation> mutations = {});
|
std::span<const persistence::CellularMutationReservation> mutations = {},
|
||||||
|
std::span<const CellularAdminCommand> admin = {});
|
||||||
[[nodiscard]] std::span<const CellularBirthRefusal> refused_births() const noexcept {
|
[[nodiscard]] std::span<const CellularBirthRefusal> refused_births() const noexcept {
|
||||||
return refused_births_;
|
return refused_births_;
|
||||||
}
|
}
|
||||||
[[nodiscard]] const CellularBatch& batch() const noexcept {
|
[[nodiscard]] const CellularBatch& batch() const noexcept {
|
||||||
return batch_;
|
return batch_;
|
||||||
}
|
}
|
||||||
|
// ADR-0182: names the rules of adopt_tuning commands (the host's verified revisions).
|
||||||
|
void set_tuning_resolver(CellularTuningResolver tuning) {
|
||||||
|
tuning_ = std::move(tuning);
|
||||||
|
}
|
||||||
|
// ADR-0182: each admin command appended so far and whether it applied, in trace order.
|
||||||
|
[[nodiscard]] std::span<const CellularAdminResult> admin_results() const noexcept {
|
||||||
|
return admin_results_;
|
||||||
|
}
|
||||||
[[nodiscard]] std::span<const CellularActionRecord> actions() const noexcept {
|
[[nodiscard]] std::span<const CellularActionRecord> actions() const noexcept {
|
||||||
return actions_;
|
return actions_;
|
||||||
}
|
}
|
||||||
@@ -82,6 +99,19 @@ class CellularSessionBatchBuilder {
|
|||||||
[[nodiscard]] const CellularLives& candidate() const noexcept {
|
[[nodiscard]] const CellularLives& candidate() const noexcept {
|
||||||
return *working_;
|
return *working_;
|
||||||
}
|
}
|
||||||
|
// Hands the working state to a commit; the builder is spent afterwards.
|
||||||
|
[[nodiscard]] std::unique_ptr<CellularLives> take_candidate() noexcept {
|
||||||
|
return std::move(working_);
|
||||||
|
}
|
||||||
|
// A batch started on an uncommitted predecessor (a commit still in flight) takes that
|
||||||
|
// predecessor's real head once it is known. The head must end where this batch begins.
|
||||||
|
[[nodiscard]] bool rebase(const persistence::RegionHead& head) noexcept {
|
||||||
|
if (head.frame != batch_.header.frame || head.end_tick != batch_.header.begin_tick)
|
||||||
|
return false;
|
||||||
|
batch_.header.predecessor = head.commit;
|
||||||
|
batch_.header.predecessor_digest = head.digest;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// The owner's own refusal behind the last `biology` error, for operator logs.
|
// The owner's own refusal behind the last `biology` error, for operator logs.
|
||||||
[[nodiscard]] std::optional<CellularLivesError> last_lives_error() const noexcept {
|
[[nodiscard]] std::optional<CellularLivesError> last_lives_error() const noexcept {
|
||||||
return last_lives_error_;
|
return last_lives_error_;
|
||||||
@@ -93,7 +123,7 @@ class CellularSessionBatchBuilder {
|
|||||||
std::span<const network::CarriedAction> actions,
|
std::span<const network::CarriedAction> actions,
|
||||||
std::span<const CellularTickIntents::Birth> births,
|
std::span<const CellularTickIntents::Birth> births,
|
||||||
std::span<const persistence::CellularMutationReservation> mutations,
|
std::span<const persistence::CellularMutationReservation> mutations,
|
||||||
bool allow_refusals);
|
std::span<const CellularAdminCommand> admin, bool allow_refusals);
|
||||||
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
|
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
|
||||||
: working_{std::move(working)} {}
|
: working_{std::move(working)} {}
|
||||||
std::unique_ptr<CellularLives> working_;
|
std::unique_ptr<CellularLives> working_;
|
||||||
@@ -101,6 +131,8 @@ class CellularSessionBatchBuilder {
|
|||||||
std::vector<CellularActionRecord> actions_;
|
std::vector<CellularActionRecord> actions_;
|
||||||
std::vector<CellularMutationActionRecord> mutation_actions_;
|
std::vector<CellularMutationActionRecord> mutation_actions_;
|
||||||
std::vector<CellularBirthRefusal> refused_births_;
|
std::vector<CellularBirthRefusal> refused_births_;
|
||||||
|
std::vector<CellularAdminResult> admin_results_;
|
||||||
|
CellularTuningResolver tuning_;
|
||||||
std::optional<CellularLivesError> last_lives_error_;
|
std::optional<CellularLivesError> last_lives_error_;
|
||||||
};
|
};
|
||||||
} // namespace evo::server
|
} // namespace evo::server
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user