2D game programming: Dynamic sprites

Started by
4 comments, last by juuso 15 years, 8 months ago
Hi all, I'm the newest member of GameDev.net forum. I'm currently a uni undergraduate doing a computer science project on 2D game graphics. Project duration is about 2 semesters (abt 9 mths) It's hard to express and explain what my project is about in my own words so I will just quote the synopsis of my project here: "Visualization Techniques for 2D Game Characters: Dynamic Synthesis 2d graphics in games are often based on the concept of "sprites" - images that can be moved or animated. For a game that uses a very high number of characters (e.g., with different sizes, colors, animation patterns), preparing images and animations for every single character may however be very costly. The goal of this project is to study and research on different techniques for synthesizing new characters while the game is running (ranging from simple sprite compositions to elaborate procedural techniques). Various approaches need to be analyzed and new techniques designed, implemented and tested." I have did some research on Sprites and learnt the basic characteristics of sprites such as image file type, color, transparency, Z-order (depth of sprite) and animation frames. I have also read several books, tutorial sites and articles on using SDL and D3D which teaches how to manipulate these characteristics and applying basic 2D transformations to form a simple 2D game character. Most of the codes demonstrated simply teach how to load from an existing image pre-drawn by a 2D artist. No 'dynamic drawing' is involved. However, I'm puzzled as to how a say 2D RPG character with many combinations of equipments, expressions, colors etc can be created with different animations. Do the 2D sprite artist really draw every single combinations of every equipment and colors (etc.) for every frame? Diablo 2 is a good example. It has several characters and many different equipments that are visible on the character such as weapons, helms, shields and armor. How did the game generate the correct sprite frames for each action with a particular combination of equipment? Did they really draw spritesheet for every single combinations of character and equipment? Another example would be Maplestory. It has tons of sprite items and equipments that makes drawing and loading every single combinations of every frame impossible. What's the technique that Nexon used to generate the sprites dynamically? I have been goggling for articles/guides in this area but found little useful information besides what is mentioned. Can anyone here guide or advised me on where to find further informations on dynamic sprite creation? What 2D graphics engines, if any are capable of generating sprites dynamically? Is it feasible to dynamically create sprites at run-time? Sorry for such a long post. I hope I expressed myself clearly enough. Any advice, tips, questions and suggestions are welcomed.
Advertisement
Actually, both examples that you listed (Diablo, MapleStory) use different frames for each animation - not generated on the fly as you think. To be honest, dynamic sprite generation isn't really going to be used that much. Maybe for clouds or something; however, it's not practical to use it for changing parts of armor to stretch over an arm, for example.
Well one way of doing it would be to draw the character sprite as the base and then draw the clothing sprites on top of it. That would require each item of clothing to be drawn in each direction that a player can be viewed in.

There would be other potential problems, such as if one character was taller than another, then the clothing would have to be scaled and positioned, but this data could be stored per character.

That, I guess would be the easiest way of doing it, assuming I'm not barking up the wrong tree here.

-SD
A common approach is to model a character and then take snapshots from various angles (this can easily be automated). Many development teams employed this tactic.

As for characters and item combinations, the most straight-forward approach would be to use multiple images. One for each characters bodypart, one for the item, depending on the games needs. As for colors, older games usually swapped palette's, modern games can simply draw sprites with different colors.
Create-ivity - a game development blog Mouseover for more information.
Quote:Original post by Captain P
A common approach is to model a character and then take snapshots from various angles (this can easily be automated). Many development teams employed this tactic.

As for characters and item combinations, the most straight-forward approach would be to use multiple images. One for each characters bodypart, one for the item, depending on the games needs. As for colors, older games usually swapped palette's, modern games can simply draw sprites with different colors.


That was pretty much what I have found out on other websites as well. However, as for drawing separate sprites for each bodypart and items and then layering them by their Z values, I could not find any relevant codes that uses sprite Z value other than a tutorial site teaching Java programming. Is Z-ordering of sprites supported by DirectX and/or OpenGL or do I have to write my own class to support Z-ordering?
You can use z-buffers with both OpenGL and DirectX, even with 2D graphics. Or you can just draw the sprites in order, ignoring the z-buffer.

This topic is closed to new replies.

Advertisement