The Daily Click ::. Forums ::. Klik Coding Help ::. Random Seed Query
 

Post Reply  Post Oekaki 
 

Posted By Message

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
13th November, 2009 at 00:37:44 -

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

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
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.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

bigredron



Registered
  07/04/2007
Points
  299
16th November, 2009 at 04:08:40 -

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.

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
16th November, 2009 at 04:44:23 -

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.

Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50152

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
16th November, 2009 at 05:00:08 -

You could always code your own random function.

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!

 
n/a

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
16th November, 2009 at 12:21:51 -

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.
   

Post Reply



 



Advertisement

Worth A Click