First up, this isn't a random question about seeds (Although don't you just love phrases like that? "Massive Rug Sale" - Who would want a massive rug?)
Anyway. Would it be feasible to use controlled seeds as a way of saving randomly generated levels? I know that Solitaire on Windows uses a method like this in order to replay past games, but I was wondering to what extent it would be advantageous over, say, saving array files. The way I see it, saving a single seed into either an encrypted ini or just writing and reading a single value in an external array would be a hell of a lot faster than looping through an entire array and loading everything like that, but I don't know of any problems that could crop up.
There are 10 types of people in the world: Those who understand binary and those who don't.
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
13th November, 2009 at 05:31:50 -
Its an interesting idea that I've also thought about using before but I wouldn't rely on it - not using MMF's built in seed anyway. You might accidently use a random number before loading your map in which case the map wouldn't load properly.
If you want to do this I would recommend trying one of the Random Number objects that are available because those will give you better control over the set of random numbers that you have.
If you use LUA you can define a seed which means that all levels will be loaded exactly the same.
I am not aware of a way to do this in MMF, so you would need to use LUA and have that do a lot of you code and simply do calls back to MMF passing whatever values you need.
MMF does have a random seed action. All you have to do is save/load the seed right before you use it to generate the level.
But I'd highly suggest you use one of the random generation extensions, or even generate it in Lua or something. MMF's in-built random function is not at all very random
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Get some really large numbers and take them the powers of the mouse cursors position or something.
Then take the modules of that number to whatever you want to the range to be.
You want to get a random number between 0 and 10?
Then you do this:
RandomValuePool mod 10
ta daaa!
I've done this before to generate more "random" numbers without using extra extensions, but yeah muz is right, using lua or a random extension is the way to go!
I like your suggestion, UrbanMonk. I have thought in the past about using the computer's own internal clock as a seed since I know that's another option.
There are 10 types of people in the world: Those who understand binary and those who don't.