Up until now, I've been working with some really stupid AI code for my game. Basically, the algorithm I used for the critters was: "If you're beside an enemy, hit him. Whether or not you hit an enemy, move in a random direction." Not surprisingly, this wasn't the most effective AI in the world.
While I ponder some of the nitty-gritty details of gameplay mechanics (I'll probably post more about that tonight) I decided to fix the AI and make it appear a little less brain-damaged. I've introduced some code that looks at all possible enemy targets and prioritise them, and even try to move towards them. Of course, it's still only moving in straight lines, so if it happens to bump into a wall before it runs into the enemy, well, it'll just keep running into that wall.
Sometime this week, I'll be adjusting that code even farther to implement something called the A* pathfinding algorithm, which allows monsters to do things like walk through open doors. It's crazy, I know! But it works! And honestly, it'll probably only take me about 2 or 3 hours to write, at which point I'll have monsters behaving almost intelligently. That should make a huge difference to the feel of things...
And in the meantime, I think I've come up with some fun gameplay mechanics, which I'll post about later. For now, I'm going to go make the monsters dig out unwanted walls and then watch the NHL All-Star game.
No comments:
Post a Comment