feat(cellular): session v14, bundle 15 and rules-13 wildlife
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s
Session v14 carries the rules-13 revamp: a body block in the owner's view (members, emergence threshold, exclusions, Emerge open, payable energy, mass and the 20 traits), become, emerge and channel exclusions on actions, become on mutation choices, catalog offers (id, chance, cost) and the emerged ending. Older sessions never see a v14 field. The client shows Stay / Become offspring offers named from the shared catalog, continuing as a bud, the organism and its Emerge button, kept channels, the body and the emerged end screen. Bundle 15 (rules 13 on owner format 11) is durable: schema 60 admits it raw-only, stores become as bit 15 of the choice's operator, widens the action input and mutation results, and publishes the 14 -> 15 revamp profile migration. evo-world-clone opens cellular-v10 (cellular-v9 plus the revamp upgrade from --revamp-tuning), resumable and recoverable. Wildlife counts reserve matter as energy, waits for the bud fee, grows organisms one short of emerging, and hunts by the region step's rules-13 engulf test. The play summary adds organisms, offers and the spent pool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -107,7 +107,9 @@ bool valid_action_input(const CellularActionRecord& action, std::uint64_t begin_
|
||||
return !all_zero(action.account) && action.action_id != 0 && tick > begin_tick &&
|
||||
tick <= end_tick && move_x >= -movement_limit && move_x <= movement_limit &&
|
||||
move_y >= -movement_limit && move_y <= movement_limit && input[12] <= 3 &&
|
||||
input[13] <= 1 && all_zero(input.subspan(14, 2)) &&
|
||||
// Flags: brake, become (with a bud) and emerge (no target); then exclusions.
|
||||
input[13] <= 7 && ((input[13] & 2U) == 0 || input[12] == 3) &&
|
||||
((input[13] & 4U) == 0 || input[12] == 0) && input[14] <= 0x0F && input[15] == 0 &&
|
||||
(input[12] == 1 || all_zero(input.subspan(16, 8)));
|
||||
}
|
||||
bool action_less(const CellularActionRecord& a, const CellularActionRecord& b) {
|
||||
@@ -400,7 +402,7 @@ encode_cellular_mutation_input(const CellularMutationActionRecord& action) {
|
||||
put(bytes, action.input.life_id, 8);
|
||||
put(bytes, action.input.event_index, 8);
|
||||
put(bytes, action.input.offer_tick, 8);
|
||||
put(bytes, action.input.operator_id, 2);
|
||||
put(bytes, action.input.operator_id | (action.input.become ? 0x8000U : 0U), 2);
|
||||
std::array<std::uint8_t, cellular_mutation_input_bytes> out{};
|
||||
std::ranges::copy(bytes, out.begin());
|
||||
return out;
|
||||
@@ -418,10 +420,12 @@ decode_cellular_mutation_input(const std::array<std::uint8_t, 16>& account, std:
|
||||
action.input.life_id = get(input, 8, 8);
|
||||
action.input.event_index = get(input, 16, 8);
|
||||
action.input.offer_tick = get(input, 24, 8);
|
||||
action.input.operator_id = static_cast<std::uint16_t>(get(input, 32, 2));
|
||||
const auto stored = static_cast<std::uint16_t>(get(input, 32, 2));
|
||||
action.input.operator_id = static_cast<std::uint16_t>(stored & 0x7FFFU);
|
||||
action.input.become = (stored & 0x8000U) != 0;
|
||||
if (action_id == 0 || action.tick == 0 || action.input.life_id == 0 ||
|
||||
action.input.event_index == 0 || action.input.offer_tick == 0 ||
|
||||
action.input.offer_tick >= action.tick)
|
||||
(action.input.become && action.input.operator_id == 0) || action.input.event_index == 0 ||
|
||||
action.input.offer_tick == 0 || action.input.offer_tick >= action.tick)
|
||||
return std::nullopt;
|
||||
return action;
|
||||
}
|
||||
@@ -517,7 +521,8 @@ encode_cellular_mutation_action_block(std::span<const CellularMutationActionReco
|
||||
put(out, action.input.life_id, 8);
|
||||
put(out, action.input.event_index, 8);
|
||||
put(out, action.input.offer_tick, 8);
|
||||
put(out, action.input.operator_id, 2);
|
||||
// Rules 13: become is bit 15 of the stored operator, as in the reservation input.
|
||||
put(out, action.input.operator_id | (action.input.become ? 0x8000U : 0U), 2);
|
||||
put(out, 0, 6);
|
||||
}
|
||||
return out;
|
||||
@@ -541,8 +546,11 @@ decode_cellular_mutation_action_block(std::span<const std::uint8_t> bytes, std::
|
||||
action.input.life_id = get(record, 32, 8);
|
||||
action.input.event_index = get(record, 40, 8);
|
||||
action.input.offer_tick = get(record, 48, 8);
|
||||
action.input.operator_id = static_cast<std::uint16_t>(get(record, 56, 2));
|
||||
if (!all_zero(record.subspan(58, 6)))
|
||||
const auto stored = static_cast<std::uint16_t>(get(record, 56, 2));
|
||||
action.input.operator_id = static_cast<std::uint16_t>(stored & 0x7FFFU);
|
||||
action.input.become = (stored & 0x8000U) != 0;
|
||||
if (!all_zero(record.subspan(58, 6)) ||
|
||||
(action.input.become && action.input.operator_id == 0))
|
||||
return std::unexpected{CellularActionBlockError::format};
|
||||
out.push_back(action);
|
||||
offset += cellular_mutation_action_record_bytes;
|
||||
@@ -587,7 +595,10 @@ match_cellular_actions_to_trace(const CellularLives& predecessor, const Cellular
|
||||
intent->intent.movement.y !=
|
||||
std::bit_cast<std::int16_t>(static_cast<std::uint16_t>(get(input, 10, 2))) ||
|
||||
intent->intent.intake_target != target || intent->intent.engulf != (input[12] == 2) ||
|
||||
intent->intent.bud != (input[12] == 3) || intent->intent.brake != (input[13] == 1))
|
||||
intent->intent.bud != (input[12] == 3) ||
|
||||
intent->intent.brake != ((input[13] & 1U) != 0) ||
|
||||
intent->intent.become != ((input[13] & 2U) != 0) ||
|
||||
intent->intent.emerge != ((input[13] & 4U) != 0) || intent->intent.exclude != input[14])
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
}
|
||||
return {};
|
||||
@@ -623,7 +634,8 @@ match_cellular_mutation_actions_to_trace(const CellularLives& predecessor,
|
||||
action.tick == tick && action.input.life_id == selection.life_id &&
|
||||
action.input.event_index == selection.event_index &&
|
||||
action.input.offer_tick == selection.offer_tick &&
|
||||
action.input.operator_id == selection.operator_id;
|
||||
action.input.operator_id == selection.operator_id &&
|
||||
action.input.become == selection.become;
|
||||
});
|
||||
if (matches != 1)
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
@@ -645,7 +657,8 @@ match_cellular_mutation_actions_to_trace(const CellularLives& predecessor,
|
||||
if (departed == mutations.end() || departed->life_id != action.input.life_id ||
|
||||
departed->event_index != action.input.event_index ||
|
||||
departed->offer_tick != action.input.offer_tick ||
|
||||
departed->operator_id != action.input.operator_id)
|
||||
departed->operator_id != action.input.operator_id ||
|
||||
departed->become != action.input.become)
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
continue;
|
||||
}
|
||||
@@ -655,7 +668,24 @@ match_cellular_mutation_actions_to_trace(const CellularLives& predecessor,
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
const auto selection = std::ranges::lower_bound(mutations, life->identity.life, {},
|
||||
&CellularMutationSelection::life_id);
|
||||
if (!life->mutation.offer)
|
||||
if (predecessor.rules_version() >= cellular_lives_revamp_rules) {
|
||||
// Rules 13: the catalog offer the life held; operator 0 declines it.
|
||||
const auto& offer = life->revamp.offer;
|
||||
const auto end = offer.ids.begin() + offer.count;
|
||||
if (selection == mutations.end() || selection->life_id != life->identity.life ||
|
||||
selection->event_index != action.input.event_index ||
|
||||
selection->offer_tick != action.input.offer_tick ||
|
||||
selection->operator_id != action.input.operator_id ||
|
||||
selection->become != action.input.become || offer.count == 0 ||
|
||||
offer.event_index != action.input.event_index ||
|
||||
offer.offer_tick != action.input.offer_tick ||
|
||||
life->identity.life != action.input.life_id ||
|
||||
(action.input.operator_id != 0 &&
|
||||
std::ranges::find(offer.ids.begin(), end, action.input.operator_id) == end))
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
continue;
|
||||
}
|
||||
if (!life->mutation.offer || action.input.become)
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
const auto offer = life->mutation.offer.value_or(biology::MutationOffer{});
|
||||
if (selection == mutations.end() || selection->life_id != life->identity.life ||
|
||||
|
||||
Reference in New Issue
Block a user