Jump to content

Post-menu random number generation


Recommended Posts

I have a concept for a VCS game that would rely on an RNG in at least a couple crucial ways. I know from using Omegamatrix's startup values program that the Harmony ROM selection menu will repeatably leave the RAM in a certain state, which I'm sure depends on where a particular ROM happens to be in the file system, but it's still deterministic. Maze Craze will also more often than not produce one particular first maze, and this can change based on how I traverse the file menu before selecting it.


So I'm wondering what the best source for a random seed would be to ensure good RNG performance no matter if a game is running on a Harmony with the menu BIOS, a Harmony in single-image mode, or (possibly in the future) a dedicated cartridge. My first guess would be to almost immediately sample INTIM and store the value, say, at the top of RAM and skip over that byte in the init routine. Is the latency of ROM loading unpredictable enough to make that a viable strategy?

Link to comment
Share on other sites

step 10 - "Random Numbers"


One thing that helps when using an LFSR is to keep reading values at a regular rate, even if you don't need the value. What this does is impose an element outside of the Atari's control - namely the time it takes the human to do things: hit the RESET switch to start a game, collect the next box, etc. I've added this to VerticalBlank


        jsr Random


Link to comment
Share on other sites

Check Berserk. I know for sure that it does the initial sampling of INTIM as you plan it. Probably you should additionally update the RNG every frame. Then its state depends on the player when he starts the game.


With Harmony, the RAM area is completely used for the stall code, displaying the Yin-Yang symbol. So that's not random at all.

Link to comment
Share on other sites

Thanks for your help, everyone. I'm almost certainly going to use an LFSR.


With Harmony, the RAM area is completely used for the stall code, displaying the Yin-Yang symbol.

That's weird, my Harmony has never shown the yin-yang.

The loading latency, though, is unpredictable, right?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...