★ TouchArcade needs your help. Click here to support us on Patreon.

Framerate issues

12-13-2008, 07:03 PM
#1
Junior Member [Original Poster]
Joined: Dec 2008
Posts: 14
Framerate issues

Hi,
I've recently been having framerate issues (sporadic slowdowns, choppiness) in an iPhone game I'm working on. The game runs at 30fps, leaving 33ms to render a single frame. I've timed the code, and the entire update/draw logic takes less than 10ms, occasionally spiking to 15ms. I've also run the game with Activity Monitor in Xcode, and the total cpu usage for the iPhone stays around 30-40%.

The draw logic is based on EAGLView from Apple's examples if that helps.

From my tests, it doesn't seem like I'm putting any real strain on the device, but the framerate still occasionally drops. Has anyone else has problems like this? Is there anything else I could try to help diagnose the problem?

Thanks,
- Galen
12-13-2008, 10:40 PM
#2
Joined: Nov 2008
Posts: 128
there are a few things ive noticed that cause quick dips in fps.. background stuff running and the internal times. calls to webkit stuff etc. since you have no control over background processes you cant do much about it.. for fun go into itunes and start downloading a podcast, and then go back and lay your game.. watch how much different it runs

12-14-2008, 07:00 AM
#3
Music streaming causes semi-random performance hits in our experience. Experiment with other music formats and/or lower bit rates.
12-15-2008, 05:54 AM
#4
Joined: Oct 2008
Location: 127.0.0.1
Posts: 389
Quote:
Originally Posted by Frand View Post
Music streaming causes semi-random performance hits in our experience. Experiment with other music formats and/or lower bit rates.
You do spin? Sounds like mod/tracker music to me, is it? I guess the benefit is small file sizes and basic samples. I remember a 486 could play a 32 channel XM (like mod) file with samples, but couldn't play a 128kbs MP3

EDIT: sorry for thread hijack, i'll leave this now

Last edited by darwiniandude; 12-15-2008 at 05:00 PM.
12-15-2008, 06:37 AM
#5
Quote:
Originally Posted by darwiniandude View Post
You do spin? Sounds like mod/tracker music to me, is it? I guess the benefit is small file sizes and basic samples. I remember a 486 could play a 32 channel XM (like mod) file with samples, but couldn't play a 128kbs MP3
SPiN uses XM, but the observations regarding streaming audio come from the development of Zen Bound.
12-15-2008, 04:48 PM
#6
Junior Member [Original Poster]
Joined: Dec 2008
Posts: 14
Thanks for the ideas. Unfortunately we still get the framerate drops even without music playing. It must be something else.
12-16-2008, 11:21 AM
#7
Joined: Nov 2008
Location: San Francisco
Posts: 430
Have you run your game in Shark to see where the majority of time is spent in your game?

Also, the iPhone just does crap. Nothing is frustrating than that buzz when you realize the stupid phone just checked email during a game.

Also, take a careful look at your texture loader, Apple's previous sample projects leaked memory horribly.

I've made a lot of games. You've played them.