Brad Wardell's site for talking about the customization of Windows.
Published on September 23, 2009 By Frogboy In Elemental Dev Journals

The AI in Galactic Civilizations I and II has tended to get a lot of praise over the years.  But it could have been better. Much better. 

A big reason that kept it from being better was sheer laziness on my part.  A lot of the best strategies involve algorithms that just are tedious to write.

For example, I submitted feedback to GPG for Demigod’s AI based on algorithms I knew would be effective but that I didn’t actually use in GalCiv because they were a pain to write.

My favorite example is a pretty straight forward algorithm: What is the strength of an enemy in a given area compared to mine? You provide the unit in question and a radius and it returns a value based on the relative damage potential of other things in the area and from that you can decide whether to move forward or not. 

It’s a great way to mobilize units together as a cohesive mass. In Demigod, it would tend to make the AI less likely to go into harm’s way.  This is one tiny example and each tiny example on its own is easy to write but taken together, they mean a lot of work that I wasn’t able to get to (or didn’t want to get to) in Galactic Civilizations.

In Elemental things are different.  Oh, I’m still lazy. Dangerously lazy.  But now I have Charles to work with who helps split the work on this stuff.  On our previous games, I wrote the AI myself – The Politial Machine, GalCiv, Entrepreneur, etc.  This time, I have a small team to help me with it.

Part of that is because the AI in Elemental is a very big deal. People are excited about the features of Elemental but to me, those features are meaningless unless there are computer players that make good use of those features. Or more to the point, intelligent use of them.  While Elemental will have multiplayer (up to 32 people for starters), the focus of the game is single player. That’s the part of the game I want to make sure we absolutely nail and for that, it absolutely must have intelligent computer players.

Over the past 15 years I’ve built up an increasing library of algorithms I’ve doodled together for how computer players could play more like expert humans. Elemental will be my first real chance to see them come to life. I’m very excited.


Comments (Page 4)
4 PagesFirst 2 3 4 
on Sep 25, 2009

LDiCesare

In my opinion the issue is not so much the complexity to code the algorithms but the amount of time they require and then how to handle fuzzy/incomplete information.

I did something like the above example in my own game a while ago, where I computed power projections and had a map of power projections that could be used to decide whether or not it was safe/useful to go into a certain area. The data was incomplete because there were some factors that couldn't be easily evaluated, but the real issue was what happened when fog of war hid a unit. You have to somehow remember that a unit has been seen there and thus the threat is higher than expected, until you actually see the same unit the other side of the map, (but how can you be sure it's the same unit)...

Keeping in memory all the relevant data and checking it for each player tends to be computationally expensive when there are many units, which calls for astute coding if you want the game not to slow down too much as number of units grows.

In a turn based game that should not be that much of a problem, especially since you can do a lot of computation while the player does his turn.

For a unit which is afterwards hidden by a fog of war I'd suggest diffusing the power depending on the speed of the unit and with the fog of war borders as walls.

on Sep 26, 2009

One of the things mentioned while speaking with a certain someone was this...

"I got into making games because I wanted to write AI.  I'm rooting for the computer, I want it to win... Other guys write AI because they have to.  So they kind of half-way write AI."

