Archived

This topic is now archived and is closed to further replies.

Kibbler

Sprite layering? Chars with weapons/armor?

Recommended Posts

Hello people, I''m currently working on an RPG game, 2D isometric using sprites in OGL. I would like to know how engines like Diablo and Diablo2 (what "engine" do they use, anyway?) and Bioware''s Infinity engine displays and animates character sprites holding a variety of weapons and wearing different armor types. More specifically, when you change from a sword to a bow in Diablo, the character now carries a bow. Do these engines layer "bow sprite" on top of "armor sprite" on top of "character sprite?" or a separate set of animations for every possible instance (sword with plate, bow with chainmail, bow with shield, etc). I think the latter would take up ridiculous disk space just to store all the animations, but I also fail to understand how "layering" makes doing this easier. I''m sure any Diablo mod makers out there know this kind of stuff. Could someone just give me an overview of how these games do character/armor/weapon animations? I''d really appreciate it, thanx! This is a great forum, very informative=)

Share this post


Link to post
Share on other sites
Layering is how I plan on coding my unit animations for the RTS I''m working on.

Say for Human race units you could have a Peon, Footman, Archer, Pikeman, and a Spear guy. Well, my way I''d have one unit, Peon, and I''d overlay animations for Sword, Bow, Pike, and Spear respectively. And just as you mentioned, I could overlay animations for leather, chain, or plate armor as well.

Each object, weapon or armor, would only take the same number of animation frames as a regular unit. However, instead of just gaining just one extra unit for your efforts you gain a multiple of units.

With just a Peon base unit and object animations for Sword, Bow, and Plate Armor, or 4 object animations total you basically have a total of 6 different units. If I added a Chain Armor animation sequence to overlay on the Peon, I would gain another 3 units possibilities.

Example:

Peon
Peon w/Plate
Peon w/Sword
Peon w/Sword & Plate
Peon w/Bow
Peon w/Bow & Plate

Peon w/Chain
Peon w/Sword & Chain
Peon w/Bow & Chain

The list goes on. Plus you get the cool capability of having your Peons out in the fields, farming or chopping down wood, and being able to run to an armory and grab some weapons that your blacksmith had created.

As far as drawing I just use alpha-blending for masking. Each frame of animation of the Peon base object (i.e., walking, running, attacking, defending, etc.) has a corresponding animation frame in an associated object. It''s like drawing a Peon with a Sword but then erasing the Peon. Do this for each frame and you have a bunch of animations of a Sword walking by itself, Running by itself, Attacking by itself, etc.

When overlayed on the Peon, the Peon then looks like he''s wielding a sword, wearing armor, or whatever.

Let''s hope it works like I think it will!

Care,
Chris
Florida, USA
http://www.knology.net/~heaven

Share this post


Link to post
Share on other sites
You''re right, the method of layering offer great possibilities like in Ultima Online where you have an infinity of clothing possibilities.

But there is a drawback and this depends on your game concept. When you use multiple sprite layers, take into account tthat you are doing pixel overdrawing (you draw multiple pixels at the same place so you waste cpu).

So before orienting your sprites to be multilayered, think a lot to see if it is necessary, because if you have a lot of little sprite like in Warcraft, you will have slowdowns.

Cya



/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, ying and yang.

Share this post


Link to post
Share on other sites
Laying works very well and there are actually two ways of doing it.

One is to do the layering on the fly. Gang Wars uses that method. If you''re doing it this way you may want to create a test render loop to see how many textured quads you can render per second.

The other works best when you aren''t animating the textures which is typically only when using meshes. Basically each character is given it''s own texture layer and all the layering is done directly to that texture. That way the only overdraw happens when creating the texture. Since that only happens once every great while and not every frame, it doesn''t slow down the game. Tombstone uses that method.

Ben

[The Rabbit Hole | The Labyrinth | Programming | Gang Wars | The Wall]

Share this post


Link to post
Share on other sites