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

Gratuitous Air Strikes

It’s taken me a while, but I have air strikes in the game, although they still need balancing. Here is a brief demo video:

Air strikes currently come in 2 flavours (although it’s all controllable by text files so modders should have fun). And are presented to the player just like a deployable unit from the deployment bar. I might have to fiddle with that a bit later, because currently they ignore divisions, which might annoy some people?

Air strikes last for a set duration and then drop fairly high damage blasts onto random 9and not-so-random) locations within the given radius over that time. Balancing them will be a pain, but currently my thinking is relatively low cost, high-impact and long recharge times, so that you use just 3 or four of them (max) during a battle.

The difficult bit, as ever, is the knowing you have balanced them right, but I’m sure people will let em know if I haven’t. This is probably the last pre-release added feature for the game, the rest will be mod support, bug fixing and minor tweaks and refinements.

 

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.

Gratuitous Tank Battles 1.005 released

So I’ve finally released patch 1.005 for Gratuitous Tank Battles, and I’ve been trying to get a patch a week released between beta and eventual final release. This patch might seem to have less stuff than the last, mostly due to one of the items taking a lot of re-working.

Here is a forum thread showing the full changelist:

http://positech.co.uk/forums/phpBB3/viewtopic.php?f=32&t=7210

And here are the highlights:

There is now a direct association between the flames and damage textures on a unit, and it’s current state of health, rather than the semi-random system there seemed to be before! That means that a unit that looks undamaged probably is (although shields and armor may be reduced), and a unit with several plumes of smoke streaming from it is probably in trouble. Of course, for player-units toggling ‘H’ or the health button will let you see the details (or select that unit). This took a lot of fairly tedious re-jigging.

On a similar note, shields now flicker in a strobey-way if they are below 33%. You probably won’t notice on units without big chunky shields, because once down to 33%, they are probably under attack and close to failure, but hopefully this makes things a bit clearer.

There is a gratuitous new visual effect for laser guidance. Previously, those red laser beams were on a lot of units, mostly mechs, semi-randomly. Now, they only appear if that unit is equipped with the top (VI) targeting system. They also swish across and illuminate some smoke, and pulse a bit and generally look pretty cool at night. Expect to see less of them, but for them to look better :D

There is a new campaign map (Tanks for the memories!) added at the end of the campaign. It’s another evening map, this time very trench-heavy, hopefully you will all enjoy it :D

There are some changes and improvements to the explosions, after a LOT of work on the explosion editor. I expect them to be better still in the next patch, now I have seriously tided up my particle & explosion editing code!

Enjoy the new version, and as usual, anyone pre-ordering the game right now gets the very latest version automagically (you won’t need a patch). Don’t forget to tell friends, family members and total strangers if you have played the game and enjoy it, it’s all much appreciated. There is an official patch 1.005 comments thread here:

http://positech.co.uk/forums/phpBB3/viewtopic.php?f=32&t=7225

Explosive fun

There is a todo list for the Gratuitous tank Battles beta, and something not officially on it (because nobody mentioned it) was to make the explosions and flames and so-on look better. People keep telling me they look great, but I want them to look tons better. That means a lot of tweaking, optimising and theorizing.

It’s amazing how many variables you need to get particles looking right, and then how much more code. I have special code for flames, for flamethrowers, for ground bursts, for smoke plumes, for debris, for emitters attached to moving units… and so on. It’s quite a spaghetti mess of complicated and differently designed systems, but it seems to work.

Hopefully by the time the game ships to final release, the effects will look a lot better. It’s one of those things I really enjoy coding (even on Good Friday when i should be eating chocolate!), so I can often justify silly amounts of time on it.

I also have grand plans for target designation laser effects, flickering shields and pulsing damage textures, but not enough hours in the day. How annoying…

First real players, first real bugs

So…. GTB is out there being played by real actual people, rather than just me and my cats, and of course, the first few bug reports come in.

It seems hard for many gamers to believe that developers do their best to reduce bugs, because the minute you play a beta build, you encounter crazy stuff that makes you think “how the HELL did they let this one go?”. I thought I’d give an example of the worst bug found so far, and what caused it, and why I didn’t spot it.

Alt-Tab hangs the game.

On the surface of it, that seems mad, and annoying. Surely cliff tested it? Yes… he did, massively so, and it worked fine. So when I got multiple bug reports, after I KNEW it worked, I did some digging. Did alt-tab work for me? yes. In release build? yes. In release-build run outside Visual Studio? Yes? In different maps? Yes? Nighttime? yes. units selected at point of alt-tab? paused? mid-explosion? shockwave being rendered? nightvision on? paths drawn? yes,yes,yes,yes… after a cold reboot? YES.

Testing all that takes longer than it sounds… So then I do what you *have to do* when you encounter stuff like this. You pretend to be playing innocently, and go through an entire mission, playing and ignoring the potential bug, winning an entire battle. Then you play a second battle, and alt-tab. HANG

Which makes you think that it is something to do with multiple battles. Cue lots of digging through code. Cue turning on the directx debug run-time and maximised error reporting, and running the game in debug. Also cue bouts of near-sobbing when I manage to play 2 battles and it NOT happen… Eventually I manage to reproduce the hang in the debugger. (This is a big win). The you get that infuriating directx error that basically says “Srry, can’t restore DX, you forget to release some directx resource. We know which one, but we are leaving it to you to guess..” or words to that effect.

I bet this guy wrote that one:

Anyway, to cut a loooong (6+ hours) story short, eventually, a whole lot of experimenting shows that the problem occurs only if the post-mortem dialog, or one of it’s many offshoots get launched. This does some multi-threading, which led me up a right blind alley. Anyway… eventually it becomes clear that displaying the unlock-choices dialog causes it…sometimes…

Then a sudden brainwave. The unlock choices *sometimes* gives you a new Hull, and to do that it needs to render that hull. As an optimisation, it doesn’t draw it in layers, it renders out a composite texture (multi-layered) as a sprite, and uses that (it will get re-used later in various dialogs…). That means some render-target code gets triggered. A bit of digging shows that when I create a render target to save out a new composite hull texture, I wasn’t calling Release() on it correctly, in two places. Arrghhh! bug fixed. (AFAIK).

So why didn’t I find it before I shipped? Well basically I implemented the unlock dialog after I’d already tested the hell out of alt-tab. By the time I was close to shipping, and double-checking alt-tab, I either tested it in the first battle (no probs) or I had already unlocked anything and didn’t see that dialog, or I got lucky and the dialog only offered modules or ready-rendered hulls.

But it’s swings and roundabouts. This bug was hell, but pretty much every issues everyone is experiencing on the unit design screen to do with saving and deleting turns out to be a single line where I used = instead of ==.

Don’t you just love C++?