Test round 3 fixes (unlocked content on Normal and Hard: odds and pools, every character, challenge, special seed and ending from the menus, unlock visuals, about 90 save and continue points, 72 stable goldens): Tainted Eden's Birthright survives Continue (GameState player fields), WeightedOutcomePicker::AddOutcomeWeight adds a new outcome only with a positive weight (0049cb60), Torn Pocket drops nothing from an empty pocket
This commit is contained in:
1 parent
ee965dad25
commit
2e30446824
8 files changed
+28
-31
No files matched your search
@@ -101,8 +101,10 @@ Flags on the game binary (`src/engine/harness.cpp`), deterministic: the same inp
|
|||||||
`tools/harness/run.sh SAVE WORK [flags]` runs on a fresh copy of a save folder with a private `XDG_DATA_HOME`;
|
`tools/harness/run.sh SAVE WORK [flags]` runs on a fresh copy of a save folder with a private `XDG_DATA_HOME`;
|
||||||
`tools/harness/menu.py` writes the boot-to-run menu input; `tools/harness/compare.py A B` prints the first frame
|
`tools/harness/menu.py` writes the boot-to-run menu input; `tools/harness/compare.py A B` prints the first frame
|
||||||
and field where two traces differ; `tools/harness/bot/` is a Lua mod that plays through `MC_INPUT_ACTION`.
|
and field where two traces differ; `tools/harness/bot/` is a Lua mod that plays through `MC_INPUT_ACTION`.
|
||||||
`tools/harness/goldens/check.sh` replays about 40 recorded runs (every character, the main and alternate floors,
|
`tools/harness/goldens/check.sh` replays about 70 recorded runs (every character, the main and alternate floors,
|
||||||
bosses, Greed, challenges, saving and continuing) and names each trace that changed; `--record` re-records them.
|
every final boss, Greed and Greedier, challenges, typed seeds, saving and continuing) on three saves (nothing unlocked
|
||||||
|
in Hard, everything unlocked in Normal and in Hard) and names each trace that changed; `--record` re-records them.
|
||||||
|
Traces follow the compiler's float code, so check with a clang build, as the goldens were recorded.
|
||||||
|
|
||||||
## Quick use
|
## Quick use
|
||||||
|
|
||||||
|
|||||||
@@ -1224,13 +1224,6 @@ static int ultra_greed_walk(Entity_NPC& npc, const UltraGreedControl& control, f
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds an attack's weight, a new attack only when it has any.
|
|
||||||
static void attack_weight_add(WeightedOutcomePicker& picker, int attack, int weight)
|
|
||||||
{
|
|
||||||
bool isListed = std::ranges::any_of(picker.outcomes, [attack](auto& outcome) { return outcome.id == attack; });
|
|
||||||
if (isListed || weight > 0) picker.AddOutcomeWeight(attack, weight);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ultra Greed's own attacks: the slots (fewer coins out, fewer minions), the dash at the target when it lines up with
|
// Ultra Greed's own attacks: the slots (fewer coins out, fewer minions), the dash at the target when it lines up with
|
||||||
// him, the single spin up close and the long spin.
|
// him, the single spin up close and the long spin.
|
||||||
static void ultra_greed_attacks_weigh(Entity_NPC& npc, const UltraGreedRoom& scene, float rage,
|
static void ultra_greed_attacks_weigh(Entity_NPC& npc, const UltraGreedRoom& scene, float rage,
|
||||||
@@ -1242,7 +1235,7 @@ static void ultra_greed_attacks_weigh(Entity_NPC& npc, const UltraGreedRoom& sce
|
|||||||
int slots = scene.coinsOut < SLOTS_COIN_LIMIT ? (int)(rage * WEIGHT_SLOTS_RAGE + WEIGHT_SLOTS) : 0;
|
int slots = scene.coinsOut < SLOTS_COIN_LIMIT ? (int)(rage * WEIGHT_SLOTS_RAGE + WEIGHT_SLOTS) : 0;
|
||||||
|
|
||||||
if (scene.minions < FEW_MINIONS) slots += WEIGHT_FEW_MINIONS;
|
if (scene.minions < FEW_MINIONS) slots += WEIGHT_FEW_MINIONS;
|
||||||
attack_weight_add(picker, ULTRA_GREED_SLOTS, slots);
|
picker.AddOutcomeWeight(ULTRA_GREED_SLOTS, slots);
|
||||||
|
|
||||||
Vector lead = vector_add(npc.CalcTargetPosition(0), vector_scale(target->velocity, random_unit() * DASH_LEAD));
|
Vector lead = vector_add(npc.CalcTargetPosition(0), vector_scale(target->velocity, random_unit() * DASH_LEAD));
|
||||||
Vector aim = vector_sub(room.GetClampedPositionImpl(lead, DASH_TARGET_MARGIN, DASH_TARGET_MARGIN,
|
Vector aim = vector_sub(room.GetClampedPositionImpl(lead, DASH_TARGET_MARGIN, DASH_TARGET_MARGIN,
|
||||||
@@ -1252,14 +1245,14 @@ static void ultra_greed_attacks_weigh(Entity_NPC& npc, const UltraGreedRoom& sce
|
|||||||
plan.dashWay = vector_cardinal(aim);
|
plan.dashWay = vector_cardinal(aim);
|
||||||
else
|
else
|
||||||
tantrum = 0;
|
tantrum = 0;
|
||||||
attack_weight_add(picker, ULTRA_GREED_TANTRUM, tantrum);
|
picker.AddOutcomeWeight(ULTRA_GREED_TANTRUM, tantrum);
|
||||||
|
|
||||||
Vector apart = vector_make(npc.pos.x / npc.sizeMulti.x - target->pos.x / npc.sizeMulti.x,
|
Vector apart = vector_make(npc.pos.x / npc.sizeMulti.x - target->pos.x / npc.sizeMulti.x,
|
||||||
npc.pos.y / npc.sizeMulti.y - target->pos.y / npc.sizeMulti.y);
|
npc.pos.y / npc.sizeMulti.y - target->pos.y / npc.sizeMulti.y);
|
||||||
int spinOnce =
|
int spinOnce =
|
||||||
vector_length(apart) < npc.size * SPIN_ONCE_REACH ? (int)(rage * WEIGHT_SPIN_ONCE_RAGE + WEIGHT_SPIN_ONCE) : 0;
|
vector_length(apart) < npc.size * SPIN_ONCE_REACH ? (int)(rage * WEIGHT_SPIN_ONCE_RAGE + WEIGHT_SPIN_ONCE) : 0;
|
||||||
attack_weight_add(picker, ULTRA_GREED_SPIN_ONCE, spinOnce);
|
picker.AddOutcomeWeight(ULTRA_GREED_SPIN_ONCE, spinOnce);
|
||||||
attack_weight_add(picker, ULTRA_GREED_SPIN, (int)(rage * WEIGHT_SPIN_RAGE + WEIGHT_SPIN));
|
picker.AddOutcomeWeight(ULTRA_GREED_SPIN, (int)(rage * WEIGHT_SPIN_RAGE + WEIGHT_SPIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draws his next move every 15 frames: his own attacks, the coin spit from mid range, the stomps (more with few
|
// Draws his next move every 15 frames: his own attacks, the coin spit from mid range, the stomps (more with few
|
||||||
@@ -1278,7 +1271,7 @@ static int ultra_greed_attack_draw(Entity_NPC& npc, const UltraGreedRoom& scene,
|
|||||||
{
|
{
|
||||||
int shoot = isGreedier ? (int)(rage * WEIGHT_GREEDIER_SHOOT_RAGE + WEIGHT_GREEDIER_SHOOT)
|
int shoot = isGreedier ? (int)(rage * WEIGHT_GREEDIER_SHOOT_RAGE + WEIGHT_GREEDIER_SHOOT)
|
||||||
: (int)(rage * WEIGHT_SHOOT_RAGE + WEIGHT_SHOOT);
|
: (int)(rage * WEIGHT_SHOOT_RAGE + WEIGHT_SHOOT);
|
||||||
attack_weight_add(picker, ULTRA_GREED_SHOOT, shoot);
|
picker.AddOutcomeWeight(ULTRA_GREED_SHOOT, shoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
int stomps = isGreedier ? (int)(rage * WEIGHT_GREEDIER_STOMPS_RAGE + WEIGHT_GREEDIER_STOMPS)
|
int stomps = isGreedier ? (int)(rage * WEIGHT_GREEDIER_STOMPS_RAGE + WEIGHT_GREEDIER_STOMPS)
|
||||||
@@ -1289,8 +1282,8 @@ static int ultra_greed_attack_draw(Entity_NPC& npc, const UltraGreedRoom& scene,
|
|||||||
if (isRichFloor) walk += WEIGHT_WALK_COINS;
|
if (isRichFloor) walk += WEIGHT_WALK_COINS;
|
||||||
if (npc.variant == 0 || isGreedier)
|
if (npc.variant == 0 || isGreedier)
|
||||||
{
|
{
|
||||||
attack_weight_add(picker, ULTRA_GREED_STOMPS, stomps);
|
picker.AddOutcomeWeight(ULTRA_GREED_STOMPS, stomps);
|
||||||
attack_weight_add(picker, npc.state, walk);
|
picker.AddOutcomeWeight(npc.state, walk);
|
||||||
}
|
}
|
||||||
if (isGreedier)
|
if (isGreedier)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ constexpr int POKER_TOP_QUALITY = 2;
|
|||||||
constexpr std::array<uint32_t, 3> DAEMONS_TAIL_SHIFTS = {1, 5, 16};
|
constexpr std::array<uint32_t, 3> DAEMONS_TAIL_SHIFTS = {1, 5, 16};
|
||||||
constexpr std::array<uint32_t, 3> POKER_CHIP_SHIFTS = {1, 21, 20};
|
constexpr std::array<uint32_t, 3> POKER_CHIP_SHIFTS = {1, 21, 20};
|
||||||
|
|
||||||
// Adds weight to an outcome, never below zero, or adds the outcome (inlined in the original).
|
// 0049cb60 Adds weight to an outcome, never below zero, or adds the outcome when the weight is positive.
|
||||||
void WeightedOutcomePicker::AddOutcomeWeight(int id, int weight)
|
void WeightedOutcomePicker::AddOutcomeWeight(int id, int weight)
|
||||||
{
|
{
|
||||||
for (Outcome& outcome : outcomes)
|
for (Outcome& outcome : outcomes)
|
||||||
@@ -193,7 +193,7 @@ void WeightedOutcomePicker::AddOutcomeWeight(int id, int weight)
|
|||||||
outcome.weight = std::max(0, outcome.weight + weight);
|
outcome.weight = std::max(0, outcome.weight + weight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
outcomes.push_back({id, weight});
|
if (weight > 0) outcomes.push_back({id, weight});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0049cbf0 Draws an outcome: a roll below the total weight lands in one outcome's share, the first with no weight.
|
// 0049cbf0 Draws an outcome: a roll below the total weight lands in one outcome's share, the first with no weight.
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ static void it_hurts_hit(Entity_Player& player)
|
|||||||
|
|
||||||
// Torn Pocket's part of 007729d0: once per copy and once more, a coin, key or bomb (Bethany's soul charge as a half
|
// Torn Pocket's part of 007729d0: once per copy and once more, a coin, key or bomb (Bethany's soul charge as a half
|
||||||
// soul heart, Tainted Bethany's blood charge as a half heart, each one time in ten any heart), picked by how many the
|
// soul heart, Tainted Bethany's blood charge as a half heart, each one time in ten any heart), picked by how many the
|
||||||
// player holds, falls out of the pocket.
|
// player holds, falls out of the pocket. Nothing falls when the player holds none.
|
||||||
static void torn_pocket_hit(Entity_Player& player)
|
static void torn_pocket_hit(Entity_Player& player)
|
||||||
{
|
{
|
||||||
enum PocketLoss
|
enum PocketLoss
|
||||||
@@ -269,6 +269,8 @@ static void torn_pocket_hit(Entity_Player& player)
|
|||||||
picker.AddOutcomeWeight(POCKET_BOMB, player.numBombs);
|
picker.AddOutcomeWeight(POCKET_BOMB, player.numBombs);
|
||||||
if (player.playerType == PLAYER_BETHANY) picker.AddOutcomeWeight(POCKET_SOUL_CHARGE, player.effectiveSoulCharge);
|
if (player.playerType == PLAYER_BETHANY) picker.AddOutcomeWeight(POCKET_SOUL_CHARGE, player.effectiveSoulCharge);
|
||||||
else if (player.playerType == PLAYER_BETHANY_B) picker.AddOutcomeWeight(POCKET_BLOOD_CHARGE, player.effectiveBloodCharge);
|
else if (player.playerType == PLAYER_BETHANY_B) picker.AddOutcomeWeight(POCKET_BLOOD_CHARGE, player.effectiveBloodCharge);
|
||||||
|
if (picker.outcomes.empty()) continue;
|
||||||
|
|
||||||
RNG rng;
|
RNG rng;
|
||||||
rng.SetSeed(pocketRng.Next(), POCKET_SHIFT_INDEX);
|
rng.SetSeed(pocketRng.Next(), POCKET_SHIFT_INDEX);
|
||||||
|
|
||||||
|
|||||||
@@ -813,6 +813,7 @@ void Entity_Player::RestoreGameState(GameStatePlayer& saved)
|
|||||||
damageChargeCooldown = saved.damageChargeCooldown;
|
damageChargeCooldown = saved.damageChargeCooldown;
|
||||||
forgottenBodyRoomIdx = saved.forgottenBodyRoomIdx;
|
forgottenBodyRoomIdx = saved.forgottenBodyRoomIdx;
|
||||||
forgottenBodyPos = saved.forgottenBodyPos;
|
forgottenBodyPos = saved.forgottenBodyPos;
|
||||||
|
edenBirthrightFrame = saved.edenBirthrightFrame;
|
||||||
maggyHealthDrainCooldown = saved.maggyHealthDrainCooldown;
|
maggyHealthDrainCooldown = saved.maggyHealthDrainCooldown;
|
||||||
echoChamberItems.assign(saved.echoChamberItems.begin(), saved.echoChamberItems.end());
|
echoChamberItems.assign(saved.echoChamberItems.begin(), saved.echoChamberItems.end());
|
||||||
std::ranges::copy(saved.bagOfCraftingContent | std::views::take(bagOfCraftingContent.size()),
|
std::ranges::copy(saved.bagOfCraftingContent | std::views::take(bagOfCraftingContent.size()),
|
||||||
|
|||||||
+4
-3
@@ -311,9 +311,9 @@ static bool is_familiar_saved(Entity_Familiar& familiar, bool isSaveTemporaryFam
|
|||||||
// 007b0be0 Copies the player into a saved player: its character, health and consumables, its sub player and the co-op
|
// 007b0be0 Copies the player into a saved player: its character, health and consumables, its sub player and the co-op
|
||||||
// babies that belong to the first player, history, stats and counters, items, pockets and their RNGs, costumes, the
|
// babies that belong to the first player, history, stats and counters, items, pockets and their RNGs, costumes, the
|
||||||
// Moving Box, the friendly enemies it charmed (up to 10, the first twin only), its familiars and persistent effects.
|
// Moving Box, the friendly enemies it charmed (up to 10, the first twin only), its familiars and persistent effects.
|
||||||
// The fields the curated player does not have yet keep their defaults: the soul charge, the last collectible frame
|
// The fields the curated player does not have yet keep their defaults: the soul charge and the unknown fields. Its
|
||||||
// and the unknown fields. Its Echo Chamber items are saved without their kind, and its voided passives without their
|
// Echo Chamber items are saved without their kind, and its voided passives without their second word. A player kept
|
||||||
// second word. A player kept out of the room with an unlisted restore state (a backup player) keeps its familiars.
|
// out of the room with an unlisted restore state (a backup player) keeps its familiars.
|
||||||
void Entity_Player::StoreGameState(GameStatePlayer* saveState, bool isSaveTemporaryFamiliars)
|
void Entity_Player::StoreGameState(GameStatePlayer* saveState, bool isSaveTemporaryFamiliars)
|
||||||
{
|
{
|
||||||
GameStatePlayer& state = *saveState;
|
GameStatePlayer& state = *saveState;
|
||||||
@@ -382,6 +382,7 @@ void Entity_Player::StoreGameState(GameStatePlayer* saveState, bool isSaveTempor
|
|||||||
state.damageChargeCooldown = damageChargeCooldown;
|
state.damageChargeCooldown = damageChargeCooldown;
|
||||||
state.forgottenBodyRoomIdx = forgottenBodyRoomIdx;
|
state.forgottenBodyRoomIdx = forgottenBodyRoomIdx;
|
||||||
state.forgottenBodyPos = forgottenBodyPos;
|
state.forgottenBodyPos = forgottenBodyPos;
|
||||||
|
state.edenBirthrightFrame = edenBirthrightFrame;
|
||||||
state.maggyHealthDrainCooldown = maggyHealthDrainCooldown;
|
state.maggyHealthDrainCooldown = maggyHealthDrainCooldown;
|
||||||
state.echoChamberItems.assign(echoChamberItems.begin(), echoChamberItems.end());
|
state.echoChamberItems.assign(echoChamberItems.begin(), echoChamberItems.end());
|
||||||
std::copy(bagOfCraftingContent.begin(), bagOfCraftingContent.end(), state.bagOfCraftingContent.begin());
|
std::copy(bagOfCraftingContent.begin(), bagOfCraftingContent.end(), state.bagOfCraftingContent.begin());
|
||||||
|
|||||||
+6
-8
@@ -429,7 +429,7 @@ void StateWriter::player_write(const GameStatePlayer& player)
|
|||||||
write(player.forgottenBodyRoomIdx);
|
write(player.forgottenBodyRoomIdx);
|
||||||
write(player.forgottenBodyPos.x);
|
write(player.forgottenBodyPos.x);
|
||||||
write(player.forgottenBodyPos.y);
|
write(player.forgottenBodyPos.y);
|
||||||
write(player.lastCollectibleFrame);
|
write(player.edenBirthrightFrame);
|
||||||
write(player.maggyHealthDrainCooldown);
|
write(player.maggyHealthDrainCooldown);
|
||||||
|
|
||||||
uint8_t echoCount = (uint8_t)player.echoChamberItems.size();
|
uint8_t echoCount = (uint8_t)player.echoChamberItems.size();
|
||||||
@@ -584,7 +584,6 @@ static std::vector<uint16_t> room_map_pack(const std::array<int, ROOM_MAP_CELLS>
|
|||||||
// Esau Jr. players, the pools, the seed and the special seeds, the histories, the Ascent's stages and the versus rules,
|
// Esau Jr. players, the pools, the seed and the special seeds, the histories, the Ascent's stages and the versus rules,
|
||||||
// closed by the checksum of everything after the header, scrambled. More than 255 erased enemies are cut to 255, as
|
// closed by the checksum of everything after the header, scrambled. More than 255 erased enemies are cut to 255, as
|
||||||
// the original does.
|
// the original does.
|
||||||
// The Death Certificate floor's way back, which Game does not keep yet, is written as the original's defaults.
|
|
||||||
// The original's rooms are a fixed array, so a state Level never stored writes default rooms.
|
// The original's rooms are a fixed array, so a state Level never stored writes default rooms.
|
||||||
std::vector<uint8_t> GameState::write()
|
std::vector<uint8_t> GameState::write()
|
||||||
{
|
{
|
||||||
@@ -1125,7 +1124,7 @@ bool StateReader::player_read(GameStatePlayer& player)
|
|||||||
}
|
}
|
||||||
fields_read(player.reverseSunBoneHearts, player.pendingPill);
|
fields_read(player.reverseSunBoneHearts, player.pendingPill);
|
||||||
player.damageChargeCooldown = read<int16_t>();
|
player.damageChargeCooldown = read<int16_t>();
|
||||||
fields_read(player.forgottenBodyRoomIdx, player.forgottenBodyPos, player.lastCollectibleFrame,
|
fields_read(player.forgottenBodyRoomIdx, player.forgottenBodyPos, player.edenBirthrightFrame,
|
||||||
player.maggyHealthDrainCooldown);
|
player.maggyHealthDrainCooldown);
|
||||||
|
|
||||||
uint8_t echoCount = read<uint8_t>();
|
uint8_t echoCount = read<uint8_t>();
|
||||||
@@ -1297,11 +1296,6 @@ static std::array<int, ROOM_MAP_CELLS> room_map_unpack(const std::vector<uint16_
|
|||||||
return roomMap;
|
return roomMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 009cc1a0 Reads the saved run (written by versions 155 to 169) as write writes it, once its header names such a
|
|
||||||
// version and its checksum matches both its own and the one the progress file remembers. A wrong header deletes the
|
|
||||||
// file. A bad room, player, character or item fails the read, as does a run that does not end where its checksum is.
|
|
||||||
// Netplay is offline, so the checksum is always checked and the run read as this machine's own.
|
|
||||||
// The Death Certificate floor's way back, which Game does not keep yet, is read past.
|
|
||||||
// A saved file's version from its header, 0 when the header names none the reader knows (155 to 169).
|
// A saved file's version from its header, 0 when the header names none the reader knows (155 to 169).
|
||||||
static uint32_t header_version_read(std::span<const uint8_t> file)
|
static uint32_t header_version_read(std::span<const uint8_t> file)
|
||||||
{
|
{
|
||||||
@@ -1326,6 +1320,10 @@ static bool seal_check(std::span<const uint8_t> file, uint32_t& outChecksum)
|
|||||||
return (sealed ^ CHECKSUM_KEY) == outChecksum;
|
return (sealed ^ CHECKSUM_KEY) == outChecksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 009cc1a0 Reads the saved run (written by versions 155 to 169) as write writes it, once its header names such a
|
||||||
|
// version and its checksum matches both its own and the one the progress file remembers. A wrong header deletes the
|
||||||
|
// file. A bad room, player, character or item fails the read, as does a run that does not end where its checksum is.
|
||||||
|
// Netplay is offline, so the checksum is always checked and the run read as this machine's own.
|
||||||
bool GameState::read(std::span<const uint8_t> file)
|
bool GameState::read(std::span<const uint8_t> file)
|
||||||
{
|
{
|
||||||
uint32_t version = header_version_read(file);
|
uint32_t version = header_version_read(file);
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ struct GameStatePlayer
|
|||||||
int curseMistRedHearts = 0;
|
int curseMistRedHearts = 0;
|
||||||
int damageModifier = 0;
|
int damageModifier = 0;
|
||||||
int donateLuck = 0;
|
int donateLuck = 0;
|
||||||
|
int edenBirthrightFrame = -1;
|
||||||
int effectiveBloodCharge = 0;
|
int effectiveBloodCharge = 0;
|
||||||
int effectiveSoulCharge = 0;
|
int effectiveSoulCharge = 0;
|
||||||
int eternalHearts = 0;
|
int eternalHearts = 0;
|
||||||
@@ -148,7 +149,6 @@ struct GameStatePlayer
|
|||||||
int jarHearts = 0;
|
int jarHearts = 0;
|
||||||
int jumperCablesKills = 0;
|
int jumperCablesKills = 0;
|
||||||
int keepersSackBonus = 0;
|
int keepersSackBonus = 0;
|
||||||
int lastCollectibleFrame = -1;
|
|
||||||
int lastPillColor = 0;
|
int lastPillColor = 0;
|
||||||
int luckModifier = 0;
|
int luckModifier = 0;
|
||||||
int maxHearts = 0;
|
int maxHearts = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user