Monday 27 February 2012

Feedback To Player When Nothing Is Happening

Waiting around, scratching yourself, wondering what the hell the Ai is up to ... if anything? Has it crashed? Locked in a loop? Waiting for input without telling you that it wants you to do something. Who knows?


I had noticed occassionally decals would not work as expected but didn't think much of it as it didn't seem related to the stability issues I had been experiencing. I'd ripped out my custom explosion stuff and gone back to using automated functionality, and whilst this had fixed my disappearing decal, it hadn't done anything for stability. Eventually I noticed that things were getting deleted, random things like GUIs, decal data, SFX, and other things which was causing the stability issue.

Now I'd had previous experience of this a long time ago in a galaxy far, far away - and knew that it was trying to clean something up, failing to find it, and then eating something else.

There had been an issue ... located somewhere between the chair and the keyboard ... that had crept in very early at the start. However it hadn't surfaced until 6 or so months later when I'd had the Ai team in and working with near complete functionality.

I was attempting to delete a decal in the Ai's move routine which the Ai didn't even own, when I should have been using the decal management system to simple remove it.

BY ODIN'S HAT! Either extreme crunch or a sudden outbreak of sobriety had caused such a faux pas.

And with that fixed, stability issues disappeared.

So onwards and er ... onwards!

After replacing all my custom explosion stuff - for the umpteenth ruddy time - I'd also rolled back a few other changes which I'd recently made. Ammo packs went back down to their original 5 from changed 10. This means that ammo might need monitoring on the high rate of fire weapons and various rocket/grenade launchers. The fact was packs of 10 rounds really seemed to stop bullets being a resource and I might as well have just gone for infinite ammo - which I very much do not want (apart from in the handfull of hugely expensive rechargeable energy weapons). I'd made various tweaks to weapon and ammo weights, ranges, stopping powers, and scrapped the original idea of grenades exploding at the end of a turn in favour of immediate detonation. There were far too many instances in testing of hurling a frag and then getting shot when trying to step back into cover afterwards - thus making grenades a liability rather than another tool of the arsenal.

I'd sorted out a whole load of Ai related thinky-thinky about equipment, decisions on using grenades, swapping weapons and finding more ammo if they run out. Which all took far too much effort to synchronize and stop them from changing their minds halfway through doing something. Various tweaks to initially equipping them were also made and some dodgy mathematics fixed.

All of which brings me to having the player wait for things.

When one of the player's troops comes under fire during their active turn, control is momentarily removed and then given back when the incoming projectiles have either impacted or burntout their lifespan. During the enemy Ai's turn, there's a lot of waiting around obviously - which does tend to happen in sequential turn based games, in fact it's supposed to happen or it wouldn't be sequentially turn based ... er ... obviously.

So I've developed a camera and information system to give the player feedback when they are in "passive mode" and do not have direct input control. This starts as a basic GUI announcement that it is the opponents turn, and some basic information about what is happening. At it's most basic this is a simple "Hidden Movement" announcement, telling the player that stuff is a-foot, but none of his little chaps can see it.

This progresses to giving feedback on things that are in the field of view of any of the player's troops, such as an enemy going beserk and shooting indescriminately, fleeing in panic, or walking into a booby-trap that the player had placed at the beginning of the battle. The camera moves to whichever trooper is the most relevant, displaying their Name, Rank and Class, and information about what is happening. This can be about that particular trooper being in danger, to returning fire, to viewing something passively such as enemy panic or new enemies spotted. Eventually I'm considering tweaking the "Hidden Movement" part of the passive phase so that the camera shows a random part of the map as scenery, rather than just lingering on the last trooper that had any information to pass on to the player.

All designed to keep the player up-to-date with pertinent information and views of the action during the phase when the player has no control.

And here's some vidya of it all in action. It starts off with me planting a shed-load of booby-traps ... which the Ai then avoids by using dual flanking manouevers ... ah bugger. This just happened to be the tactics it chose, the opponent not having any clue where booby-traps are until unless spotted by a "Recce" or "Sapper" class (Sapper's can defuse booby-traps by walking into them). The enemy do however walk into an IED on either flank and there's a bug displayed in the player info where the name of the viewing trooper is not displayed with the information (since fixed!). At the very end there's a little demo of me fragging the main group of IEDs and watching them set each other off with secondary explosions.

The majority of the video is just gameplay, with an emphasis on the camera and feedback system during the player's passive phase. It features "Stormy" weather type which has visibility of all troops reduced to 100 units. (There are 4 weather types with troop visibility ranging from 300 down to just 50 units/metres).

Next up, finishing off the Ai's decision making about which equipment to use in various situations, having the Ai take more advantage of cover, and use a wider dynamic avoidance rule when moving as they do still tend to knock into each other on corners. Also required is an end of battle screen featuring stats on how each trooper did, their current state, promotions, the chance to recruit new core troops from any deployed militia which did well in the battle, and an overall battle rating.

After that it's about sorting out armoured cavalry (also to give the sapper class something to act against as an equaliser with all of it's explosive class-based weaponry), make sure the whole thing loads and saves correctly, and then it's about time to make some proper maps/battle arenas for the post-alpha game.