Thread Tools
Old November 30, 2001, 17:08   #1
Nadexander
Warlord
 
Nadexander's Avatar
 
Local Time: 09:46
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Saratoga, California
Posts: 122
Explaining of civ3 slowdown - Intractable algorithms!
As anyone that has played a game on a huge map with 16 civs has noticed that it takes a _VERY_ long time for the AI to play its turns. In trying to understand why i happened on a very important observation: when you pillage a road, destroy a harbor, conquer a city or do anything else that disrupts the trade network there is a lag time of around 30 seconds (on a 900mhz cpu). The reason that this takes forever is that calculating the existance of a connection between x number of cities and through y number of squares is proportional to x! (x factorial) In other words the cost of calculating the existance of the trade network gets exponentially larger as the number of cities and the number of map squares increases. This also explains why there is a significant slow down when the AI is at war. Think of how often the AI pillages a road or takes a city? I wager that 90% of the game turn winds up being the recalculation of the trade network. I suggest that firaxis change the game mechanics so that the trade network is only calculated at the end of turn in order to make the game playable on the huge map settings.
Nadexander is offline  
Old November 30, 2001, 17:15   #2
Peets
Warlord
 
Peets's Avatar
 
Local Time: 18:46
Local Date: October 31, 2010
Join Date: Jun 2001
Location: Belgium
Posts: 210
Hmmm, I was wondering too why it took so long time...
good job of "maybe" finding it
Well, I hope they can do something about it...
Peets is offline  
Old November 30, 2001, 17:18   #3
Asmodean
Civilization III Democracy GameThe Courts of Candle'Bre
Emperor
 
Asmodean's Avatar
 
Local Time: 19:46
Local Date: October 31, 2010
Join Date: Aug 1999
Location: Aarhus, Denmark
Posts: 3,618
If that is really so - and I suspect that you may be right there, it should be fairly easy for Firaxis to solve this - major - problem.

