Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to create a 2D game but I'd like to have the character to wear tons of different equipments on different combinations, like a RPG or something.

So let's say the user changes his/her shoulders and pants, this must be shown to the player and all these different equipments must follow the different characters action (hitting, being hit, spelling magic, etc.).

I see a few problems that I'd like to know the best approach/algorithm/architecture to solve.

1 - Sprites or Animations

Should I create different sprites for each equipment in each action animation?

Is it better to just have the equipment sprite and animate it directly on code like rotating and translating (using something like tween on Flash)?

Is there any other better option? (I really don't like the ideas above)

2 - Positions

Let's say during one of the character's move he starts looking directly in front to the player's view but ends his movement showing his right side to the player (like if he swings his sword from one side to the other).

If we consider one part of the user, like his head for example, it starts in front and then turns left.

It means at least 3 different positions for each head equipment (helmet, cap, whatever).

This surely influence the answer of #1 question. How is the best way to achieve that?

3 - Layers

Let's consider a character move where he spins 360 degrees with his arms open. At the beginning of the animation, his right hand is close to the user's view and then, at the middle of the movement, this is probably behind the character's body on the animation.

Whatever is the option on #1 question, you surely needs to use some kind of layer model to make this sprite or animation to starts closer to the player's view and later change to far away from player's view.

Is there any good way to do that?

I know the question is quite long and difficult to understand. Let me know if you think it's better to have some drawings to try to explain which one and I'll try to do that.

share|improve this question
To what level do you intend for your art to be at? Like retro pixel art? Or those HD sprites, if you have any existing art that would really help me tailor my response. –  Noctrine Jul 23 '10 at 5:25
Hi Noctrine. Actually I'm considering it as a "art independent" question. I'll try to draw some explanations later this weekend to make it easier to understand. Thank you –  homemdelata Jul 23 '10 at 12:45
add comment

6 Answers

up vote 5 down vote accepted

I think it sounds like you are looking for a 2D skeletal animation system perhaps? I don't know of any off-the-shelf systems for that unfortunately, since it has been mostly superseded by the 3D-gfx-but-2D-game trend.

share|improve this answer
+1 It's much easier to do this if you just make the character 3D. –  knight666 Jul 23 '10 at 10:10
but for "3D-gfx-but-2D-game" I would have to consider one of the solutions I mention anyway otherwise I'll need to have a sprite for any items combinations, for example, the same chest piece with 10 different braces pieces will generate 10 animations :( –  homemdelata Jul 23 '10 at 12:49
Not really, you just have attachment points on the skeleton and can drop in whatever you need. –  coderanger Jul 23 '10 at 16:50
I've made an (open source) simple 2d skeletal animation library for XNA, including a decent editor. Check out youtube.com/user/srekel#p/a/u/0/46LIoFNdG_4 and youtube.com/user/srekel#p/a/u/1/8sYkeu5k7XE –  Srekel Jul 23 '10 at 20:02
This is almost the correct answer. Actually you made me figure out that what I'm looking for is 3D Skeletal system for 2D animation. I need to find algorithms for that (if exists any) –  homemdelata Jul 24 '10 at 17:21
show 1 more comment

As Zorba says, most retro games didn't do this specifically because you would need (with sprites) to have multi-frame animations for every single piece of equipment.

Some "lazy" alternatives:

  • Palette-swap the gear instead of making totally different sprites.
  • Draw the character in such a way that the only parts of their body that animate are parts that aren't attached to gear. Like, if the character can only wear a single suit of armor anyway, make it a Helmet instead, and then you're free to animate the entire body while keeping the head still.
  • Use a single sprite for the character in the main game screen, but show the equipment in a subscreen with a static portrait. Then you don't have to worry about animation.
share|improve this answer
add comment

Check James Da Silva's book where he explains how he did The Dishwasher: Dead Samurai. It'll show you how KISS pretty much can solve this. The suggestion of using 3d or 2d skeletal animations are valid, and kinda in the same realm.

share|improve this answer
Can you add the link? –  homemdelata Jul 24 '10 at 17:22
Ah, it's James Silva. Whoops! amazon.com/Building-XNA-2-0-Games-Professionals/dp/1430209798/… –  Kaj Jul 24 '10 at 17:38
add comment

This is a great question but I think you've answered it yourself - you need a 2D bones system that supports bones changing layers, so different limbs can go behind and in front of each other as the character rotates. You will also need to draw your sprites from 4 or 8 angles (or however many you need). Depending on what skills are in your team it might be easier to create these assets in 3D and render them out from the angles you need.

Using a 3D engine is also a good solution, although this will bring it's own set of challenges.

share|improve this answer
Yeah, that's almost that. Just got the other answer as correct but this one is valid too. As i commented on the other, I need a 3D skeletal system for 2D animation :) –  homemdelata Jul 24 '10 at 17:23
add comment

There is one good sprite engine available for C++ called Kyra, maybe it could resolve the issues you have with composition of sprites for your characters.

share|improve this answer
add comment

In old games like the Ultima series, they would indeed draw one piece of equipment in every possible character pose. Occlusion would be dealt with either by not drawing the gear (if the left glove is behind the player sprite you don't need to worry about it) or by just drawing the gear in back-to-front order.

Obviously this was very labor-intensive, and as a result there were relatively few pieces of unique gear, with a lot of palette-swapped and palette-modified versions of that gear.

In a modern game, I'd strongly recommend making 3d characters. If you want 2d-looking art or your platform doesn't have the horsepower for actual 3d, you're still likely to be better off modeling everything in 3d, rendering, and then tweaking the final result by hand.

Alternatively, if you decide you don't need tweaking, don't have horsepower for full 3d, but don't want to ship a huge sprite library, you can package the 3d models and render them to a texture in realtime when you know the model is about to show up in-game.

share|improve this answer
The same I mention on the other answer is considerable here: I would have to consider one of the solutions I mention anyway otherwise I'll need to have a sprite for any items combinations, for example, the same chest piece with 10 different braces pieces will generate 10 animations :( –  homemdelata Jul 23 '10 at 12:50
You'd composite the "end sprite" at runtime. You don't have a sprite for "the player", you'd have a list of sprites that are rendered for each animation frame. So if the player is facing to the right, you'd render "left glove", "left bracer", "player character", "boots", "pants", "body armor", "helm", "right bracer", "right glove" in order. Then you animate each piece of gear independently, floating in midair. –  ZorbaTHut Jul 23 '10 at 19:03
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.