feat(menu): Day length, day and night cycle 1 to 5 times as long, at any frame rate cap and Game speed #2413

Open
Heliumrich wants to merge 2 commits from Heliumrich/Longshot:feat/day-length into main
Contributor

Summary

Adds a Day length setting, so the day and night cycle can last longer than in the original game. It sits on the Gameplay tab, between Game speed and Field of view, with five choices: x1 (original), x2, x3, x4 and x5. At x1 a full day and night takes about 12 minutes of play; at x5, about an hour. It applies at once, is saved as day_length= in longshot_options.ini (option HOS_OPT_DAY_LENGTH, 160, in game/options.h), and is translated in all 13 menu languages. Only the clock slows down: NPCs, guards, cutscenes and everything else keep the game's normal speed.

How it works: the time of day (f_803edf70) adds (int)(2 * step) game seconds each frame, and main's hook site frame.wholeTimeOfDay already replaces that cut with hos_frame_whole, which keeps the fractions above 60 fps. The site's callback (game/oot_sites.c hos_site_whole_time_of_day) now calls hos_oot_day_whole (game/oot_day_length.c) instead:

  • x1: it calls hos_frame_whole, so the code path is the same as on main (HOS_FRAME_CARRY, the frame rate cap and Game speed behave as before).
  • x2 to x5: the amount is divided by the length, and its fractions are always carried, per counter (a few slots of its own: game/ reaches the host only through game_host.h, so it does not use host/frame_whole.h). Always, because at a cap of 60 the step is a whole frame and the game's cut of 2/3 of a second is 0: the clock would stop. With the carry the day keeps its new length at a cap of 30, 60, 120, 144 or uncapped, with Game speed Real time or Per frame (with Per frame below 60 fps the day slows down with the rest of the game, as at x1).
  • The row is one of the game's rows (game/menu/rows.c, a GAME_MENU_CHOICE with its texts and hints), so the menu keeps its value by its option id and saves it under its key (tests/test_menu_ini_keys.py's FROZEN holds day_length).

Rebased on main c6022bcd: the game's code moved to game/ and the code patches to hook sites, so the change is written for them (a hook site's callback instead of a patch of the lifted C; a game row instead of a renderer module's row).

Read first: game/oot_day_length.c, then hos_site_whole_time_of_day in game/oot_sites.c.

Testing

Tested: Windows 11, NVIDIA GeForce RTX 4080, driver 621.35 :

  • x1: the sun moves at the same speed as on main.
  • x2 to x5: the sun moves slower, as expected, smooth, with no judder or flicker.
  • Two quests, including sneaking past the guards into Hyrule Castle: NPCs and guards at normal speed, no timing problems. Two main story cutscenes play correctly. Moving between areas: no timing problems.

Checks: tests/test_day_length.py (new: each second of play adds 120 / length game seconds at caps 30, 60, 120 and 144 and with Real time at 46 fps, the carry on and off, over 1 s and 10 s; x1 is hos_frame_whole; out-of-range values, NaN and negative amounts; each counter's own remainder; a change applying at once; the game row, the option id, the hook site's callback; the texts translated in all 13 tables), tests/test_menu_ini_keys.py, test_menu_i18n, test_menu_i18n_count, test_settings_table, test_game_boundary pass. run_all.py --changed main on Linux (Ubuntu 22.04, Python 3.10): 26 passed; the 3 failures fail on main too (test_opening_skip, test_hud_layout_row, test_skip_title: no tomllib in Python 3.10); the skips need tools that machine lacks.

Still to test:

  • Windows, RTX 4080: this head built with main's builder, x1 and x5 at caps 30 / 60 / 120 with both Game speeds, as above (by hand)
  • Linux: x1 and x5 in Hyrule Field, the sun's speed (@Beanstalk Day length x1 and x5 in Hyrule Field)

Measurements

Nothing to measure: one float divide and a carry on one call a frame, and only above x1; x1 runs main's code.

Risks

  • x1: nothing changes; the callback runs hos_frame_whole as on main.
  • Above x1: everything the game derives from the time of day's step (+60, also added to the counter at +16) moves slower with it: that is the point, but a scene timer tied to that step would be slower too. None showed up in two quests, the Hyrule Castle guards and two story cutscenes.
  • To turn it off: Day length x1; a revert is enough.
  • After updating: older longshot_options.ini files have no day_length= line: x1.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VurVAi1MmNDvxaQzPTRZbq

