How random is "Random" ?

Discussion and feedback on Construct 2

Post » Mon May 20, 2013 2:46 am


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.Xionor2013-05-20 03:19:34
Posts: 233
Reputation: 1,537

Post » Mon May 20, 2013 3:33 am

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.Xionor2013-05-20 03:33:58
Posts: 233
Reputation: 1,537

Post » Mon May 20, 2013 3:36 am

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...Pixel perfick2013-05-20 03:37:28
As long as I can move left, right and fire, I'm Happy...
Posts: 655
Reputation: 12,270

Post » Mon May 20, 2013 5:49 am

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.DimensionWarped2013-05-20 06:18:34
Posts: 17
Reputation: 659

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests