feat(menu): Day length, day and night cycle 1 to 5 times as long, at any frame rate cap and Game speed #2413
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2413
Loading…
Reference in a new issue
No description provided.
Delete branch "Heliumrich/Longshot:feat/day-length"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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=inlongshot_options.ini(optionHOS_OPT_DAY_LENGTH, 160, ingame/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 siteframe.wholeTimeOfDayalready replaces that cut withhos_frame_whole, which keeps the fractions above 60 fps. The site's callback (game/oot_sites.chos_site_whole_time_of_day) now callshos_oot_day_whole(game/oot_day_length.c) instead:hos_frame_whole, so the code path is the same as onmain(HOS_FRAME_CARRY, the frame rate cap and Game speed behave as before).game/reaches the host only throughgame_host.h, so it does not usehost/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).game/menu/rows.c, aGAME_MENU_CHOICEwith 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 holdsday_length).Rebased on main
c6022bcd: the game's code moved togame/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, thenhos_site_whole_time_of_dayingame/oot_sites.c.Testing
Tested: Windows 11, NVIDIA GeForce RTX 4080, driver 621.35 :
main.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 ishos_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_boundarypass.run_all.py --changed mainon Linux (Ubuntu 22.04, Python 3.10): 26 passed; the 3 failures fail onmaintoo (test_opening_skip,test_hud_layout_row,test_skip_title: notomllibin Python 3.10); the skips need tools that machine lacks.Still to test:
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
hos_frame_wholeas onmain.longshot_options.inifiles have noday_length=line: x1.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_01VurVAi1MmNDvxaQzPTRZbq
WIP: feat(menu): Day length, day and night cycle 1 to 5 times as long, at any frame rate cap and Game speedto feat(menu): Day length, day and night cycle 1 to 5 times as long, at any frame rate cap and Game speedb3250b6c14b15ce30816View 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.