Can anyone explain to me the relationship between graphic file size and graphic memory usage?

My game currently has about 120 mb of images. All 72 ppi png's, all optimised to sizes 64 x 64, 128 x 128 and so on. I say that there is about 120 mb because I have them all saved in a folder on my mac and that is the total size of the folder. I'm currently experiencing problems with my game crashing in the Viewer on my iPad 3 (the smallest memory size iPad 3). I'm suspecting that this may be a memory overload type problem. Now when I compress and run the game on the Viewer I see the memory usage breakdown in Creator and it says Images: 438 mb (or something) and as the game plays I watch this increase to 569.3 mb (an example) and then the game crashes in Viewer.

I should point out that there are no animations in my game, just single png's that I move around the screen using interpolate, destroying actors when they go offscreen.

Can anyone explain to me the following:

  1. How does 120 mb of png's end up being 438 mb + of Images in Gamesalad? I think I use each png only once in the game i.e.. 1 png equals 1 actor, I'm not spawning multiple actors on screen using the same png.

  2. Why does the "Images" memory usage fluctuate?

  3. Any suggestions on what I should do?

Thanks very much.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @flurospeedo said:
    My game currently has about 120 mb of images. All 72 ppi png's.

    The ppi is irrelevant, it has no effect on file size, memory usage, processor 'strain' or image fidelity, it has the same effect on the file as the file's name (i.e. it is only metadata).

    @flurospeedo said:
    all optimised to sizes 64 x 64, 128 x 128 and so on.

    The powers-of-2 rule applies to each dimension separately, that is to say the file sizes don't need to be square, you can have non-square files (128 x 1024, 32 x 512 . . . etc etc).

    @flurospeedo said:
    I say that there is about 120 mb because I have them all saved in a folder on my mac and that is the total size of the folder. I'm currently experiencing problems with my game crashing in the Viewer on my iPad 3 (the smallest memory size iPad 3).

    16GB should be more than enough to handle a game with 120MB of images, I doubt the images are the issue (?) I've run much bigger GameSalad projects on my iPad3 (also 16GB).

    @flurospeedo said:
    1. How does 120 mb of png's end up being 438 mb + of Images in Gamesalad?

    I think a lot of it has to do with how the images are held in RAM, they are written to a 24bit colour-space, so whereas (for example) a 1024 x 768 pixel image of some random noise might be 2.4MB on your hard drive and a second 1024 x 768 pixel image of some flat colour might only be 100kb - the will both be 2.4MB when on the actual device as they both occupy 1024 x 768 pixels as any efficiencies gained through - for example lossless compression on disk are lost when moved into RAM.

    @flurospeedo said:
    I think I use each png only once in the game i.e.. 1 png equals 1 actor, I'm not spawning multiple actors on screen using the same png.

    The number of actors you apply an image to is irrelevant, if you have 1 actor with an image applied to it, and that image is 1MB in size then the memory usage for images will be 1MB (or thereabouts), but if you then apply that image to 130 actors, and have them all in the scene at the same time, then the memory usage for images will still be 1MB.

  • flurospeedoflurospeedo Member Posts: 33

    Thanks very much for taking the time to explain, Socks. I did not realise I could have say a 1024 x 128, I thought they all had to be square!

    Yeah well I guess the problem must be in my coding somewhere.

    If anyone else has anything to contribute please be my guest!

  • SocksSocks London, UK.Member Posts: 12,822

    @flurospeedo said:
    If anyone else has anything to contribute please be my guest!

    The one thing I would recommend would be to run a bunch of tests, make a new project, import all your images, throw them into the scene, preview on your device . . . . etc

  • flurospeedoflurospeedo Member Posts: 33

    I should just add that the game is running fine when I preview it in Creator on my mac. It is only when I run it in the Viewer that it crashes.

  • SocksSocks London, UK.Member Posts: 12,822

    @flurospeedo said:
    I should just add that the game is running fine when I preview it in Creator on my mac. It is only when I run it in the Viewer that it crashes.

    They are two entirely different devices (obviously), someone might have the latest Mac Pro and a slow iPad 1 . . . . where someone else might have an old laptop and the latest iPad Air 2 . . . so you can't really take much from them telling you that something works well in Creator, but not so well in the device Viewer.

    I've had projects that were a little glitchy on my Mac but ran fine on the device, and vice versa . . . and this is with an up to date iMac and iPad, so you can't really see Creator and Viewer as equivalents, you need to do lots of tests.

Sign In or Register to comment.