feat(cellular): split collection evenly across a source's nutrients
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m31s
Foundation / postgres-tools (push) Successful in 21s
Foundation / server-image (push) Successful in 4m21s
Foundation / image (push) Successful in 5m3s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m31s
Foundation / postgres-tools (push) Successful in 21s
Foundation / server-image (push) Successful in 4m21s
Foundation / image (push) Successful in 5m3s
Playtest: phosphorus held growth back everywhere. Per-nutrient collection limits followed the body recipe (5% phosphorus), but the membrane is 10% phosphorus, so no cell could collect phosphorus as fast as it builds with it. Two optional revamp tuning keys, stored in a formerly reserved rules word so regions opened without them keep their exact meaning: - feeding.split_evenly: matter from one food source is split equally between the nutrients it holds (a carbon-only bubble gives the whole matter limit to carbon, carbon and phosphorus half each, all four a quarter each), each share scaled by the cell's collection trait; - feeding.collection_percent: every collection limit per cent (100 default). The DEV tuning file takes these keys with the image that reads them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1630,7 +1630,11 @@ std::vector<std::uint8_t> CellularLives::snapshot() const {
|
||||
if (revamp) {
|
||||
const auto& r = state_->revamp;
|
||||
out.put(r.body.essential_upkeep_per_thousand, 4);
|
||||
out.put(0, 4);
|
||||
// Formerly reserved: collection per cent (0 for the original 100) and the even split
|
||||
// in bit 16. Regions opened before these keys hold zero and keep their meaning.
|
||||
out.put((r.step.collection_percent == 100 ? 0U : r.step.collection_percent) |
|
||||
(r.step.split_evenly ? 0x10000U : 0U),
|
||||
4);
|
||||
for (const auto rate : r.burn_pj_per_kfg)
|
||||
out.put(rate);
|
||||
out.put(r.step.membrane_collection_per_mille_per_point, 4);
|
||||
@@ -2157,7 +2161,10 @@ CellularLives::restore(std::span<const std::uint8_t> bytes, std::uint64_t world,
|
||||
if (revamp_version) {
|
||||
const auto u32 = [&in] { return static_cast<std::uint32_t>(in.get(4)); };
|
||||
revamp.body.essential_upkeep_per_thousand = u32();
|
||||
const auto reserved = in.get(4);
|
||||
const auto feeding = in.get(4);
|
||||
revamp.step.collection_percent =
|
||||
(feeding & 0xFFFFU) == 0 ? 100U : static_cast<std::uint32_t>(feeding & 0xFFFFU);
|
||||
revamp.step.split_evenly = (feeding & 0x10000U) != 0;
|
||||
for (auto& rate : revamp.burn_pj_per_kfg)
|
||||
rate = in.get();
|
||||
revamp.step.membrane_collection_per_mille_per_point = u32();
|
||||
@@ -2169,7 +2176,8 @@ CellularLives::restore(std::span<const std::uint8_t> bytes, std::uint64_t world,
|
||||
revamp.drip_bubble_pj = in.get();
|
||||
revamp.drip_bubble_fg = in.get();
|
||||
spent = in.inventory();
|
||||
if (!read_revamp_offers(in, revamp) || reserved != 0 || !cellular_revamp_valid(revamp))
|
||||
if (!read_revamp_offers(in, revamp) || (feeding & ~0x1FFFFULL) != 0 ||
|
||||
(feeding & 0xFFFFU) == 100 || !cellular_revamp_valid(revamp))
|
||||
return std::unexpected{CellularLivesError::format};
|
||||
}
|
||||
const auto life_bytes =
|
||||
|
||||
@@ -41,6 +41,7 @@ bool cellular_revamp_valid(const CellularRevampRules& rules) noexcept {
|
||||
return false;
|
||||
return rules.body.essential_upkeep_per_thousand <= 1'000 &&
|
||||
step.membrane_collection_per_mille_per_point <= 1'000 && step.engulf_ratio_milli >= 1 &&
|
||||
step.collection_percent >= 1 && step.collection_percent <= 1'000 &&
|
||||
step.engulf_ratio_milli <= 1'000'000 && step.engulf_reserve_percent <= 100 &&
|
||||
step.kill_bubble_per_thousand <= 1'000 && rules.drip_interval_ticks <= 72'000 &&
|
||||
rules.drip_bubble_pj <= most && rules.drip_bubble_fg <= most &&
|
||||
@@ -51,8 +52,9 @@ bool cellular_revamp_valid(const CellularRevampRules& rules) noexcept {
|
||||
rules.split_share_per_thousand < 1'000 && rules.split_min_growth != 0 &&
|
||||
rules.split_min_growth <= 1'000 && rules.bud_fee_scale_percent <= 100 &&
|
||||
rules.bud_fee.energy.value <= most &&
|
||||
std::ranges::all_of(rules.bud_fee.matter,
|
||||
[](const accounting::Femtograms& f) { return f.value <= most; }) &&
|
||||
std::ranges::all_of(
|
||||
rules.bud_fee.matter,
|
||||
[](const accounting::Femtograms& f) { return f.value <= most; }) &&
|
||||
rules.organism_cap != 0 && rules.organism_cap <= biology::max_cellular_tick_lives &&
|
||||
rules.organism_load_per_thousand <= 10'000 && rules.emerge_members >= 2 &&
|
||||
rules.emerge_members <= 10'000 && rules.emerge_mass_fg <= most &&
|
||||
@@ -248,7 +250,9 @@ CellularRevampRules cellular_revamp_rules(const biology::CellularRevampTuning& t
|
||||
u32(t.feeding_membrane_collection_per_mille_per_point),
|
||||
.engulf_ratio_milli = u32(t.predation_engulf_ratio_milli),
|
||||
.engulf_reserve_percent = u32(t.predation_engulf_reserve_percent),
|
||||
.kill_bubble_per_thousand = u32(t.predation_kill_bubble_per_mille)},
|
||||
.kill_bubble_per_thousand = u32(t.predation_kill_bubble_per_mille),
|
||||
.collection_percent = u32(t.feeding_collection_percent),
|
||||
.split_evenly = t.feeding_split_evenly != 0},
|
||||
.drip_interval_ticks = u32(t.spent_drip_interval_ticks),
|
||||
.drip_bubble_pj = u64(t.spent_drip_bubble_pj),
|
||||
.drip_bubble_fg = u64(t.spent_drip_bubble_fg),
|
||||
|
||||
Reference in New Issue
Block a user