+Random Terrain Posted September 30, 2008 Share Posted September 30, 2008 (edited) With or without "dim rand16=z" if I use reboot instead of just jumping back to a label, rand no longer seems to be random. I noticed this when randomly placing playfield pixels on the screen. If I jump back to a label when the reset button is pressed, the playfield pixels are always random, but if I use reboot when the reset button is pressed, I get the same configuration of playfield pixels every time. I'm using Stella 2.51 in case that matters. Edited September 30, 2008 by Random Terrain Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 30, 2008 Share Posted September 30, 2008 Does bB seed RAND by pulling something like INTIM during powerup? If so, this behaviour makes sense. I suggest jumping to a variable initialization routine rather than rebooting. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 30, 2008 Author Share Posted September 30, 2008 Does bB seed RAND by pulling something like INTIM during powerup? If so, this behaviour makes sense. I suggest jumping to a variable initialization routine rather than rebooting. I'm just a lowly bB user with a tiny brain. I don't know what bB does. The explanation will have to come from someone with a bigger brain. Whatever the explanation is, it looks like I'll have to avoid reboot. It's fairly 'new' and I never had a chance to become addicted to it, so no big deal if I can't use it. Thanks. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 30, 2008 Share Posted September 30, 2008 Does bB seed RAND by pulling something like INTIM during powerup? If so, this behaviour makes sense. I suggest jumping to a variable initialization routine rather than rebooting. I'm just a lowly bB user with a tiny brain. I don't know what bB does. The explanation will have to come from someone with a bigger brain. Whatever the explanation is, it looks like I'll have to avoid reboot. It's fairly 'new' and I never had a chance to become addicted to it, so no big deal if I can't use it. Thanks. Yes, bB seeds rand with the value of INTIM (after ORAing it with #1 to make sure rand won't be 0). So if reboot is always performed at the same time (in terms of the overall kernel loop), then INTIM will probably have the same value each time. You could try varying the time with something like the following: if switchreset then temp1 = rand : for temp2 = 1 to temp1 : next : reboot I haven't tried that myself to see how well it works, but it should cause the reboot command to be performed at different times each time the user presses reset. Michael Quote Link to comment Share on other sites More sharing options...
yuppicide Posted September 30, 2008 Share Posted September 30, 2008 Yeah, I had the same problems also. My game picked two random numbers to make a hole in a "wall" and each time they were coming in the same places. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 30, 2008 Share Posted September 30, 2008 Another strike against rebooting is that display loses sync (so it would jitter on the next frame). You could probably store the current random seed to TIM64T (or one of it's cousins) before rebooting to keep the seed from being identical, tho. Maybe EOR it with some variable like a framecounter to lower the odds even more. Quote Link to comment Share on other sites More sharing options...
potatohead Posted September 30, 2008 Share Posted September 30, 2008 (edited) Can you take some player input at that time for a new seed? If you make them do something, while incrementing a counter or something, then their actions will trigger some low level of randomness in that they are not all that likely to do it exactly the same time every time. Kind of a "press fire, then up, then down to continue" kind of thing. Edited September 30, 2008 by potatohead Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.