View unanswered posts | View active topics It is currently Thu Mar 28, 2024 3:30 am



Reply to topic  [ 15 posts ] 
 Randomize universe not so random... 
Author Message
Gameop
User avatar

Joined: Wed May 05, 2004 2:00 am
Posts: 190
Location: Oklahoma City OK
Unread post Randomize universe not so random...
While doing a few Big Bangs today I noticed when randomizing the random seed, the number simply seems to increase like system ticks...

It was on 222267xxxxxx and the numbers kept moving up incrementially whenever I randomized. Never once did the number decrease. And the first few numbers remained the same.

I'll bet its using system ticks (how windows tells its uptime) as a random number?

Ticks is a duration... for example 2257382261 represents 3wks 5days 3hrs 2mins 56secs which is my current winxp home uptime.

Not really a bug but its not random either. Its just a big number that counts up.

K. Tyson

_________________
Scolfax's TradeWars
telnet://twgs.mustangpc.net
ICQ: 5342886


Fri Jan 13, 2012 5:20 pm
Profile ICQ WWW
Site Admin
User avatar

Joined: Sun Dec 24, 2000 3:00 am
Posts: 3150
Location: USA
Unread post Re: Randomize universe not so random...
It just uses the standard Delphi randomize function, which I think does use system ticks to generate a seed. This is a random seed, btw, not a random number. So the important thing is that it's different, not that it's random. A seed that changes by 1 will generate a very different random sequence from the previous seed.

However, if it isn't changing every time you enter 0, that would be a bug. I'll have a look at that.

_________________
John Pritchett
EIS
---
Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.


Fri Jan 13, 2012 5:31 pm
Profile WWW
Gameop
User avatar

Joined: Wed May 05, 2004 2:00 am
Posts: 190
Location: Oklahoma City OK
Unread post Re: Randomize universe not so random...
it does change every time.

_________________
Scolfax's TradeWars
telnet://twgs.mustangpc.net
ICQ: 5342886


Fri Jan 13, 2012 5:41 pm
Profile ICQ WWW
Site Admin
User avatar

Joined: Sun Dec 24, 2000 3:00 am
Posts: 3150
Location: USA
Unread post Re: Randomize universe not so random...
Ok, cool. You said "And the first few numbers remained the same", so I thought you meant a few times the number failed to change. Then it's working as expected. The main thing is that even if a number changes by 1, the universe should be vastly different.

_________________
John Pritchett
EIS
---
Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.


Fri Jan 13, 2012 5:45 pm
Profile WWW
Gameop
User avatar

Joined: Wed May 05, 2004 2:00 am
Posts: 190
Location: Oklahoma City OK
Unread post Re: Randomize universe not so random...
I'm sorry I was a little vague on that sentence. What i meant to say was the xxxxx's were changing. What i expected to see was big jumps across the whole spectrum. Although I'm sure this behaviour has nothing to do with the version, I imagine its been the same all this time and i just noticed today.

:)

_________________
Scolfax's TradeWars
telnet://twgs.mustangpc.net
ICQ: 5342886


Fri Jan 13, 2012 5:50 pm
Profile ICQ WWW
Site Admin
User avatar

Joined: Sun Dec 24, 2000 3:00 am
Posts: 3150
Location: USA
Unread post Re: Randomize universe not so random...
Well, I appreciate the scrutiny. Others notice things I'd never notice.

_________________
John Pritchett
EIS
---
Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.


Sat Jan 14, 2012 3:41 am
Profile WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: Randomize universe not so random...
scolfax wrote:
I'll bet its using system ticks (how windows tells its uptime) as a random number?


That's pretty conventional. That number is used as a seed to a pseudo-random number generator, which means it selects one of the many possible sequences of pseudo-random numbers the PRNG can produce. Just because two of those sequences happen to be consecutive, like 2257382261 and 2257382262, does not mean that they will bear any resemblance to each other. At least not if the PRNG is good.

Generating randomness on computers is a whole subject unto itself. It's difficult because computers are inherently deterministic. Pseudo-random numbers have some random properties, and they're good enough for purposes like games. Some are good enough for purposes like cryptography. UNIX-like operating systems gather "entropy" from things like user keystrokes to seed the system PRNG. But a true RNG requires special hardware... like a small piece of radioactive material and a geiger counter.

_________________
Suddenly you're Busted!


Sat Jan 14, 2012 9:29 am
Profile WWW
Gameop
User avatar

Joined: Wed May 05, 2004 2:00 am
Posts: 190
Location: Oklahoma City OK
Unread post Re: Randomize universe not so random...
It would be more to the point to build a random number from ten random numbers put together:

$rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9)

etc.

I realize my scripting language is probably different than what you use. But building a randomize script isnt all that difficult you dont have to draw entropy from system ticks. Linux has a random number generator built in, however in windows it lacks the generator so you either have two choices: build your own random number generator or use windows ticks.

_________________
Scolfax's TradeWars
telnet://twgs.mustangpc.net
ICQ: 5342886


Sat Jan 14, 2012 11:45 am
Profile ICQ WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: Randomize universe not so random...
That would not give you any better randomness.

