Thread Tools
Old August 27, 2002, 19:15   #31
Theseus
PtWDG Gathering StormApolyton UniversityApolytoners Hall of FameBtS Tri-LeagueC4DG Gathering StormApolyCon 06 Participants
Emperor
 
Theseus's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The warmonger formerly known as rpodos. Gathering Storm!
Posts: 8,907
Actually, Thrawn05 makes a good point... I'm playing the Banana Island game that Sir Ralph designed (waaay fun, btw), and being willing to lose some Galleys is critical.

(BUT, losing 2 Galleys and 4 Swordsmen in my first overseas attack was probably the most painful event in the history of Civ)

Glad to see you hanging around, Soren.
__________________
The greatest delight for man is to inflict defeat on his enemies, to drive them before him, to see those dear to them with their faces bathed in tears, to bestride their horses, to crush in his arms their daughters and wives.

Duas uncias in puncta mortalis est.
Theseus is offline  
Old August 27, 2002, 19:28   #32
N. Machiavelli
Prince
 
N. Machiavelli's Avatar
 
Local Time: 07:56
Local Date: November 1, 2010
Join Date: Nov 2001
Location: THE Prince
Posts: 359
I appreciate the word Soren. If you've been forced to repeat yourself a million times across as many threads, I apologise for adding one to the list.

Just curious was all. Anywho, I'm content and appreciative.
N. Machiavelli is offline  
Old August 27, 2002, 19:29   #33
Ethelred
King
 
Ethelred's Avatar
 
Local Time: 22:56
Local Date: October 31, 2010
Join Date: Mar 2002
Location: Anaheim, California
Posts: 1,083
Quote:
Originally posted by Thrawn05


So there is no AI fuction called: AmIFeelingLuckyThisTurn() ?
I have a function called

IF My galleys have looked at all the tiles they can

AND its not a Pangea Map

THEN its time to head STRAIGHT out near the equator.

I once made a bundle that way when I was the only civ with contacts between the two major land masses. Its dangerous though. My first galley sank just as it spotted the boundry of one of the Civs. I got a bit luckier with the second galley I sent as it made it to the coast.
Ethelred is offline  
Old August 27, 2002, 20:05   #34
Zachriel
King
 
Zachriel's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2001
Location: U.S.A.
Posts: 1,194
Quote:
Originally posted by N. Machiavelli
Sure it does. For one thing, the random number sequence, is exactly that: a sequence, or list of random numbers created at the begining of each 'turn'.
When the AI decides to move into the ocean, it could check the randomizer, but the next randomizer result is not the number that is used to determine whether the galley sinks or not. Rather, the AI completes its turn; then the human makes its turn, taking an indeterminant number of randomizer results from the top of the "stack." Finally, the randomizer is called to determine whether the galley would sink or not. There is no way the AI could know which result would be used because it can't predict how many calls to the randomizer will occur during the human's turn.

Unless you send your galleys out on dangerous transoceanic missions you wouldn't necessarily know that the galley does not sink at the time you move it, but not until the next turn.



http://www.zachriel.com/gotm9/ad0170-Exploration.htm
Zachriel is offline  
Old August 27, 2002, 20:24   #35
N. Machiavelli
Prince
 
N. Machiavelli's Avatar
 
Local Time: 07:56
Local Date: November 1, 2010
Join Date: Nov 2001
Location: THE Prince
Posts: 359
Ah, I see. I was thinking that when the movement was concluded, the call was made, (i.e. galley moves to ocean square on final move, then triggering the call to the RNG which would mark it as 'fine' or 'lost'), then continuing with the rest of the turn. I didn't think about the call to the RNG for that specific function to be made at the begining of the individual Civ's turns. Good point Zach, thanks.
N. Machiavelli is offline  
Old August 27, 2002, 22:44   #36
Jaybe
Mac
Emperor
 
Jaybe's Avatar
 
Local Time: 23:56
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Henderson, NV USA
Posts: 4,168
Oh, nooo. That's not how it's done, Zach. The random number is done when you finish moving the galley, the number is reserved until the start of the next turn, when it takes effect!

