Repository navigation
feat: Tears of the Kingdom and Breath of the Wild record the player's route and replay it, as Ocarina of Time - #2402
Merged
Conversation
…oute and play it again, as Ocarina of Time games/oot/runtime/input_tape.h (ca71d60) moves to shared/runtime/input_tape.h, linked from games/oot and games/totk. TotK's pad_states hands the tape the merged controller state, as OoT's does. TOTK_INPUT_RECORD=<file> records each change by frame (from the start, then from the world's first frame); TOTK_INPUT_REPLAY=<file> plays it instead of the real input and closes the game when the route ends. The OOT_ names still work. For A/B runs on a route the user played: a scripted walk ran Link into a rock in Kakariko. Tests: tests/test_totk_input_tape.py (record and replay under the TOTK_ names; the tape sits after the controller merge; one file for both games); tests/test_oot_input_tape.py unchanged and passing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ned, as recorded Breath of the Wild 1.9.0's real-time step follows each frame's measured length, so a tape replayed by frames drifted from the recorded route (2026-11-26). With framestep 8.333 sent while recording and while replaying, six replays of one route each reached its end on the same frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test ignores an exported TOTK_ tape From an independent review of this branch: - games/totk/runtime/input.c calls input_tape inside the pad-in-use block. After it, a read of another controller id in the same frame added a line of zeros to the recording, and a replay (the frame's last line wins) handed the pad zeros. - tests/test_oot_input_tape.py drops OOT_INPUT_* / TOTK_INPUT_* from the environment: the shared header reads the TOTK_ names first, so an exported TOTK_INPUT_RECORD made the probe write its route over the user's tape. - tests/test_totk_input_tape.py requires the tape after every merge (controller buttons and sticks, the VR pitch lock) and inside the pad-in-use block; with the call back after the block it fails. - TOTK_INPUT_REPLAY_LIVE joins the TOTK_ names; the docs say a finished replay closes the game on the Mac only (the iOS frontend's close only logs). Checked: a Breath of the Wild replay of the user's route with this runtime entered the world on the same frame (5837), reached the tape's end and closed itself, at 101.8 fps as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Tears of the Kingdom and Breath of the Wild can record the route a player plays and replay it, as Ocarina of Time does (ca71d60). An A/B of two runtimes can then run on the same route, which a scripted walk could not do: one ran Link into a rock in Kakariko.
games/oot/runtime/input_tape.hmoves toshared/runtime/input_tape.h.games/ootandgames/totklink to it, as with the other shared files (shared/README.mdrow added).games/totk/runtime/input.cpad_stateshands the tape the merged state of the pad in use: keyboard, controller buttons and sticks, after the VR pitch lock.TOTK_INPUT_RECORD=<file>records each change by frame. Frames count from the start, then from the world's first frame.TOTK_INPUT_REPLAY=<file>plays the tape instead of the real input. On the Mac it closes the game when the route ends.OOT_names still work.TOTK_INPUT_REPLAY_LIVEis added besideOOT_INPUT_REPLAY_LIVE.getenvs once, then one uncontended lock perpad_statescall.Breath of the Wild needs the frame step pinned. Above 30 fps, 1.9.0 steps game time by each frame's measured length. A tape replayed by frames therefore drifted from the recorded path. With
framestep 8.333sent throughTOTK_INPUT_FILE(at launch and again once the world is entered), both while recording and while replaying, replays follow the route. This is noted in the header and in the README row.Checked
tests/test_totk_input_tape.py:TOTK_names;tests/test_oot_input_tape.pynow strips exportedOOT_INPUT_*/TOTK_INPUT_*. Otherwise a shell holding a realTOTK_INPUT_RECORDwould have its tape overwritten by the probe..github/run_source_tests.py core(2,404 tests, 31 skipped) andsettings(8 tests, 3 skipped) pass with the Python 3.14 ui-pack environment. The skips were not investigated.input.cbuilds with-Wall -Wextra -Werrorfor BotW, BotW 1.9.0 and TotK. An independent review also built it for V121, V143, BOTW160, DKB, Pokopia and the iPhoneOS SDK.build_app.py(sync_folder),games/oot/build.pyand the Launcher's source archive;inputLock, then the tape's mutex.Not in this PR (seen in review; these behaviours were already there before this change)
games/totk/Makefileprobe-input,probe-input-fileandprobe-autoloadalready fail to link onmain(7 undefined symbols). Whoever repairs them must also definedm_nvn_frame_countandmtl_world_frame.input.cstill calls the tape after the pad-in-use block. It has the same multi-id exposure the TotK hook avoids here; it is left as it is.🤖 Generated with Claude Code