fix: Replace InitGameLogicRandom with InitRandom for consistent client and audio seeds#2339
fix: Replace InitGameLogicRandom with InitRandom for consistent client and audio seeds#2339Caball009 wants to merge 4 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/Common/RandomValue.h | Removed declaration of InitGameLogicRandom, clean header change |
| Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp | Updated call from InitGameLogicRandom to InitRandom, correct implementation |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp | Updated both calls from InitGameLogicRandom to InitRandom, correct implementation |
Last reviewed commit: f6aa7d2
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp
Line: 566-567
Comment:
This file still calls `InitGameLogicRandom` which was removed in this PR, causing a compilation error
```suggestion
InitRandom( TheGameSpyGame->getSeed() );
DEBUG_LOG(("InitRandom( %d )", TheGameSpyGame->getSeed()));
```
How can I resolve this? If you propose a fix, please make it concise. |
|
Broke da build! but looks like it's due to core files being altered :P |
|
Yes, Generals isn't updated yet but the core files are, so that project won't compile. |
|
|
||
| void InitGameLogicRandom( UnsignedInt seed ) | ||
| { | ||
| #ifdef DETERMINISTIC |
There was a problem hiding this comment.
I don't think so, though I use that macro when testing sometimes to reduce the chances for run-to-run variance.
| /// @todo: when Campaign & skirmish are separated, make campaign have fixed seed and skirmish random. | ||
| InitRandom(0); | ||
| /* | ||
| if (TheGlobalData->m_fixedSeed >= 0) |
There was a problem hiding this comment.
Considering the todo above, do skirmish games have a random seed? Wondering if the comment can be removed?
There was a problem hiding this comment.
Considering the todo above, do skirmish games have a random seed?
Skirmish multiplayer maps have a random seed, skirmish single player maps / scenarios do not.
There was a problem hiding this comment.
might be good to cleanup the todo aswell if it's not relevant
There was a problem hiding this comment.
It's not entirely clear to me if this todo is completely done, but it looks that way so I'll remove the comment.
This PR removes function
InitGameLogicRandom, and changes all use cases toInitRandom. The former only sets the logical seed values (important for the CRC), while the latter also sets the client and audio seed values. I think setting all 3 types of seed values improves consistency. This change is not user-facing.I checked 2000+ of Joker's (short) replays and this change did not introduce any new mismatches, as expected.
TODO: