Monthly Archives: October 2011

Amazingly cheap computing

October 17, 2011 | Filed under: Uncategorized

I guess the younger you are, the less this post may resonate.

Computers and computing gadgets and software is staggeringly cheap. Yes, games, but practially everything. I recently bought Sony Vegas HD 11 video editing software. It does EVERYTHING, and it cost under £100, as I recall. I’ve spent more than that on getting my boiler serviced. This is software that I could use to run an entire video editing business. It’s mad.

I also bought an external 1 terrabyte back up drive yesterday for £45.

FOURTY FIVE POUNDS for a TERRABYTE.

I need not remind you that a terrabyte is over 1,000,000 megabytes, which is a million zipped copies of war and peace. And I got a device that can store all that for less than the price of a tank of petrol. This is staggering.

Meanwhile, to compensate, the rest of the world gets stupidlty expensive. I just bought a 990mm by 395mm piece of 2mm thick polycarbonate (plastic) and it cost me £27 including tax and delivery. Madness. Getting a drain unblocked cost me over £100.

We live in strange times indeed. Everything is so expensive its a wonder people can afford to live, and yet anything encoded digitally is so cheap as to be laughable, and the technology that would have been dismissed a decade ago as a pipe-dream is now practically disposable. As an IT engineer I worked on 30MB hard drives you could practically crush a car with. You now wouldn’t bother buying a hard drive below a terrabyte, and you could put that in a large pocket.

If only all this crazy advances in computing tech co0uld be applied to making this stuff cheaper. Insulation FTW.

In case you missed my minor PR splurge, there is a new video, and new screenshots of the game. The screenshots are clickable on the slightly redesigned site here:

http://www.gratuitoustankbattles.com

There is also a moddb page now here:

http://www.moddb.com/games/gratuitous-tank-battles

And mroe excitingly than all that is the new video. You can watch it in 720 res HD if you like :D. PLEASE upvote it, tweet it blah blah, if you think you can help spread the word. Mentioning the game on forums is especially helpful. The more hype and eventual players the more maps everyone will have :D

Opinions on how it looks are most welcome:

Also note that Democracy 2 is on sale at direct2drive:

http://www.direct2drive.co.uk/481/7494/product/Buy-Democracy-2-Download

And hopefully the parasites DLC for GSB will be on sale through steam on monday.

That’s a full day surely?

This is not an easy task. It is for most Tower Defense games, because they are simply scripted. The level has a set number of enemies of certain types and times, and they appear as attackers. And of course, most TD games don’t let you play as the attacker, so programming the defense AI is not needed. I need both of these to be non-scripted for Gratuitous Tank Battles.

I need attacking AI that ideally adapts mid battle to your decisions, and this is harder than it sounds. The first approach I took was to have a system with 3 types of placement timing mode (steady placement, or hoard points for a big attack or spam the current unit) and two types of unit selection (random, and select the one that has been most effective so far…with some variation).

The AI would switch randomly between these combinations and it looked pretty convincing. Sudden waves of identical units followed up by who-knows what. The problem was, it obviously did so with little care as to what it was up against.The ‘most effective unit’ code was good, because it meant totally useless designs which charged into a hail of bullets would not see much repeat business, but something major was lacking. That was the anticipating of future events.

If the defender has placed 6 machine-gun turrets (rubbish, but devastating to infantry) you shouldn’t place down infantry, regardless how well they did earlier in the battle. If they have lots of laser turrets, place down shielded units to get past them…etc.

So today, at the end of a long day of video rendering and editing, and tweaking, and bug fixing, I’m starting work on a more generic system for opponent army composition analysis, that can take snapshots of the enemy forces and realise that its 63.2% anti-shield units, and thus we should de-prioritise shielded unit selection etc.

This is annoying, fiddly, long winded code that nobody will ever see, as such, but will make Gratuitous Tank Battles a convincing challenge, which is well worth spending time on.

It’s easy to get caught up with features, graphics, optimising and going through a checklist of items to do when you work on a game, and not set aside time to keep fiddling with the mechanics. There are an absolute ton of variations to the mechanics of any game. The only real way you know if the mechanics are right, is by trial and error.

If you wonder what the hell I’m on about with ‘game mechanics’, it’s basically the rules and systems by which the game is played. For example, in chess, the pieces all move in different ways. Some can only move forwards, some can only move 1 square at a time… None of the chess mechanics are obvious. Imagine designing it from scratch. We take for granted the idea of a knight moving over other units, or castleing, or units like bishops having infinite ‘range’, but none of them is ‘obvious’.

Right now, my bugbear is support units. GTB has repair trucks and ambulances for attackers, hospitals and repair yards for defenders. My current mechanic is this:

The support units pulse out ‘waves’ of effect at a certain interval and radius. Any damaged vehicle (repair) or soldier (hospital) within that radius at the time gets X of their health replaced.


Look! Neither side is bothering with hospitals or repair units…

This seems ineffective, and there is little real incentive to use these units. I might have just set the costs for them too high or the effect too small, but in fact i think it’s more fundamental. By the time people are losing health, they are a lost cause, and the interval between lost health and death is too slow to enable a health pulse to really do much good.

Possible solutions:

  • Ultra-rapid health pulses to ensure timing not an issue,
  • Reduce armor and shields and increase health of all units
  • Make support units dirt cheap so they are worth it anyway
  • Allow recently destroyed / killed units to be revived by the pulses.
  • Change the mechanic entirely so that the units don’t use pulses, but act as damage modifiers to protect everyone within their radius, effectively making them mobile buffs.

I’m planning on trying out the last option. It involves a lot of fiddly code, but what doesn’t eh?

BTW, stuff like this takes AGES, and it’s why I REALLY hate clones of games, where some talentless drone comes along and just copies an existing game design but slaps on some new textures. Yes, it really is easy to copy the mechanics of a popcap game, but coming up with those mechanics took a ton of work. This stuff is never obvious, and I personally don’t think it can be reliably learned from books. I think you have to just keep trying stuff.

Life is so much simpler when you bunch up all your hotkeys and toggles for debugging the game into a single menu. I feel like I have a rough idea what’s going on now. I also feel more confident about coding decent defensive AI when you play as the attacker:

The code for defending basically needs to manage three things. The play style (Is it spamming units, hoarding points, or steadily placing), The choice of units (Does the enemy have units weak Vs lasers? Are there lots of infantry needing flamethrowerising?) And the choice of unit placement. I’ve been concentrating on the unit placement debug UI today, so I can see what the AI is thinking when it chooses to place a turret at X rather than Y. More work to do, but currently it evaluates proximity to enemies, their size, victory-point value, closeness to the exit and proximity to the placement, plus it also has bonuses for being able to cover multiple paths from a single location.

It all needs lots of tweaking and balancing obviously, but it’s getting there. Attacking AI is much simpler.

After getting this stuff done, I’m thinking of experimenting with a unit ‘cooldown timer’ beyond a certain level to prevent spamming the same unit everywhere. Essentially there are supply delays if you plonk down 4 heavy tanks all very quickly, as new ones need to be dispatched from your offscreen HQ. I think it might be a good mechanic that encourages variety.