Random number generation in Bubble Bobble

Coin-operated games and arcades.
Post Reply
User avatar
Svovl
Posts: 222
Joined: September 6th, 2012, 7:46 am
Location: Denmark
eBay: clemensnk
Initials: CNK

Random number generation in Bubble Bobble

Post by Svovl »

I am working on a talk about the game mechanics of Bubble Bobble and I have difficulties piecing together exactly how the pseudo-random number generation works on the original arcade PCB.
The best information I have found comes from this blog post http://mamelife.blogspot.com/2006/08/co ... -last.html.
As far as I understand, on the PS4 chip there are 1280 bytes of random data and a "random number" is produced from a pointer to one of these bytes and that pointer is updated to the next byte every frame.
The blog post I linked to says:
The EXTEND randomisation simply doesn't exist in the original MCU. While the simulation code used a RNG to provide truly random letters, the original MCU simply increases the counter every frame. This seriously affects the game, making the EXTEND letters predictable.
Since a new bubble enters the screen exactly 128 frames after the previous one, and the remainder of 128 / 6 is 2, this means that if you get consecutive letters each one will be 2 places after the previous one. So if you get 3 letters you can get either E, T, N or X, E, D. After that they will repeat.
.
I'm having a hard time understanding what this means and how, e.g., the extend bubbles are interleaved with bubbles of other types (e.g., water, lightning, and plain bubbles).
I'm also interested in knowing in what other aspects of the game the pseudo-random numbers are used.

Is there anyone who can shed some light on this?
jimmerd
Posts: 224
Joined: May 15th, 2010, 7:01 pm
Location: Berkshire, England
eBay: jimma-d
Initials: jmd

Re: Random number generation in Bubble Bobble

Post by jimmerd »

I've not read the link, but some theory might be..

The emulator is using a random number generator (RNG), so the number you get is not predictable.
The original hardware uses a pseudorandom number generator (PRNG) and is also not truly random but can be made non predictable if desired - but has not been made so in this case.

So imagine a roulette wheel with 1280 positions, set each position with a number of your choice that will never change as had been burnt into the MCU.

Put a book marker (our pointer) at position 0 when we start up the game, then every second move it one position around the roulette wheel. Given the current position and using a know period of time (eg a second/frame) between each movement of the book marker we can predict in so many seconds/frames exactly which position we will land on.

Thus if you get awarded a letter at a given frame you can predict what the next letter in the sequence will be since it's using the PRNG number provided from the MCU.

If they wanted non predictable PRNG, then they would have either not always incremented the pointer by exactly one position when the frame changed or occasionally changed the seed (i.e not always start at position 0)
"Please contact the local attendant"
User avatar
Svovl
Posts: 222
Joined: September 6th, 2012, 7:46 am
Location: Denmark
eBay: clemensnk
Initials: CNK

Re: Random number generation in Bubble Bobble

Post by Svovl »

Thanks for the input! Very helpful.
I assume that each level have a list of bubbles that can enter the room? E.g., plain bubbles, extend letters, water, etc.
If an extend letter is picked randomly the next one or two will also be extends but picked deterministically as it will be the next 128 number of the 1280 numbers.
I would then also assume that, e.g., level 3 has custom code to always let the first bubble be an extend bubble?
Post Reply