Frogboy Frogboy

The lazy AI developer

The lazy AI developer

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.

124,802 views 60 replies
Reply #51 Top

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

Reply #52 Top

Quoting joasoze, reply 51
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.

Reply #53 Top

Quoting Jvstin, reply 15
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?

Reply #54 Top

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.

Reply #55 Top

Quoting Yestin, reply 54

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.

Reply #56 Top

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.

Reply #57 Top

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.

Reply #58 Top

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.

Reply #59 Top

Quoting AIAndy, reply 56



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.

Reply #60 Top

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.