Game Development Community

FPS hickups when I change animation

by Ray Graham · in iTorque 2D · 01/17/2009 (12:21 am) · 4 replies

Hi guys,

For my game, I'm getting really fantastic steady-state FPS values...typically 40 to 45. However, whenever my characters are notified to switch their animation (because they changed direction), I get FPS hick-ups. Typical dips go down to 15 FPS if just 1 character is moving...down to 6 FPS when 2 are moving around.

Any pointers or tips?

All of my animations are 8 frames, 64x64. 8 frames per direction per image. So that's 8 total images per character (n, s, e, w, nw, ne, se, sw).

Thanks!

#1
01/17/2009 (1:31 am)
Are the datablocks set to preload? It sounds like they are being loaded right then.
#2
01/17/2009 (2:26 am)
So far I've done two things with one of the characters and the results are good.

1. merged all direction animations into 1 512x512 image
2. turned on preload (per your suggestion)

With that 1 character walking around, the lowest the FPS dipped to was 22.

I'm going to finish some other optimizations here and post the results here.

I kept allowUnload = "1". Is that bad?

Thanks for your tip Mat.
#3
01/17/2009 (3:08 pm)
Preload tells iTGB to load the image when the datablock is created, instead of when it is first used.

AllowUnload allows the image to be deleted from memory.


If you find that you're running low on graphics memory, you should AllowUnload on you lesser-used images, but if not it shouldn't be nescessary, and will probably lead to you having to load the animation multiple times, depending on how you use it.
#4
01/18/2009 (3:23 pm)
Thank for the information Mat.

After reworking all of my character animations so that each one is in its own 1024x1024 image (animation frames and shadow frames) my frame rates are consistent and smooth. The average seems to be about 20FPS.