Friday, August 21, 2009

Cheating AI

While writing Island Commander, the temptation has always been to allow the AI to cheat, as this would make it so much easier to write.

A programmer has only two options when writing an AI if they want to make a challenging game: allow it to cheat, or to analyse the game so much that they can break down the "secret" of winning into something like a flowchart, where every situation is covered and has an appropriate response.

Needless to say, this is no easy option for anything above the simplest of games (can you imagine something like this for chess?). In addition, every time a change is made to the game, or a feature added, the whole "flowchart" (and thus the AI code) needs to be changed.

However, this is the only option, since if any situation is not covered, the human players will quickly identify it and take advantage of it, and from that point on, the AI is no competition. Something I have been told several times!


Bryan said...

Have you tried learning systems? They aren't easy, but this game design might be a fit for one.

zorful said...

These "find expected position" blocks remind me of a brief experiment to divert AI attention and resources in IC and make him build silos there. It works to some point, you can then advance around these to destroy the mines.