I am implementing an NPC to walk around a virtual space, specifically a cat. I have a series of short animation clips (3-5 seconds). My first instinct was just to choose a random animation when the last one ended, but I realised that it wouldn't look realistic as it would change behaviour too often, even if the next animation is limited to physically contingent possibilities.
My intended solution is something like a behaviour tree (http://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php), where each animation has a weighted list of next animations. I.e. if the cat is walking, it has an 80% chance of continuing to walk, 20% of sitting down, 0% of sleeping. Basically using a markov model to get the appropriate next step.
However I have no idea if this is a good solution, nor do I know how I'm going to generate the mapping from current animation to potential next animation + probability. 30 animations * 30 next animations = 900 weightings. That's a lot to calculate manually.
The cat will sometimes react if it hits an obstacle, but the brunt of the problem is choosing a realistic sequence of animations without picking them all in advance. In the tree there would also be some other inputs, like proximity to a person, location in room, time since last ate etc.