Jump to content
LaunchBox Community Forums

Attract mode random wheel not very random


Xpendable

Recommended Posts

I have my BigBox Attract mode set to spin the wheel within the platform it is current on, and I have set to spin every 60 seconds.  I've noticed that it tends to pick the same small set of games over and over again, despite having 1000+ roms on a single platform.  For example, in a  span of 1 hour, it will hit the same game several times.  Statistically that should not be possible if it is supposed to be randomly picking a game.  How is the game being selected?  I suspect there could be a bug in the implementation.  

 

Link to comment
Share on other sites

Sorry, but I know a lot more about how random numbers work than you think.  I'm not saying no game should ever be repeated.  What I'm saying is the same 10 games should not be repeated 5-10 times within 60 samples when the range is 1000+ games.  Something is statistically wrong with the number generator if is generating the same sets of numbers over and over and over again.  I should only have a 1/1000 chance of seeing the same number on each random number generation.  Instead, I'm seeing the same game 1/10 times, consistently, or something like that.  That is wrong.  If that happened once in awhile, it would be correct, but when it happens 1 out of very 10 random games, and the other games are also happening at the same frequency... there's something wrong.

Link to comment
Share on other sites

7 hours ago, Xpendable said:

I should only have a 1/1000 chance of seeing the same number on each random number generation.

Thats not true though, that would only be accurate if every time Launchbox was rolling a number it was on the same game, but of course it isnt its always rolling a number from a different game (excluding the first roll of course). So it is actually more common than you would think to hit the same game. If you had 1000 games in a platform and on the first roll Launchbox picked 300, you would of course see a different game, but then if the next roll it chose 700 as the number, then you would be back at the same game 300 + 700 = 1000, in that case it still chose two completely random numbers, but because the starting point is different the chance of hitting the same game is higher, If the roll was always starting from zero i could see your point but its choosing a random number roll from a previously random roll position so the chances of hitting a already seen game is actually statistically higher than if every roll started out from a zero position.

Im not saying that there isnt potentially something wrong here, just that the very nature of something being random, and started from random points is always going to look somewhat not random as you will hit the same outcomes.

Link to comment
Share on other sites

I've also noticed that it does tend to pick the same games and platforms to scroll through again and again. I swear some platforms I've never seen it randomly go into at all. I don't have any real data to back it up, but I got 50k+ games and I feel I'm seeing a very small percentage of them during attract mode.
Not a massive issue for me though, but I have noticed it and thought I'd add my observations as well.

Link to comment
Share on other sites

I  agree with polygonslayer and DOS76.  I think something is wrong with the randomizer somehow.  It might be worth doing some debugging and logging out the number chosen each time to a file and compare the results.  My arcade machine is right next to my office where I work from home, and I often stare at watching it.  It's definitely goofy.

Link to comment
Share on other sites

I watched my arcade machine and wrote down every game it spun to for the past 45 minutes.  This is what I observed.  Platform is set to Atari 2600 (with 577 titles).  I've color-coded all the matching repeat entries.

  1. Challenge (8:58)
  2. Bacherlor Party (8:59)
  3. 2600 1.00 Files   (9:00)
  4. Amidar (9:01)
  5. Bachelor Party (9:02)
  6. Breakout
  7. Atlantis (9:03)
  8. Col "N" (9:04)
  9. Astro Attack (9:05)
  10. Beamrider (9:06)
  11. Col "N" (9:07)
  12. Bachelor Party (9:07)
  13. Breakout (9:08)
  14. Centipede (9:09)
  15. Bank Heist (9:10)
  16. 2-in-1: Frostbite and River Raid (9:11)
  17. Atari Video Cube (9:12)
  18. 2 Pak Special Blue: Dungeon Master, Creature Strike (9:13)
  19. Blueprint (9:13)
  20. Blackjack (9:14)
  21. 2 Pak Spcial Yellow:  Warrior,Frogger (9:15)
  22. Bionic Breakthrough (9:16)
  23. Bank Heist (9:17)
  24. Bridge (9:18)
  25. Air Raid (9:19)
  26. Berzerk (9:20)
  27. Cat Trax (9:18)
  28. Boing! (9:19)
  29. China Syndrome (9:20)
  30. Armor Ambush (9:21)
  31. Beamrider (9:22)
  32. Cakewalk (9:23)
  33. Computer Chess (9:23)
  34. Bermuda Triangle (9:24)
  35. Communist Mutants From Space (9:25)
  36. Chase the Chuck Wagon (9:26)
  37. Circus Atari (9:27)
  38. 128-in-1 Junior Console (9:28)
  39. Chase the Chuck Wagon (9:29)
  40. Atlantis (9:30)
  41. Bionic Breakthrough (9:31)
  42. Climber 5
  43. Berzerk
  44. Berenstain Bears
  45. Atlantis 

 

So BigBox selected 45 entries over 45 minutes, and 19 of those titles repeated, some more than twice.  So... 42% of the entries were repeats.

It looks like it is picking a random number and using that as an offset to spin the wheel X number of entries forward or X number of entries backward.  I noticed that every spin over the this time frame was within the first 98 entries of my 577 titles.  It never made it higher than the 98th entry, which is Communist Mutants From Space.  This makes sense since the platform is alphabetically sorted by title, and this game is the 98th entry in the Windows folder, also sorted alphabetically.

 

