Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Kweepa on Sat 22/05/2010 20:32:00

Title: MODULE: SeededRandom v1.1
Post by: Kweepa on Sat 22/05/2010 20:32:00
Here's a module to allow you to have a reproducible random number stream.

http://www.kweepa.org/step/ags/tech/SeededRandom.scm (2k)

Functions are:

RandomSetSeed(int seed)
RandomSetSeedString(String seedString)
int RandomInt()
float RandomFloat()
int RandomMax()
int RandomRange(int max)


See the header/code for more details.
Steve

Version History:
1.1 Updated to use x = (16809*x)%(2^31-1), so it has a period of ~2^31 instead of ~2^16
1.0 Initial version
Title: Re: MODULE: SeededRandom v1.0
Post by: Monsieur OUXX on Sun 23/05/2010 16:47:14
Quote from: SteveMcCrea on Sat 22/05/2010 20:32:00reproducible random number stream.

Very useful for those who want to create procedural universe, but don't want to store everything in memory. The seed is enough.

Think of the random dungeons in early RPGs (but it's still the same dungeon if you visit it twice).

I say yey for Steve.

Title: Re: MODULE: SeededRandom v1.0
Post by: abstauber on Sun 23/05/2010 18:54:20
I've recently read an article about Elite just before I've seen this module :)

Do you have any plans about a space opera?
Title: Re: MODULE: SeededRandom v1.0
Post by: Joseph DiPerla on Mon 24/05/2010 01:22:43
Steve, you never cease to amaze me.
Title: Re: MODULE: SeededRandom v1.0
Post by: Jim Reed on Mon 24/05/2010 02:39:23
Roguelikes use seeded randoms a lot.
Why isn't anybody making a roguelike in AGS? Quick, somebody, make my dreams come true! =)
Title: Re: MODULE: SeededRandom v1.0
Post by: Wonkyth on Mon 24/05/2010 08:17:04
Haven't I told anyone about my roguelike sidescroller?
I really thought I had...
Title: Re: MODULE: SeededRandom v1.0
Post by: discordance on Mon 24/05/2010 20:34:45
Quote from: Jim Reed on Mon 24/05/2010 02:39:23
Roguelikes use seeded randoms a lot.
Why isn't anybody making a roguelike in AGS? Quick, somebody, make my dreams come true! =)

I tried :) Then gave up and started writing it in python. AGS isn't great if you want to use ascii.
Title: Re: MODULE: SeededRandom v1.0
Post by: abstauber on Mon 24/05/2010 20:39:56
@Wonkyth
In case you also feel like explaining how you did pathfinding, you know where to find my ears  ;)
Title: Re: MODULE: SeededRandom v1.0
Post by: Wonkyth on Tue 25/05/2010 11:38:03
Oh, it's still got a long way to go before it's ready for that, but mostly it relies on strong AI in all parts of the code, handling things dynamically.
Title: Re: MODULE: SeededRandom v1.1
Post by: Kweepa on Sat 05/06/2010 07:54:17
Updated the random number generator to have a period of about 2^31 instead of about 2^16, using the 'minimum standard' generator described in Park and Miller's 1988 paper:
http://www.firstpr.com.au/dsp/rand31/p1192-park.pdf
This is a great generator because it works with signed ints as provided by AGS scripting. Most simple generators rely on unsigned ints or smaller word lengths.
So, err, hooray!
Title: Re: MODULE: SeededRandom v1.1
Post by: cat on Sat 01/06/2019 07:28:38
I used this module for a generated maze (https://www.adventuregamestudio.co.uk/site/games/game/2348/). Thanks!