Level seed
Posted: Fri Jun 27, 2008 2:45 pm
Simply a number you can set in the level properties that is the seed for the random number. If set to the default 0 then it uses the normal RnDs random method (using milliseconds to get a "real" random number, I guess), otherwise use a seed.
RnDs random elements would react the same every time (like watching a tape), E.G. Setting a seed of 32511 will make a certain yamyam always move down at the start of a level, setting it to 33 will make it go left. In VB I call this "hand picked random".
Good for getting some strict rules in a level (for timing stuff maybe). I'd use it for CEs personally...in fact the amount of cool things you could make with this very simple setting is huge!
It is would also be very cool for BD type levels, where a box of boulders and dirt are drawn randomly in the cave, but with the seed set they always appear in the same place......to make the cave harder you "hand pick" another seed until the boulders are in a more tricky position. This is really the skill level in BD.
Setting the seed in a CE action would also be very nice....you could construct the interior of house randomly (think Zelda),and change the seed as you enter it. Furniture is randomly placed, but using the seed so it looks the same every time you enter (the seed would be determined by the map position, as well as the house number)
Coding would be easy, if C+ has similar seed functions as VB......
If you run this in VB, using the seed of 2442 will always print 63,51,17,25,2 (try it if you have VB6). Taking out the first two lines returns the randomness to normal (I use "Randomize Timer" to get real random), so really the RnDs element code wouldn't have to be changed, just the random initialise.
RnDs random elements would react the same every time (like watching a tape), E.G. Setting a seed of 32511 will make a certain yamyam always move down at the start of a level, setting it to 33 will make it go left. In VB I call this "hand picked random".
Good for getting some strict rules in a level (for timing stuff maybe). I'd use it for CEs personally...in fact the amount of cool things you could make with this very simple setting is huge!
It is would also be very cool for BD type levels, where a box of boulders and dirt are drawn randomly in the cave, but with the seed set they always appear in the same place......to make the cave harder you "hand pick" another seed until the boulders are in a more tricky position. This is really the skill level in BD.
Setting the seed in a CE action would also be very nice....you could construct the interior of house randomly (think Zelda),and change the seed as you enter it. Furniture is randomly placed, but using the seed so it looks the same every time you enter (the seed would be determined by the map position, as well as the house number)
Coding would be easy, if C+ has similar seed functions as VB......
Code: Select all
Rnd (-1)
Randomize 2442
For L = 1 To 5
Print Int(Rnd(1) * 100)
Next