Skip to content

Conversation

@Glought
Copy link
Contributor

@Glought Glought commented Nov 16, 2025

I added support for randomizing music, sound effects, and cosmetics on file load, with or without a seed.
Instead of adding a bunch of new checkboxes, I removed the old ones and replaced them with a single combobox as shown below.

Audio Editor:

I have removed both "Randomize All Music and Sound Effects on Randomizer Generation" and
"Randomize All Music and Sound Effects on New Scene" checkboxs.

I have replaced it with "Automatically Randomize All Music and Sound Effects" Combobox
The Options are :

  • Manual: Manually randomize music or sound effects by pressing the 'Randomize all Groups' button.
  • On New Scene: Randomizes when you enter a new scene.
  • On Rando Gen Only: Randomizes only when you generate a new randomizer
  • On File Load: Randomizes on File Load.
  • On File Load (Seeded):Randomizes on file load based on the current
    randomizer seed/file.

Manually pressing the "Randomize All Groups" button will ignore the "Automatically Randomize All Music and Sound Effects" setting.
Note : Combobox name shown in image is old
SoH AudioEditor Rando Combobox

Cosmetics Editor:

I have removed both "Randomize All on Randomizer Generation" and
"Randomize All on New Scene" checkboxs.

I have replaced it with "Automatically Randomize All Cosmetics" Combobox.
The Options are :

  • Manual: Manually randomize cosmetics by pressing the 'Randomize all' button.
  • On New Scene: Randomizes when you enter a new scene.
  • On Rando Gen Only: Randomizes only when you generate a new randomizer
  • On File Load: Randomizes on File Load.
  • On File Load (Seeded):Randomizes on file load based on the current
    randomizer seed/file.

Manually pressing the "Randomize All" button will ignore the "Automatically Randomize All Cosmetics" setting
Note : Combobox name shown in image is old
SoH Cosmetics Rando Combobox

Build Artifacts

@briaguya0
Copy link
Contributor

briaguya0 commented Nov 17, 2025

i think "Disabled" might be misleading. maybe "Manual" makes more sense, as the functionality is actually "only randomize when the player presses the randomize all button"

either that or rename the option from "Randomize All Cosmetics Mode" to "Automatically Randomize All Cosmetics"

@serprex
Copy link
Contributor

serprex commented Nov 19, 2025

ideally this would come after #5900 which moved some of this code to hooks

@Malkierian
Copy link
Contributor

5900 is merged now, so this can be updated to match.

@Glought Glought force-pushed the Seeded_Rando_Audio_Cosmetics branch from c7e72d4 to 74d0be9 Compare December 3, 2025 21:34
Add "Randomize All Music and Sound Effects Mode" Combobox
The Options are :
- Disabled: No music or sound effects are randomized.
- On New Scene: Randomizes when you enter a new scene.
- On Rando Gen Only: Randomizes only when you generate a new randomizer
- On File Load: Randomizes on File Load.
- On File Load (Seeded):Randomizes on file load based on the current
  randomizer seed/file.

Removed "Randomize All Music and Sound Effects on Randomizer Generation"
checkbox.
Removed "Randomize All Music and Sound Effects on New Scene" checkbox.
Add "Randomize All Cosmetics Mode" Combobox
The Options are :
- Disabled: No cosmetics are randomized.
- On New Scene: Randomizes when you enter a new scene.
- On Rando Gen Only: Randomizes only when you generate a new randomizer
- On File Load: Randomizes on File Load.
- On File Load (Seeded):Randomizes on file load based on the current
  randomizer seed/file.
Removed "Randomize All on Randomizer Generation" checkbox.
Removed "Randomize All on New Scene" checkbox.
"Automatically Randomize All Music and Sound Effects"

