ScummVM logo Forum Index - ScummVM website - Contact us - Buy Supported Games: GOG.com Rules - Search - Register - Login curved edge
Folder Forum Index > General Discussion > Ways to remove RNG
Ways to remove RNG
  Author    Thread Reply to topic
TheSassyBird



Joined: 24 Mar 2018
Posts: 2
Ways to remove RNG 

I was wondering if there would be ways to remove randomly generated events or assure that I would encounter them from the game Freddi Fish (3). For example, that the Golden Pipes would always spawn at the same three places. Maybe this is possible via the console, I wouldn't know. Anyways thank you for answering my question.

 Reply with quote  
Post Sat Mar 24, 2018 4:27 pm 
 View user's profile Send private message
digitall
ScummVM Developer


Joined: 02 Aug 2012
Posts: 874
 

I am not an expert in SCUMM HE engine internals, but I suspect that this _might_ be possible by forcing certain object values, but to ensure the game is totally deterministic, I think you would need to modify the SCUMM engine source code to "break" the opcodes used to generate random numbers and compile a new version of SCUMMVM from your modified code... I think that would be opcode 87 and 88 based on:
http://wiki.scummvm.org/index.php/SCUMM/V6_opcodes#getRandomNumber

 Reply with quote  
Post Sun Mar 25, 2018 6:19 pm 
 View user's profile Send private message
digitall
ScummVM Developer


Joined: 02 Aug 2012
Posts: 874
 

Hmm... The engine calls the Common::RandomSource code to generate random numbers. You could also replace that code or hobble it, but this could have some graphics effect impact as it seems to be used in places in the engine code other than the script interpreter:
https://github.com/scummvm/scummvm/blob/master/engines/scumm/scumm.cpp#L2104

 Reply with quote  
Post Sun Mar 25, 2018 6:24 pm 
 View user's profile Send private message
digitall
ScummVM Developer


Joined: 02 Aug 2012
Posts: 874
 

Aha. I think you can use Common::RandomSource's setSeed method function to reset the PRNG seed to the same value each time. This would make the behaviour deterministic:
https://github.com/scummvm/scummvm/blob/master/common/random.h#L49

If you remove the line I indicated in scumm.cpp L1204 and then place a _rnd.setSeed(1) or similar before the main loop there, that should do it.

Can I ask why you want to do this?

 Reply with quote  
Post Sun Mar 25, 2018 6:29 pm 
 View user's profile Send private message
TheSassyBird



Joined: 24 Mar 2018
Posts: 2
 

quote:
Originally posted by digitall
Aha. I think you can use Common::RandomSource's setSeed method function to reset the PRNG seed to the same value each time. This would make the behaviour deterministic:
https://github.com/scummvm/scummvm/blob/master/common/random.h#L49

If you remove the line I indicated in scumm.cpp L1204 and then place a _rnd.setSeed(1) or similar before the main loop there, that should do it.

Can I ask why you want to do this?
Thanks for the help, I speedrun Freddi Fish 3 for fun and you need a certain route for the best score, don't want to reset every time I get the wrong seed. It's helps me practice faster.
 Reply with quote  
Post Mon Apr 02, 2018 10:05 pm 
 View user's profile Send private message
  Display posts from previous:      
Reply to topic

Forum Jump:
 



Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Powered by phpBB © 2001, 2006 phpBB Group
Forum design by ScummVM team, icons by raina
curved edge   curved edge