Artwork size => app crashes
LAdrian
Member Posts: 237
Hi Guys!
I'm working on my first game for the iPhone 3GS and I have a problem with the artwork size.
Until now I had 220 files taking 10Mb (all are power 2) and everything worked fine, the game loaded pretty fast in the iPhone viewer and the frame-rate was ok (35-47 fps). Yesterday I added to a very small scene a big explosion (80 frames taking 14Mb). The problem now is that when I try to test it in the iPhone viewer it crashes after loading the scene. Like I said, the big explosion is on an nearly empty scene with very little artwork so I thought that will be fine but apparently not.
My guess is that the app loads all the artwork for all the scenes even if you don't used it in that particular scene that it's loading. I hope I'm wrong since that would be a serious limitation (the images take only 23Mb, I'm sure that are more heavy app for the 3GS). Or maybe there is a way to specify what actors not to load for a scene?
Any idea how I could make it work? Really, 23Mb is way to little for my game.
Thanks a lot,
Adrian
I'm working on my first game for the iPhone 3GS and I have a problem with the artwork size.
Until now I had 220 files taking 10Mb (all are power 2) and everything worked fine, the game loaded pretty fast in the iPhone viewer and the frame-rate was ok (35-47 fps). Yesterday I added to a very small scene a big explosion (80 frames taking 14Mb). The problem now is that when I try to test it in the iPhone viewer it crashes after loading the scene. Like I said, the big explosion is on an nearly empty scene with very little artwork so I thought that will be fine but apparently not.
My guess is that the app loads all the artwork for all the scenes even if you don't used it in that particular scene that it's loading. I hope I'm wrong since that would be a serious limitation (the images take only 23Mb, I'm sure that are more heavy app for the 3GS). Or maybe there is a way to specify what actors not to load for a scene?
Any idea how I could make it work? Really, 23Mb is way to little for my game.
Thanks a lot,
Adrian
Comments
You always need to be conscious of you RAM usage, but it does not have to do with file size. For example, MYST is 700MB, but the RAM usage does not cause the iPhone to crash.
I made a post the other day about image size in relation to RAM usage here:
http://gamesalad.com/forums/topic.php?id=7249
For the sake of argument, let's say your big explosion is full-screen on the iPhone (480x320). At that size, 80 images is 32MB. That will definitely cause the device to crash.
You have very little RAM allocated to you on the iPhone. You have to allow room for the engine, as well as audio in your game.
I was also thinking that the file size shouldn't influence the ram usage.
The explosion is indeed full screen (png 24 with transparency) and the 80 frames take 14 Mb. The way I setup the explosion is this: the actor has a timer that after 5 seconds plays the animation (80 frame). The thing is that the game doesn't crash when the animation is played, it crashes before the level is loaded even. So I see the progress bar loading the level, after is finished the black screen with the rotating loading icon appears and then crash (exits the app) and game salad shows device disconnected.
A. Almost empty, only the character:
fps: 60
images: 47.5 MB
sounds: 11 KB
game engine: 6.0 MB
other: 20.7 MB
total: 74.2 MB
B: very little artwork
fps: 60
images: 50.1 MB
sounds: 11 KB
game engine: 8.4 MB
other: 21.9 MB
total: 80.4 MB
C: almost full level
fps: 40
images: 52.8 MB
sounds: 11 KB
game engine: 8.4 MB
other: 23 MB
total: 84.3 MB
I was expected a much bigger difference regarding the ram usage of the artwork (images). Only 5 MB between the empty level and the full level is very low, also there is almost no loading time between levels so I suppose that all are loaded in RAM at the beginning and that's something that I don't want. There must be a way to set a scene to load when accessed and then offload it from RAM when you go to the next one.
Any suggestions?
Thanks
In the images section of the RAM usage, the smallest # you have is 47.5MB.
After you add up the Sounds, Game Engine, and Other, it seems that you are about 30MB already.
So you really only have about 10MB or so to play with, not 50MB...
Now, if this game is solely for the iPad, then you have a little more to play with.
But over 40MB is starting to get into crashing territory on the iPhone...
It is my experience that RAM does get flushed when you change Scenes.
Definitely looks like the RAM is not flushed between scenes Does flushing works when using the iPhone Viewer or should I compile the app?
You might want to try starting a new clean project. Slowly add in things one by one from the old project and test each new thing you add. That way you see what specifically causes RAM spikes.
Plus, it's possible that the old project has become corrupted and is still retaining those images even though it would seem that you have deleted them.
I made a new test project with 3 simple scenes and the ram flushing works Thats the good news, the bad one is that I need to redo a lot of work but at least I have hope again.
Thanks again for the suggestions