Renamed "Randomize All Cosmetics Mode" to
"Automatically Randomize All Cosmetics"
"Automatically Randomize All Cosmetics" was set to
"On File Load (Seeded)" and
Audio Editor "Automatically Randomize All Music and Sound Effects" set
to "On File Load" causing the audio editor to get seeded by the
cosmetics setting.
@Glought Glought force-pushed the Seeded_Rando_Audio_Cosmetics branch from 74d0be9 to 49be5ba Compare December 4, 2025 18:03
Copy link
Contributor

@Pepper0ni Pepper0ni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I back up Bria in that Disabled should be renamed and the tooltip changed, as it's misinforming with the current text, making it sound like it disabled all randomisation

Also, random seeded does not work for vanilla files, when other seeded randomness such as enemy rando do, IIRC based on file creation time, which should be fixed

@Glought
Copy link
Contributor Author

Glought commented Dec 28, 2025

Also, random seeded does not work for vanilla files, when other seeded randomness such as enemy rando do, IIRC based on file creation time, which should be fixed

I did some tests and the gSaveContext.ship.stats.fileCreatedAt value is only set when you save for the first time not when the file is created in the file menu.

So when the player loads the file for the first time the seed is 0 then when they save and come back to the file later they will have a different seed. I assume this issue also effects Enemy rando too since it uses the fileCreatedAt value for vanilla.

and changed the tooltip to "Manual: Manually randomize music or
sound effects by pressing the 'Randomize all Groups' button"

Renamed the "Disabled" option in "cosmeticsRandomizerModes" to
"Manual" and changed the tooltip to "Manual: Manually randomize
cosmetics by pressing the 'Randomize all' button"

Removed the "IS_RANDO" in "AudioEditor.cpp: RandomizeGroup" and
"CosmeticsEditor.cpp: RandomizeColor" if statements so
"On File Load (Seeded)" can be used in Vanilla
(minor issue on first load will have a false seed of 0 till the player
saves for the first time making the true seed).
@Glought
Copy link
Contributor Author

Glought commented Dec 28, 2025

Figured out the issue audio and cosmetics are randomized before the fileCreatedAt is set in memory.

@garrettjoecox
Copy link
Contributor

Yeah, that’s tricky, might need to rely on something else for randomness in vanilla.

the fileCreatedAt is intentionally set when the player makes their first input, which is used for RTA timing speed runs and races and such

@Glought
Copy link
Contributor Author

Glought commented Dec 28, 2025

I don't know what could be used that is set once and saved to the file like fileCreatedAt I thought maybe duplicating it and calling it something like "seedCreatedAt" or "fileSeedCreatedAt" that can be set when the file is created on the file select screen. any suggestions would be nice.

@Pepper0ni
Copy link
Contributor

Pepper0ni commented Dec 28, 2025

it sounds like fileCreatedAt needs to be renamed to firstInput and a real fileCreatedAt made for seeding or for when someone starts cheesing randomiser race timers by thinking about how to start the seed from load in without making inputs

@Glought
Copy link
Contributor Author

Glought commented Jan 2, 2026

it sounds like fileCreatedAt needs to be renamed to firstInput and a real fileCreatedAt made for seeding or for when someone starts cheesing randomiser race timers by thinking about how to start the seed from load in without making inputs

I made your suggestion its own PR #6070

#if !defined(__SWITCH__) && !defined(__WIIU__)
std::mt19937 rng(seed);
#else
std::mt19937_64 rng(seed);
Copy link
Contributor

@serprex serprex Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to go with #5979 over using mersenne twister, which is a bad RNG

(tho that's blocked on making our current PCG code accessible for modular use)

but since this is copying code above, this'll do for now, & can be handled by #5979 itself

}

void AudioEditorRegisterOnLoadGameHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {
Copy link
Contributor

@serprex serprex Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be using COND_HOOK, but I can make a follow up PR converting the other 2 functions to hooks too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want me to make a PR converting those functions to use COND_HOOK ? I was working on it before I realized this PR got merged lol.

@serprex serprex merged commit dd9d63e into HarbourMasters:develop Jan 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants