Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Which is the best approach to make a 2D character to be able to use tons of different equipments when in action?

I'm developing a 2d isometric game (typical Tolkien RPG) and wondering how to handle character/equipment combinations. So for example, the player wears leather boots with chain-mail and a wooden shield and a sword - but then picks up plate-armour instead of chain-mail.

I'm using Blender3D to create objects, environments and characters in 3D, then a script runs to render all 3D meshes into 2D orthographic tile maps. So I can use this script to create all the combinations of character equipment for me, but there would be an explosion in terms of the combinations required.

share|improve this question

marked as duplicate by Byte56, Tetrad Oct 29 '12 at 15:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

As you are pre-rendering everything... why worry how many combinations there are? If you do them in sets, you won't have to re-render everything every time, only subsets. This is dev-time stuff, I wouldn't sweat it. Just pick up a cheap second-hand PC or two to act as a little render farm, if you're solo. – Arcane Engineer Oct 28 '12 at 14:18
up vote 4 down vote accepted

Most 2d games solve this problem with the "paperdoll" technique.

You create a spriteset for the "naked" player character (you might want to add underwear to avoid nudity), and you create separate spritesets for all boots, shirts, pants, headgears etc. These equipment spritesets only contains the item itself, nothing else. When the player character is drawn, all the sprites are drawn on top of each other in a predetermined order.

So you first draw the naked character, then its boots over the naked sprite, then its pants, then its shirt and then its helmet.

When performance is a concern, you can optimize it by caching the appearance of all the sprites over each other until the equipment changes.

share|improve this answer
A good example is Hack, Slash, Crawl on Kongregate. – Arcane Engineer Oct 28 '12 at 14:12
Doesn't Diablo 2 use this technique? – Markus von Broady Oct 28 '12 at 14:28
@Markus Yep, the game I mentioned is just a cheap Diablo clone :) – Arcane Engineer Oct 28 '12 at 14:47
Some good answers here thanks. Can't quite get my head around the ordering though when it comes to the weapon rendering. If the character swings their weapon in such a way that their body obscures part of the weapon, the paperdoll technique would break wouldn't it? – JimFing Oct 28 '12 at 14:53
@JimFang: You could solve that issue by having two weapon spritesets, one which is drawn before the base sprite (so it's behind everything else) and one which is drawn least (so it's drawn over everything). The first spriteset only contains the animation phases where the weapon is behind the character, the other only those where the weapon is in front. – Philipp Oct 28 '12 at 16:39

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