Game Design, Programming and running a one-man games business…

Better AI on the way

There are a bunch of things that could be added to Gratuitous Tank Battles, all of which takes time, and lots of tweaking and balancing, and may or may not add to the gameplay. My pet idea is a ‘safe zone’ extending some distance behind heavy tanks, which gave infantry in that area a cover bonus against fire. Theoretically easy, but might it look a little weird? if there is obviously clear line-of-sight from enemy turret to infantry, how can I justify the bonus?

One thing that I have started on, because it was bugging me, is improving the defensive AI. A lot of people have been complimentary about the AI in GTB, which is very nice, as I am, in my heart a bit of an AI coder, but I see so many battles when the AI does dumb things. The two dumb things that really bugged me (but NOBODY has mentioned it) were as follows:

The Ai building turrets next to attacking units, rather than ahead of them, so they don’t stride past during construction

The AI not effectively demolishing and rebuilding units in the last minute or so of battle

The first problem is hopefully now fixed (The second has always been coded, but obviously needs more work), but it’s actually one of those coding problems that annoys AI people, because management will never understand the complexity (and think you are crap/slacking). In theory, the solution is simple – Don’t analyze the path next to each potential unit-build location, analyze the paths that are 5-10 path tiles ahead of them, so you can know what will be in range when a unit is built, rather than right now. Easy, job done, 10 minutes!

But in practice much harder. There are maps with branching paths, and worse, some with paths that flip back between two tiles (making for some interesting recursive gotchas), so that means that identifying which path squares to keep an eye on and calculate ‘urgency’ for becomes a bit of a pain. It’s also horrendously slow, but thankfully way way faster in release build, and only happens on map load anyway. (Theoretically it could be saved out and rebuilt only on edits, but it turned out to be fast enough not to bother). To code all that, test it, optimise it and debug it (with a debug overlay to check it worked) , took the best part of a day, but I think it’s worth doing.

So today, one thing on the list is the demolishing/endgame stuff for the defensive AI. No reviewer has yet criticised the AI for the game, but I guess I should be aiming at them praising it, and hopefully I’m nudging in that direction.


4 thoughts on Better AI on the way

  1. Hope you will keep in mind, that AI who plays perfectly is a very boring AI to play against, since computer intellect is obviously much better at crunching numbers than alive person is. Better AI != better gameplay.

  2. I agree perfect AI is a bit boring. Also If the AI is too good, I’ll never win. I find you tend to make your games a bit on the hard side. I always got my ass kicked In GSB Galactic Conquest. I’ll be lucky to even beat GTB.

  3. One thing I have noticed is that near the end of a game the AI, on defense, will often spend time deconstucting non-optimal turrets which, nevertheless, could fire on my forces as they try to leave the map and replaces them either 1) not at all, or 2) with insufficient time to build before the game ends.

Comments are currently closed.