View Full Version : Slow AI turns
Andvare Mar 22, 2010, 07:57 PM I love the gigantic earth map (even though there are too many resources), and pretty much only play that. The map is a bit large, and becomes quite slow in the end, so I saw that AND advertised being faster, and here I am.
But though my own turns are quick and responsive, the AI turns have become excruciatingly slow, far slower than "vanilla" ROM.
So my question is, is there any sub-addon that could be causing this slowdown?
Afforess Mar 22, 2010, 10:17 PM I'm not sure what you mean...
The amount of time your turn takes depends on how long you take. The game doesn't control that. If you sit and leave your computer for an hour, your turn will have taken an hour. AND doesn't change that...
As for the AI, the time they take to complete a turn takes seconds, less usually.
I'm not sure what you are talking about? Is the time in-between turns slow? What? Can you clarify what you mean?
Andvare Mar 22, 2010, 10:25 PM Sure.
It's the time in between turns that is unusually slow.
Vanilla ROM didn't have the same problem.
Afforess Mar 22, 2010, 10:41 PM Sure.
It's the time in between turns that is unusually slow.
Vanilla ROM didn't have the same problem.
I'm not trying to insult you; it's just that this is mathematically impossible.
A New Dawn is at least 50% faster (in respect to turns) than vanilla RoM. I can't vouch for any other modmods of RoM in the modmods forum, but I know that if you use RoM & AND, you will have a faster game.
As for why it is impossible, I discussed the RoM slowdown problem (http://forums.civfanatics.com/showthread.php?t=342393) in this thread a few months back. Since Zappara was/is unwilling to make SDK changes, I began the task of fixing the problem. That was the earliest beginnings of A New Dawn.
If you doubt me, you can test the game speed for yourself. Get a clean copy of Rise of Mankind 2.9, and load a standard size game on normal speed. Start a timer, and use AI Auto Play (Control-A) to let the AI play for 100 turns. When the AI finishes, clock the time. Install A New Dawn 1.70beta3, and repeat. I will guarantee that A New Dawn is at least 50% faster.
Hydromancerx Mar 22, 2010, 11:45 PM Its true! I use to not be able to play with anything larger than a small map and I would not even think of using extra features like revolutions. Yet now with all the improvements Afforess has done I can not only play on a large size map but enable all the bells and whistles like revolutions.
szemek77 Mar 23, 2010, 02:26 AM A New Dawn is at least 50% faster (in respect to turns) than vanilla RoM.
This is true. RoM, no matter how great the mod is, would be almost unplayable due to the fact, how slow it is, especially on bigger maps/more civs. Beside the fact of many other great improvements, we should thank you Afforess zillion times for speed optimalization.
Andvare: you can't compare RoM/AND to Vanilla.... Taking content/features into consideration, I would say, RoM/AND is MUCH bigger and MUCH more complicated game. For example, tech tree is probably 4 times bigger in the MOD, than it used to be in Vanilla.
Not to mention that you play on gigantic maps, while Vanilla offers huge size as maximum.
No contest.
Andvare Mar 23, 2010, 03:03 AM I'm not trying to insult you; it's just that this is mathematically impossible.
A New Dawn is at least 50% faster (in respect to turns) than vanilla RoM. I can't vouch for any other modmods of RoM in the modmods forum, but I know that if you use RoM & AND, you will have a faster game.
As for why it is impossible, I discussed the RoM slowdown problem (http://forums.civfanatics.com/showthread.php?t=342393) in this thread a few months back. Since Zappara was/is unwilling to make SDK changes, I began the task of fixing the problem. That was the earliest beginnings of A New Dawn.
If you doubt me, you can test the game speed for yourself. Get a clean copy of Rise of Mankind 2.9, and load a standard size game on normal speed. Start a timer, and use AI Auto Play (Control-A) to let the AI play for 100 turns. When the AI finishes, clock the time. Install A New Dawn 1.70beta3, and repeat. I will guarantee that A New Dawn is at least 50% faster.
As I said, I have tried a clean install of ROM (not 2.9 though), and it was choppy in the late game. AND isn't choppy like RoM is, when it's my turn, but really slow between turns.
I wouldn't ask the question, if it wasn't there.
It's really strange. I can't find a reason for the slowness. I'll try to reinstall it, as I didn't install all the components, so perhaps some there is some conflict somewhere.
This is true. RoM, no matter how great the mod is, would be almost unplayable due to the fact, how slow it is, especially on bigger maps/more civs. Beside the fact of many other great improvements, we should thank you Afforess zillion times for speed optimalization.
Andvare: you can't compare RoM/AND to Vanilla.... Taking content/features into consideration, I would say, RoM/AND is MUCH bigger and MUCH more complicated game. For example, tech tree is probably 4 times bigger in the MOD, than it used to be in Vanilla.
Not to mention that you play on gigantic maps, while Vanilla offers huge size as maximum.
No contest.
I never compared ROM to BTS. That would be like comparing fast food to a gourmet restaurant. While it's still filling and fast, it is a bit bland, boring and with fewer choices.
When I said "vanilla", I meant the unmodded RoM.
szemek77 Mar 23, 2010, 03:26 AM I never compared ROM to BTS. That would be like comparing fast food to a gourmet restaurant. While it's still filling and fast, it is a bit bland, boring and with fewer choices. When I said "vanilla", I meant the unmodded RoM.
Yeah, sorry, my mistake.
ruskyandrei Mar 23, 2010, 04:41 AM I have noticed this myself, so i tried to get a little test going, since i had two similar saves, one in RoM/AND (1.70 Beta3) and the other in vanilla RoM.
Here's what i found:
Vanilla RoM Save:
Large Earth2 Map, Epic Speed, ~18 civs present
Industrial Era, 36 cities (my own, about 127 world wide)
Time between turns: Varies from 20-40s
RoM + AND 1.70Beta3 Save:
Large Pw2 Map, Epic Speed, ~18 civs present
Industrial Era, 29 cities (my own, about 100 world wide)
Time between turns: Varies from 1m:20s-2m
Reading this post actually got me to go back to vanilla RoM to check out the speed and i was surprised to see it go faster, it could be a fluke instance since i dont exactly have a lot of games to do head to head tests on atm, but that's what i got so far. :(
I can provide both saves if needed.
Andvare Mar 23, 2010, 07:58 AM My findings from the first 10-20 turns is that RoM takes 4-10 seconds, while AND takes 5-10 times that, 30-60 seconds.
(very inaccurate measurements, but that shouldn't matter, as the difference is too great)
Same exact map/starting location/actions.
This is with a standard AND instalment.
I'll try to go through different AND game options next to see if I can identify any culprit.
Talin2009 Mar 23, 2010, 08:02 AM There is possibility that while AND improves code it at the same time adds new buildings/units etc. with included addons.
ruskyandrei did you run AND with only Better Rom mod turned on or any other mods were there as well?
ruskyandrei Mar 23, 2010, 08:13 AM I was running AND with (from the log):
{Required Files} {Realistic Diplomacy} {Seafaring } {Larger Cities} {Lead From Behind} {Event Images} {No Storms} {Mega Civ Patch} {Better RoM} {Forest UI} {Blue Marble Terrain} {Better RoM Artwork} {Airbase Range} {Civic Diplomacy}
Custom
Not sure what "Mega Civ Patch" is actually, dont remember installing anything like that.
Afforess Mar 23, 2010, 10:39 AM I have noticed this myself, so i tried to get a little test going, since i had two similar saves, one in RoM/AND (1.70 Beta3) and the other in vanilla RoM.
Here's what i found:
Vanilla RoM Save:
Large Earth2 Map, Epic Speed, ~18 civs present
Industrial Era, 36 cities (my own, about 127 world wide)
Time between turns: Varies from 20-40s
RoM + AND 1.70Beta3 Save:
Large Pw2 Map, Epic Speed, ~18 civs present
Industrial Era, 29 cities (my own, about 100 world wide)
Time between turns: Varies from 1m:20s-2m
Reading this post actually got me to go back to vanilla RoM to check out the speed and i was surprised to see it go faster, it could be a fluke instance since i dont exactly have a lot of games to do head to head tests on atm, but that's what i got so far. :(
I can provide both saves if needed.
My findings from the first 10-20 turns is that RoM takes 4-10 seconds, while AND takes 5-10 times that, 30-60 seconds.
(very inaccurate measurements, but that shouldn't matter, as the difference is too great)
Same exact map/starting location/actions.
This is with a standard AND instalment.
I'll try to go through different AND game options next to see if I can identify any culprit.
After reading both your posts, I decided to test things for myself. I ran some test games using exactly the same map (I generated it, saved it as a worldbuilder save, and re-used it).
Here are the results
Rise of Mankind 2.9(w/o A New Dawn) 100 turns: 2:06
Rise of Mankind 2.9(w/o A New Dawn) 200 turns: 6:32
A New Dawn 1.70beta3 (Recommended Settings) 100 turns: 2:32
A New Dawn 1.70beta3 (Recommended Settings) 200 turns: 7:46
A New Dawn was running about 10% slower. So I went and started profiling turn times (with special DLLs, you can turn on engine profiling, which will identify the length the longer functions and code takes to compute). I found that one of the key time consumers was CvPlayer::canTrain(). What that function does is check if units can be built for each player based on civics, the unit limits, techs, and other player-wide criteria. It doesn't take a ton of time to compute, but was being used over 1000 times a turn, in the early game (Late game, it's used > 10,000 times a turn... :eek:). I cached the values. (I made the game calculate once per turn for each unit, saved the results in memory, and the game checks the memory instead of recalculating each time. Much Faster.)
I ran profile tests again on the same scenario as before,
A New Dawn Beta4 (Recommended Settings) 100 turns: 2:10
A New Dawn Beta4 (Recommended Settings) 200 turns: 6:10
So, while it didn't speed up the early game a ton (only a few seconds difference, within error margins, so effectively, the same times), the late game was slightly faster than RoM, and significantly faster than the previous A New Dawn.
I've been doing this a lot lately, Identifying places where the game should cache values in memory instead of recalculating them. Generally, this doesn't speed up the early game any, since the early game hardly uses these values at all, but by the late game, there should be a considerable difference in turn times. Rise of Mankind will slow down immensely in the late game due due to it's use of python callbacks.
One last note here, some irony:
The reason why Rise of Mankind 2.9 feels so much faster than 2.81 is that I submitted a lot of code to improve game-speed to the RevDCM team, and that code got included in Rise of Mankind 2.9. (RoM 2.9 is ~15% faster than 2.8 because of it). I'm competing against myself. ;)
Andvare Mar 23, 2010, 11:13 AM It also means that AND is more RAM intensive than RoM, and that could be part of the reason for my problems, as I have recently had some faulty RAM that I haven't replaced yet.
Thanks for the help.
civ_king Mar 23, 2010, 07:08 PM It also means that AND is more RAM intensive than RoM, and that could be part of the reason for my problems, as I have recently had some faulty RAM that I haven't replaced yet.
Thanks for the help.
you want 3GB non-faulty RAM 32-bit for AND, if 64-bit then 6GB that's to get max speed out of AND
NBAfan Mar 23, 2010, 09:06 PM I have 8GB.:p
The more RAM you have the better.:goodjob:
szemek77 Mar 24, 2010, 02:20 AM One last note here, some irony:
The reason why Rise of Mankind 2.9 feels so much faster than 2.81 is that I submitted a lot of code to improve game-speed to the RevDCM team, and that code got included in Rise of Mankind 2.9. (RoM 2.9 is ~15% faster than 2.8 because of it). I'm competing against myself. ;)
More irony: We were all sure that AND is faster than RoM and stated so all over the forum. So latest findings left us, as we say in Poland, with bald heads :lol:
Afforess Mar 24, 2010, 06:16 AM More irony: We were all sure that AND is faster than RoM and stated so all over the forum. So latest findings left us, as we say in Poland, with bald heads :lol:
The good news is that it will be faster once again. It's actually quite an achievement, considering I was using a recommended install of AND. I'm sure Lite AND would have kicked RoM's butt.
zappara Mar 24, 2010, 12:12 PM One last note here, some irony:
The reason why Rise of Mankind 2.9 feels so much faster than 2.81 is that I submitted a lot of code to improve game-speed to the RevDCM team, and that code got included in Rise of Mankind 2.9. (RoM 2.9 is ~15% faster than 2.8 because of it). I'm competing against myself. ;)Your post was interesting to read. :) There was couple changes that I made in RoM 2.9 that also increased turn speed: the storm system was "cut down" ie. maps don't usually spawn them at the game start (only random events) and the number of starting players was decreased on giant/gigantic map sizes.
Splade Mar 24, 2010, 06:18 PM I'm not sure this is exactly on-topic but I put RoM+AnD on 500 turn auto play (windowed mode) and watched Win7 resource monitor.
Civ4 was only using 1 CPU (i have dual-core). Is there anyway to get the game to use both? I'm sure that would speed things up a lot.
Afforess Mar 24, 2010, 06:49 PM Civ4 was only using 1 CPU (i have dual-core). Is there anyway to get the game to use both? I'm sure that would speed things up a lot.
No, Civ4 is only a single core game. The best thing to do is to push all applications to one core, and give civ the other one by itself.
civ_king Mar 24, 2010, 09:48 PM Switch Civ to use Core 2 so the other apps will run on Core 1
oldmanpaco Mar 26, 2010, 07:16 PM Switch Civ to use Core 2 so the other apps will run on Core 1
How do you do that?
Afforess Mar 26, 2010, 07:21 PM How do you do that?
You can manually assign programs to a core by using the Task Manager (Control-Alt-Delete). In the application tab, select the program you want to chance the core to, and right click and select "Go To Process". That should bring you to the corresponding process in the processes tab. Right click on the process and select "Set Affinity". You can disable it from one or the other cores (Don't disable it from both, or it will lock up!)
Dreifels Apr 01, 2012, 08:53 AM I'm not sure this is exactly on-topic but I put RoM+AnD on 500 turn auto play (windowed mode) and watched Win7 resource monitor.
Civ4 was only using 1 CPU (i have dual-core). Is there anyway to get the game to use both? I'm sure that would speed things up a lot.
Civ4 does use one cpu and max 2 cores only. CPU load up to 55%, Ram less than 1.7GB + video. If oyu have an Intel CPU with boost tech, it runs nearby always in boost mode because idle cores. (if minimum 2 cores are idle, CPU goes to boost mode). It reads mass of HDD always, so it would be more effective to get CIV4 using more file cache (if Ram available), as using more CPUs give little as then the boost mode gets off and it still needs lot of time for reading from HDD always.
But it still crashes somewhere above turn 720 (application crash dll), in AnD with any constellation, in MoD it crashes only if Revolution is on.
Dreifels Apr 01, 2012, 09:04 AM You can manually assign programs to a core by using the Task Manager (Control-Alt-Delete). In the application tab, select the program you want to chance the core to, and right click and select "Go To Process". That should bring you to the corresponding process in the processes tab. Right click on the process and select "Set Affinity". You can disable it from one or the other cores (Don't disable it from both, or it will lock up!)
this gives nothing
it is already set to use all CPUs, but it does use one CPU and 2 cores nevertheless only.
You cannot force to run a program to use more CPUs if it is not designed to do such.
and assign it to one special CPU and all other the the other CPUs also gives nothing, as Windows regulary takes the next free core (if there is one), so other are running on other cores anyways. Also this would stop the automatically boost of the active CPU/cores. (if your CPU has Intel boost tech)
Dreifels Apr 06, 2012, 04:33 PM I'm not sure what you mean...
The amount of time your turn takes depends on how long you take. ...
no, when you click ready it's game sole playeing the other factions.
Here I see no better speed than before. It depneds mostly how much units around, and if they have activities. Also, if you have enales "show enemy moves fast or not.
If I let the game do an autorun, it needs ~ 1 hr for 100 turns at beginning, after Great War, when all the barbarians come out, then it slows down to 60 turns/hr with set show all moves fast.
Its a problem of too much units around. I let the game autorun 500 turns and had one ONE field (!!!!!) more than 200 units, "parking", as no real need for so much troops.
In one turn it did create more than 800 barbarians.
This is a construction failure of the game or of the mod: the AI does not understand when it has enogh solders or enough settlers or enough worker, and instead to collect money and invest it into speed up of buildings, it produces units endless.
Other bugs I found in 2.x I post here http://forums.civfanatics.com/showthread.php?p=11393095#post11393095
(3GHz 4 CPUs, 8GB Ram, 4GB Video)
Fewt Apr 17, 2012, 11:16 AM You can manually assign programs to a core by using the Task Manager (Control-Alt-Delete). In the application tab, select the program you want to chance the core to, and right click and select "Go To Process". That should bring you to the corresponding process in the processes tab. Right click on the process and select "Set Affinity". You can disable it from one or the other cores (Don't disable it from both, or it will lock up!)
This is quite useless since I have 2x4 CPU's...
Dreifels Apr 17, 2012, 12:15 PM This is quite useless since I have 2x4 CPU's...
worthless anyways, as Civ4/BtS does use up to 2 core and one CPU only. The other core/CPUs are idle if no system or other background processing.
If you have CPUs with boost technology, you then will see that the booster is working as soon as minimum 2 cores are idle.
No, Civ4 is only a single core game. ... .
no, it is a single-CPU-game, but not a single-core-game. In Win7 it does use the next free core of same CPU for a new thread, but does not split threads like Win7/64 tech. Up to two threads can be open at same time. As it cannot differ between cores of same cpu, it does use all 4 cores if it is a 4-core-CPU, but never more than 2 cores at same time (two open threads), and if there are more CPUs they are idle.
AIAndy Apr 23, 2012, 08:40 AM no, it is a single-CPU-game, but not a single-core-game. In Win7 it does use the next free core of same CPU for a new thread, but does not split threads like Win7/64 tech. Up to two threads can be open at same time. As it cannot differ between cores of same cpu, it does use all 4 cores if it is a 4-core-CPU, but never more than 2 cores at same time (two open threads), and if there are more CPUs they are idle.
While Civ4 does use more than one core for some purposes, the entire game logic and AI is single threaded. And turn times are because of AI calculations so having one fast core is important to keep turn times low.
Dreifels Apr 23, 2012, 09:34 AM While Civ4 does use more than one core for some purposes, the entire game logic and AI is single threaded. And turn times are because of AI calculations so having one fast core is important to keep turn times low.
Not all is linear calculation.
BtS uses constant 10 open threads and sometimes up to 13 threads. If at end of turn something gets finished (i.e. research) or a popup for ranking then that opens a new extra thread (i.e. choose new research), and may use the 2nd core if free. Because that, it makes no difference if you have 2 or 8 cores, or more, it always uses max 2 cores only.
Times needed after click end turn depends mainly from two things: linear calculation of the unit movements/activities (and there the barbarian can slow all dramatically), and the processing for screen (and that depends from speed of grafic card, so it is a big dfference if you have i.e. "show enemy movements" and hundreds of barbarian activities get shown, or not, and then the cpu load can go up to 100% for a core while other are idle ). If you want to speed up the AI's tuns then disable all what gets shown extra on monitor.
AIAndy Apr 23, 2012, 10:52 AM Not all is linear calculation.
BtS uses constant 10 open threads and sometimes up to 13 threads. If at end of turn something gets finished (i.e. research) or a popup for ranking then that opens a new extra thread (i.e. choose new research), and may use the 2nd core if free. Because that, it makes no difference if you have 2 or 8 cores, or more, it always uses max 2 cores only.
Times needed after click end turn depends mainly from two things: linear calculation of the unit movements/activities (and there the barbarian can slow all dramatically), and the processing for screen (and that depends from speed of grafic card, so it is a big dfference if you have i.e. "show enemy movements" and hundreds of barbarian activities get shown, or not, and then the cpu load can go up to 100% for a core while other are idle ). If you want to speed up the AI's tuns then disable all what gets shown extra on monitor.
When I talk about game logic I mean everything that changes the synchronized game state and that is only one single thread and it is the same thread that the AI uses (most of it is in the DLL so we know that code).
Reducing what is shown on the screen speeds up AI turns but in general the part that causes the scaling issues is the AI calculation itself. It is quite heavy on brute force searches for best stuff and triggers the pathing engine a huge amount of times.
100% one core usage while others are idle is the sign that the AI is in some heavy calculations.
MatuX Apr 28, 2012, 03:01 PM Hey!
I've an Athlon X4 II 2.6ghz and 6gb RAM. I love playing Gigantic PW2 maps with +30 civs. I usually have to endure 1 minute per turn at around 1500BC in Epic speed (15% complete).
This is normal, right? :)
Dreifels Apr 28, 2012, 03:26 PM Hey!
I've an Athlon X4 II 2.6ghz and 6gb RAM. I love playing Gigantic PW2 maps with +30 civs. I usually have to endure 1 minute per turn at around 1500BC in Epic speed (15% complete).
This is normal, right? :)
yes, if lot of factions have lot of units whch all are moving around and conflicts, it may be. Also after "Great War" when all the barbarian ships come out. When you come to industrial time it will be much more. Later it will be less, as the (also AI) units will not move around but stay somewhere collected. Less wars = less movements. But 1-3 min per turn is usual, maybe 5. (and "Epic" IS slow :lol: )
Also save and reload often will help a little.
|
|