Automating character animation of static images
Ok, so I'm not a pixel artist. I'm more of a programmer.
In my spare time I'm working on a game using LPC assets, which are mostly great. I've made/edited some tilesets, but of course I also need to populate the world. The game in question is an action/adventure RPG (think A Link to the Past for inspiration), which means I need at least move and attack animations for different critters. Now, there is a lot of very useful art here. And there is also a lot of very nice looking static images, or incomplete animations. Expanding those (or finishing them) takes up a lot of my time (I posted one such outcome here a while back, for the Warthotaur), that I'd rather spend on the game code.
So, a couple of weeks ago I had an idea: what if I chopped up an LPC base image in different body parts (head, torso, arm, hand, leg, foot) and tried to reconstruct the animation by figuring out where the different parts fit best.
The result, for the south-facing base animation, is this:
Not too bad. In fact, I'm quite happy with it. Now, I can derive the required transformation from the base assets. Then I can apply those to a different image, after chopping it up in suitable ways. Let's try this guy again:
Result:
Again, not too shabby.
So, as a proof of concept, I'm quite happy with how this works out at this point. Some caveats. The biggest one is that the south-facing walking animation is probably the easiest animation to do this with. The attack animations are going to be far more challenging. Besides that, the output needs some manual polish to make it look good. It should still end up saving time compared to doing the entire animation by hand.
That's really cool! I think this has a lot of potential.
I can see a 1-pixel gap appear on the walking animation's knee every few frames. I wonder if cropping the parts with a few pixels of overlap would solve that.
--Medicine Storm
Thanks! I certainly hope this will turn out to be useful.
I haven't done much to improve the output of the algorithm; I'm sure it's possible to eliminate the 1-pixel gap in the walk cycle with a bit more care (and more careful selection of the relevant body parts). I did have to tweak some of the offsets for the Warthotaur to get the limbs and head spaced correctly (the ruff throws off the placement of the arms and head), and I'm trying to automate that first. Shouldn't be too hard, but it's giving me issues...
Are you planning to release the code? Even imperfect animations that need a little cleanup would be great.
I might as well. No concrete plans though.
I did simplify the algorithm considerably though. My initial setup had a hierarchical network of anchor points (joints) and offsets, but you can do all that implicitly and just store the coordinates directly.
The forward walkcycle works fine, most of the other animations are a good first attempt, but I'm sure it can do better by automating some more. Progress is a bit slower than I'd like, unfortunately.