I was reading an article over at TAGN (which I do often – and I’ve linked to him quite a bit recently so not linking that post directly today – may be accused of over-linking!!) The article is his play through of Civ 5 with friends online and what happens to their strategies when anyone drops and the computer AI takes over. Basically its a gong show with little consistency with what the AI chooses to do after you leave. You would think (well that may be a bit presumptuous – I think) that it would be sensible for the computer controlled AI to watch what moves you have done over the past x number of moves, and continue along the same course – if you tend to work with countries on things through diplomacy while beefing up a ground defense, it wouldn’t make sense to suddenly divert all of your resources to build a navy now, would it? (hint: something like that did happen to him. It didn’t make sense to me.) After reading through his well written article and my personal experiences with Civ 5 it dawned on me that the AI programmed there is probably preset by ruler and attached to current units/research tied to what year it is. So, when you drop from the game, the computer AI completely ignores what you felt were sensible moves and immediately reverts to its core thinking regardless of current state.
That feels like poor programming to me. That is immediately what I thought. Then I pulled a great big “WHOA NELLY!” and thought what in the hell do I know about programming AI – hell, programming in general? (yes, I think in italics.)
Turns out very little. I can’t imagine trying to program an AI for a game that complex. For games such as World of Warcraft you would expect the average AI to be pretty simple.
Spawn. Stand there until one of three things happen
a) a player character walks within X units of you (aggro radius)
b) you are hit for damage from a player character
c) you are idle for x minutes so path somewhere.
In the event any of those happens, the AI is also simple enough to imagine –
a) chase them for x units – if you reach them start attack sequence, -if you don’t then reset
b) move x units to player character – begin attack sequence, or
c) walk to coordinates.
I don’t even know if this is how it works but it makes sense to me. And it also feels like the type of sensible “if-then” arguments in programming.
So programming is easy peasy! Seriously though, imagine the layers and thoughts and concepts being building an AI capable of being a fair challenge in a game that has so many complex options, moves, ideas, player skill levels and the like. Imagine the investment that would take to make that game engaging and make the AI make sense. Obviously a bit more than Sid was willing to invest.
But fear not, gentle reader – for I HAVE programmed a computer based AI! It was for a math based game 23 years ago in Turing, in high school. (does that even exist anymore? Turing?). There were three difficulty levels and it was pretty easy to code – The hardest level, aptly named Satan, was perfect. It would calculate every possible remaining move on the board and always make the right move to win, recalculating every possible move every time. If you played a perfect game against the AI (Satan) – AND had the first move, you would win. If you made one mistake or he had the first move, you lost.
The second level (Einstein) was based on the same formula, but had a 30% chance to choose any move BUT the right move. I programmed in human error.
The third level (Gumby), the easiest, was based on the perfect game formula but only had a 30% chance to make the RIGHT move, making a wrong one 7 out of 10 times.
Of course that is incredibly basic but the theory was there was always the opportunity to have a challenging game. Einstein or Gumby could go on streaks and make the game fun, and due to the chosen percentages if you weren’t very good at the game there were different options to enjoy it. This, at a most basic and root level, a math game on an 8 x 8 board. (I also tried programming in background music in Turing, but that is a completely different story).
The point of this entire post and the way I want to end this is twofold:
1) A newfound appreciation for programming gaming AI, and imagining the complexity and vision behind programming for that that must be required. If anyone has any insight on this I would love to hear it!
2) A curious question – has anyone gone up against GOOD gaming AI in the past – and if so, where, and why was it good?
I don’t ever recall feeling like gaming AI giving me a fair run for my money but I bet I am missing a big one or two out there that have.