fix: regenerate seed randomization for singleplayer skirmish when restarting match #2355
fix: regenerate seed randomization for singleplayer skirmish when restarting match #2355ViTeXFTW wants to merge 2 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp | Added conditional random seed generation for singleplayer mission restarts; minor typo in comment and commented-out code remain |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp | Changed shell map initialization to use random seed instead of fixed 0; clean implementation |
Last reviewed commit: 3034789
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
Outdated
Show resolved
Hide resolved
Additional Comments (1)
|
|
Can you explain how this relates to #2270 ? Do the changes made here impact replays which require a correct restored seed? Randomization in the shell map seems fun |
|
I will make this a draft as I hadn't updated my local fork which introduced the changes mentioned in the PR above. |
672f7a8 to
3034789
Compare
Additional Comments (1)
|
This change tries to do a bit of the oppisite of what that PR did as when you are playing mission maps you would potentially want your seed to be regenerated when restarting maps to make random events "random". I have updated the code now to only regenerate a new seed if the game was a singleplayer game. This will keep the seed for replays and also not touch multiplayer seeds as they should be consistent. |
|
The change in As for the |
Could we add a new random function behind the retail compatible flag which is "more" random and doesn't use this weird bit shift, multiplication, division, old setup. |
| InitRandom(seed); | ||
| // TheSuperHackers @bugfix ViTeXFTW 26/02/26 Generate a new seed value if we are in a singleplayer match | ||
| // to avoid the same random events happening in the same order as previous match. | ||
| if (gameMode == GAME_SINGLE_PLAYER) { |
There was a problem hiding this comment.
This is a very hands-on handling of the Generals challenge issue but should work as they all have prefixes. The same can be done for mission maps. But that can interferre with custom maps if they decide to name their map something similar.
| if (gameMode == GAME_SINGLE_PLAYER) { | |
| if (gameMode == GAME_SINGLE_PLAYER && !mapName.startsWith("GC_")) { |
There was a problem hiding this comment.
Looks brittle and doesn't work for campaign maps.
There was a problem hiding this comment.
Campaign maps can be filtered with !mapName.startsWith("MD_");, but i agree this is a brittle solution
|
I think it's worth asking if single player maps should have scripted run-to-run variance at all. The code doesn't support that currently, though we could change that probably, but I don't know if it's even desirable. |
I would only assume that it is intended to have it as WorldBuilder has scripts which set timers and counters between 2 values. But I agree that it is mostly (if not only) for single player / mission maps. But for above average mission maps it is a powerfull feature to have. In theory the code already supports it as when you load a map from fresh it will update the seed (just not that quickly) but expecting players to quit and then re-launch the map instead of using the restart button is just not feasable. |
Description
This PR changes when new seeds are generated for the randomization of events in maps. Specifically focused around singleplayer.
Before this change when using random triggers in maps, the seed would be reused if the user restarted the mission using the quit menu. For maps that use random triggers this ruins the emergence and time invested by the mapper for a dynamic feel in the map.
Old Behavior
Showcase_Original.mp4
New Behavior
Showcase_Fixed.mp4
Map used for testing:
ShellMapMD.zip
Todo