Thursday, January 16, 2014

Enemy AI

I've wrestled with how I'm going to implement the AI for the bot players for several days. I've studied Behavior Trees, Goal Oriented Action Planners, Simple Hierarchical Finite State Machines, and Hierarchical Task Networks.

I've varied from one to the next, always circling around Behavior Trees as my most likely implementation. Then something interesting happened. I remembered what my actual goal was. I have to finish an ambitious game design inside of 30 days and I'm more than halfway through my deadline.

I pulled out the razor and cut my ambition in half and the scope of my game AI into thirds. This game doesn't have to be a world beater, it has to be finished in 13 days. Having made my decision,(I'm going with old fashioned Finite State Machines, they don't scale for crap and the implementation is almost guaranteed to be sloppy, but I understand them and can code them up quickly.) I'm breathing a sigh of relief.

I thought about all of the half finished projects on my hard drive and all of the excitement of exploring new concepts and new technologies. The truth is I can explore those parts of programming at will. Goal-less, ill-formed dalliances into whatever catches my eye will always be available to me.

Right now I need to practice finishing. And finishing means not rolling the dice on a technology I'd have to learn from scratch. I've already integrated a new GUI library into this project and it set me back several days. I've overcome that with a lot of hard work and focus but I'm not sure the project can stand another adventure.

With that settled I started rolling the Bot AI this evening. My other work on the creep and tower AI served me well and I knocked out over half of the basic implementation in just a few hours. I'm going to make a bold prediction and state that the Bots in this game are not going to be exceptionally smart.

The first pass, which I'm only halfway through will allow the bots to hunt whatever is nearest them and go back to base to heal when they get below some health threshold. Additionally I'm going to give them access to the node network I built for the creeps and they'll use that to switch lanes if I get that far.

Otherwise they'll just be super tough creeps with some extra will to live and an extra trick up their sleeve. A bit boring, but ultimately achievable.

I still have to implement so many things. Major systems untouched include the entire game state manager, an introduction GUI to start the game, a respawn ability for the players and the bots, sound effects, music, and a victory/defeat screen for the end of the game.

That doesn't even include skinning the game if I get time, animation, a lot of feedback systems that are important to understand the nuances of the game, and the player controller is still the hacky version I rolled initially just to test the game.

Good times. 13 days remaining and I'll need all 13 to hit the mark but I'm enjoying the hell out of this experience. I think back to my last serious game attempt before I started the 1 Game a Month Challenge and the time I spent on it. It was a rather simple space shooter with randomly spawning enemies and a simple level manager. Depending on whether I roll another month with this game after hitting the challenge I may go back and re-make that game. What took me 80 days last time to make a game that's maybe 80% complete would probably take me 20 or 25 days now. It would be a good test of how far I've developed in the last 45 days.


More later...

No comments:

Post a Comment