Author Topic: MODULE: SeededRandom v1.1  (Read 2884 times)

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
MODULE: SeededRandom v1.1
« on: 22 May 2010, 20:32 »
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
« Last Edit: 21 Jan 2018, 15:32 by Kweepa »
Still waiting for Purity of the Surf II

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.0
« Reply #1 on: 23 May 2010, 16:47 »
reproducible 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.

 

abstauber

  • Cavefish
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.0
« Reply #2 on: 23 May 2010, 18:54 »
I've recently read an article about Elite just before I've seen this module :)

Do you have any plans about a space opera?

Joseph DiPerla

  • Joseph DiPerla, Adventure Game Creator Wannabe!
    • I can help with backgrounds
    • I can help with characters
    • I can help with play testing
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
Re: MODULE: SeededRandom v1.0
« Reply #3 on: 24 May 2010, 01:22 »
Steve, you never cease to amaze me.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Re: MODULE: SeededRandom v1.0
« Reply #4 on: 24 May 2010, 02:39 »
Roguelikes use seeded randoms a lot.
Why isn't anybody making a roguelike in AGS? Quick, somebody, make my dreams come true! =)

Wonkyth

  • Liscence to Misspell.
    • I can help with AGS tutoring
    • I can help with making music
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • Wonkyth worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.0
« Reply #5 on: 24 May 2010, 08:17 »
Haven't I told anyone about my roguelike sidescroller?
I really thought I had...
"But with a ninja on your face, you live longer!"

discordance

  • teach him how to rock.
    • discordance worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.0
« Reply #6 on: 24 May 2010, 20:34 »
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.

abstauber

  • Cavefish
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.0
« Reply #7 on: 24 May 2010, 20:39 »
@Wonkyth
In case you also feel like explaining how you did pathfinding, you know where to find my ears  ;)

Wonkyth

  • Liscence to Misspell.
    • I can help with AGS tutoring
    • I can help with making music
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • Wonkyth worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.0
« Reply #8 on: 25 May 2010, 11:38 »
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.
"But with a ninja on your face, you live longer!"

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.1
« Reply #9 on: 05 Jun 2010, 07:54 »
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!
Still waiting for Purity of the Surf II

cat

  • Mittens Baronet
    • cat worked on one or more games that won an AGS Award!
    •  
    • cat worked on one or more games that was nominated for an AGS Award!
Re: MODULE: SeededRandom v1.1
« Reply #10 on: 01 Jun 2019, 07:28 »
I used this module for a generated maze. Thanks!