Ludum Dare 48h & Locomotion

It looks like there's another Ludum Dare 48 hour game programming competition starting soon, so I'll hopefully be taking part in that. Spread the word and join in - the more the merrier!

Meanwhile, back on my main project, I'm having much trouble with just trying to get a simple "chase player" behaviour. Pathfinding (with A*) wasn't too hard but there's lots of icky low-level details for moving a character around the environment which are creaping into my behaviour and generally cluttering it up. And due to the highly temporary nature of behaviours stopping and restarting a behaviour (such as repathing when the player moves far enough to invalidate the current behaviour) tends to lead to unpleasant animation jittering as it rapidly switches between idle and running animations.

So I'm trying to pull out some of the low-level movement and animation into a "locomotion" layer. The idea being that it will take high level orders like "run left to this point" or "jump to this waypoint" and it'll automatically handle transitioning from the current animation to the next as well as the low-level ground following and animation ticking.

The idea is that if a behaviour aborts or switches the locomotion layer will still retain the current action and state, so it'll continue with it's current animation until issued a new order by the behaviour. So hopefully switching to or restarting the "chase" behaviour means that instead of snapping to a halt and then starting to run again (often in the same direction) the enemy should continue to run as it was until the "chase" behaviour decides where it actually wants to go. The locomotion layer should probably have a default anim to revert too should the current action finish, so if a behaviour is taking a particularly large time to respond it'll start playing an idle animation rather than doing nothing.

That's the theory at least. In practice drawing the line between locomotion and AI logic is proving tricky, so we'll see how it evolves as things progress...

Leave a Reply