Game Development Community

Game doesnt work on iPhone 3G but works fine on 3GS

by Hitesh Patel · in iTorque 2D · 01/28/2010 (12:17 pm) · 4 replies

My game works perfect on iPhone3GS and iPOD Touch (3rd Gen) but i get memory warnings when i run it on iPhone3G. Its a very simple game. The sprites that I use are about 13kb and at any one time there can be about 30 static sprites and maybe 10 animated sprites. I have used sprite sheets for animated sprites and each animated sprite has a max of 4 frames. The only place I can think that could be a problem is that most of the sprites need collision enabled and i have read that this can take up memory.

I am so close to submitting the app, sometimes i feel i should just submit it and mention that it only works on iPhone 3GS and iPOd 3rd gen. Does anyone know the number of 3GS and ipod 3rd gen devices out there???

#1
01/28/2010 (12:20 pm)
The errors are pretty much plausible, as the 3GS generation has 128MB RAM and 232MB VRAM more (it can use the whole RAM as VRAM, not just the predefined 24mb)


for a sprite to be 13kb it would need to be a 64x64 image more or less (or larger + pvr).
40 distinct sprites and some of them with animation normally should be no problem, but question is how well you organize it.


did you make sure that your game only loads the datablocks needed at a time (previous to 1.3 you had to implement an own thing for that or use the present resource. 1.3 enforces it)


generally you would best restart the device and then run it through the memory instrument in xcode and see whats really going on.
#2
01/29/2010 (5:43 am)
Thanks Marc. I went through the images and sound files and found a few files where i could cut down the sizes. I changed the sound to 256kbps and mono. Some images were much larger then what they should have been, so i reduced their sizes. These changes reduced my load time on iphone 3GS to 9 secs fom 14 secs and the game also worked on 3G. But the only problem on the 3G is that its really slow. Any more suggestions on how i can make it fatser.
#3
01/29/2010 (6:31 am)
You will have to use profiling and the xcode instruments to first find out what causes the slowdown.

my guess is that you use T2Di physics, which is pretty slow, or that its caused by the distinct sprite objects (1.3 would come in handy with its possibility to use 1 texture and use subareas of that one texture -> draw call reduction. you have about 30 drawcalls basically on the 3g)
#4
02/01/2010 (6:16 am)
I have tried to optimize as much as i could. Now the game is working reasonably well on 3g but any moving objects i.e. where i am using velocity, they move really slow. Is there another option i can use to make the objects move at certain veloicty.