PDA

View Full Version : 2D Animation Patterns



cairnswm
10-10-2003, 05:13 AM
How do most of the 2D graphic systems (or 2D in 3D) do animation? I only use DelphiX (Dont have time to try anything else) so thats all I know.

DelphiX uses multiple images in a single image. Each image is then displayed at the right time. And after a certain interval the next image is displayed.

How do other systems do it?

Traveler
10-10-2003, 10:08 AM
Not sure if it's the most used way, but I've seen programs that use a large image where all sprites are inside a grid. After that it's a bit of a guess as to wether the seperate images are first loaded into memory or drawn directly from the large image. I believe both options could work.

It's almost the same as using a dximagelist though, only the images would not get inserted inside the exe. And I have learned that not including images in the exe speeds up the game, depending on the number of images, quite a bit.

Alimonster
10-10-2003, 09:38 PM
The "many images on one bitmap" is the most obvious and natural way to do it. Whether the images are split up into an array at load-time or kept as one big bitmap depends on the API. With 3d acceleration, state changes (e.g. binding textures) are expensive, so you want to minimize them. So, with 3d APIs you'd probably keep the image as a whole and copy individual frames out using texture coordinates (no mipmaps, of course, and probably no filtering, plus the usual 2d-in-3d requirements). It doesn't matter too much what you do with software APIs though, so you could choose either method (keep as whole or split into array).

Deciding when to change between frames is simply a matter of logic (and preference). If using frame rate-dependent timing, you could use a integer counter and increase it. Once to a certain level, change to the next frame and reset. With delta time you'd keep a real number for the time passed, and add the frame's delta to the time passed. Once it got past a certain amount of time you'd swap over. Having different rates of animation for different frames is simply a matter of perseverence. You can code any sort of frame changing logic if you take enough care to use variables instead of constants for everything, and if you have enough patience.

cairnswm
13-10-2003, 05:34 AM
If the multi-images in one is the normal way of doping it why arn't there more tools for creating these multi image maps.....?

I've created my own ImageTiler program that does this for me but its very badly written at the moment.

Can anyone suggest a nice drag and drop interface that would assist me in creating these images.

Alimonster
15-10-2003, 01:35 PM
I'll have a dig around the 'Net to see if I can find suitable programs. I'm sure I've seen one or two that do this task (heck, I was busy writing one myself until I got sidetracked with other stuff!).

cairnswm
16-10-2003, 05:36 AM
Well why dont we as a DGDev community make a decent one for our own games? Like I say I've got a partially written one but its very very buggy and sometimes I even do things wrong on it :)

I'll try put the program and source on the web later today.