## Summary Adds a **Day length** setting, so the day and night cycle can last longer than in the original game. It sits on the Gameplay tab, between Game speed and Field of view, with five choices: x1 (original), x2, x3, x4 and x5. At x1 a full day and night takes about 12 minutes of play; at x5, about an hour. It applies at once, is saved as `day_length=` in `longshot_options.ini` (option `HOS_OPT_DAY_LENGTH`, 160, in `game/options.h`), and is translated in all 13 menu languages. Only the clock slows down: NPCs, guards, cutscenes and everything else keep the game's normal speed. How it works: the time of day (`f_803edf70`) adds `(int)(2 * step)` game seconds each frame, and main's hook site `frame.wholeTimeOfDay` already replaces that cut with `hos_frame_whole`, which keeps the fractions above 60 fps. The site's callback (`game/oot_sites.c` `hos_site_whole_time_of_day`) now calls `hos_oot_day_whole` (`game/oot_day_length.c`) instead: - **x1:** it calls `hos_frame_whole`, so the code path is the same as on `main` (`HOS_FRAME_CARRY`, the frame rate cap and Game speed behave as before). - **x2 to x5:** the amount is divided by the length, and its fractions are always carried, per counter (a few slots of its own: `game/` reaches the host only through `game_host.h`, so it does not use `host/frame_whole.h`). Always, because at a cap of 60 the step is a whole frame and the game's cut of 2/3 of a second is 0: the clock would stop. With the carry the day keeps its new length at a cap of 30, 60, 120, 144 or uncapped, with Game speed Real time or Per frame (with Per frame below 60 fps the day slows down with the rest of the game, as at x1). - The row is one of the game's rows (`game/menu/rows.c`, a `GAME_MENU_CHOICE` with its texts and hints), so the menu keeps its value by its option id and saves it under its key (`tests/test_menu_ini_keys.py`'s FROZEN holds `day_length`). Rebased on main c6022bcd: the game's code moved to `game/` and the code patches to hook sites, so the change is written for them (a hook site's callback instead of a patch of the lifted C; a game row instead of a renderer module's row). Read first: `game/oot_day_length.c`, then `hos_site_whole_time_of_day` in `game/oot_sites.c`. ## Testing **Tested:** Windows 11, NVIDIA GeForce RTX 4080, driver 621.35 : - **x1:** the sun moves at the same speed as on `main`. - **x2 to x5:** the sun moves slower, as expected, smooth, with no judder or flicker. - Two quests, including sneaking past the guards into Hyrule Castle: NPCs and guards at normal speed, no timing problems. Two main story cutscenes play correctly. Moving between areas: no timing problems. **Checks:** `tests/test_day_length.py` (new: each second of play adds 120 / length game seconds at caps 30, 60, 120 and 144 and with Real time at 46 fps, the carry on and off, over 1 s and 10 s; x1 is `hos_frame_whole`; out-of-range values, NaN and negative amounts; each counter's own remainder; a change applying at once; the game row, the option id, the hook site's callback; the texts translated in all 13 tables), `tests/test_menu_ini_keys.py`, `test_menu_i18n`, `test_menu_i18n_count`, `test_settings_table`, `test_game_boundary` pass. `run_all.py --changed main` on Linux (Ubuntu 22.04, Python 3.10): 26 passed; the 3 failures fail on `main` too (`test_opening_skip`, `test_hud_layout_row`, `test_skip_title`: no `tomllib` in Python 3.10); the skips need tools that machine lacks. **Still to test:** - Windows, RTX 4080: this head built with main's builder, x1 and x5 at caps 30 / 60 / 120 with both Game speeds, as above (by hand) - Linux: x1 and x5 in Hyrule Field, the sun's speed (@Beanstalk Day length x1 and x5 in Hyrule Field) ## Measurements Nothing to measure: one float divide and a carry on one call a frame, and only above x1; x1 runs main's code. ## Risks - **x1:** nothing changes; the callback runs `hos_frame_whole` as on `main`. - **Above x1:** everything the game derives from the time of day's step (+60, also added to the counter at +16) moves slower with it: that is the point, but a scene timer tied to that step would be slower too. None showed up in two quests, the Hyrule Castle guards and two story cutscenes. - **To turn it off:** Day length x1; a revert is enough. - **After updating:** older `longshot_options.ini` files have no `day_length=` line: x1. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VurVAi1MmNDvxaQzPTRZbq
feat(menu): Day length, the day and night 1 to 5 times as long at any frame rate cap and Game speed
Some checks failed
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
b3250b6c14
Gameplay's new Day length row (x1 original to x5, day_length= in longshot_options.ini, HOS_OPT_DAY_LENGTH 160).
The time of day's whole-second cut (f_803edf70, nx2/oot_patches.py WHOLE_FUNCS) now goes to hos_oot_day_whole
(host/oot_day_length.c): hos_frame_whole at x1, unchanged; above, the amount divided by the length and its
fractions always carried, so the day keeps its length at 30, 60, 120 fps and with Per frame or Real time.
A lift patched before takes the new hook. Translated in all 13 menu languages; tests/test_day_length.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VurVAi1MmNDvxaQzPTRZbq
Heliumrich changed title from WIP: feat(menu): Day length, day and night cycle 1 to 5 times as long, at any frame rate cap and Game speed to feat(menu): Day length, day and night cycle 1 to 5 times as long, at any frame rate cap and Game speed 2026-11-23 22:04:52 +00:00
Heliumrich force-pushed feat/day-length from b3250b6c14
Some checks failed
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to b15ce30816
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Failing after 8s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-11-27 23:53:06 +00:00
Compare
Merge branch 'main' into feat/day-length
Some checks are pending
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 6s
b3bb051126
Some checks are pending
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 6s
This pull request has changes conflicting with the target branch.
  • docs/user/graphics-and-controls.md
  • game/menu/rows.c
  • game/oot_sites.c
  • game/options.h
  • gpu/vk/menu_i18n.h
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/day-length:Heliumrich-feat/day-length'
git switch 'Heliumrich-feat/day-length'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2413
No description provided.