1. Hey! Guest! The 32nd GMC Jam will take place between Feb 22nd, 12:00 UTC (Friday noon) and Feb 25th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Random number generator, gathering statistics

Discussion in 'Programming' started by Dawid, Feb 11, 2019.

  1. Dawid

    Dawid Member

    Feb 11, 2019

    I make prototypes for slot games. I am considering using Game Maker. However, I need playable versions, as well as simulations that would run a million times and return some statistics. Is it possible to do that in Game Maker?

    Thank you in advance for help.
  2. Tsa05

    Tsa05 Member

    Jun 21, 2016

    Suppose you have 3 wheels with 20 positions.
    var file = file_text_open_write("position.csv");
         var p1 = irandom(19);
         var p2 = irandom(19);
         var p3 = irandom(19);
         var toWrite = p1+","+p2+","+p3;
         file_text_write_string(file, toWrite);
    You now have a million-line text file in your local appdata folder with 3 spins, 0-19, on each line.

    You could also generate those 3 results and then draw an image strip that loops behind the window of the slot for a playable version.

    If you *are* going to use GameMaker for gambling-type games, be certain to call the randomize() function before making a playable build!!!!!!!!!!!!!!
    GameMaker uses a fixed random seed for each game project, making it much easier to test and debug code (the sequence of numbers generated is identical each time the game is played). Calling randomize() at the start of your game will choose a different seed.
    Bayesian likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice