Categories
Game Development

Effective AI programming

In game programming you need to keep learning to stay effective. When I finish a game, I reflect on what I’ve learned and consider my new skills to be more valuable than the pay I’ve earned (although that’s important too). For my last two games, Getting Up and Star Wars Ep3, I worked on the […]

In game programming you need to keep learning to stay effective. When I finish a game, I reflect on what I’ve learned and consider my new skills to be more valuable than the pay I’ve earned (although that’s important too).

For my last two games, Getting Up and Star Wars Ep3, I worked on the AI. Although work on is sort of misleading, because all I really did was support users for the AI code that was already written. The existing AI code was pretty good – lots of code, lots of features, and most importantly anytime anyone else tried to add to it it was invariably worse than what was already there (and often duplicated an existing feature they just didn’t know about). So I didn’t much rewrite or extend it, and honestly there wasn’t that much to learn. In fact, a few months ago I would have said the only thing I learned is what a pain in the ass it is to maintain other people’s code who no longer work there.

On reflection though, I did learn a lesson. Because I’ve been dealing with AI actually since I started in the industry. We had the same AI programmer for every game from my first company, and the AI sucked equally bad for every game that company released. What this has demonstrated is the same thing that the AI code for GU and EP3 has demonstrated: that your AI is only as good as how high level you design it from the start.

In my first game, the design was at the level of pathfinding and movement. Subsequent attempts to add cover pretty much failed, because cover is a higher level concept that takes higher level design. I used to have a teacher that said “You can’t see the forest from the trees” and I never understood what he meant until I worked for a couple of years.

In GU and EP3, the design is at the level of combat and game mechanics, such as triggers, hide points, and gotos. Therefore, these features worked fairly well but there was no higher level planning such as group tactics or fear.

I think in order to have really good AI in a game, you need to design in high level tactics from the start, and fill in lower level concepts such as pathfinding later. Otherwise you will get bogged down in tweaking the existing code to try to compensate and never really succeed.

Leave a Reply

Your email address will not be published. Required fields are marked *