Customizable avatars in your RPG

Hey everybody. ;D

I’m new here (not new to game programming). My name is Darren. I look forward to contributing.

I wanted to ask how some of you achieved customized characters in your RPGs? By that, I mean in terms of appearance. For example, when the player creates their character, they choose x hairstyle, y shirt, and z pants. Ingame, they might be using an axe and be wearing a steel helmet.

Normally, that would be easy. Just substitute an equippedWeapon variable and your done. However, animations complicate things. Would I need to make separate animations for all actions for each item? What about two different equipment in the animation (i.e. sheathing a sword requires my armor and my weapon to animate together).

How did any of you achieve this?

depending on the requested goal : use different layers, and a sprite hierarchie : like weapon is child of body

example :
have n weapons animations and only one body animation, if you want to just change clothes/skin/hair colors you may use same spritesheeet but with a tint filter, when user change weapon tou will just change its children weapon spritesheet/animation

Hey, you know, that’s not a bad idea. I think I get what you’re driving at. Thanks. :slight_smile:

Has anyone else had to climb this hill before?

A lot depends on how much customisation you want to provide, and how much animation you want to have. Overlaying sprites can be really effective (see the RLTiles characters here: http://rltiles.sourceforge.net/) but that doesn’t have animation. Alternatively you can do your animation by rotating and scaling body parts. That’ll make doing the animation less costly, but the actual animation quality tends to suffer a lot.

Of course if you want the absolute best then you’re probably looking at a proper 3d animated skeleton and 3d customisable body parts.

There’s a nice post on Lost Garden about this: http://www.lostgarden.com/2008_04_01_archive.html (although it’s more from an artist’s perspective and a little to geared towards customisation-as-a-selling-tool IMHO).

Personally I plan on letting the user pick from one of several prefab characters, then palette swapping the primary/secondary/skin/hair colours for further customisation. That means they don’t get avatars with the exact equipment used, but it’s a reasonable compromise between customisation and quality IMHO.

Thanks for the links! I haven’t worked with 3d yet, but I wonder if there’s a skeletal system for 2d sprites?

A skeleton would only make sense, if youd have a ragdoll. Because in 2D you are only moving images, and can’t morph them, without getting very intense with math and it wouldn’t look good :wink:

Well, I was thinking that the new Terraria game on steam does it well. Something to that effect.

I imagine there is a sprite sheet for each bit of clothing with all animations on it. Example would be maybe chainmail.png, which has the chainmail torso piece with a jumping animation, a swinging animation, maybe an emote or two. Then, in Java, have like a Torso class to act as a parent to all pieces of armor. Same with maybe Legs, Head, Helmet etc… Then in the Equipment class or something, have an object for each one that changes. Maybe a method like public void changeTorso(Torso torso). When rendering, do like feet.paint(g), legs.paint(g), torso.paint(g), etc…

Is that a sensible approach?