Performant AI

wlievens

Warlord
Joined
Feb 4, 2003
Messages
243
Location
Belgium, Europe
The game should be playable on huge maps with > 30 civs without taking 10 minutes per turn.

One way to solve this is using a multithreaded AI design, like GalCiv has.
 
It means the AI does some of its calculations while you are playing, and not after you've played.
 
I think this is a great idea. I have played GalCiv quite a lot and found that it works fine. I rarely use up much of my processor power while playing my turn - and I guess this is the case with most players. While I am pondering what to build next, the AI could work those out in the meantime.
 
:hmm: Is there any word on this from Firaxis?

The concept is excellent - the PC AI can do some work while I do mine - and would probably go a distance toward addressing Civ4's most likely problem: Speed in AI turn :mad: just like Civ3.
 
would this idea also help AI intelligence by allowing it more time to think of its reactions and moves??
 
Do realize that whether multi-threading will help depends tremendously on the architecture and rules of the game. Just because it helped in one game doesn't mean it will help in this one. It's not magic pixie dust. Performance problems and threading issues can be pretty complicated and highly specific to a particular game (or part of the game), and it's hard to make a useful recommendation without understanding the code. The only thing that we can do is emphasize that speed is an important feature and hope they put the time and energy into meeting the requirement.
 
apatheist said:
Do realize that whether multi-threading will help depends tremendously on the architecture and rules of the game. Just because it helped in one game doesn't mean it will help in this one. It's not magic pixie dust. Performance problems and threading issues can be pretty complicated and highly specific to a particular game (or part of the game), and it's hard to make a useful recommendation without understanding the code. The only thing that we can do is emphasize that speed is an important feature and hope they put the time and energy into meeting the requirement.

Not just multi-threading CPUs, but the AI performing calculations which it would normally carry out in it's own 'turn, instead during the human player - spreading the load over a longer time period.
 
They do this in a lot of games. Chess does it. And, Warlords IV does it too, I believe (Warlords is a turn-based strategy game just like Civ).
 
wlievens said:
It means the AI does some of its calculations while you are playing, and not after you've played.

There are only so many calculations that can be done this way in a IGOUGO game. Some will either have to wait or be invalidated constantly as a player (either human or other AI) changes the game state. (This is not to say that some things can not be done that way). Incidentally, the reason GalCiv runs faster than Civ3 is simple and has nothing to do with mulitithreading. In space the shortest path is a straight line. If you want perfect pathfinding (remember Civ2 and how units would get lost on long trips or go the loooooong way around), you've got to pay the price.
 
I don't know if "muti-threading" is what you are talking about cause if it is then you just increased the min specs past most the people in this forum.

Performing some calculations during the players turn is a good idea except:
By the time the civ takes their turn the situation may have changed

this would mean that the AI would have to be calculated 2wice, making it more ineficient. Somethings like build queues, reachearch descisions and stuff could probably be decided during the players turn as long as they are very carfull not to put too much burdon on the CPU.
 
10Seven said:
Not just multi-threading CPUs, but the AI performing calculations which it would normally carry out in it's own 'turn, instead during the human player - spreading the load over a longer time period.

The CPU doesn't have to be multi-threaded (hyperthreading, CMT, SMT, SMP, dual core, etc.) since work can be done while waiting for the player to click things. We're remarkably slow compared a CPU.

Even so, it's not necessarily for certain that the AI calculations can be run during the player turn, or, if they can, whether that would be any help. It depends on how the data set can be partitioned. After all, those calculations depend on what the player does. Maybe a player's moves change things enough that they have to recalculate 90% of the stuff anyway.

Actually, all of this is moot. These people have been programming games and game AIs for a very long time. I seriously doubt that anyone here could suggest some new trick that they haven't thought of. Multi-threading is definitely not a new trick. Scenarios, units, civs, game concepts, etc., sure, people here can and have come up with lots of ideas. When it comes to implementing those, though, we can tell them nothing useful. They know it's important. They know the AI has been bad and slow before. I have full confidence that the developers will be able to provide the best AI with the best performance that is possible, or pretty close to it.
 
apatheist said:
Actually, all of this is moot. These people have been programming games and game AIs for a very long time. I seriously doubt that anyone here could suggest some new trick that they haven't thought of. Multi-threading is definitely not a new trick. Scenarios, units, civs, game concepts, etc., sure, people here can and have come up with lots of ideas. When it comes to implementing those, though, we can tell them nothing useful. They know it's important. They know the AI has been bad and slow before. I have full confidence that the developers will be able to provide the best AI with the best performance that is possible, or pretty close to it.

I knew about multi-threading :goodjob: I'm a computputputputer nerd.

It seems likely that virtually everything the AI would do in it's turn would, if calculated on the players turn, have to be recalculated - it might speed things up, but then it might simply waste cycles.

It could, ultimately, also waste programming time.

Can anyone thing of processing tasks the AI might undertake independant of any new action the player might make?
 
One optimization they can do is calculating your automatic moves while it's waiting for you. I'm assuming that all players want to still see their automatic moves. Maybe you have GOTOs or automated workers. It seems like the latter are especially brain-dead in civ3; they'll move onto a square and then off it again, achieving nothing except burning 1/3 move.
 
Back
Top Bottom