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>
59 lines
3.5 KiB
C++
59 lines
3.5 KiB
C++
#include "evo/server/lifecycle/cellular_liquid.hpp"
|
|
|
|
namespace evo::server {
|
|
bool cellular_liquid_valid(const CellularLiquidRules& rules, biology::CellularArea area) noexcept {
|
|
const auto& c = rules.currents;
|
|
const auto& f = rules.founder;
|
|
const auto& d = rules.deposits;
|
|
// Generation itself is checked once, by the owner that keeps the generated field.
|
|
return c.width_um == area.width_um && c.height_um == area.height_um && c.pitch_um != 0 &&
|
|
c.pitch_um <= biology::max_cellular_current_pitch_um && c.min_count <= c.max_count &&
|
|
f.thrust_q10 <= static_cast<std::uint32_t>(biology::cellular_velocity_limit_q10) &&
|
|
f.reverse_thrust_q10 <=
|
|
static_cast<std::uint32_t>(biology::cellular_velocity_limit_q10) &&
|
|
f.forward_drag_ppm < biology::cellular_drag_ppm_limit &&
|
|
f.lateral_drag_ppm < biology::cellular_drag_ppm_limit &&
|
|
f.turn <= biology::cellular_heading_turn / 2 && f.thrust_cost.value == 0 &&
|
|
f.reverse_cost.value == 0 && d.merged_cap != 0 && d.bubble_radius_um != 0 &&
|
|
d.bubble_radius_um <= biology::max_cellular_deposit_radius_um && d.max_drift_q10 >= 0 &&
|
|
d.max_drift_q10 <= biology::cellular_velocity_limit_q10 &&
|
|
d.drift_decay_ppm < biology::cellular_drag_ppm_limit &&
|
|
rules.thrust_cost_per_mille != 0 && rules.thrust_cost_per_mille <= 10'000;
|
|
}
|
|
|
|
CellularLiquidRules cellular_liquid_rules(const biology::CellularTuning& t,
|
|
biology::CellularArea area, std::uint64_t seed) {
|
|
const auto u32 = [](std::int64_t value) { return static_cast<std::uint32_t>(value); };
|
|
return {
|
|
.currents = {seed, u32(static_cast<std::int64_t>(area.width_um)),
|
|
u32(static_cast<std::int64_t>(area.height_um)), u32(t.currents_grid_pitch_um),
|
|
u32(t.currents_min_count), u32(t.currents_max_count),
|
|
u32(t.currents_min_width_um), u32(t.currents_max_width_um),
|
|
u32(t.currents_min_speed_um_per_s), u32(t.currents_max_speed_um_per_s)},
|
|
.founder = biology::founder_cellular_handling(t, {}, {}),
|
|
.deposits = {.drift_radius_um = u32(t.food_induced_drift_radius_um),
|
|
.max_drift_q10 =
|
|
static_cast<std::int32_t>(t.food_induced_drift_max_um_per_s *
|
|
biology::cellular_velocity_q10_per_um_s),
|
|
.drift_decay_ppm = u32(t.food_induced_drift_decay_ppm_per_tick),
|
|
.merged_cap = static_cast<std::uint16_t>(t.food_merged_bubble_cap_multiple),
|
|
.bubble_radius_um = biology::cellular_mote_radius_um},
|
|
.thrust_cost_per_mille = u32(t.founder_thrust_cost_per_mille)};
|
|
}
|
|
|
|
std::expected<biology::CellularHandling, biology::CellularHandlingError>
|
|
cellular_liquid_handling(const biology::Genome& genome, const biology::MetabolicBudget& budget,
|
|
const CellularLiquidRules& rules) {
|
|
auto handling = biology::derive_cellular_handling(genome, budget, rules.founder);
|
|
if (!handling)
|
|
return handling;
|
|
const auto scaled = [&rules](accounting::Picojoules cost) {
|
|
const auto product = cost.value * rules.thrust_cost_per_mille;
|
|
return accounting::Picojoules{product / 1'000 + (product % 1'000 != 0 ? 1 : 0)};
|
|
};
|
|
handling->thrust_cost = scaled(handling->thrust_cost);
|
|
handling->reverse_cost = scaled(handling->reverse_cost);
|
|
return handling;
|
|
}
|
|
} // namespace evo::server
|