Maybe add a message that says (when it's your turn once again) something like: [CityX] can't build Musketeer, due to lack of supplies. Or something to that effect.

Asmodean
__________________
Im not sure what Baruk Khazad is , but if they speak Judeo-Dwarvish, that would be "blessed are the dwarves" - lord of the mark
Asmodean is offline  
Old November 30, 2001, 17:18   #4
Ferdi
Warlord
 
Ferdi's Avatar
 
Local Time: 19:46
Local Date: October 31, 2010
Join Date: Oct 1999
Location: Europe, Brussels
Posts: 108
Indeed, this problem has been reported by many other guys but without pointing the problem. I've also been faced with that and it must be DEFINITELY fixed.
Ferdi is offline  
Old November 30, 2001, 17:55   #5
Cavalier_13
Chieftain
 
Local Time: 12:46
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Montreal
Posts: 38
A wasted thread......
I went into detail of this in 2 prior posts in 2 different threads, and yet you say the same thing I did. Was a new thread really needed?

Cavalier
Cavalier_13 is offline  
Old November 30, 2001, 18:31   #6
justin_sayn
Settler
 
Local Time: 17:46
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 9
WRONG AND WRONG!
Actually Johnson's algorithm will find the shortest past between all squares in a time that is roughly proportional to (X*X)*lgX +XE (where E is the number of links, and a link is only counted between 2 squares)

I.E.: If there are 1000 squares on the map, the time of algorithm will be proportional to:
1000*1000*Lg1000 +1000*E=

Since each square is linked to 8 other squares then there are 8*1000 = 8000 links, so we have:

1000*1000*Lg1000 +1000*8000 = 1 000 000*10 + 8 000 000

Which is equal to 18 000 000.

Since the number of squares and links on the map is constant, there is no reason for the game to take an increasingly amount of time as more cities are developed. (if they were using that alogorithm of course).

Where did you ever get the X! idea?

Eitherway, whatever algorithm they use, the number of squares is always constant on the map.
justin_sayn is offline  
Old November 30, 2001, 18:36   #7
War4ever
Civilization II MultiplayerCivilization III MultiplayerCivilization II Democracy GameApolytoners Hall of Fame
Emperor
 
War4ever's Avatar
 
Local Time: 09:46
Local Date: October 31, 2010
Join Date: Dec 1969
Location: I live amongst the Red Sox Nation
Posts: 7,969
laymans terms.....all i know is standard maps are about all i have the patience for
__________________
Boston Red Sox are 2004 World Series Champions!
War4ever is offline  
Old November 30, 2001, 23:43   #8
Nadexander
Warlord
 
Nadexander's Avatar
 
Local Time: 09:46
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Saratoga, California
Posts: 122
Re: WRONG AND WRONG!
Quote:
Originally posted by justin_sayn
Actually Johnson's algorithm will find the shortest past between all squares in a time that is roughly proportional to (X*X)*lgX +XE (where E is the number of links, and a link is only counted between 2 squares)

I.E.: If there are 1000 squares on the map, the time of algorithm will be proportional to:
1000*1000*Lg1000 +1000*E=

Since each square is linked to 8 other squares then there are 8*1000 = 8000 links, so we have:

1000*1000*Lg1000 +1000*8000 = 1 000 000*10 + 8 000 000

Which is equal to 18 000 000.

Where did you ever get the X! idea?

Eitherway, whatever algorithm they use, the number of squares is always constant on the map.
assuming a square map of side x
number of squares is x^2
number of paths between any two squares X^4
time to find a path between two given squares: worst case
is X^2 so time to find path between all given squares is x^6
So i messed up saying that its non-polynomial. Its but its not pretty thats for sure. Doubling the map size will make it so that it takes something like 50 times as long. And you also need to consider that the bigger the map, the larger the number of units running around and pillaging things so the more often the paths need to be calculated.
Nadexander is offline  
Old November 30, 2001, 23:44   #9
Nadexander
Warlord
 
Nadexander's Avatar
 
Local Time: 09:46
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Saratoga, California
Posts: 122
Re: WRONG AND WRONG!
Quote:
Originally posted by justin_sayn
Actually Johnson's algorithm will find the shortest past between all squares in a time that is roughly proportional to (X*X)*lgX +XE (where E is the number of links, and a link is only counted between 2 squares)

I.E.: If there are 1000 squares on the map, the time of algorithm will be proportional to:
1000*1000*Lg1000 +1000*E=

Since each square is linked to 8 other squares then there are 8*1000 = 8000 links, so we have:

1000*1000*Lg1000 +1000*8000 = 1 000 000*10 + 8 000 000

Which is equal to 18 000 000.

Since the number of squares and links on the map is constant, there is no reason for the game to take an increasingly amount of time as more cities are developed. (if they were using that alogorithm of course).

Where did you ever get the X! idea?

Eitherway, whatever algorithm they use, the number of squares is always constant on the map.
This is only for finding a path for any two given points (which worst case can never take more steps than the number of squares on the map. However It needs to calcualte the pairwise linking for any two cities (to see if it could be accessing a resource from that city.
Nadexander is offline  
Old December 1, 2001, 03:11   #10
Archmage
Chieftain
 
Local Time: 11:46
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Arizona Nevada border
Posts: 40
Uuuuh....must find tylenol.......uhhhhghhhh
Archmage is offline  
Old December 1, 2001, 03:14   #11
Magician
Chieftain
 
Magician's Avatar
 
Local Time: 03:46
Local Date: November 1, 2010
Join Date: Nov 2001
Location: HK
Posts: 46
Re: Re: WRONG AND WRONG!
Quote:
Originally posted by Nadexander


This is only for finding a path for any two given points (which worst case can never take more steps than the number of squares on the map. However It needs to calcualte the pairwise linking for any two cities (to see if it could be accessing a resource from that city.
As far as I know Johnson's algorithm is capable of finding all pair shortest path. It is not limited to finding a path from two vertex alone.

Btw, I don't think this is a shotest-path problem. If you find a path (trade route) from one city to another, no matter it is the shortest or not, will be accepted. Using shortest path algo will enumerate all vertex which is a big overhead.

So playing on a large/huge map != long wait. although the chance is higher.
Magician is offline  
Old December 2, 2001, 04:57   #12
Combat Ingrid
Prince
 
Combat Ingrid's Avatar
 
Local Time: 02:46
Local Date: November 1, 2010
Join Date: Nov 2001
Location: Smothered in delicious yellow chemical sludge.
Posts: 782
Maybe they should include DNA computers with the patch, they are supposed to be very efficient at doing this kind of stuff
__________________
The enemy cannot push a button if you disable his hand.
Combat Ingrid 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 13:46.


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