How random is "Random" ?

0 favourites
  • 4 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hey.

    I wonder, exactly how randomized is the Random function?

    Im making an upwards scrolling platformer and I've made an event where the game creates a small 100 px platform anywhere on the 1000px X plane of the layout the player's going towards.

    What I notice very often is 5+ platforms on one side at very similiar X coordinates, then 5+ on the other, then 4 in the middle.

    At times it would even create

    Platform 1 - 50px

    Platform 2 - 60px

    Platform 3 - 75px

    Platform 4 - 92px

    As in, scaling platform groups.

    And that happens A LOT! It looks like half of my platforms create stared/scaled structures.

    Thus wondering about the randomness of the whole process.

    EDIT : I made another event. I basically gave it a 10% chance to spawn an orange on each platform. As it is now, the oranges spawn mostly in clumps of 4+ with great patches of the level with no oranges. Very rarely would only 1 orange appear.

    What's wrong here?

    EDIT 2: Postig a capx as soon as possible.


    I made a quick project to give an example.

    Notice how the oranges appear clumped, then there's few screens of no oranges, then suddenly its 2-3 oranges on the same screen again.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • sounds like you may have a loop running at "random" intervals...a capx or screenshot of your code would help...

    I hate it when that happens...

  • Tested it (the RNG) on my PC with Chrome. I'm not observing any particularly abnormal patterns.

    EDIT: Part of the problem is that you are allowing the event to execute multiple times in a single jump. This can happen multiple times within a 10th of a second period, so if the event procs twice (which it does often) and the boost value is already set, it's going to spawn multiple times for the same random value.

    EDIT2: By the by, it helps to add audio cues to test this sort of thing. The reason I was able to figure out that it was doubling the events on single hops is because I made it play a sound whenever it created a fruit.

    EDIT3: Fixed it so that it can't execute the event multiple times without multiple landings.

    Make sure you remove the sounds if you ever use this for a commercial project. They aren't free to use and doing anything commercial with them is a no-no.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)