Re: [stella] Random seed

Subject: Re: [stella] Random seed
From: "Eckhard Stolberg" <Eckhard_Stolberg@xxxxxx>
Date: Thu, 14 Apr 2005 16:23:36 -0400
> ... but I keep getting the same values from INTIM each time I run the 
> binary! :(
> I've tried on both z26 and with a CuttleCart, same results.

The emulators always start the emulation with a fresh scanline,
so you'll always get the same value with this method. And the
Cuttle Cart 1 (and the Supercharger) always try to maintain a
stable display. So there are WSYNCS in the code that transfer
the control to the loaded game. So no luck with your code there
either.

> The only way I've been able to get a random number is by simply
> reading from INTIM just after initializing the zero page with 0's, but
> sadly this seems to work with z26 only and not on real hardware (with
> CuttleCart1)!!

Reading INTIM is random on a real VCS. Berzerk uses it to initialize
it's pseudo random number generator. If you play Berzerk on your VCS,
you'll see that it always comes up with a different screen each time
you turn on the console.

The CC1 and the SC display loading screens which of course use
the timers too. So INTIM isn't random when the loaded game gets
control. To still provide a seed for the RNG both devices load
the accumulator with a loading time counter before they jump to
the game code. This value is pretty random depending on the quality
of you audio source.

> Of course I'm not sure if my theory of the random raster position is
> correct, here the input of gurus is definitely welcome!

Your theory might be correct, but since it would only work with
a game on real cartridge, it would be easier to just read INTIM
directly for a random number.


Ciao, Eckhard Stolberg

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread