Tuesday, 27 August 2013

Tuesday Tribulations

Every Flavor Bean

A common problem when writing AI is the increasing sophistication of the logic as you compound conditions on top of each other. Should a character duck before reloading, when should they run for cover and reload, do they have the time to reload while stood up without being shot, what if the player springs on them mid-reload?  As you can imagine there are multiple permutations for every single animation event the character can perform.

As such, my progress goes much slower than I would have liked, probably because I like to tinker and get things 'just so'. I am realizing all too clearly that such an attitude will keep me in AI land for months if I let it.

Story So Far

The current AI prototype is looking good now, with the character patrolling and running, ducking, running while ducking, strafing when stood, tracking down the player, finding cover before reloading and most recently, climbing the staircase up and down using proper animation which finds the steps perfectly. The animation needs improving but the mechanism has been added to the state engine to get the character to the foot of the stairs, play the animation, adjust the world position of the character and resume any previous state the character was in.

This same mechanism I can use for the ladders and intend to do so and remove the last of the hack code present in the prototype.  I also plan to accelerate adding features for the character, and fiddle less so I can get some serious progress made.

Right now the character can put up a decent fight, hiding behind cover, retreating the reload, and finding new paths to the player (thanks to a strange Search Area bug) which means combined with the character running event, your foe can run at you from seemingly random directions and spraying you with bullets.

I am not 100% happy with the character so far, not least because you can still catch him doing silly things like reloading but I can still see a bit of him round the corner, or standing point blank in front of me shooting with very little strafe. I am considering adding a melee attack at this close range as it might solve the problem and improve the dynamic all in one go.  Fighting at more distant ranges with cover objects works very nicely.

Signing Off

I am not too miffed about today's progress despite wanting to have done more. It's still over 10 hours graft and it moved the prototype forward in valuable ways.  I do feel I need to press down harder on the gas now, as we still need to see character physics adding, player weapon functionality, health logic, grenades, doors, e.t.c. All this will be needed for an 'ace' demo!


  1. Hello Lee,
    looking to other games i found things that you described here, almost all enemy reload behind a cover, but eventually you can catch'em while they reload. your consideration is right!! i tried some titles (on pc & ps3) and when at some distance enemy stop to shoot at you and start a melee attack. if could be possible try to add it and see the result, when the distance between player & enemy is under certain value, make the enemy run to the player and start a melee attack. this action is very effective, and if you think, very logical..


  2. Don't forget swimming. Melee is a perfect solution. Punch or stab swipe etc at a certain range he switches. To sword knife fists etc. I do admire your hard graft. And it is good to see progress that you are happy with. Well done. Note: will you ship the biped or do character shop reloaded