My spot in the world
Published on December 4, 2008 By LifeSomewhereElse In Off-Topic

Being a software developer for many years (20+ now) I have always marveled at game development.  I love computer games and I can say that my love of them in the late 70's and early 80's is what drove me into my profession.  Although I have never worked in a game company my career has always been in microcomputer and then quickly PC platform once it was out.  This allow me to learn many things at home and provided a platform in which I was able to write very simplistic games back in the day. 

In playing around with game development, as crude as it was, I enjoyed every aspect of it and was actually able to use some of the high school math of which I said I would have no use.  One area that has always intrigued me was in the area of AI and game AI.  In college, one of the simple AI programs I had to develop determined what item a user was thinking off (think the 20 questions game) and if it could not guess it then asked the user about the item and learn it. 

Then there is game AI.  I am not talking about logic to control a space ship flying around and being able to hunt you down and shoot you dead but the AI of the type that you see in RTS and even more so TBS type of games. A long time ago programmers would struggle over writing the best chess algorithm.  While that horse has been beaten to death a hundred times over I tend to think that a AI for a complex TBS game would be a much more challenging thing to create.  Case in point, GalCiv2.  GalCiv2 is considered by many to have one of the best AI’s for a game of its’ type.  Many variables come into play with a game like this.  Writing an AI for it would be challenging, especially a good AI. Most other games of this type try to simulate intelligence by giving the computer AI a handicap.  GalCiv2 does not do that, at least not until the highest levels of intelligence setting.  Indeed, many of the lower settings actually dumb down AI.  There is a mid level (I cannot recall which one it is now, I think it has changed as the game has evolved) in which the AI is not given any cheats and all of its’ mind (algorithms) are in play.  I find this rather fascinating.

One of the things I would like to know about the GalCiv2 AI is whether it develops a strategy and marches towards that goal from turn to turn, call it goal seeking.  Or, does it simply re-evaluate the game situation every turn and hopefully come to the same conclusion as to what action to take this turn as it did the previous turn?  I would like to see a article or post from Brad (frogboy, etc) that gave a high level overview of how his AI works.  I certainly am not asking for the keys to the kingdom here, I would not want that.  Rather, just a little insight into how he developed this AI and how it evaluates its’ position and determine course of action from turn to turn.  That would be cool.

See ya

*** Note: moved to GalCiv Dev Journals in hopes the Mr. Frogboy will comment.

 


Comments
on Jan 21, 2009
I've always enjoyed making ai - even if it's only using wc3. Thinking of ways the AI can prioritize and create strategies to achieve the priorities interests me. But I wouldn't be surprised if it thinks in short term goals. If you carefully plan yourself out, the AI holds little surprises past a turn. It doesn't consider what will happen if it loses the war (ships guarding planets), among others. But I couldn't even begin to grasp how complex and wide-ranging the AI for galciv must be. While I'm surprised combat isn't more advanced than it is, how the AI handles civilian and production is astounding. While bored the other day, I created a small chart on how factions recognize squads, and prioritize them. http://img108.imageshack.us/img108/4206/aigroupke0.jpg http://img108.imageshack.us/img108/4878/unitgroupwv1.jpg While it isn't too advance, the ai values targets which are attacked more often than those who aren't. When something is of value to the ai, it sends what considers the least valuable troops to it. Value for the troops is based on their quality, range, and their current goal (and that goals value) A factions stats make up how exactly it values something. Most things are handled on chance though, and I don't think I'll let the ai judge strategically losing a town might do.
on Jan 21, 2009

One of the things I would like to know about the GalCiv2 AI is whether it develops a strategy and marches towards that goal from turn to turn, call it goal seeking. Or, does it simply re-evaluate the game situation every turn and hopefully come to the same conclusion as to what action to take this turn as it did the previous turn?

Two points.

One: The AI historically (from DL 1.x up to the current TA 2.x) has had difficulty changing its research priorities.  If it decides it needs industrial sectors, then it's going to research up to them, and if it happens to land in a war before then, it'll just build laser ships.  This has seen some improvement, but the bottom line is that it reacts slowly in this capacity.

Two: On the lower levels (up to around Tough IIRC, maybe one less), the AI will reevaluate its military standing once every ten turns.  I changed my autosave to 9 turns because of this ages ago.  It's not as big of a deal on the higher difficulties, where the AI is reevaluating at least components of its game on a a 3 turn or less basis (exact numbers are difficult to produce, if any-give the AI the benefit of the doubt in this regard and assume it happens to do a reevaluation every turn, but doesn't see that much difference).  However, again, on the lower difficulty levels, 98% of the time you are declared war on, it will happen on a turn divisible by 10.

Or rather, as a caveat to anything Brad decides to post, this is what it looks like the AI is doing.

on Jan 21, 2009

Feedback from the main dev of the GalCiv2 AI would be most helpful.

 

Brad?...

on Jan 21, 2009

I would also be interested in hearing from Ironclad on some of their methods for Sins too....