My Attract Mode settings are:

Enable Attract Mode (checked)

Switch Between Platforms/Filters (unchecked)

Wait Time:  1 Minute

Time In-Between Movements:  40 seconds

Maximum Speed: 20 milliseconds

Minimum Speed:  200 milliseconds

 

Edited by Xpendable
Link to comment
Share on other sites

I think that most likely the issues are coming more from the nature of how the wheels spin, rather than a bug in the random number generator. It is true that RNGs are never perfect, and are often not so great at being random, but the issue here is that the wheel doesn't often get all that far past the beginning of the alphabet, because it goes both forwards and backwards. I do have a couple of ideas that might help though:

  • Randomize where in the list the wheel starts when changing between platforms
  • Change the wheel to never (or more rarely) go backwards

The wheel is randomized by how many games are jumped through for each move, not by selecting a particular game, so that probably has an effect on the results as well.

  • Like 2
Link to comment
Share on other sites

I've improved this in a few ways for the next beta. Made it less likely to move backwards in the wheel, changed out the random number generator for one that's supposedly improved (just in case that is actually the issue), and tweaked some of the chances. Let me know how it fares for you guys after the beta 12 release.

  • Like 2
Link to comment
Share on other sites

Thanks, Jason.  I'll have a go at it.

Another way you could do it which would always ensure that every game has the same odds of appearing next (1/577 in my case) would be to make note of the current position, then randomly select a number between 0 and MAX -1 (567 in my case) and then compute whether you need to go forward or backwards and by how many steps. 


while (newPos == curPos)
{
    newPos = (get your random number between 0 and Max)
    if (newPos < curPos)
    {
        // Go backwards
        steps = curPos - newPos;
    }
    else if (newPos > curPos)
    {
            // Go forward
        steps = newPos - curPos;
    }
}


 

Now you can calculate how to spin the wheel so that it lands on the chosen game.  But I get this a bit more complex, and maybe the tweaks you've made for the next Beta will take care of the problem.

Link to comment
Share on other sites

1 hour ago, Xpendable said:

Thanks, Jason.  I'll have a go at it.

Another way you could do it which would always ensure that every game has the same odds of appearing next (1/577 in my case) would be to make note of the current position, then randomly select a number between 0 and MAX -1 (567 in my case) and then compute whether you need to go forward or backwards and by how many steps. 



while (newPos == curPos)
{
    newPos = (get your random number between 0 and Max)
    if (newPos < curPos)
    {
        // Go backwards
        steps = curPos - newPos;
    }
    else if (newPos > curPos)
    {
            // Go forward
        steps = newPos - curPos;
    }
}


 

Now you can calculate how to spin the wheel so that it lands on the chosen game.  But I get this a bit more complex, and maybe the tweaks you've made for the next Beta will take care of the problem.

That would not be a good way to proceed, because the wheel would likely spin for far too long if you had too many games in the wheel.

Link to comment
Share on other sites

Can the spin animation for the wheel just be a visual representation of a true random result and not actually match the time it would take? Even a slight screen blink to end up at  the random game would better.

Edited by Mr.Laor
Link to comment
Share on other sites

2 hours ago, Mr.Laor said:

Can the spin animation for the wheel just be a visual representation of a true random result and not actually match the time it would take? Even a slight screen blink to end up at  the random game would better.

To be honest, that sounds confusing and I don't think that's a good idea at all. We could add a random feature a lot easier if we just jumped to a random game, but that's not really what this discussion was about.

Link to comment
Share on other sites

15 hours ago, Jason Carr said:

That would not be a good way to proceed, because the wheel would likely spin for far too long if you had too many games in the wheel.

Jason, I've got a solution for that.  What if you implemented logic  to compute a random number that is always within a max spin range of the current position?  You can even make it configurable to be +/- 100, +/- 200, etc.  That way you will always be randomly picking a title that is within range of the current position and never spinning further than the max "search" range.  The beauty of this is it will scale well regardless of whether you have 100 titles, 1000 titles, 10,000 titles.

 

int maxrange = 200;

int halfrange = maxrange / 2;  // if maxrange = 200, then we are looking for a range that is +/- 100.

int minvalue = curPos - halfrange;
int maxvalue = curPos + halfrange;

if (minvalue < 0)
{
    // Since the minvalue < 0, we need to shift the range to the right.
    // For example, if curPos = 40, the minvalue would be -10 and maxvalue would be 90.  After shifting,
    // the new range would be minvalue = 0 and maxvalue = 100.  
    maxvalue += Math.abs(minvalue);  
    minvalue = 0;
    if (maxvalue > maxtitle-1) maxvalue = maxtitle-1;  // truncate range if the number of titles is less than your maxrange.
}
else if (maxvalue > maxtitle-1)
{
    // Since the maxvalue > then the maxtitle-1, we need to shift the range to the left.  If maxtitle = 1000 and
    // maxrange is 1005, we need to shift the entire range to the left by 5 so that the mavalue = maxtitle-1.
    minvalue -= maxvalue - maxtitle-1;
    maxvalue = maxtitle-1;
    if (minvalue < 0) minvalue = 0; // truncate range if the number of titles is less than your maxrange.
}

int newrandom = Random.Next(minvalue, maxvalue); // random number.  For example, if curPos = 300 and maxRange = 200, then range is (300,400)

 

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...