Formats for animated game sprites? Many images?

Page 1 of 1 [ 3 posts ] 

BloomingArtist
Tufted Titmouse
Tufted Titmouse

User avatar

Joined: 13 Sep 2011
Age: 35
Gender: Female
Posts: 25

11 Nov 2011, 7:54 pm

I would like to know how sprites are made from 3d models and images. First things first, I have a to-be-animated game character model I made, and I don't know how to make it into a sprite within the software I have.

So, what format should I use for a non-pixelated, not hand drawn 3d model sprite once I get some animations in it? I want to have the background to be transparent.

Should I use a video format, a gif format, or any image format to render the frames? If so, what formats do you suggest?

Also, should I try to limit the number of frames for each animation? If so, how many frames should usually be present for a walk cycle animation for example?

For a good top-view game, I think I should stick to at least 2 or 4 cameras for each character variation as well as for each separate animation. Wouldn't that lead to many images for the frames of each character variation with each animation? I would think it would take all of my computer's memory (or lots of it) from the hard drive.

Thanks!



kxmode
Supporting Member
Supporting Member

User avatar

Joined: 14 Oct 2007
Gender: Male
Posts: 2,613
Location: In your neighborhood, knocking on your door. :)

11 Nov 2011, 8:24 pm

Get TexturePacker http://www.texturepacker.com/



Hero
Snowy Owl
Snowy Owl

User avatar

Joined: 6 Feb 2008
Age: 38
Gender: Male
Posts: 141

12 Nov 2011, 3:05 pm

I'm assuming this is in continuation from the last thread made about game character models?

Again, what you do is going to depend on the game engine.
Don't use a video format.

However, if you want transparent sprites that could work assuming the game engine just has basic alpha recognition, than you could probably just use .gif or .png.
While GIF can have animation saved directly in the format, the quality is usually lacking. It would be better to handle animation based on the engines needs.

In Other words, if the engine reads the character as part of a larger single file, where it jumps 40 pixels across the image file per frame for a specific number of jumps, you can use virtually any basic format that can be read. PNG is heavily optimized for low memory transfer, while retaining image quality and can have built in alpha. This makes it a perfect format. However, assuming the game engine reads a certain color(lets say pitch black in this example)as transparent, you can use an image file that lacks an alpha channel. This would reduce the memory needed even more. You won't be able to use that color on any image assets however, and the engine itself needs to have several lines of commands built in to determine a certain color to be transparent. (this will also need to be reflected in the codes to determine collision).

Frames of your animation will be determined by your engines needs. For smooth animation, you should probably count on at least 12. It is possible to get lower. And if your game is built to be choppy, than you could probably have as low as 3-4 frames and have the animation make sense.

Also, if you are creating a sprite based game, you really only need 1 camera(the view that is the perspective). If your talking about the character face/directional animations, than you would probably want 4 per motion. (You can mirror and have 2, but if there are any subtle changes based on the character angle, than those will be lost without 4 seperate animations.

This will not come close to using all your computer's memory. Not, unless you had hundreds of hundreds of animations per character and had hundreds of distinct characters. Even than, your characters sizes would need to be in the size of 256 x 256 + per frame, with very smooth animation to do so.

Likely though, you will have each character frame at around 72 x 72 or smaller. Than since you will want to optimize it for your engine, a common method is to combine all the frames of each distinct animation into one image file.

For example, if you had a swing animation you might have a character that uses a 64x64 box for maximum frame constraints. Each animation might have 10 frames. And the code might tell it to go from frame 1 to 10 jumping between each frame every 0.1 seconds. Thus the image file will now be 64 high x 640 wide. At the same time, you will have 4 distinct facial directions(Maybe you have a slight angle to your top-down view to make it more dynamic like in A Link to the Past.) So you place all four seperate directional frames into one image file. Now, you have a 256 H x 640 W pixel image file. There will be code in the engine that determines which image file to use based on the last directional input of your controller/keyboard. This will determine at what height it will read when jumping 64 pixels across the image file every 0.1 seconds.

To further optimize the file, maybe you don't use an alpha channel. Instead you are using the other color. So perhaps you make the darkest tone a character uses near black, but not pitch black. Instead, anything that is pitch black of value will be rendered invisible in front of the background of environment assets.

Finally, you might use a Jpeg image format, because you do not need an alpha channel, and you reduce the quality to maybe 70% of the Raw image format. This way you maintain a good quality, but heavily optimized image, that will remain in the ram, and will not require the loading of numerous assets in order to run simple animations.

You would then have seperate Image files like these for each type of command. Each would also have their own code in the engine to determine what happens, or what file to retrieve from.

In the end, considering all enemies, heroes, cannibalized character assets, etc. you might end up with around a few hundred total 256 h x 640 W optimized images. (One could take it further and turn each character into huge 5k+ x 1k+ rough image file sheets with every possible animation on them).

In the end your character assets will be huge, but if properly optimized should range between 10MB to 100MB. The raw files themselves you used to make the optimized images, might take around 1-10 GBs of information, depending on how you created them. These won't be used or loaded in the game engine though. They will simply remain stored on your computer.

If you are extremely efficient with Optimization it is possible to make a game the likes of Kirby or donkey Kong, with smooth animation and near perfect visualization with using less than 10MB for every image asset from characters to environment assets. This, however, takes a strong understanding of image file formats, image quality, color, illusion, and the game's internal engine.