Brad Wardell's views about technology, politics, religion, world affairs, and all sorts of politically incorrect topics.
Watching the AI play with itself..
Published on January 17, 2007 By Draginol In GalCiv Journals

On the hierachy of lameness, you have:

  1. A guy playing a video game
  2. A guy watching his friend playing a video game
  3. A guy watching computer players play each other in a video game.

I am at the bottom.

I watch computer players play each other. To see what smart things they do in different situations and what dumb things they do.  So much of good computer AI really boils down to play testing. The best algorithms in the world are no match for real world playing. And what looks like a good idea on paper can end up being a disaster in the real game.

The decision tree in Galactic Civilizations is actually pretty significant. Consider the choices it has to make. Then consider other strategy games you've played and think of the choices that have to be made there:

  1. What should my tax rate be? The higher, the more unhappy my people will be which will slow down population growth but the more money I get.
  2. What should my spending rate be? Spend too much and I'll run out of money or not have enough to make quick purchases. Spend too little and I'll fall behind.
  3. How should I set my ratios of research, social, and military?
  4. How should I design my ship? There's an infinite number of designs possible.
  5. What technology should I research? There's over a dozen distinct, non-connected branches in GalCiv (look carefully at the # of branches in other games -- usually less than 3 or 4). Pick the wrong one and my economy might be weakened or maybe my industry weak or my military weak or my morale weak or maybe I won't be able to get those special worlds or maybe my logistics will be too low or maybe my miniaturization won't be competitive and so on.
  6. What should I put on my planets? Do I use that special farming tile (i.e. put a farm on it?) or should I sacrifice it for another factory or a research center or save it for a galactic achievement or a fusion power plant? Or maybe build a farm but if I do, will I have space to put on morale improving buildings?
  7. How should I use my military forces? Is the human player my friend or is his build up designed for a sneak attack? Should I escort my transport even though my transport moves at 10 moves per turn while my escorts only move at 4 or do I send it at that undefended planet that is only 12 moves away and the fog of war might be hiding an enemy there?
  8. Should I hold back my fleet and wait for more shpis to be built to make a bigger fleet or should I send it out now and wreak some havoc?
  9. Should I build a transport (only transports can take planets -- unlike in many other games where any unit can conquer the city/planet/star/) or a constructor to take that nearby resource?
  10. Should I build a starbase near my planet or should I extend my range with a starbase?
  11. Should I upgrade my starbase or construct a new one by a different planet?
  12. Should I put resources into spies and if so, how much?
  13. What should I be doing with my spies? Protect my worlds or send them out? If so, which worlds should they go to?
  14. If I'm sending a spy to a given world, which planet improvements should I take out that will do the most harm to them based on the strategy that I perceive they're taking? Or alternatively, which enemy agent should I nulify?

Some of these decisions are more complex than others. The one I have the most difficulty with is one of the more straight forward -- what to research and when.  I've had others I've had to struggle with -- I didn't write, for instance, the planet improvement placement code in GalCiv II, but in Dark Avatar I've rewritten it (for better or worse) to something that matches more closely the way I play the game.

In most strategy games that have computer opponents, the decision tree is kept very small.  Think through the games you've played and consider the # of actual decisions that the computer opponents have to make. And by decisions, I mean actual choices as opposed to choices that are pretty obvious.

Consider your first 20 turns of Galactic Civilizations II. What should you research? If you research the same thing (i.e. you script it) you become predictable. If you just have the computer players randomly select what it should research, it becomes pretty obvious and ineffective. 

Having computer players that don't cheat makes it tough too. I can't just tell the computer players to send a colony ship to the closest uncolonized planet. It has to know about it or at least make a reasonable guess based not on real data but based on what the map looks like.  Very often players will complain that the AI should have not done this or that without realizing that the AI made its decision because it couldn't see their ships or a planet. Sometimes players will insist that the AI must know where the good planets are because it did what most good players would do -- built a colony ship and sent it into a sector full of planets that were on the galactic sensor map (the odds were in its favor after all).

In most games with tech trees, players are pretty much expected to research every technology. In GalCiv, players are punished for doing that. The tech tree is too big. Players have to pick and choose which techs for their strategy for a particular game. That means the AI can't just randomly muddle through. It has to wisely pick.  At lower difficulty levels, that's what I have the AI do -- randomly pick technologies. But higher up, people expect their opponents to be thinking about this stuff carefully -- and they do.

And so on a variety of maps, a variety of players, I watch them play each other. What's worse, I like doing it.


Comments (Page 1)
2 Pages1 2 
on Jan 17, 2007
I am at the bottom.


I can read no further without saying 1) GCII is not a mere "video [deck] game" and 2) The game spectator role (video [deck], PC, or otherwise) is perfectly respectable given the fact that individual skills and tastes vary.
on Jan 17, 2007
And what looks like a good idea on paper can end up being a disaster in the real game.


Bollocks to the "on paper" part here. What looks like a good idea can *always* end up being a disaster, whether or not you had time to read, think, and write about it.

The one I have the most difficulty with is one of the more straight forward -- what to research and when.


This makes me think I might be a decent student of GCII. The question list is really interesting to read, but b/c I'm a tech-obsessed player, this gives me hope that I might eventually earn an A if the Metaverse stays around and I manage to post enough games.
on Jan 17, 2007

Here's a game that just got completed where the Terran Alliance ultimately defeated the Drengin, Torians, and Altarians. The Drengin were the AI I was working on today to improve. I spent last night mostly on the Terrans and the effect was pretty good.

Drengin ship design

What techs the Drengin had researched:

 

Terran Alliance ship design:

The ship that allowed the Terrans to win:

What techs the Terrans had researched:

 

The Terran Home World:


Summary:
0 morale improvements (bad)
2 economy improvements (great)
2 factories on bonus spots (good)
2 research labs (good)
1 farm on farm bonus (good)
2 galactic achievements (great)

A pretty optimal use of the planet other than not having a morale improvement bonus.

Let's see how the Drengin did:


Summary:
1 morale improvement (upgraded) (not bad)
1 economy improvement but never upgraded (terrible)
2 enhanced factories (bad for this late in the game)
2 research labs (good)
1 unused tile!!! (awful)
1 tile that just needed habitat improvement (awful)

It's pretty easy to see how the Drengin blew it. For shame. The Drengin had better weapons and defenses on their ships but were incapable of creating a fleet to support it.

Back to mines...

on Jan 17, 2007
Well, I've already did #3 a few times... And worst of all, sometime it wasn't even AIs that I coded myself or anything like that.


1. What should I be doing with my spies? Protect my worlds or send them out? If so, which worlds should they go to?
2. If I'm sending a spy to a given world, which planet improvements should I take out that will do the most harm to them based on the strategy that I perceive they're taking? Or alternatively, which enemy agent should I nulify?


Are the AIs able to remove their spies to use them elsewhere? To think : "I need to nullify this enemy spy or I need to stop the growth of this civ, so I'll remove my spy on the planet of an almost dead civ..."

I've never seen it does that though.
on Jan 17, 2007
AI's who are allied should gang up spywise on a powerful player. Not as a cheat, but as a legitimate cooperative tactic. Players should be able to ask an allied AI to spy on another race as well.

As for the techs, the AI should be very aggressive on tech trading, and even offer a new tech to a player if relations/distance make it feasible- if the player offers enough. If most players will sell the farm for a tech and make it back trading to others, why not have the AI do that?

As for planets- AIs should never waste a research or manufacturing tile, even if it goes against the overall idea of the planet- ESPECIALLY in the case of research tiles.
Influence tiles I can see wasting- and usually do, unless the planet is high PQ near another planet, or they are being culturally attacked. Farming tiles I tend to use- for the influence/tax bonus they provide. Population means more money- and 100% morale with max pop means 0 growth, so I use farms more then most people, and will take a morale hit to do it.

AIs at peace and not prepping for war should rushbuy projects when possible
on Jan 17, 2007
Personally I don't build galactic achievments on my homeworld. The civilization capital's increased population is like a free farm on that planet.

Galactic achievements always seems like a bad idea to put on a capital planet, I always threw them on smaller planets with low populations I was not going to get much out of anyway. An econ building on a capital is worth much more than an econ building on a base population planet.
on Jan 17, 2007
Diplo Trans I will rushbuild no matter what- that tech is worth 10k-20k credits over a game...


on Jan 17, 2007
The political capital is great for your home planet. I usually build two morale improvements and a farm, then replace one of the morale improvements with the political cap - a good influence bonus for a high population planet, and the slight increase in morale bonus is good, too.

One thing I still ocasionally see in the DA beta is an AI faction building one of its capitals (usually the econ capital) on a planet deep within my sphere of influence. In such a case, I am almost certain to culture flip it eventually. Even if I don't, the AI is bulding a valuable and unique improvement on a world far from home that it can't adequately protect in a war.

In every other way, however, the AI improvement building has gotten a lot better in DA. The difference is refreshing.
on Jan 18, 2007

Personally I don't build galactic achievments on my homeworld. The civilization capital's increased population is like a free farm on that planet.

Galactic achievements always seems like a bad idea to put on a capital planet, I always threw them on smaller planets with low populations I was not going to get much out of anyway. An econ building on a capital is worth much more than an econ building on a base population planet.

Depends on how many colonies they have, what the quality of those planets are, what the likelyhood of obtaining more colonies and what number of other colonies they might obtain at a distant point depending on strategy. (seriously, these are things it has to take into account -- a lot of players only play on a single map size, the AI has to be ready to handle not just different map sizes but custom scenarios as well).

on Jan 18, 2007
What techs the Drengin had researched:

Hmm, how do you zoom out that far on the research screen? Is that new with Dark Avatar?

On the hierachy of lameness, you have:

1. A guy playing a video game
2. A guy watching his friend playing a video game
3. A guy watching computer players play each other in a video game.

on Jan 18, 2007
Is that new with Dark Avatar?


Yes it is, and it's a great feature.
I am at the bottom.


Sturgeon spend most of their lives on the bottom, and they produce caviar.
on Jan 18, 2007
All I know is this: If the AI in Dark Avatar finally starts researching Good and Evil and improved government forms, Im screwed. Ive built my entire playstyle around the fact that the GC2 AI doesnt research these, or doesnt do it ill its far too late to matter(at least on every difficulty up to and including "Crippling").
on Jan 18, 2007
This was the first time I'd seen the streamlined tech tree and I'm a big fan. Is there a slightly higher-res version that's a bit more clear? It's tough to read the names of some of that stuff.

It seems like the AI vs. AI tests require quite a bit of analysis to see their effectiveness. It would be interesting to see a rating system (perhaps for players, too) similar to what you get at the very end of a game that might provide a better indicator for effectiveness (or the why portion of it). I don't have a good example off-hand, but maybe a resource usage guide (ie 50% of all planet tiles were used overall, average of 2 ships per planet, "theme" pursued by AI/player- cultural/tech/miliatary, etc.).
on Jan 18, 2007
Is there a slightly higher-res version that's a bit more clear? It's tough to read the names of some of that stuff.


You can zoom in and out using your mouse wheel. Zoom in to read, and out to get to a far branch quickly.
on Jan 18, 2007
Just a general question, what about a general adaptive AI, is it something that's just beyond what we're able to implement in modern games?
Something that reviews the player's game and add's it to a comprehensive decision tree developed based around all the player's previous games created to counter that player's specific strategy.

Here's why I ask...
A friend of mine (extremely analytical guy) pretty much grew bored with the game once he developed a single winning strategy and proceeded to hone it to razor like sharpness and the AI could not match it. Once he's got a strategy perfected the game looses its appeal.

Personally, I like to play with different strategies each time and repeating the same game strategy over and over would drive me nuts.. but my friend thrives on that type of mastery of a build order. And frankly I'm looking forward to the day he gets his backside handed to him by an AI that recognizes his strategy and knows how to defend.
2 Pages1 2