O'Reilly logo

GameMaker Game Programming with GML by Matthew DeLucas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding and utilizing randomization

A lot of different games use randomization to create a sense of unpredictability, serving as a challenge to players. In the case of this puzzle game, randomness refers to the selection of each piece type in the grid. Contrary to what is observed, the randomness in most games isn't truly random; instead it is a nearly unpredictable pattern of numbers.

In GML, this pattern is determined using an integer value called seed. This seed value can be obtained using the built-in function random_get_seed; it can also be set using random_set_seed. Storing or setting the value of the randomization seed can be useful when debugging the initial setup of a game so that a particular pattern is always the same. When a game ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required