   Sprite animation framerate
  For those that are doing 2D sprites in their games, how are folks handling the animation framerate? Are folks using fairly low framerates (circa 8-bit/16-bit gaming) in the ballpark of 2-6 fps? Is anyone doing something at full-motion quality (24fps+) or even traditional animation quality (12fps)?I don't think I have a concern with generating the number of frames of animation (everything will be sourced from 3D models with minimal post-processing, largely automated, so 2fps or 200fps isn't really more work for the artist). It's more the playback/runtime costs associated with it.It seems that most folks store their sprites in "sheets" or "pages" (whatever your favorite terminology may be) where multiple frames are stored in a single image. This is certainly the format that works best for the hardware when it comes time to render.But, if I wanted to do something like 30fps animation, we'd be looking at thousands of frames of animation for a complete "hero" character, which is a huge memory cost if the frames are laid out in pages.This starts to sound like video playback at these framerates. So, I decided I'd track down (or write if I have to) a lossless(!) video codec that does some intra-frame delta'ing and RLE, etc. Obviously, though, the hardware is not going to directly handle this video format for me, so I'm guessing I'd need to decompress to a cache (probably making it a big enough cache to hold several hundred frames of animation) and then blit out of that.Part of me thinks someone has got to be already doing this kind of thing, so I'm wondering if anyone can share their experiences or point me at some relevant codecs for lossless animation (with an alpha channel!).Finally, I was trying to nail down what would be a reasonable framerate. Traditional cel animation is able to get away with fluidity at 12fps. I was thinking about targeting this framerate. If I stuck to 12fps, then the game could run vsync'd perfectly on 60hz and 72hz LCDs (with 5 & 6 blanks between updates respectively) and also on CRTs at 84hz, 96hz, 120hz (refresh rates I've seen on my CRT). Do those CRT refresh rates sound sensible?   
  I think you might be overestimating what is needed to make "smooth" animation. It isn't necessary to have a different frame of animation for each frame that is rendered to the screen. In old NES games there would be 2 frames for walking in each direction, one of which was used for standing still. In a game like Mortal Kombat I have seen sprite sheets that suggest that actions range in number of frames from 3 to 8 and are looped continuously.Of course more animation frames make things look smoother but there is usually a point where adding more frames doesn't seem to make a difference in appearance. As for synching to fps it shouldn't make a difference as long as your animation frames are time based and not fps based. You will probably find that a standard walking animation over 8 frames in any direction will probably be overkill.The debate over optimal framerate is one I don't care to add to other than 30 seems to be the minimum acceptable base on modern machines and 60+ seems to be the goal most people here shoot for anyway. Nuff said on that point cus I know I will get flamed from someone for something there.As I said above though, try and find out a minimal acceptable amount of animations for each action you need to perform. What works for you is always different than for someone else but I am sure you can "get away with" less than 30 unique frames of animation in any normal action like walking, running, fighting etc.   ;Quote:Original post by evillive2As I said above though, try and find out a minimal acceptable amount of animations for each action you need to perform. What works for you is always different than for someone else but I am sure you can "get away with" less than 30 unique frames of animation in any normal action like walking, running, fighting etc.What evillive2 said was right on. I had the same question when I was starting out with my game, and definitely the best way to find out what frame count works "best" for your game is to just try it out and see for yourself.To give you an example though, I'll describe how it's done in my game. First here is a link to some sample sprite frames. You see for up/down movement we use 5 frames and for left/right we use 7. This is actually not true anymore, because our sprite style has changed and now we use 5 frames for motion in each direction, along with an additional "still stance" frame. This actually makes the left/right animations look better, IMO.The way the animation is done in the game is based on how much distance a sprite has traveled when they are traversing between two tiles (tiles are square and 32 pixels per-side. The sprites are 32x64 pixels). Between each tile move, we actually only use three of those five frames. Here is how it is done (excerpt from my map mode documetation):With very few exceptions, all sprites when loaded into a map automatically have their standard frame set loaded. This set has a total of 24 frames, 6 in each of the four standard directions (north, south, east, west). 4 of these 24 frames represent the sprite standing with no motion, while the other 5 work together to make the sprite's walking animation. These directional frames are generally labeled as follows: Frame 0 - Still stance Frame 1 - Left foot forward (1) Frame 2 - Left foot forward (2) Frame 3 - Neutral stance Frame 4 - Right foot forward (1) Frame 5 - Right foot forward (2)The frames are animated in the non-traditional sense in thatit does not use the AnimatedImage class available in the video engine. Instead, after the sprite moves every quarter of a tile, a new frame is displayed. What follows is an example of a sprite moving between two tiles.<TABLE BORDER="1" ALIGN="center"> <caption align="bottom">Table I. Sprite Animation Sequence</caption> <TR> <TH>Frame Number  <TH>Event  <TH>Notes    </TH> </TR> <TR> <TD>0 </TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD>3 </TD> <TD>Movement request</TD> <TD>Immediate transition from frame 0 to 1</TD> </TR> <TR> <TD>1 </TD> <TD> </TD> <TD>25% of distance to next tile is reached</TD> </TR> <TR> <TD>2 </TD> <TD> </TD> <TD>50% of distance to next tile is reached</TD> </TR> <TR> <TD>1 </TD> <TD> </TD> <TD>75% of distance to next tile is reached</TD> </TR> <TR> <TD>3 </TD> <TD>Movement request still active</TD> <TD>Next tile is reached</TD> </TR> <TR> <TD>4 </TD> <TD> </TD> <TD>25% of distance to next tile is reached </TD> </TR> <TR> <TD>5 </TD> <TD> </TD> <TD>50% of distance to next tile is reached </TD> </TR> <TR> <TD>4 </TD> <TD> </TD> <TD>75% of distance to next tile is reached </TD> </TR> <TR> <TD>0 </TD> <TD>No more movement request</TD> <TD>Next tile is reached </TD> </TR></TABLE>Hope that helps you get an idea of where to start. [smile]EDIT: Bah, the forums don't translate my HTML table. I'm too lazy/tired to fix it, so hopefully you can read it and make some sense of it.