Ghidra 12.2 project and full dump of isaac-ng.exe v1.9.7.17, query scripts, notes indexed by entity, anm2/rooms reimplementations, and db/ (names + fields) that build.sh re-applies. Fixes awk numeric address comparison in find.sh/decompile.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 KiB
REBIRTH BEHAVIOUR
Here is how Jacob & Esau behave in Repentance+. The rules and numbers come from mods/rebirth_in_flash/reference/characters.json (records jacob id 19 and esau id 20, wiki page "Jacob & Esau") and from the dump's players.xml and costumes2.xml. I did not call the wiki API or look at the executable. Two open questions are noted below: what exactly "half as effective" speed means, and whether a twin starts with all of its base stats.
Rules and numbers
Base stats
| Jacob (players.xml id 19) | Esau (id 20, record has form_of: "jacob") |
|
|---|---|---|
| Health | hp="6": 3 red hearts |
hp="2" armor="2": 1 red heart and 1 soul heart |
| Damage | x0.786 (2.75) | x1.071 |
| Tears | +0.277 | -0.1 |
| Shot speed | 1.15 | 0.85 |
| Range | -5 in Flash terms (Repentance stats: -1.5, 5 tiles) | +5 (Repentance stats: +1.5, 8 tiles) |
| Luck | 1 | -1 |
| Head costume | costume 52 (Character_002x_JacobHead.anm2, priority 99) |
costume 53 (Character_003x_EsauHead.anm2, priority 99) |
| Skin colour | skinColor="-1" |
skinColor="3" |
| Unlock | achievement 405 | achievement -2, so it is not a selectable title slot |
Control and movement
- Both brothers are controlled as one: same movement and fire inputs, and the same speed. Both have collision and can be pushed apart.
- Holding Drop keeps Esau in place while Jacob moves freely.
- Speed is one shared stat. Speed changes are only half as effective (exact formula unknown; probably half the delta).
- Taurus's speed and D8's speed reroll apply to both brothers.
Shared and separate
- Shared: coins, bombs and keys.
- Separate: items, health and every other stat.
- Each brother has his own active item, trinket and pocket slot, so the pair carries two of each.
- Classic controls: Jacob's active and pocket are both on the Item button, Esau's on the Pill/Card button, and holding Drop switches from active to pocket.
- "Better" controls: normal buttons, and holding Drop switches to Esau's slots.
- An item applies only to the brother who picks it up or uses it, unless listed otherwise below.
Bombs
- One bomb press makes both brothers place a bomb, but only one is spent from the shared count.
Doors
- If either brother passes through a door, both move to the next room.
- Curse Room door damage hits only the brother who went through.
Pedestals and choices
- Two "pick one" pedestals touched at the same moment both get taken: The Polaroid and The Negative, There's Options/More Options, Death Certificate.
- Options? (consumables) still allows only one.
Death and revival
- If either brother dies, both die.
- Revive items fire in a set order no matter who owns them. If both own a copy of the same item, Jacob's is used up first.
- Dead Cat revives both brothers with 1 red heart container each.
- Missing Poster revives the pair if either brother holds it.
- Spirit Shackles works only if its owner is the one who dies.
Other rules
- Room clear rewards use the brothers' luck added together (1 + -1 = 0 at the start).
- Blue flies and spiders take the damage of the brother who spawned them.
- Transformations count per brother. An active item counts only for the brother who touched it first, so each needs 3 books for Bookworm.
- A 6-pip dice room rerolls both brothers. A 1-pip room and D4 reroll only the brother who triggered them.
- Devil deal prices follow the brother who pays. Underpaying is possible and the shortfall is never taken from the other brother. A soul-heart shortfall costs 1 container per missing soul heart (likely a bug).
- Clicker or Judas' Shadow into J&E: health containers are split evenly, items are distributed randomly, held consumables drop.
- Clicker out of J&E: the new character gets the combined health and items. Esau's cards, pills and trinkets drop, and his active item is lost.
- Key Piece 1/2 and Knife Piece 1/2 combine across the brothers. Broken Shovel 1/2 does not.
- Eden's Blessing items go to Jacob only.
- Birthright ("What's yours is mine"): the brother who picks it up gains copies of the other brother's last 3 picked-up passive items. Copied pickup-granting items do not grant their pickups again.
Records that depend on this feature
Characters
- jacob, esau (both
needs_mechanic): need the whole feature.- Esau as a second body carrying his own record's stats and hearts.
- Shared consumables, drop-to-hold, per-body active and pocket.
- Linked death, both brothers changing rooms together, death page and cutscene art.
Cards
- XIX - The Sun: heals both brothers.
- Soul of Jacob and Esau (id 97,
player:second_body): spawns a temporary Esau for the room.- He gets one random item per item Isaac has, each from that item's pool.
- His death has no consequence.
- He reuses the twin body without the linked death.
Items
- Strawman (
player:second_body): a Keeper controlled exactly like Esau, speed synced with Isaac's.- He has coin hearts and no linked death.
- On his death: 5 blue spiders, and Strawman is removed.
- Esau Jr. (703,
player:second_body/player:form): swaps the whole body (items, hearts, pockets) and shares consumables.- Esau Jr. has 3 black hearts, flight and +2 flat damage.
- Dying as either character ends the run.
- This is closer to the Forgotten form swap, but it uses the same per-body inventory.
- Friend Finder, Sumptorium, Decap Attack, Recall (
player:second_body): bodies or monsters that mirror Isaac's inputs. Only the mirror-input part is needed. - Birthright: the J&E entry is the copy of the other brother's last 3 passives (rule above).
- Taurus, D8: the speed effect applies to both.
- D4, Diplopia: act on the user only. Diplopia can give each brother the same active.
- Dead Cat: revive order, both revived.
- Spirit Shackles: only its owner's death counts.
- Gnawed Leaf: Esau held with Drop counts as idle while Jacob moves.
- Kamikaze!, The Ladder, PHD/False PHD, Redemption, Echo Chamber, Glyph of Balance, Damocles, Stitches, Binge Eater, Genesis, Urn of Souls, Spirit Sword, Bursting Sack, Luna, Technology Zero, Eden's Blessing, Little Baggy: each needs a per-owner or "either brother" scope. The rules are in their
wiki.notes. - The Polaroid, The Negative: both can be taken in one go.
Trinkets
- Missing Poster: revives the pair if either holds it.
- Lil Larva: shared if either holds it.
- Extension Cord: also arcs between the brothers and to both brothers' familiars.
- Counterfeit Penny: works for the holder only.
- Filigree Feather: Jacob must hold it.
- Your Soul: two deals taken at once are both free, and the trinket is removed.
- Found Soul: a ghost that mirrors inputs. It dies separately for each brother.
- RC Remote: uses the same Drop-holds-in-place rule for familiars.
Art and sound
Paths are relative to /home/anon/sda/Personal/Projects/Binding of Isaac Repentance Mods/shweet-sprites/. The user's resprite (resources/) has nothing for J&E except gfx/005.300.34_soul of jacob.anm2, so everything else comes from the dump, dump/rep+full/resources/.
Player sheets (gfx/characters/costumes/)
character_002x_jacob.pngandcharacter_003x_esau.png.- Tint variants of each:
_white,_black,_blue,_red,_green,_grey. - Hair layers:
character_002x_jacobhair.png,character_003x_esauhair.png.
Head costumes (gfx/characters/)
character_002x_jacobhead.anm2,character_003x_esauhead.anm2.002x_schoolbag.anm2, with sheetscostumes/costume_002x_schoolbag*.png(likely the second active slot's backpack).
UI
- Name:
gfx/ui/boss/playername_02x_jacob_esau.png. - Portrait:
gfx/ui/stage/playerportrait_jacob.png. - Achievement:
gfx/ui/achievement/achievement_jacobesau.png. - No Esau-specific HUD sheet was found. Esau's hearts and items reuse the normal heart/HUD sprites drawn as a second block.
Soul of Jacob and Esau
- Pickup:
gfx/005.300.34_soul of jacob.anm2(resprite version exists). - Voiceover:
sfx/voiceover/soul of jacob and esau.wav.
Esau Jr.
gfx/003.244_esau jr.anm2,gfx/familiar/familiar_esau_jr.png.gfx/items/collectibles/collectibles_703_esaujr.png(resprite version exists).sfx/esaujr.wav.
Sound
- J&E have no sounds of their own; they use the normal player sounds.
ENGINE MAP
The engine has exactly one player. Game holds a single PlayerState player_, used about 1,000 times across src/game (game.cpp 257, items.cpp 180, effects.cpp 135, firing.cpp 113, and so on). Making all of that loop over two players is a non-starter. The closest existing feature is the Forgotten/Soul partner form, which already does most of the twin's plumbing: a second character in characters.json, a loader, a second body in PlayerState, a second sprite in the scene, extra health on the HUD, and run_save support. My recommendation is to build the twin on top of it. I only read code; nothing was built or run.
Existing partner system to copy or extend
- Loader: src/game/game_rules.cpp:967 adds "partner" to the allowed character keys. Lines 1038-1052 parse
partner {character, resting{anm2,animation}, tether, health_shown}, and lines 1080-1081 check the partner character exists. - Rules struct: src/game/game_rules.hpp:116-126 is
CharacterDefinition::Partner. The SoulOverflowisPartnerflag is at :107-113. - Field docs: docs/fields/characters.json already has the partner fields. New fields go there.
- RiF data: mods/rebirth_in_flash/characters.json has the_forgotten's partner block at :581. jacob (:672) and esau (:687) already exist with stats only.
- Runtime body: src/game/player/player_state.hpp:65-73 is
PartnerForm {character, hp, armor, blackHearts, hearts, extraHealth, position}, and :79 isPlayerState::partner. - Creating the partner:
Game::partner_prepareat src/game/game.cpp:1353-1366 builds it fromstarting_player_make(config, rules)(game.cpp:25). It is called at game.cpp:380, fromcharacter_set(src/game/items/items.cpp:334), from effects.cpp:1265, and from run_load. - Swapping:
Game::partner_swapat items.cpp:353-373 exchanges health, callscharacter_set, thenplayer_stats_refresh. Effect kindPartnerSwapis defined at src/game/effects/effect.hpp:115, loaded at src/resources/effect_data.cpp:128, and run at src/game/effects/effects.cpp:1433. - Position handling: the tether clamp runs right after
player_movement_step(game.cpp:1214-1221). The partner follows on room entry at game.cpp:1349-1350 (default_position_spawn) and :1591-1592 (room_entry_finish). - Partner in health logic: items.cpp:103-109 spends
extraHealthfor the partner, and items.cpp:121-136 sends soul overflow to it.
Cleanest design
Keep player_ as the body currently being simulated. Hold the other body as a full std::optional<PlayerState> and swap it in once per tick, so every existing system works on both bodies unchanged. A PartnerForm is too thin for Esau because he needs his own items and stats.
-
Data: add
partner.twin: true, or atwintrait, on jacob withcharacter: esau. It needs a check in game_rules.cpp:1041 and a description in docs/fields/characters.json. -
Game state: add
std::optional<PlayerState> twin_to src/game/game.hpp nearpartner_prepare(:788). Build it inpartner_preparewithstarting_player_makefor the partner character, positioned besideplayer_. -
Tick: in
Game::step(game.cpp:545-565), aroundframe_step(input):- run
frame_stepfor Jacob; - copy coins, bombs and keys into the twin (
PlayerStatefields at player_state.hpp:88-90); std::swap(player_, *twin_)and run only the player section for Esau, then swap back.
The player section is the control, movement and firing block, roughly game.cpp:1080-1230. Running the whole of
frame_steptwice would also tick enemies twice, so that block needs to become its own method, something likeplayer_control_step(input), that both bodies call.- Mirroring inputs: Esau receives the same
Input. Repentance's J&E don't mirror direction; both just follow the same input. - Drop key holds one in place:
Input::isDropHeld(game.hpp:60, bound in src/app/app.cpp:86) is currently read bypockets_drop_step(src/game/pickups/pickups.cpp:121-149, gated byPlayerDropRules). For a twin character, clear movement for the held body, the same wayinput_movement_clearis used at game.cpp:~1201.
- run
-
Enemy targeting and contact: these read
player_.positioneverywhere (src/game/combat/contacts.cpp, src/game/player/player_enemy_contact.cpp, enemies/*). The swap gives contact and damage for both bodies for free. Targeting will chase whichever body is inplayer_, which is Jacob outside his own step. That is acceptable for v1; a nearest-body chase can come later. -
Death:
Game::death_resolveis at src/game/effects/effects.cpp:244-252. If either body reachesPlayerLifePhase::GameOver, the run ends. Esau's death must be checked after his step, using theresult.isPlayerDiedpath at game.cpp:~1090. A revive from an extra life runs through the existing Death effects trigger for the swapped-in body. -
Room entry: at game.cpp:1349 and :1591, place the twin next to
player_.familiars_reset(game.cpp:1534) andplayer_room_reset(game.cpp:1427) also need to run on the twin, again via the swap.
Rendering
- Scene depth: src/rendering/scene_depth.cpp:65-66 pushes a Player actor with index 1 when
scene.player.partnerexists. Add an index-2 actor, or reuse index 1, when a twin exists.SceneView(src/game/presentation/scene_capture.hpp:29-54) needs aconst PlayerState* twin, set inGame::scene_view(game.cpp:458-479), with matching changes toSceneCaptureandscene_view_make/scene_capture_make. - App drawing: in src/app/app.cpp,
actor_art(:2017-2030) treats index > 0 as the resting partner. For the twin it should useplayer_art_get(*scene.twin)plusplayer_frame_overrides.actor_serial(:2056) already returns the index.actor_draw(:2109-2121) chooses the position by index.
HUD
- State:
HudStateis at src/game/hud/hud_state.hpp:19-31 andhud_state_captureat src/game/hud/hud_state.cpp:4.Game::hud_capture(game.cpp:1382-1426) currently merges the partner's health into the main row (:1386-1394). For a twin, capture a secondHudState(e.g.std::optional<HudState> twinHud_) from*twin_. - Drawing:
hud_artis at src/rendering/hud_art.cpp:209, its health block at :313-340, andhud_healthat :29. The app calls it once at app.cpp:1878-1882. Draw the twin's health row and active item with an offset. The offset should be a HUD data field in mods/rebirth_in_flash/hud.json, not a constant in code.
Save state (src/game/progression/run_save.cpp)
- The player block is written inline at :152-240 (
const auto& p = player_and the{"player", {...}}object at :181-240, including grants and swarms at :152-171) and read back inline at :329-~402. - Factor both into helpers,
player_json_make(const PlayerState&)andplayer_json_load(json, PlayerState&). Then add{"twin", ...}after "player" and load it when present, falling back topartner_prepare()for older saves, as :333-334 does now. PartnerFormserialization at :70-88 stays for the Forgotten.- Coins, bombs and keys are shared, so only the main record's copy counts.
Art
- Player sheets: in the dump's gfx/characters/costumes/:
character_002x_jacob.pngwith_jacobhair, andcharacter_003x_esau.pngwith_esauhair. The head anm2s are in gfx/characters/:character_002x_jacobhead.anm2andcharacter_003x_esauhead.anm2. - Costume folders: RiF already sets
costumes_rebirth(Jacob) andcostumes_rebirth_red(Esau) in characters.json, sotools/rebirth_art.pyonly has to import the two sheets.
Questions before building
- Shared pocket items: should Esau hold his own card/pill/trinket? Repentance gives each twin their own pocket slots and shares only coins, bombs and keys.
- Enemy targeting: is chasing Jacob only acceptable for v1, or do you want enemies to go for the nearest body now?
DESIGN
Jacob & Esau: design for a generic "twin" character
This is a design only: no files were changed and nothing was built or run. Most of it rests on the engine map in the task. I checked the partner loader (game_rules.cpp:1038-1052), the Partner struct (game_rules.hpp:116-126), partner_prepare (game.cpp:1353) and the jacob/esau records (characters.json:670-700); the other line numbers are unchecked.
1. Data fields
characters.json, inside the existing partner block. This avoids a new top-level key and reuses the loader branch, partner_prepare, run_load and the room-entry follow.
"partner": { "character": <key>, "twin": true, "twin_drop_hold": true }
twin(bool, default false). Docs text: "The partner is a second body that plays alongside this one instead of swapping in. It has its own items, health, stats and pocket slots, and shares coins, bombs and keys. Both bodies get the same inputs and move to the next room together. If either body dies the run ends, unless that body is revived.restingandtetherare ignored."twin_drop_hold(bool, default false). Docs text: "While Drop is held, the twin body stands still and the main body moves on its own."- Loader: add both to the optional keys in
keys_checkatgame_rules.cpp:1041. Parse them withflag_loadintoPartner::isTwinandPartner::isTwinDropHeld. Rejecttwintogether withresting, because a twin never rests.
Speed. Repentance's "speed changes are half as effective" stays out of v1, because the formula is unknown. Mark it in a comment in the jacob record.
hud.json. One new field, twin_offset: [x, y] (default [0, 0], no twin row). Docs text: "Where a twin character's second health row, active item and pocket are drawn, relative to the first." It needs a loader check where the HUD rules load, and a docs entry in docs/fields/hud.json.
RiF data:
- jacob:
"partner": {"character": "esau", "twin": true, "twin_drop_hold": true}. - esau keeps its stats and is never selectable. It already has no title slot, and it should get
form_of/hidden if that already exists for Soul. - hud.json:
twin_offsetset to the row below the main hearts. Repentance draws Esau's block in the bottom-right corner; use a fixed offset for v1.
2. Code changes
game_rules.hpp / game_rules.cpp: two bools on Partner, plus the loader lines above.
game.hpp:
- Add
std::optional<PlayerState> twin_;. - Add
void player_control_step(const Input&);. - Add
template<class F> void twin_with(F f). It runsstd::swap(player_, *twin_); f(); std::swap(...), with no-op guards. - Add
void twin_sync();, which copies coins, bombs and keys fromplayer_to the twin.
game.cpp:
partner_prepare: ifform->isTwin, setplayer_.partner.reset(). Buildtwin_fromstarting_player_make(config, rules_)(the fullPlayerState), withposition = player_.position + spawn offset. Use an existing spawn-spacing constant, or addTWIN_SPAWN_OFFSET. Otherwise calltwin_.reset().Game::step/frame_step: move the control, movement and firing block (around :1080-1230) intoplayer_control_step(input). Inframe_step:- Call
player_control_step(input). - If there is a twin: call
twin_sync(). MaketwinInput = input, then ifisTwinDropHeld && input.isDropHeldcallinput_movement_clear(twinInput). Runtwin_with([&]{ player_control_step(twinInput); }). - After the swap back, copy coins, bombs and keys from the twin into
player_so pickups Esau collected count. Store the shared counts as twin-after minus twin-before, added to the player's counts. That keeps both bodies' spending and pickups.
- Call
- Drop for pockets: gate
pockets_drop_stepso that while a twin is held with Drop, the drop does not also cycle pockets. Use the Repentance "better controls" rule: Drop is hold-only for twins, and pockets still cycle through the pocket button. - Bombs: both bodies run the bomb-place code from the same input. The delta merge above would spend 2, so take the minimum delta for bombs when both placed on the same frame. Simpler alternative: skip the twin's bomb spend when
player_placed one this frame (isBombPlacedThisFrameon PlayerState). I prefer the flag. - Death: after each body's control step, if
life phase == GameOver, call the existingdeath_resolvefor that body inside the swap so its own revive effects run first. If it stays GameOver, end the run. The main path already does this forplayer_. The twin's path needs one check aftertwin_with:if (twin_->lifePhase == GameOver) player_.lifePhase = GameOver;. - Doors: the door trigger in the control step reads
player_.position, so Esau crossing a door inside the swap triggers the transition, which then lands both. Contact and room damage come free from the swap. - Room entry and reset:
- At
default_position_spawn(:1349) androom_entry_finish(:1591), place the twin atplayer_.position + offsetinstead of the partner follow. - At
player_room_reset(:1427) andfamiliars_reset(:1534), call them again insidetwin_with.
- At
- Tether clamp (:1214): skip it when the partner is a twin.
- Body push-apart: after both steps, separate the two bodies by their radii using the existing circle-overlap helper that player/enemy contact uses. That is about 5 lines in
frame_step.
items.cpp:
character_setcallspartner_prepare, which already handles twins.partner_swapmust refuse when a twin is active. Add a guard.- Leave the
extraHealthand soul-overflow paths alone;isPartneroverflow is meaningless for twins.
Scene:
SceneView/SceneCapture: addconst PlayerState* twin.Game::scene_view: settwin = twin_ ? &*twin_ : nullptr.scene_depth.cpp:65: push a Player actor with index 2 whentwinis set.app.cpp:actor_arttreats index 2 asplayer_art_get(*scene.twin)withplayer_frame_overrides, andactor_drawtakes its position from the twin.- Enemy targeting keeps reading
player_(Jacob) for v1.
HUD:
- Add
std::optional<HudState> twinHud_, filled inhud_capturethroughhud_state_capture(*twin_). app.cpp:1878: callhud_arta second time with thetwin_offsettranslation, drawing only health, active and pocket. Add aHudStateflagisTwinRowthat skips counters, minimap and similar. That flag is a few branches inhud_art.cpp.
run_save.cpp:
- Pull :152-240 into
player_json_make(const PlayerState&)and :329-402 intoplayer_json_load(json, PlayerState&). That cuts the save code roughly in half. - Write
"twin": player_json_make(*twin_)when a twin exists. - On load: if
"twin"is present,twin_.emplace()and callplayer_json_load. Otherwise callpartner_prepare(), which covers older saves. - The shared counts come from the main record only.
3. Flash behaviour
Nothing changes unless data sets twin, because every new path is gated on twin_ or isTwin. The one risk is the refactor itself. Moving the player block into player_control_step must keep the statement order exactly, especially the ordering of enemy ticks relative to player movement inside frame_step. The parity tests catch that, so run them even in vibes mode, or at least the next time ctest runs. The run_save helper split must write the same JSON keys; check it by round-tripping an existing save.
4. RiF records in this change
Fully implemented (set triage to "done"):
- jacob and esau, except half-effective speed, combined room-clear luck, and the death page and cutscene art. Those are noted in the jacob comment. If triage "done" must mean complete, leave them as
partial.
Partial support through rules that now hold automatically:
- XIX The Sun: heals Jacob only for now. A both-bodies scope is future work.
- Birthright, Dead Cat, Missing Poster, Spirit Shackles, D4, Diplopia, Polaroid and Negative, Gnawed Leaf: each owner's effect runs for that body, which matches the per-brother rules. Leave them
needs_mechanicand add a comment. - Soul of Jacob and Esau, Strawman, Esau Jr.: need a temporary twin without the linked death, which is an
isTwinLinkedflag on the runtime twin. That is a separate follow-up and stays out of this change.
5. Art
- Import
character_002x_jacob.pngandcharacter_003x_esau.pngfrom the dump'sgfx/characters/costumes/, plus their hair layers, into the existing costume folderscostumes_rebirthandcostumes_rebirth_red. jacobhead/esauhead.anm2go in as character head costumes.tools/rebirth_art.pyalready imports player costume sheets for other RiF characters, so add the two entries to its character table. If it has no such table, add a small "player sheets" list that the Forgotten import can also use.- The HUD reuses the normal heart sprites. No sounds are needed.
6. Testing (vibes mode)
- Build the
isaac-classictarget and regenerate MODDING.md withfield_registry. - Check
git diffon MODDING.md: it should show only the 3 new fields. - Suggested for later, not run now:
- The xvfb smoke test with and without mods.
- A
--game-reportsave round-trip as Jacob. - ctest parity, to prove the refactor changed nothing.
Questions for the user
- Pockets: should each body keep its own card/pill/trinket? The design assumes yes, which is automatic with a full
PlayerState. The open part is how to use Esau's pocket. The proposal is Drop + pocket button, as in Repentance's "better" controls. - Targeting: Jacob-only targeting for v1 is the assumption; the alternative is nearest body now.
- Triage: should jacob/esau be marked "done" without half-effective speed and combined luck?