Turn a large number into a value between 2 numbers

Get help using Construct 2

Post » Sun Nov 08, 2015 1:06 am

Hey,
So, I'm working on procedural generation, and I want it to work off a seed system. As in, you find a cool world, copy the seed, he pastes it into his game, and gets the same world. Therefor, I can't use any random values, because it would defeat the purpose of the seed system. Because of this, I need to find a way to generate somewhat random seeming values from a string of numbers, my "seed".

My seed consists of purely numbers, to simplify things. My seed can be anywhere between 1, and 10,000,000.
so let's say, I get the seed 76364, I need a way, to turn that into a number between say 1 and 10.
But
The outcome cannot be constant. The formula needs to incorporate outside factors. Say if I have blocks all over my level, I'd need to vary the formula in some way to include block.x and block.y, so that
A: All the blocks dont have the same number,
B: all the blocks in the same X row dont have the same number,
C: all the blocks in the same Y row dont have the same number.

Hopefully one of you amazing geniuses can help me out with this one :)
B
6
S
1
Posts: 54
Reputation: 533

Post » Sun Nov 08, 2015 1:53 am

Two ideas come to mind. One is to use the third party noise plugin. With it you can set a seed and get random values over a grid with perlin noise.

The second idea is to use a random number generator. A simple one is rather easy to write but the quality won't be there. More complex ones will give better values.
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Sun Nov 08, 2015 2:31 am

Not sure if you understood my original post or not, sorry, but I need to avoid using random numbers, so that my seed idea works, if possible :)
B
6
S
1
Posts: 54
Reputation: 533

Post » Sun Nov 08, 2015 2:40 am

as for the perlin noise plugin, tried to find it, and I cant seem to find it? Could you link me? @R0j0hound
B
6
S
1
Posts: 54
Reputation: 533

Post » Sun Nov 08, 2015 5:43 am

I did understand it. You want a seeded random number generator.

These are the three plugins that can do a seeded random:
viewtopic.php?t=93998&start=0
viewtopic.php?t=63543&start=0
viewtopic.php?t=76204&start=0

And btw here is where you go to find a list of all the plugins:
c2-plugins-and-behaviors-list_t65170

If you wan to do it yourself the simplest way is this:
https://en.wikipedia.org/wiki/Linear_co ... _generator
Wikipedia also lists other methods here if you're curious:
https://en.wikipedia.org/wiki/Random_nu ... al_methods
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Sun Nov 08, 2015 2:12 pm

Sorry I think I misunderstood what you said in the first message and it made me think you didnt understand, my english isn't the best at times :) Thanks a bunch for those links, you're the best! @r0j0hound
B
6
S
1
Posts: 54
Reputation: 533


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests