feat(cellular): random founder spawns, tunable thrust cost, commit timing
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 1m6s
Foundation / checks (deploy) (push) Successful in 5m41s
Foundation / postgres-tools (push) Successful in 1m33s
Foundation / image (push) Successful in 4m42s
Foundation / server-image (push) Successful in 4m55s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 1m6s
Foundation / checks (deploy) (push) Successful in 5m41s
Foundation / postgres-tools (push) Successful in 1m33s
Foundation / image (push) Successful in 4m42s
Foundation / server-image (push) Successful in 4m55s
Playtest feedback on region 10. Rules-12 founders now start at a seeded random spot anywhere in the region (1 mm clear of the edges, clear of other cells; seeded by world, region and the life's identity so replay is exact). The provisioned sites remain the fallback. Thrust energy is tunable: founder.thrust_cost_per_mille scales the metabolic full-speed movement cost for thrust and braking (trial 250, a quarter of today's cost). It is part of the liquid rules declared when a region opens, persisted in the format-10 block's reserved slot (zero stands for the original 1,000), so existing regions keep their meaning. The server logs every cellular commit slower than 50 ms (and one in 60) with its tick count and duration, to find what stalls the loop once a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "fixtures/cellular_ecology.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
||||
@@ -166,6 +167,44 @@ void trace_replays_brakes() {
|
||||
require(replayed->snapshot() == live->snapshot(), "replay diverged from the live run");
|
||||
}
|
||||
|
||||
// Founders start at a seeded random spot, not a provisioned site, identically on replay.
|
||||
void founders_spawn_at_random() {
|
||||
const auto state = liquid_region();
|
||||
const auto first = state->lives().front().position;
|
||||
const auto sites = std::array{1'000ULL, 4'000ULL};
|
||||
require(!(std::ranges::find(sites, first.x_um) != sites.end() &&
|
||||
std::ranges::find(sites, first.y_um) != sites.end()),
|
||||
"a rules-12 founder started on a provisioned site");
|
||||
require(first.x_um >= 1'000 && first.y_um >= 1'000 && first.x_um < 47'000 &&
|
||||
first.y_um < 47'000,
|
||||
"a founder started too close to the region edge");
|
||||
// The same identity starts at the same spot (the fixture funds one founder).
|
||||
auto again = liquid_region();
|
||||
require(again->lives().front().position == first, "spawning is not deterministic");
|
||||
}
|
||||
|
||||
// The declared thrust cost share scales every thrust and braking cost.
|
||||
void thrust_cost_is_tunable() {
|
||||
const auto state = liquid_region();
|
||||
const auto& life = state->lives().front();
|
||||
const auto genome = state->archive().find(life.identity.genome);
|
||||
require(genome.has_value(), "founder genome missing");
|
||||
const auto budget = biology::metabolic_budget(*genome, life.growth, {293'150, {}});
|
||||
require(budget.has_value(), "founder budget");
|
||||
auto full = rules();
|
||||
auto quarter = rules();
|
||||
quarter.thrust_cost_per_mille = 250;
|
||||
const auto a = checked(cellular_liquid_handling(*genome, *budget, full), "full cost");
|
||||
const auto b = checked(cellular_liquid_handling(*genome, *budget, quarter), "quarter cost");
|
||||
require(a.thrust_cost.value > 0 &&
|
||||
b.thrust_cost.value == (a.thrust_cost.value * 250 + 999) / 1'000 &&
|
||||
b.thrust_q10 == a.thrust_q10,
|
||||
"thrust cost did not scale");
|
||||
auto zero = rules();
|
||||
zero.thrust_cost_per_mille = 0;
|
||||
require(!cellular_liquid_valid(zero, area), "a zero thrust cost share was accepted");
|
||||
}
|
||||
|
||||
void older_rules_refuse_brake() {
|
||||
auto state = opening(7, true, 1);
|
||||
require(!state->advance_tick(swim(*state, {}, true)), "rules 8 accepted a brake");
|
||||
@@ -179,6 +218,8 @@ int main() {
|
||||
food_moves_and_merges_without_loss();
|
||||
restore_continues_exactly();
|
||||
trace_replays_brakes();
|
||||
founders_spawn_at_random();
|
||||
thrust_cost_is_tunable();
|
||||
older_rules_refuse_brake();
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "%s\n", error.what());
|
||||
|
||||
Reference in New Issue
Block a user