Hi guys I have been working on an endless runner like game for the past month. For sake of simplicity I won’t post my code for my basic level which generates endless levels with obstacles. The idea however is that i use timer.performWithDelay to call a LOCAL update fucntion which calls GLOBAL functions such as moving the background, and obstacles(which are tables) using “:translate(dx, dy)” .I also have a runner sprite which has a physics body attached to it along with relevant obstacles. I also obviously remove obstacles and power-ups that have moved off to the left of the screen to keep everything clean and tidy. Since I’m spawning a lot of these random things I have caches in the createScene storyboard event along with initialization with all other relevant elements such as the HUD. These are global variables so that “enterScene” can access them to move them. Correct me if I am doing that wrong please.
My problem is that all thought I think this is very cleanly coded and there are absolutely no errors and runs fine in the simulator at 60 fps(I have an fps counter function to) it is stuttery on my android phone. I have an Optimus 2x dual core and I make sure to close all background apps before starting mine. The game runs at around 55 - 60 fps at times, but sometimes stutters and dips down to 20 randomly! Its unacceptable that a reflex based game be laggy. What’s wierd though is that my friends US Tmobile Galaxy S2 runs it perfectly event though it is not much more powerful in terms of cpu and gpu. My other friend also has some dual core htc phone(not sensation) from att and it also runs fine. Could my 512 mb ram be a problem since I have fairly large sprite sheets (about 1800 * 50 and another about 900 * 600 plus a 2000 * 480 pixel background)?
I would really appreciate if someone could help me or would be willing to test my app? If you guys need to see the code I’ll gladly share. Thanks in advance and I hope this post wasn’t too much! [import]uid: 118482 topic_id: 27811 reply_id: 327811[/import]
[import]uid: 52491 topic_id: 27811 reply_id: 112947[/import]