(mind you... these aren't the exact words spoken, but the general idea comes across.. )

on Sep 26, 2009

In a turn based game that should not be that much of a problem, especially since you can do a lot of computation while the player does his turn.

Unfortunately that's wrong. Play Civ (any version) on large maps on an average requirements machine and you'll see that turns take a lot of time to compute.

on Sep 26, 2009

I'm still hoping that Elemental will see "a certain someone" spread his interests to include AI that is 'on staff' for the player as well as running a strong civ all by itself. Maybe the vassals will be a good starting ground, and eventually we'll get royal councillors who can truly handle some delegated responsibility without too much risk of them abusing their authority.

on Sep 26, 2009

LDiCesare

In a turn based game that should not be that much of a problem, especially since you can do a lot of computation while the player does his turn.
Unfortunately that's wrong. Play Civ (any version) on large maps on an average requirements machine and you'll see that turns take a lot of time to compute.

Well, of course you can always use up any amount of computation time if you wish to. It depends on what algorithms you use and how much of a brute force approach. But compared to RTS, you have a lot of CPU cycles free for AI.

on Sep 26, 2009

How about a setting in the game where we can say how much waiting we accept and the game would compute AI accordingly. I would not mind waiting 20 seconds extra every turn if the AI is slightly better.

A setting like this:

 

AI compute time acceptable

1. Very quick - shallow algorithms

2. Normal - standard AI

3. Slow - the AI is alllowed extended calculations

4. Marathon - AI Extreme - Allow a minute extra pr turn

on Sep 26, 2009

joasoze
How about a setting in the game where we can say how much waiting we accept and the game would compute AI accordingly. I would not mind waiting 20 seconds extra every turn if the AI is slightly better.

A setting like this:

 

AI compute time acceptable

1. Very quick - shallow algorithms

2. Normal - standard AI

3. Slow - the AI is alllowed extended calculations

4. Marathon - AI Extreme - Allow a minute extra pr turn

What, are we running 286 processors? I am pretty sure the AI will be figuring out their moves and will be "waiting" on us meatheads to hit "end turn". I would be severely disappointed if 1 minute was ever required to make its moves. Even late game in a huge world.

on Sep 26, 2009

Jvstin
I loved Kohan.  It kicked my tail up and down for the longest while, but it was definitely a favorite for me too.


Kohan - best RTS game ever. Still play it online actually although it has got harder to get multiplayer games. Who did you and Tormy use to play as?

on Sep 26, 2009

Denryu


What, are we running 286 processors? I am pretty sure the AI will be figuring out their moves and will be "waiting" on us meatheads to hit "end turn". I would be severely disappointed if 1 minute was ever required to make its moves. Even late game in a huge world.

 

Have you played Dominions 3, or Civilization 4? I'm sure their designers did their best to reduce ai thinking time, but on the largest maps even a good computer can take a looong time to calculate multiple ai actions.

on Sep 26, 2009

Yestin

Quoting Denryu, reply 52

What, are we running 286 processors? I am pretty sure the AI will be figuring out their moves and will be "waiting" on us meatheads to hit "end turn". I would be severely disappointed if 1 minute was ever required to make its moves. Even late game in a huge world.
 

Have you played Dominions 3, or Civilization 4? I'm sure their designers did their best to reduce ai thinking time, but on the largest maps even a good computer can take a looong time to calculate multiple ai actions.

I'm not totally sure about this, but I think I read once that one thing that allowed GalCiv2 to have such good AI was that it computed what it would do on the AI's turn while the player was moving, instead of waiting until the end turn button was clicked. I never had to wait as long between turns in GalCiv2 as I did in Civ4, so I'm guessing that the latter didn't use this method.

on Sep 27, 2009

Yestin

Have you played Dominions 3, or Civilization 4? I'm sure their designers did their best to reduce ai thinking time, but on the largest maps even a good computer can take a looong time to calculate multiple ai actions.

AI rarely has high priority and AI thinking time probably even less.

on Sep 27, 2009

Dominions 3 AI doesn't think while you are playing like a good simultaneous turn AI should. Civ 4 was kind of different since things could actually happen mid turn that it might have to think about.

Turn based games also mean that multithreading is far, far easier than normal. One of the main problems with multithreading is that the threads need to be synced up perfectly or you're in for a crash and some nightmare debugging. With turn based games (especially simultaneous turns) all the AI can run their own separate thinking thread that goes to whatever core is free. They make their decisions separately and then see how it goes (as would real players). All that matters is that they eventually all get done. They don't need to constantly be in sync and they would start thinking the second you start your turn. I'm going to be pretty disappointed if the AI isn't given its own threads.

on Sep 28, 2009

Dominions3 is a bad comparison. What takes time for a Dominions3 game to host is not ai but fight resolution. Even with only human players on a big map, if you have a few battles with hundreds of soldiers lasting 50 turns, then it's long. Civ IV on the other hand is slow.

As for the ai taking tuns as we do, yes it's possible that it'll be faster than us, but you have to avoid expensive algorithms.

on Sep 28, 2009

AIAndy



Quoting Yestin,
reply 54

Have you played Dominions 3, or Civilization 4? I'm sure their designers did their best to reduce ai thinking time, but on the largest maps even a good computer can take a looong time to calculate multiple ai actions.


AI rarely has high priority and AI thinking time probably even less.

Ouch...not to mention, that the Dominions 3. AI is very bad. Even a 8y old kid should be able to beat the AI on the highest [IIRC impossible?] diff. level.

on Oct 05, 2009

I think that a incredible AI is a must for this game. Regardeless of the Multiplayer aspect of the game. This game seems to be a revolution of sorts in this kind of game. Moreoever the way it being made will make this game a game people will play for years if not a decade or two.  One thing you do not want to hear his.. to bad the AI sucks it would of been a hell of a game. MOM still lives even though the AI sucks.

 

Let s hope Elemental will live just as long without the sucking part.

4 PagesFirst 2 3 4