You can think of any PRNG as a 2-dimensional array of pseudo-random numbers. It doesn't actually contain a huge array, as that would consume a lot of memory. But any particular row of that array is deterministically generated from its row number, i.e., its "seed". Given the same seed, the PRNG will always produce exactly the same sequence of "random" numbers.

The seed has to come from somewhere, and using the system time is good because at least it changes frequently. If you seed your PRNG with an unchanging value, and then build a random number from the first ten values it produces, you would get the same value every time.

_________________
Suddenly you're Busted!


Sat Jan 14, 2012 1:12 pm
Profile WWW
Ambassador

Joined: Wed Feb 28, 2001 3:00 am
Posts: 1410
Location: Boo! inc. Ireland
Unread post Re: Randomize universe not so random...
It is impossible to generate a random number string by computer.
By definition, if it is generated, it is not random.

Arguably it is not possible by any means, even by quantum mechanics.


Sat Jan 14, 2012 3:23 pm
Profile
Gameop
User avatar

Joined: Wed May 05, 2004 2:00 am
Posts: 190
Location: Oklahoma City OK
Unread post Re: Randomize universe not so random...
Zero Point Energy is random

From Wikipedia, the free encyclopedia
Zero-point energy is the lowest possible energy that a quantum mechanical physical system may have; it is the energy of its ground state. All quantum mechanical systems undergo fluctuations even in their ground state and have an associated zero-point energy, a consequence of their wave-like nature. The uncertainty principle requires every physical system to have a zero-point energy greater than the minimum of its classical potential well, even at absolute zero. For example, liquid helium does not freeze under atmospheric pressure at any temperature because of its zero-point energy.

There's a book by Moray B. King called "Tapping The Zero Point Energy", how free energy and antigravity might be possible with today's physics.

But it has nothing to do with programming or tradewars. But it has to do with Outer Space... which i hope is why we're all here? Until we can get our own ships and be space taxi drivers and haulers we'll just play some TradeWars!!!!

_________________
Scolfax's TradeWars
telnet://twgs.mustangpc.net
ICQ: 5342886


Sat Jan 14, 2012 3:47 pm
Profile ICQ WWW
Gameop
User avatar

Joined: Wed May 05, 2004 2:00 am
Posts: 190
Location: Oklahoma City OK
Unread post Re: Randomize universe not so random...
Pure Energy Systems wiki has a directory listing for Moray B. King:

http://peswiki.com/index.php/Directory:Moray_B_King
enjoy :)

_________________
Scolfax's TradeWars
telnet://twgs.mustangpc.net
ICQ: 5342886


Sat Jan 14, 2012 3:49 pm
Profile ICQ WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: Randomize universe not so random...
Yes, but I highly doubt you have a source of quantum randomness built into your hardware. :lol:

_________________
Suddenly you're Busted!


Sat Jan 14, 2012 3:53 pm
Profile WWW
Site Admin
User avatar

Joined: Sun Dec 24, 2000 3:00 am
Posts: 3150
Location: USA
Unread post Re: Randomize universe not so random...
The determinism of a random sequence is actually very important to gameplay. Many games I've written could not function with a true random number generator. TW tends to rely more on true randomness, but many games need to be fully deterministic. The whole point of the random seed in Bigbang isn't to make sure the game generates vastly different universes every time you run it. That's easy. The point is so that it can generate the same universe if you want. If you provide the seed to someone else, they can generate the same universe.

At one point, I actually did write my own random number generator for TW. A random number generator clearly generates a wide range of values that eventually average to a median value, but it's also important how much a random sequence can deviate from that median and also how long those windows of deviation can be, and that behavior has serious implications on gameplay. Take busting, for example. If someone busts 10 times in a row, that's kind of lame. Yet it's possible with even the best random generator, especially given enough samples. But maybe it's better to have a generator that limits these long windows of deviation. It's not quite as random, but better for gameplay. I do that kind of thing on TW. At this point, I use the standard generator for Delphi, but I filter the values in order to achieve a more desirable distribution. One example is a weighted random function that give you a very different distribution than a typical homogeneous random generator. The odds of achieving a lower value are increased or decreased based on a scale.

Obviously randomness plays a huge role in TW. Changes to the generator would effect how much deviation there can be in the results of ship combat, for example. You could have a situation where, with odds of 0.5:1, player A loses 500 fighters to player B's 1000 fighters with very little deviation. Or you could have a much longer deviation window where player A might lose 100 fighters to player B's 1000. Over a long enough window, player A and player B would have the expected 0.5:1 odds. With a deviation window that's long compared to the typical fighter wave, you could expect very erratic localized results, while a small deviation window relative to fighter wave would provide a very consistent outcome.

_________________
John Pritchett
EIS
---
Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.


Sat Jan 14, 2012 3:56 pm
Profile WWW
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2559
Location: Oklahoma City, OK 73170 US
Unread post Re: Randomize universe not so random...
Perhaps you could explain this to Pogo. The dice on their Risk game have a lot to be desired :)

_________________
Regards,
Micro

Website: http://www.microblaster.net
TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002

ICQ is Dead Jim! Join us on Discord:
https://discord.gg/zvEbArscMN


Sat Jan 14, 2012 7:26 pm
Profile ICQ YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 15 posts ] 

Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.