fix_moon_phase: also pin ubirthday and getyear() to the seed - #130
Open
kenforthewin wants to merge 1 commit into
Open
fix_moon_phase: also pin ubirthday and getyear() to the seed#130kenforthewin wants to merge 1 commit into
kenforthewin wants to merge 1 commit into
Conversation
NetHack hashes ubirthday for between-game flavor variation without consuming game RNG: shopkeeper names (shknam.c), shop surcharge parity (shk.c), antholemon() species (mkroom.c), scroll labels (read.c). fix_moon_phase pins the struct-tm path but ubirthday was still raw time(NULL), so wall-clock leaked into fully seeded games (observed as session-dependent shopkeeper names and message-pagination step drift; prices and anthole species are gameplay-relevant channels). Derive ubirthday from settings.time_seed via the same ISAAC64 pattern as nle_fill_fixed_tm, and route getyear() through the fixed-tm wrapper. No change when fix_moon_phase is off.
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.
Fixes #129.
fix_moon_phasepins thestruct tmpath butubirthdaywas still rawtime(NULL), so wall-clock leaked into fully seeded games through the flavor-variation hashes (shopkeeper names inshknam.c, shop surcharge parity inshk.c,antholemon()species inmkroom.c, scroll labels inread.c).getyear()also bypassed the fixed-tm wrapper.This derives
ubirthdayfromsettings.time_seedvia the same ISAAC64 pattern asnle_fill_fixed_tm(), and routesgetyear()throughnle_getlt_maybe_fixed(). No behavior change whenfix_moon_phaseis off.Verified: same seed run in sessions 96 seconds apart yields identical action SHA-256 and identical shopkeeper name; previously the same seed produced different shopkeeper names (and step counts, via message pagination) across sessions. No seeded outcome changed in our regression fixtures (details in #129).