Skip to content

Seeded Mode for Randomized Enemy Sizes#6617

Open
unreference wants to merge 5 commits into
HarbourMasters:developfrom
unreference:feat/seeded-enemy-sizes
Open

Seeded Mode for Randomized Enemy Sizes#6617
unreference wants to merge 5 commits into
HarbourMasters:developfrom
unreference:feat/seeded-enemy-sizes

Conversation

@unreference
Copy link
Copy Markdown

@unreference unreference commented May 14, 2026

This closes #3872.

Randomized Enemy Sizes currently uses rand(), so sizes re-roll every time a room loads. This converts the checkbox to a dropdown, matching the Enemy Randomizer pattern: Disabled, Random, and Random (Seeded).

In seeded mode, each enemy's size is derived from the same Enemy Randomizer formula alongside the randomizer seed or file creation timestamp. The same enemy at the same location always gets the same size within a given playthrough.

@unreference
Copy link
Copy Markdown
Author

Sorry, @Pepe20129, I didn't realize this already had an assignee. I was playing around and thought it might be interesting, so I implemented it. Happy to close my PR if you'd prefer to handle it, or feel free to use any of the implementation.

@unreference unreference marked this pull request as draft May 14, 2026 12:25
@f1ana
Copy link
Copy Markdown
Contributor

f1ana commented May 14, 2026

If the sizes are seeded, could this result in a softlock or even an unbeatable seed? I think a common reason for reroll in a room is to get a size that can be defeated

@unreference
Copy link
Copy Markdown
Author

unreference commented May 14, 2026

If the sizes are seeded, could this result in a softlock or even an unbeatable seed? I think a common reason for reroll in a room is to get a size that can be defeated

Randomized enemies and randomized sizes are runtime CVars, so switching modes or disabling takes effect on the next room load -- you're never truly locked into an unbeatable room. The existing exclusion lists also handle impossible cases.

The bigger concern about extreme sizes being unbeatable is a result of the preexisting collider scaling gap, which is definitely something worth addressing separately at some point.

@Pepe20129
Copy link
Copy Markdown
Contributor

Sorry, @Pepe20129, I didn't realize this already had an assignee. I was playing around and thought it might be interesting, so I implemented it. Happy to close my PR if you'd prefer to handle it, or feel free to use any of the implementation.

No problem at all, it's something I didn't around to yet as I'm in the middle of exam season.

Copy link
Copy Markdown
Contributor

@Pepe20129 Pepe20129 left a comment

Choose a reason for hiding this comment

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

Looks good but ShipUtils::Random should be used instead of rand even when not seeded, it doesn't matter that we'd use the same randomState as it'd get reset when the seeded option was turned on.

Comment thread soh/soh/Enhancements/ExtraModes/RandomizedEnemySizes.cpp Outdated
Comment thread soh/soh/Enhancements/ExtraModes/RandomizedEnemySizes.cpp Outdated
Comment thread soh/soh/Enhancements/ExtraModes/RandomizedEnemySizes.cpp Outdated
Comment thread soh/soh/Enhancements/ExtraModes/RandomizedEnemySizes.cpp
Comment thread soh/soh/Enhancements/ExtraModes/RandomizedEnemySizes.cpp Outdated
unreference and others added 4 commits May 14, 2026 06:18
Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
@unreference unreference marked this pull request as ready for review May 14, 2026 13:28
@unreference
Copy link
Copy Markdown
Author

Looks good but ShipUtils::Random should be used instead of rand even when not seeded, it doesn't matter that we'd use the same randomState as it'd get reset when the seeded option was turned on.

Good to know. Thank you!

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.

[Enhancement Request] Seeded random enemy sizes

3 participants