Hello Guest

Author Topic: Sprite Animation performance hit  (Read 6051 times)

JOHNMCLAY

  • Newbie
  • *
  • Posts: 3
    • View Profile
Sprite Animation performance hit
« on: August 30, 2013, 01:47:26 am »
Hey Unikron :D

This is a general question about 2D sprite animation on mobile devices...

Say if you have an animated sprite with 50 animations and 60 frames per animation (3500 sprites in total), where will this performance hit occur?

Will it affect the RAM?  Will it increase the loading times for a level?  Will it affect runtime performance in anyway...if all's preloaded...or if not?
Will the CPU handle the processing of all those sprites?

It wouldn't affect draw-calls or anything like that since you're still only playing 1 frame per frame?

I'm sorry if the question wasn't worded too well, I hope you can understand what I'm looking for: Just a heads up so I don't go ahead and create a character with 100 animations that then can't run on a mobile device! :D
« Last Edit: August 30, 2013, 01:51:42 am by JOHNMCLAY »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Animation performance hit
« Reply #1 on: August 30, 2013, 11:25:35 am »
It will depend on the number of sprites you have. All of them will be preloaded into RAM, but only uploaded into VRAM when first visible - so you might get a framerate spike when that happens. It depends how big your sprites are. 3500 32x32 sprites will be very different to 128x128...

Draw calls will be fine as you'll only be playing one frame at a time.

JOHNMCLAY

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Sprite Animation performance hit
« Reply #2 on: August 30, 2013, 11:50:57 pm »
It will depend on the number of sprites you have. All of them will be preloaded into RAM, but only uploaded into VRAM when first visible - so you might get a framerate spike when that happens. It depends how big your sprites are. 3500 32x32 sprites will be very different to 128x128...

Draw calls will be fine as you'll only be playing one frame at a time.

Ah thanks so much for the reply, you have no idea how hard it is to find good specific information regarding this!

Will all the sprites in an app be preloaded into RAM when the app runs initially, so 3000 at once when you load the app?

So it seems that there would be no difference between 10 different, unique sprites with 10 animations @ 100 frames... as opposed to 10 different, unique sprites with 1 animation @ 1000 frames? (all at 256x256)


I guess the best way to test this would be to just keep adding sprites and testing on the target device until the frame-rate begins dropping?!


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Animation performance hit
« Reply #3 on: August 31, 2013, 12:08:10 pm »
All of them will be preloaded.

"So it seems that there would be no difference between 10 different, unique sprites with 10 animations @ 100 frames... as opposed to 10 different, unique sprites with 1 animation @ 1000 frames? (all at 256x256)" - more or less true, it depends on what materials they are using, etc for draw call count but apart from that no major difference.

There is no substitute to simply trying it. Every game is different, and all I can offer are suggestions from my limited knowledge of what you're trying to do :) If you've only got 10 sprites, memory will likely end up being the bottleneck.

JOHNMCLAY

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Sprite Animation performance hit
« Reply #4 on: September 01, 2013, 03:47:43 am »
Thanks so much for your support Unikron :D