Friday, 27 January 2012

Something That Vaguely Resembles A Game ...

 Does exactly what it says on the tin! I've got a full blown ... if rather rough ... battle with the Ai on the go - and it all works! Well, apart form the bits when it crashes - but I'll see about fixing that later.

Well, it took 8 months but it's something that vaguely resembles a game. At least the single battle part is, which will eventually be squeezed into work with the larger Strategy-Flying-Around-Conquering-Stuff part.

But anyhoo, it works "just as planned" ... only rougher 'cos there's various parts which need tweaking, changing or just downright fixing.

I'd struggled for some time ... and pontificated considerably longer ... about how to get the Ai opponent to choose a team of troopers from the available resources of cash, veterans, 6x classes, and class-level based equipment. Initially it seemed easiest to make pre-defined teams with minor variations ... right up to the point when it became clear that this was obviously a rubbish way of doing things.

After a few morale boosting sessions where I charitably lined the Chancellor of the Exchequer's pockets in a country pub ... and trying to kill a seagull that oblitered the procedurally generated algorithm I was dreaming about, it all became quite clear.

I created a simple yet awesome system which procedurally generated an opposing force within the constraints of available cash, veterans and class levels based on weather, strategy, objectives and multiple squad tactics. No, I don't remember how ... it was all a dislocated haze, but then for Stevie, Real Life ™ gets fainter and fainter everyday ... (I find it helps if you say that in a strained and high pitched voice)

So there it is, an Ai team playing to the strengths afforded to them, using one of 8 different tactical approaches. These are fairly regular sort of tactics and are as follows:

1. Extended Line - sweep down across the battlefield, advancing on the enemy ... it worked in the Great War! Oh wait ... no ... no it didn't ...
2. Frontal Assault - group everyone together and go straight for the enemy ... and hope they don't have to many MGs, mortars or anything else that makes a mess out of a large group in open terrain ...
3. Hook and Line Left - central support group with flanking assault group to the left.
4. Hook and Line Right - guess what this is the mirror image of?
5. Horns of the Buffalo - Zulutastic. Dual assault groups flanking on either side with a central support team.
6. Pincer Movement - twin flanking assault groups.
7. Flank Support - twin flanking support groups engaging at range.
8. Skirmish Line - like extended line but made up of long range support gunners, keeping their distance as much as possible.

Needless to say, weather and terrain conditions are taken into account when the Ai are choosing tactics and classes. So if it's pitch black and everyone is tripping over each other in the dark, there's a lot more chance of their being assault groups than support groups, and likewise, if it's a barren, featureless desert with visibility stretching for miles/kilometers/leagues/cubics they're not going to create vast numbers of assault squads armed with pistols. This doesn't mean that they won't occassionally pick a less suitable tactic - just that they are a lot less likely. History is filled with plans which "seemed like a good idea at the time".

Anyhow, as I mentioned, it plays like a game ... except when it doesn't and crashes. Upgrading to the newest version of the engine might help - still using a customized previous version ...

I've still got 4 post-it notes full of bugs to sort out. And the player really does require a lot more feedback on what is happening during the enemy turn. At the moment reactive fire works fine, the camera mvoes to the player's trooper being targeted and positions itself so you can see who is shooting at him. Ideally this also needs to track visible enemies whilst they move. Talking of visible enemies, spotting works fine, showing and hiding opponents as they move in and out of sight, so no rotating the camera around an obstacle to try and spot an opponent that your team members cannot see.

Reactive fire works both ways, requiring the passive team to successfully spot and have enough initiative (based on distance, stance, angle) to either fire first or fire as the opponent moves.

The Tactical-PlayGUI (as opossed to the StrategicOverview-PlayGui) is the only one which still requires to be overhauled, and there's a definite need to highlight the start of the player's next turn as I've spent a while staring at the screen before realising that I had control of my buttons back.

I also need some sort of victory/loser screen detailing what your troops did and what sort of performance you had.

I'd been concerned over a few things and had halved the weight of ammo for fear it was too easy for playesr/Ai to run low. Turns out they don't actually use that much (either human or Ai) in any of my test battles. Also, battles are over a lot quicker than I had expected. Initially I was a bit disturbed at the ease I won my first battle 10-3, but then lost both my next battles 5-10 and 7-10 respectively when the Ai used different tactics and the terrain was less open. With both forces equal it's a fairly nice challenge.

Gah ... enough typing ... video of a battle, with the boring bits edited out. Features plenty of spotting, reactive fire, some healing and some panicking in both teams over the deaths of team-mates.

Easier to see what the hell is going on in HD but you knew that ...

Next to do is improve how the Ai decides how to start each turn, which weapon to go with when they have multiples. They already do pretty well when deciding on grenades or bullets. Currently I have the "Meeting Engagement" gametype working pretty well, but also need Assault and Defence. Also tanks/armoured cavalry needed or the Sapper class isn't going to have too much to do with it's specialized explosives. Finish up my save/load solution and eventually cram it all into the strategy part of the game so that the campaign mode works fully. And of course art ... which all comes last after the damn thing works properly.

No comments: