Changing a Character's Armor or Appearance

Started by
9 comments, last by kop0113 10 years, 8 months ago

Hi everyone!

Simple question: I'm wondering how to handle armor or appearance upgrades in-game specifically relating to the sprite's appearance. Say the player gets a new helmet! How do I reflect that on the character? What if I have 50+ different combinations of armor/clothing for each type of character in the game? Would I need to have a separate sprite image for each combination? Or does the character sprite have a base model and you overlay images onto that? What about animation for shirts or pants or weapons... Gosh, this seems quite overwhelming.

Anyway, hopefully I've gotten my question across in an understandable way. I'm sure that there's an easy solution for this but I can't imagine what that might be.

Thanks for any advice or help!

Scott.

Advertisement

Drawing sprites with transparency on top of your character should do the trick. Conceptually it's like this:

doll.jpg

I have not had to do this yet, but I agree that using transparent images on top of eachother sounds like the way to do it. I think there would be two main important points to watch out for:

1) I would probably create all the armor pieces in such a way that certain pieces would ALWAYS be drawn over the other. The draw order would probably be as follows:

Feet > Waist > Legs > Hands > Legs > Torso > Head

(assuming you used those pieces). In this way, long pants will always overlap boots, a long torso item (robe, long coat, etc) will always overlap almost everything.

2) Ensuring all your armor uses positioning relative to the character. Obviously you don't want your character to move and leave your armor floating in the air!

I realize as I type this all this may be obvious to you (or I'm just blatantly wrong), so before I insult your intelligence I'll just stop :)


What if I have 50+ different combinations of armor/clothing for each type of character in the game?
you want to go as generic as possible and mix and match. any character graphic with any equipment graphic (to the maximum extent possible). if you think 50 combos is bad, try over 500 types of characters times 60 some odd types of weapons times 40 some odd types of equipment (armor/clothing). that's somewhere in the neighborhood of 1.2 million combos. and that's with 3d meshes, not 2d sprites. but its the same idea. design everything to be as interchangeable as possible.
as mentioned above in another response, the painter's algo can be used when drawing to get the equipment to layer correctly.
you may also want to use a method from 3d for adjusting equipment graphics to characters. in 3d, the concept is called a "weapon bone". what it is, is a generic connection point between a character's graphics and the graphic for a piece of equipment.
for each character graphic you have a connection point (some pixel, relative to the sprites UL corner). for each equipment graphic you have an offset from the connection point. the connection point takes care of variations in the character graphics, and the offset takes care of variations in the equipment graphics.
you start by assigning the connection point for your first character - lets say the UL corner of the sprite.
then you adjust your first equipment graphic to the first character. the difference between the UL corners of the two sprites is the offset for the 1st equipment graphic.
then you adjust the first equipment graphic to the second character.
then subtract the offset for the first piece of equipment to get the attachment point for the second character.
you then use the first equipment graphic to adjust the connection points for the remaining character graphics.
then you can adjust the remaining equipment graphics to the attachment point of any character graphic, and everything will then be interchangeable.
you simply draw all equipment at its offset from the attachment point of the character in question, and everything mixes and matches and lines up automatically.
example:
you line up the 1st character and 1st equipment graphics and get an offset of 1,0 for the 1st equipment graphic (the equipment sprite is drawn one pixel to the right of the character sprite).
then you line up the 1st equipment and 2nd character. the difference is 2,0. subtract the equipment 1 offset of 1,0, and you get the connection point for character 2 = 1,0 (relative to UL corner).
so when you draw equipment1 on character2, you add 1,0 for the equipment, and 1,0 for the character, so you draw it at 2,0, relative to the character's UL corner.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Keep in mind animations come into play with how you display armor too, if your character is 2d and can move 8 directional or something you'll have to have many different versions of each piece of armor and make sure that animations either move the sprites slightly to make it look "sensible" or sometimes even use yet another sprite of the armor.

In the end, depending on the game every single piece of armor ends up needing many sprites and they all have to be tested for consistancy, a big task.

A good way to think about it though is how 3d games do the same thing, generally they model the armor by itself and then each character body has sort of "mounting points" like invisible clothes hooks, the armor is often supported by that position and then scaled a bit to try and make it look fluid. It's basically the same thing with 2d, you want to make a very simple base for the character and then match the armor pieces to it depending on your needs. There's no real "one way fits all" of doing it, you just have to come up with the easiest way to do it with the least art and tweak it till it looks right.

Aligning those equipments with your character animations is probably going to be the majority source of your headaches. If you haven't got a tool to help you out with this, I'd suggest you create one, or start looking for one (unfortunately, I don't have a suggestion).

What I have used in the past before, we would set up an anchor point in the character, and this anchor point will be adjusted per frame for each animation. For example, imagine a character that jumps up with his arms stretched out sideways. You want your character to hold a sword in this animation. You want the sword to stick to the hands, as your character jumps, and rotate, as he rotates his hands. None of this can be reasonably programmed by hands in a settings file. You need a tool that can help you out with this.

Keep in mind animations come into play with how you display armor too, if your character is 2d and can move 8 directional or something you'll have to have many different versions of each piece of armor...

Isn't it possible to assign a changable color palette to each armor piece though? Consider the following:

1. Make 8 versions of Chest Armor (one per direction). Each piece has a novel, unused color, e.g. "grey".

2. Create an algorithm for drawing specific colors onto specific pixels for each of the eight armor pieces. E.g. a switch statement(?)

3. Tell the game to switch color based on what kind of armor of that same texture that you got.

I'm thinking about Zelda III and the 3 armors available to Link. I've only ever found sprite sheets with the green armor, which possibly implies that those other 2 armors don't exist as separate sprites but are rather color modifications of a single set of armor sprites.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -

same sprite with different colors can be done in code or with a paint program. a graphics programming oriented person might do it in code at program start, while someone less low level about things might just use a paint program.

its also possible it was done to save memory, with just one set of sprites, and colors changed on the fly as needed, when needed.

if you have animated sprite characters, you'll probably need matching animated equipment sprites for each frame of animation for armor and clothes and such.

as stated above, you can define an anchor point at the hand for each frame of animation (like a weapon bone in 3d) and use that as your attachment point for a sword, etc. of course, that only makes the sword move with the hand, not rotate with it. this concept can be extended to other objects like hats, boots, gloves, etc. but again, they don't rotate, so it may not be useful in other cases.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Keep in mind animations come into play with how you display armor too, if your character is 2d and can move 8 directional or something you'll have to have many different versions of each piece of armor...

Isn't it possible to assign a changable color palette to each armor piece though? Consider the following:

1. Make 8 versions of Chest Armor (one per direction). Each piece has a novel, unused color, e.g. "grey".

2. Create an algorithm for drawing specific colors onto specific pixels for each of the eight armor pieces. E.g. a switch statement(?)

3. Tell the game to switch color based on what kind of armor of that same texture that you got.

I'm thinking about Zelda III and the 3 armors available to Link. I've only ever found sprite sheets with the green armor, which possibly implies that those other 2 armors don't exist as separate sprites but are rather color modifications of a single set of armor sprites.

Honestly unless the number and shape of the armors vary a lot it would actually be easiest to just incorporate the armor into the sprite and just duplicate the sprite. You only really want to bother with layered rendering when you're talking about like being able to swap out dozens of armor pieces and weapons. I'm not sure what Zelda III did really.

But you could write some kind of colorizer to recolor pieces of equipment, sure. Just another solution in a bag of many. The real trick is to pick what suits your needs.

I'm not sure what Zelda III did really.

Well, Zelda III is only 4 directions as far as Link's model goes. Zelda III's movement, however, is actually 12-directional (as I recall). Miyamoto used an interesting system of diagonal sidestepping in each of the 4 directions, when combining a primary and secondary directional buttons (e.g. Up + Left != Left + Up).

- Awl you're base are belong me! -

- I don't know, I'm just a noob -

This topic is closed to new replies.

Advertisement