2D Skeletal animations with swappable parts

I’m looking into making a 2d sidescrolling RPG. I’d like to have different items with different looks for the character, this would mean swappable image sets on a 2D character. What I’ve come to is 3d models rendered from the side, but I would prefer a 2d skeletal animation with just bones that I could map 2d images to so creating them would be way easier. Has anyone done this? What would be a good way to tackle this?

I know of 3 good tools with a MonoGame runtime that can help you with 2d skeletal animation.

  • Spine is probably the most polished tool out there. It does not have a free version, the ‘essential’ version ($70) does not support inverse kinematics or mesh deformation (deforming sprites during an animation). The ‘professional’ version is $300 or something. It has an official MonoGame runtime on the following page: https://github.com/EsotericSoftware/spine-runtimes
  • An alternative with a free version is Spriter. Free version does not support advanced kinematics, mesh deformation, advanced tweeting curves and triggers (events during animation). Full version is $60. The MonoGame runtime is on GitHub at https://github.com/loodakrawa/SpriterDotNet
  • DragonBones is a completely free tool with some of the features that are only in the paid versions in Spriter and Spine, like inverse kinematics, mesh deformation and events. The creators provide a C# runtime and @caotrong got it working with MonoGame.

You could of course roll your own tool and runtime, like the peeps that made Salt & Sanctuary: http://www.gdcvault.com/play/1024155/Postmortem-Salt-and-Sanctuary

Thanks for the reply! I already found the first two, the last was new and I looked at it.
It doesn’t seem to be what I’m looking for though. They all do skeletal animations but I would need to swap out parts, so a new hat, new clothes, a weapon etc. Imagine I have 10 hats, 10 body’s and 10 weapons. What I would like is 30 sprites that I could attach to bones, but with these systems all combinations would be a 1000 single sprites =/

But they do supoprt switching sprites at runtime.
I mentioned the runtimes, because that’s what allows you to interact with the animations by e.g. swapping out textures.

It’s probably not 100% the same for all three, but I implemented a runtime for DragonBones a while ago and here’s how it worked:
The base object is an armature (like a model). That has a list of bones, which by themselves are not visible. The bones have a transformation associated with them. Animations can change these transformations. Each bone can have a collection of slots attached to it. Slots can have a transform too, which is applied on top of the bone transform (so slots have a position relative to the bone their attached too, this makes them animate when the bone is animated). A slot has a list of Displays and a display index which determines what display it is currently showing. A Display can be one of three things. It can be a texture, a texture mesh (allows for free form deformation of a texture), or a nested armature.

You can change what’s displayed by simply changing the display index. So if you want swappable equipment, you can put some textures in displays and associate them with the relevant slots, then at runtime change the display index :slight_smile:

Alright, that sounds exactly like what I’m looking for. Any chance you have a sample of your implementation? Else I’ll just fiddle with it :slight_smile:

1 Like

I only tried DragonBones, but back then there was no official runtime, so I started writing my own. It wasn’t that good (lots of garbage, didn’t batch draw calls) and it’s not compatible with the latest version,. Because I wrote my own runtime the api is different too, so what code I have from then is pretty much useless now.

There is now an official C# runtime for DragonBones on GitHub: https://github.com/DragonBones/DragonBonesCSharp
You’ll probably need to do some tinkering to get it working with MonoGame (only the rendering). I know @caotrong managed to get it working pretty easily though :slight_smile:

If you’re looking to get up and running quickly, maybe Spriter is a better choice. There are more examples and support for Spriter and there’s a runtime specifically for MonoGame. If you want some of the more advanced features (you can do some awesome stuff with mesh deformation), but don’t want to or are unable to pay for the full version of Spriter or Spine (or just enjoy figuring this stuff out), I’d recommend DragonBones.

Hi @xStoryTeller.

You can read through this discussion: Please, help me to use DragonBonesCSharp?

https://github.com/DragonBones/DragonBonesCSharp It’s really very clean.
Read data format and inform you animation data. You just take that data and use MonoGame to draw them.
You can consult: https://github.com/DragonBones/DragonBonesCSharp/tree/master/Unity

1 Like

@caotrong did you write whole rendering code, even with mesh deformation? If you still have it, could you share it? I’m working on importers for dragon bones files based on parsers provided in the c# runtime. We could merge them and make ready to use out of the box runtime for MG.
BTW their original code is so complex and hard to read that i’ve started refactoring it to be able to understand anything from it, hours of work…