big images and animation with spritesheet - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: big images and animation with spritesheet (/thread-8399.html)
big images and animation with spritesheet - sefiroths - Dec 9, 2010 06:19 AM
i have to display an animation with all images are 960x640-pixel.
if i want to make a smooth animation i must have 18 images/sec.
a spritesheet with 18 images like that will be something like (960*18)x640.
what is scaring me is the loading time:
will it be acceptable?
if i have more sprites for the animation animation will it give problems in time or space in disk?
is there another way to load images for better performance?
RE: big images and animation with spritesheet - johncmurphy - Dec 9, 2010 07:39 AM
I'm sure you could find ways to optimize your animation.
First of all, it is hard to believe that you really need to change every single pixel in the animation sequence on each frame, which is what your post suggests. Can't you separate it out into a static background image that has the moving parts of the image overlaid on top it?
Secondly, just because you have 18 frames per second, doesn't necessarily mean you need 18 different images per second. If you analyze most animations, they typically only have 10-12 unique images per second, with the rest being duplicates. (And that is at 24 fps). So you should be able to cut out some images that way.
Lastly, there are compression techniques available. Apple has released the WWDC 2010 videos, and I know this is covered in one of them.
RE: big images and animation with spritesheet - Skorche - Dec 9, 2010 07:43 AM
You can't load a texture that big anyway. The max size of newer devices is 2048x2048 and 1024*1024 for older ones. You could group two frames per texture, but that is the best you will do.
That is also over 40MB of uncompressed data, so you are going to need to do something to get the size down. If you PVR and gzip compress the textures you can probably get it to 2-3MB on disk and 4-6 in RAM. Gzip is very fast to decompress, and the PVR texture data can be dumped directly into VRAM so this is probably your fastest loading time too.
RE: big images and animation with spritesheet - ThemsAllTook - Dec 9, 2010 08:10 AM
It sounds to me like you want to play a movie.
RE: big images and animation with spritesheet - Skorche - Dec 9, 2010 09:32 AM
(Dec 9, 2010 08:10 AM)ThemsAllTook Wrote: It sounds to me like you want to play a movie.
I guess it wasn't clear if he only had 18 frames total though.
RE: big images and animation with spritesheet - sefiroths - Dec 10, 2010 02:06 AM
thanks for the tips.
i explain the problem better:
i have a static background and a character large quote as the screen (so some background is visible but not so much)
while the game is in idle the character moves slightliy, like breathing or standing in guard position (like street fighter if i not move joistick)
if i make some action like touching the screen, the character began to move and has another animation and so on.
i thought that haveing all frames loaded i could switch between animation selecting what frame to start and what was the frame to finish, and loop between them.
i'm searching the right way to implement it, paying attention to: smooth animation
i have seen that 18fps was the minimum to trick the eye.
perhaps is best more movies?
can i have movie with a transparent background so the static background will be visible?
RE: big images and animation with spritesheet - Applewood - Dec 10, 2010 02:48 AM
If your background is genuinely static, you could munge that into the movie as well.
RE: big images and animation with spritesheet - sefiroths - Dec 10, 2010 07:58 AM
(Dec 9, 2010 07:39 AM)johncmurphy Wrote: Lastly, there are compression techniques available. Apple has released the WWDC 2010 videos, and I know this is covered in one of them.
hadn't found it...many topics covered, but i haven't seen video compression
so the best result will be with a video?
should i try with a mpeg4?
RE: big images and animation with spritesheet - sefiroths - Dec 14, 2010 12:00 PM
can i make more videos playing one on the other?
i explain better:
a background animated, and a player character moving?
it is more expensive in cpu, resource, loading time ecc, makeing 2 videos playing one on the other, or loading multiple images and make an animation with that?
RE: big images and animation with spritesheet - mdejong1024 - Jun 8, 2011 03:36 PM
(Dec 10, 2010 02:06 AM)sefiroths Wrote: thanks for the tips.
It is going to be hard to get 18 FPS on iOS using static PNGs. This is because it takes too much CPU to decode the PNG image data in between frames. On an iPhone 3G, the best you will be able to do is about 11 FPS with full screen images.
For these kinds of frame rates, you will need an optimized implementation. Please have a look at the "Street Fighter II" example at this page:
This example shows an animation composite over a static background, it sounds like this is the exact thing you want to do. What is interesting about the example is that once the animation is prepared, it will blit onto the screen very quickly. You will also get very good compression results with the APNG or Quicktime Animation codec support included in this library, so your app download size will be smaller than if you use a series of PNG images.
RE: big images and animation with spritesheet - OneSadCookie - Jun 8, 2011 04:54 PM
Why on earth would you even consider decoding PNGs each frame?
RE: big images and animation with spritesheet - mdejong1024 - Jun 8, 2011 09:21 PM
(Jun 8, 2011 04:54 PM)OneSadCookie Wrote: Why on earth would you even consider decoding PNGs each frame?
sefiroths posted a question about how to animate a series of images with alpha channels, one would typically do that with a series of PNG images. If you have other image file format advice, I am sure sefiroths would love to hear it. I was simply pointing out that decoding time for compressed images is going to be an issue that will make it difficult to get the desired frame rates. The example xcode project link I posted does not use a series of PNG images, it decodes frames of image data from a Quicktime Animation file (this is far less CPU intensive).