Specify seed for random

This forum is currently in read-only mode.
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Random events can be annoying to reproduce...

    I propose adding another parameter to the random(x) function (or another function seedrandom(x,y)) where you can specify the seed used to generate the random number... so that random(5,1053908) would give a random number up to 5 and would always be equal to another random(5,1053908)

    This could have many uses:

    In an RPG for item drops, so that at the start of the game it sets the character's 'random_seed' to random(4200000000) then when generating random drops it uses seedrandom(420,'random_seed') or seedrandom(420,'random_seed'+4200757) or whatever. This would mean the character wouldn't be able to open a chest, be unhappy with the items, load, and open the chest again obtaining better items (an exploit that is currently very hard to stop), but would be stuck with the awful items.

    I was making a game that stored your total damage to enemies as a statistic you could see at the end of the level, but some damage was random. I had events that added for example 4+random(20) to enemydamage, but i wanted to add the same random value to a global variable. The way I had to do this was make a new variable and set it to 4+random(20), then add this value to both of the events. It worked, however it would've been much simpler to add 4+seedrandom(20,tickcount) to both.

    If you made a random level generator, (essentially based on random(x) events), you could instead make it be based on seedrandom(x,y) where y can either be random(95823858940) or inputted manually. This way if you wanted to save the map all you'd need to do is save the value of y.

    It's also annoying being unable to reproduce random events for replays etc.

    There are probably way more uses than just these.

    Hopefully this is viable, I'm pretty sure people would find it useful occasionally.

  • i concur, this would be useful. I was thinking of making my own random number function but it appears to be a lot more complicated than i anticipated.

  • is this doable? can I add it to the tracker?

  • I think this would be useful as well

    one example was that random star map generator

    I could have only tracked a few stars at a time

    and still been able to make a huge level where you would see the stars you passed if you went back to look for them

  • I'd say throw it on anyway... it's a bloody good idea and I can't see the men in red hats saying no to it.

    If it's a case of impossibility (which I'm sure it won't be with the combined power of Rich, Ash, and Dave...) then they will just close the ticket on it.

    "With your powers combined.... I AM CAPTAIN ASHAVICH!"

    "GOOOO ASHAVICH!"

    -_- nvm

    ~Sol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put it on the tracker, doesn't sound hard at all.

  • Hello Is this happening?

  • Check out the "S" thread under construct discussion forum, that plugin has a seed-based randomizer.

  • Hello, Will this feature push through? I vote that it be...

  • the 's' plugin has a random seed feature

    also, the perlin noise plugin is made for another type of seeded random

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