(JUST KIDDING (I hope))
__________________
JB
I play BtS (3.19) -- Noble or Prince, Rome, marathon speed, huge hemispheres (2 of them), aggressive AI, no tech brokering. I enjoy the Hephmod Beyond mod. For all non-civ computer uses, including internet, I use a Mac.
Jaybe is offline  
Old August 28, 2002, 08:36   #37
Zachriel
King
 
Zachriel's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2001
Location: U.S.A.
Posts: 1,194
Quote:
Originally posted by Jaybe
Oh, nooo. That's not how it's done, Zach. The random number is done when you finish moving the galley, the number is reserved until the start of the next turn, when it takes effect!

(JUST KIDDING (I hope))
Now that you mention it. . . . I don't normally reload, so I don't know for sure. That is a very good point. I would be more than happy to admit my error.

Does anyone know for sure?
Zachriel is offline  
Old August 28, 2002, 08:58   #38
vondrack
lifer
InterSite Democracy Game: Apolyton TeamCivilization III PBEMCivilization IV PBEMPtWDG Legoland
Emperor
 
vondrack's Avatar
 
Local Time: 07:56
Local Date: November 1, 2010
Join Date: Jan 2002
Location: Praha, Czech Republic
Posts: 5,581
Hm... speaking of "peeking" at future RNG numbers... I think you can't actually do that. As soon as you "peek" at the RNG number that is "to be generated next time" (i.e. as soon as you call the randomizer routine), the number at the top of the stack is actually generated and it is "used up"... the next call will return something different. So you can theoretically find out what would the next "useful" random number be, IF YOU HAVEN'T TAKEN A LOOK.

Of course, if you first call the RNG engine several times and make a table containing the results, then you can have a look without influencing the results. But I can't see a reason for implementing the randomness this way... other than allowing the AI to know... But then, it would be easier to completely avoid using RNGs for the AI...

Soren, am I right? Or is it - even if only theoretically - possible to "just have a look" at the next RNG number, without actually "using it up"?
vondrack is offline  
Old August 28, 2002, 09:15   #39
metalhead
Warlord
 
metalhead's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Apr 2002
Location: USA
Posts: 158
First, I think we can all assume the people who claim to have seen AI Galleys on sea/ocean without proper tech or wonder have been smoking the pipe of peace with Hiawatha a little too often. Proving that you had seen this would be pretty easy - if you think you saw it, trade for the AI civ's map. Look at their diplomacy screen. Check the wonder screen. Take screenshots of all of them. Post them. Show where the AI's map has explored sea/ocean.

Of course, all this isn't necessary if someone would just post a shot of the AI galley on sea/ocean without tech/wonder - which NOBODY has done! Can we please, please, PLEASE put this topic to rest? Can we perhaps pick Soren's brain for some real info, rather than **** we all should already know?

