MantisBT - Zandronum
View Issue Details
0000759Zandronum[All Projects] Bugpublic2012-04-08 23:152024-04-13 01:24
Human Destroyer 
 
highmajoralways
closedduplicate 
98d 
 
0000759: Random Number Generator resets on map change, losing randomness
When a "map" map change is performed or offline skirmish is selected, the RNG remains the same as it was before the switch. This causes things such as Random Game Mode WADs to go back and forth between the same two maps and the same two game modes.
NOTE: THIS DOES REQUIRE MM8BDM TO SEE EASILY.

1. Download MM8BDM and this Random Modes WAD:'http://www.mediafire.com/download.php?yezol6bg3yg5dvz [^]'
2. Play for a while. After a while, you will notice the game alternates between the same two maps and gamemodes. (For example, an endless loop of alternating MM3TOP on Terminator and MM2MET on LMS).

OR if you use doom2.wad:

1. Go to offline skirmish.
2. Add a bunch of bots randomly. Remember which bots you added.
3. Go to a different map using offline skirmish.
4. Add the same number of bots added previously. You'll find that they are the same bots.
This was tested on both MM8BDM and Doom 2.
No tags attached.
related to 0000637closed Torr Samaho Adding a bot breaks 'random' 
? RandomGame.wad (4,439) 2012-04-08 23:17
/tracker/file_download.php?file_id=523&type=bug
Issue History
2012-04-08 23:15Human DestroyerNew Issue
2012-04-08 23:17Human DestroyerFile Added: RandomGame.wad
2012-04-08 23:22TIHanAssigned To => TIHan
2012-04-08 23:22TIHanStatusnew => assigned
2012-04-08 23:26unknownnaRelationship addedrelated to 0000637
2012-04-09 00:14TIHanNote Added: 0003188
2012-04-09 00:16TIHanStatusassigned => feedback
2012-04-09 00:45TIHanNote Edited: 0003188bug_revision_view_page.php?bugnote_id=3188#r1674
2012-04-09 01:15Human DestroyerNote Added: 0003189
2012-04-09 01:15Human DestroyerStatusfeedback => assigned
2012-04-09 07:57Edward-sanNote Added: 0003190
2012-06-09 13:22Torr SamahoCategoryGeneral => Bug
2014-10-11 19:00WatermelonAssigned ToTIHan => Watermelon
2014-10-11 19:07WatermelonNote Added: 0010508
2014-10-11 19:07WatermelonStatusassigned => needs review
2014-10-11 19:11WatermelonNote Edited: 0010508bug_revision_view_page.php?bugnote_id=10508#r5703
2014-10-11 19:12WatermelonOSWindows =>
2014-10-11 19:12WatermelonOS VersionXP/Vista/7 =>
2014-10-11 19:12WatermelonPlatformMicrosoft =>
2014-10-11 19:12WatermelonSummaryRandom Number Generator => Random Number Generator resets on map change, losing randomness
2014-10-11 19:34WatermelonNote Edited: 0010508bug_revision_view_page.php?bugnote_id=10508#r5704
2014-10-12 15:54Torr SamahoNote Added: 0010544
2014-10-12 16:09Torr SamahoStatusneeds review => feedback
2014-10-12 16:50WatermelonNote Added: 0010548
2014-10-12 16:50WatermelonNote Edited: 0010548bug_revision_view_page.php?bugnote_id=10548#r5736
2014-10-12 16:50WatermelonNote Edited: 0010548bug_revision_view_page.php?bugnote_id=10548#r5737
2014-10-12 18:31WatermelonAssigned ToWatermelon =>
2024-04-13 01:24Ru5tK1ngNote Added: 0023601
2024-04-13 01:24Ru5tK1ngStatusfeedback => closed
2024-04-13 01:24Ru5tK1ngResolutionopen => duplicate

Notes
(0003188)
TIHan   
2012-04-09 00:14   
(edited on: 2012-04-09 00:45)
Unfortunately, this may be a ZDoom issue and may not be trivially to fix.

Edit: Curious, what about using "changemap"?

(0003189)
Human Destroyer   
2012-04-09 01:15   
Changemap (and nextmap) do seem to work correctly.
(0003190)
Edward-san   
2012-04-09 07:57   
> Unfortunately, this may be a ZDoom issue and may not be trivially to fix.
we need a way to reproduce this in ZDoom 1551. Then let's see if it works in latest ZDoom.
(0010508)
Watermelon   
2014-10-11 19:07   
(edited on: 2014-10-11 19:34)
The culprit here is:
G_InitNew calls FRandom::StaticClearRandom (); on line 603, every time the CCMD map is called, it clears the randoms and re init's them with the default starting seed.


I do not know how deterministic these functions need to be, therefore I don't know if adding in a "WasInitialized" variable would screw up demos?


If demo compatibility is an issue, there might always be the option of adding in a (DM?)flag which does not reset them. That way demo's might possibly remain intact without a lot of messing around.

(0010544)
Torr Samaho   
2014-10-12 15:54   
I already detailed why this is happening almost two years ago: 0000637:0005592

Sadly, nobody ever cared to reply to my "Can somebody check why ZDoom does this?"...
(0010548)
Watermelon   
2014-10-12 16:50   
I posted in 0000637:0010547 and will try to do what was requested there.

(0023601)
Ru5tK1ng   
2024-04-13 01:24   
This seems more likely to be a duplicate of 637. Closing since that ticket was resolved. Reopen if necessary.