Jump to content
IGNORED

Strange Problem with Randomization


Lodmot

Recommended Posts

Hi. I'm having the strangest problem with randomization in my new game that I'm working on.

 

What's going on is, I have single playfield pixels falling from the top of the screen, and when they either hit a missile object or reach the bottom of the screen, they are supposed to appear back up at the top, but at a different randomly-chosen x position between 0 and 31 (because they're playfield objects).

 

The code I have seems to work fine in Stella, but when I tried it on my real Atari, the playfield pixels never get randomized; they always appear at the left-most X coordinate. Periodically the same thing will happen in Stella as well, but on the console it happens all the time. Is there anyone that may know how to fix this problem?

 

Thanks.

default.bas

Edited by Lodmot
Link to comment
Share on other sites

Hi. I'm having the strangest problem with randomization in my new game that I'm working on.

 

What's going on is, I have single playfield pixels falling from the top of the screen, and when they either hit a missile object or reach the bottom of the screen, they are supposed to appear back up at the top, but at a different randomly-chosen x position between 0 and 31 (because they're playfield objects).

 

The code I have seems to work fine in Stella, but when I tried it on my real Atari, the playfield pixels never get randomized; they always appear at the left-most X coordinate. Periodically the same thing will happen in Stella as well, but on the console it happens all the time. Is there anyone that may know how to fix this problem?

 

Thanks.

 

Perhaps it has something to do with zero page RAM being randomized in Stella and not on a real system?? You can turn this on or off in Stella with the 'ramrandom' commandline argument, either from the commandline or by editing the config file (unfortunately there's no way to do this in the UI yet). If that makes Stella behave like real hardware, then at least you'll know why it's happening.

Link to comment
Share on other sites

I had a similar problem with Seaweed Assault. It seems if you use nothing but & instead of dividing, you can get random numbers that aren't so random. I fixed the problem by dividing when necessary. For example, there was a variable that added three random numbers. I used & for two of them and used division for the third one. That made the problem go away. You have to play around and see where division is needed.

 

So if a = (rand&15) isn't working correctly, try a = (rand/16). I thought I already added something about this to the bB page, but I can't find it. I just added a warning to the Did You Know? box:

 

http://www.randomter...mands.html#rand

Link to comment
Share on other sites

Remember if you are using a Harmony Cart that it first puts code into the zero page ram and then runs it while the Tao logo is being displayed. The consequence is that when you start a game on the Harmony the zero page ram is not in a randomized state, and your initial seed is always the same. So even though it is being played on real hardware it is not quite the same effect. You might want to try making a single image with the Harmony cart and see if the problem is still there.

 

 

If I had one wish for H2 it would be to have randomized zero page ram before letting the game run, and further to that if it was being played on a 7800 then it would write the known values for zero page ram on the 7800 back in so we could preform 7800/2600 auto-detection.

  • Like 1
Link to comment
Share on other sites

Alright, this problem has gotten even stranger...

 

Last night I went ahead and implemented a game over screen, which resets the game via a timer.

Today, I tested the game on the real console. I tried the rand/# method, but that didn't change anything.

 

HOWEVER, as I was playing through the game on the real console, I discovered that if the game over screen happens, and you begin a 2nd game, RANDOMIZATION WORKS!

It only doesn't work when you play the game first time around.

 

How's that one for you?

 

Oh, and also, I use randomization for the "rants" that you get whenever one of the shitty game objects (the playfield pixels) touches the game systems at the bottom of the screen (colored horizontally moving squares). The rants also don't get randomized at first on the real console, but as stated before, after a Game Over and starting a 2nd game, it does.

Link to comment
Share on other sites

Alright, this problem has gotten even stranger...

 

Last night I went ahead and implemented a game over screen, which resets the game via a timer.

Today, I tested the game on the real console. I tried the rand/# method, but that didn't change anything.

 

HOWEVER, as I was playing through the game on the real console, I discovered that if the game over screen happens, and you begin a 2nd game, RANDOMIZATION WORKS!

It only doesn't work when you play the game first time around.

 

How's that one for you?

 

Oh, and also, I use randomization for the "rants" that you get whenever one of the shitty game objects (the playfield pixels) touches the game systems at the bottom of the screen (colored horizontally moving squares). The rants also don't get randomized at first on the real console, but as stated before, after a Game Over and starting a 2nd game, it does.

 

From the default.bas at top it looks like you need to randomize the seed value better. Check out the source to my unfinished Destiny game for an example of using player input to help seed and bit shifting to further ranomize things.

http://www.atariage.com/forums/topic/172686-destiny-wip/

Link to comment
Share on other sites

Alright, after doing a bit more research I was able to try out Omegamatrix's suggestion by making a single image to the Harmony cart. That did the trick! :D

So I assume when I get this game put on a custom cartridge, it will not have this problem, right?

 

Thanks for the help guys. :3

Edited by Lodmot
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.

Guest
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.

Loading...
  • Recently Browsing   0 members

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