Oh, and the ability of the player to traverse squares by taking the chance of sinking is a HUGE advantage over the AI. That's what makes all of these discussions even funnier. Rarely a game goes by where I don't end a turn (usually several) with a Galley on sea or ocean. Even if the AI could end turns there (WHICH THEY CAN'T!!!), I would just think, well, good for them. I do it all the time!
__________________
Wadsworth: Professor Plum, you were once a professor of psychiatry specializing in helping paranoid and homicidal lunatics suffering from delusions of grandeur.
Professor Plum: Yes, but now I work for the United Nations.
Wadsworth: Well your work has not changed.
metalhead is offline  
Old August 28, 2002, 09:18   #40
vulture
PtWDG Gathering StormPtWDG2 Mohammed Al-SahafC4DG Gathering Storm
King
 
vulture's Avatar
 
Local Time: 07:56
Local Date: November 1, 2010
Join Date: Jun 2001
Location: Leeds, UK
Posts: 1,257
There are times when creating a table of future random numbers is relevant. One of the physics software libraries I use includes a PRNG that returns an array of N random numbers (you tell it how many you want) instead of a single number. The reason for this is for speed though - lots of simulations get to spend a fair fraction of their time in the PRNG routines, 'cos they need random numbers by the bucket load, and generating an array of 1000 numbers involves a smaller overhead of time than calling a routine 1000 times to generate 1 number each time.

But since I really doubt that civ3 is spending most of its CPU time generating random numbers (it doesn't really need the more time consuming high-quality RNGs that some physics simulations do) then there is no reason to go beyond a standard PRNG which just returns the next value.
vulture is offline  
Old August 28, 2002, 10:11   #41
vondrack
lifer
InterSite Democracy Game: Apolyton TeamCivilization III PBEMCivilization IV PBEMPtWDG Legoland
Emperor
 
vondrack's Avatar
 
Local Time: 07:56
Local Date: November 1, 2010
Join Date: Jan 2002
Location: Praha, Czech Republic
Posts: 5,581
Quote:
Originally posted by vulture
There are times when creating a table of future random numbers is relevant. One of the physics software libraries I use includes a PRNG that returns an array of N random numbers (you tell it how many you want) instead of a single number. The reason for this is for speed though - lots of simulations get to spend a fair fraction of their time in the PRNG routines, 'cos they need random numbers by the bucket load, and generating an array of 1000 numbers involves a smaller overhead of time than calling a routine 1000 times to generate 1 number each time.

But since I really doubt that civ3 is spending most of its CPU time generating random numbers (it doesn't really need the more time consuming high-quality RNGs that some physics simulations do) then there is no reason to go beyond a standard PRNG which just returns the next value.
Yep, I should have probably made more clear that I was speaking about Civ3 only in my previous post. I understand that having a large set of pre-generated pseudo-random values may sometimes be needed. My question for Soren was also meant in Civ3 context only - if there is any pre-generated pseudo-random number table used in Civ3... or if it is done the obvious way, by just calling the RNG routine every time...
vondrack is offline  
Old August 28, 2002, 11:13   #42
Jaybe
Mac
Emperor
 
Jaybe's Avatar
 
Local Time: 23:56
Local Date: October 31, 2010
Join Date: Sep 2001
Location: Henderson, NV USA
Posts: 4,168
Quote:
Originally posted by vondrack
... if there is any pre-generated pseudo-random number table used in Civ3... or if it is done the obvious way, by just calling the RNG routine every time...
When the seed isn't regenerated with every call, as is the default in Civ3, doesn't that directly imply that they are using the "pre-generated pseudo-random number table?"

Geez, I didn't mean to open a can of worms, I was just nitpicking!
Jaybe is offline  
Old August 28, 2002, 11:22   #43
Zachriel
King
 
Zachriel's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2001
Location: U.S.A.
Posts: 1,194
Quote:
Originally posted by Jaybe

When the seed isn't regenerated with every call, as is the default in Civ3, doesn't that directly imply that they are using the "pre-generated pseudo-random number table?"
[i]
No. Each result of the PRNG may be pre-destined, but not pre-generated.
Zachriel is offline  
Old August 28, 2002, 13:21   #44
WarpStorm
King
 
WarpStorm's Avatar
 
Local Time: 01:56
Local Date: November 1, 2010
Join Date: Nov 2001
Location: Right down the road
Posts: 2,321
Here is the guts of the standard PRNG (I don't know if Firaxis uses it or one of the many others available)

return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);

holdrand is the previous "random" number.
__________________
Seemingly Benign
Download Watercolor Terrain - New Conquests Watercolor Terrain
WarpStorm is offline  
Old August 28, 2002, 13:28   #45
Hurricane
Warlord
 
Hurricane's Avatar
 
Local Time: 08:56
Local Date: November 1, 2010
Join Date: May 2001
Location: Arctic Hill
Posts: 266
Quote:
Originally posted by Hurricane
This is certainly NOT true. That statement is in fact ridiculous if you think about it. The AI has NO chance of knowing what the RNG will be. Remember, sinking is not determined when you enter the sea/ocean tile, but JUST BEFORE your next movement turn. Even if the AI knew exactly ALL random numbers coming up, it would have to know IN ADVANCE all AI moves, human moves as well as the exact result of the combats and diplomacy that happens after it ends its turn and before it begins its next.

As you can see, while the AI in theory could know which RNG numbers are coming up, it has no way of knowing which one of those will be used to determine if the Galley sinks or not.
Does NOBODY read my posts! Zachriel had to repeat this same stuff for people to get it.

Zachriel:
Quote:
Now that you mention it. . . . I don't normally reload, so I don't know for sure. That is a very good point. I would be more than happy to admit my error.

Does anyone know for sure?
Galley sinking is determined JUST BEFORE your movement phase. This is easy to determine by seeing your galley sink, reload at the end of your previous turn, use up a random number and note that it didn't sink this time. It is also widely known that NO random numbers are used for ANY kind of movement. Including moving sea units into dangerous squares.
Hurricane is offline  
Old August 28, 2002, 13:30   #46
Ethelred
King
 
Ethelred's Avatar
 
Local Time: 22:56
Local Date: October 31, 2010
Join Date: Mar 2002
Location: Anaheim, California
Posts: 1,083
Quote:
Originally posted by vondrack


Soren, am I right? Or is it - even if only theoretically - possible to "just have a look" at the next RNG number, without actually "using it up"?
Well I am not Soren but the answer is YES.

All you have to do is keep track of the SEED you started with and the number of times you called the RNG. If you use the same seed and generate the same number of PSUEDO-random numbers you will always get the same result. Its just an algorithym and it does the exact same thing every time you give it the same seed. ALL computer generated random numbers are psuedo random rather than really random.

This is the same basic principle in data encryption. A complex algorythim is used to convert data into a psuedo random sequence. As long as you have the encryption key (SEED NUMBER) and the algorythim you can put all back together again exactly as it was originally.
Ethelred is offline  
Old August 28, 2002, 13:32   #47
Hurricane
Warlord
 
Hurricane's Avatar
 
Local Time: 08:56
Local Date: November 1, 2010
Join Date: May 2001
Location: Arctic Hill
Posts: 266
Quote:
Originally posted by WarpStorm
Here is the guts of the standard PRNG (I don't know if Firaxis uses it or one of the many others available)

return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);

holdrand is the previous "random" number.
This is how the seed is calculated in Civ3 (Civ III uses a linear congruential RNG):

Code:
seed = (seed * 1103515245) + 12345
Hurricane is offline  
Old August 28, 2002, 13:50   #48
WarpStorm
King
 
WarpStorm's Avatar
 
Local Time: 01:56
Local Date: November 1, 2010
Join Date: Nov 2001
Location: Right down the road
Posts: 2,321
Hurricane, how did you find that Civ3 uses that function? The code I posted came from Microsoft's rand() function in the C Run Time Library. As you can see, it is also a basic linear congruential RNG with a 32 bit seed with a 15 bit positive output.
__________________
Seemingly Benign
Download Watercolor Terrain - New Conquests Watercolor Terrain
WarpStorm is offline  
Old August 28, 2002, 14:01   #49
Zachriel
King
 
Zachriel's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2001
Location: U.S.A.
Posts: 1,194
Quote:
Originally posted by Hurricane

Galley sinking is determined JUST BEFORE your movement phase. This is easy to determine by seeing your galley sink, reload at the end of your previous turn, use up a random number and note that it didn't sink this time. It is also widely known that NO random numbers are used for ANY kind of movement. Including moving sea units into dangerous squares.
Thanks. I figured that was the answer, but I wasn't able to test it myself.
Zachriel is offline  
Old August 29, 2002, 06:48   #50
Hurricane
Warlord
 
Hurricane's Avatar
 
Local Time: 08:56
Local Date: November 1, 2010
Join Date: May 2001
Location: Arctic Hill
Posts: 266
Quote:
Originally posted by WarpStorm
Hurricane, how did you find that Civ3 uses that function? The code I posted came from Microsoft's rand() function in the C Run Time Library. As you can see, it is also a basic linear congruential RNG with a 32 bit seed with a 15 bit positive output.
That code was discovered by hwinkels on the other forum. You can read it here: http://forums.civfanatics.com/showth...=&pagenumber=2
Hurricane is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:56.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team