Two numbers are said to be congruent modulo m when their difference is divisible by m. Prime1 and prime2 are two prime numbers which should be both congruent to 3 modulo 4. Sequence is the array which will contain the pseudorandom sequence. } while (sequence.indexOf((xi*xi)%M)=-1) One of the simplest pseudorandom number generator is the Blum Blum Shub, called this way after the surnames of its creators: Lenore Blum, Manuel Blum and Michael Shub.Īlthough it’s not recognized as the quickest way to generate pseudorandom numbers, it’s very simple to code, and that’s what we are looking for. Just what we are looking for to start creating our “random” levels.
In everyday’s words, it’s a sequence of numbers that people will believe to be random, but it’s not. The sequence is not truly random in that it is completely determined by a relatively small set of initial values, called the PRNG’s state ( source). I loved this game (it’s one of the 5 Commodore 64 games I would like to see ported in Flash) so it’s obvious I am trying to play with procedural generation.īut before talking about it, let’s introduce pseudorandom numbers.Ī pseudorandom number generator is an algorithm for generating a sequence of numbers that approximates the properties of random numbers. They were all created by procedural generation. This is the case of The Sentinel, a game made in 1986 with 10,000 levels but no hardware to store them individually.
Blum blum shub generator algorithm example series#
Blizzard’s Diablo series is probably the most famous example of this technique.īut more interesting than the “simple” generation of random levels would be the capability of making a game with, let’s say, 10,000 levels procedurally generated starting from pseudorandom numbers, so that people will play a big set of different levels, but, as example, level 37 is the same on every game instance. This means we can generate random levels for some kind of games such as roguelike games, making people play randomly generated levels, making a game almost endless. This is often related to computer graphics applications and video game level design ( source). Often times, this means creating content on the fly rather than prior to distribution.
Procedural generation is a widely used term in the production of media it refers to content generated algorithmically rather than manually. With this post we’ll start talking about procedural generation.