Profiling OpenGL ES App

Moderator
Posts: 3,579
Joined: 2003.06
Post: #16
No, NSTimer is reasonably accurate, so you your varying frame rate isn't coming from there. Mostly, frame rate will vary because of what's going on with OpenGL ES/related graphics hardware. There is a lot of stuff going on with the OS too which might affect frame rate at times. Touch input processing seems to be a popular source of slow down from what I've heard, although it hasn't seemed to affect my stuff as much as I've heard from others.
Quote this message in a reply
Nibbie
Posts: 1
Joined: 2009.04
Post: #17
Frank C. Wrote:Hopefully the other functions (gameStep, gameDrawFrame) are self explanatory.

Thanks Frank, that made thinks clearer for me. Actually, how are these two functions supposed to work, why does gameStep(kGameFrameStepInterval) take kGameFrameStepInterval as argument and gameDrawFrame(dt) dt? I'm not sure what to do with those. Huh
Quote this message in a reply
Member
Posts: 249
Joined: 2008.10
Post: #18
Frank C. Wrote:If you're using an NSTimer to drive frames you'll want to crank up the interval. Running a timer at 60Hz won't necessarily give you 60 FPS due to VBL syncing and other blocking event updates. Some folks recommend using a separate thread for rendering but I've never run into any problems with NSTimer - you just gotta crank it up - but note that you'll never exceed 60FPS on the iPhone since that's the hard-coded VBL rate.

What I do is run my frame timer at 120Hz and de-couple the logic/physics steps from the graphics updates using the technique described here. But I also cap the graphics updates, so I run physics at 60Hz, and draw at 30Hz. The timer might spin needlessly at times in this scenario but that 120Hz ensures you have some breathing room to catch up on updates when things are bogging down.

And yes - set your CAEAGLLayer to opaque (check the OpenGL ES project template).

Franc, if your game repaints every 33 miliseconds, why you update it every 16 miliseconds? Why do you update it 2 times if player will see only one?

Thanks.
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #19
riruilo Wrote:Franc, if your game repaints every 33 miliseconds, why you update it every 16 miliseconds? Why do you update it 2 times if player will see only one?

Thanks.

Sometimes it makes sense ... if your code is set up to step at certain intervals it makes easier to handle stuff like collisions etc ...
Quote this message in a reply
Member
Posts: 249
Joined: 2008.10
Post: #20
warmi Wrote:Sometimes it makes sense ... if your code is set up to step at certain intervals it makes easier to handle stuff like collisions etc ...

Why? I don't understand that. Usually physics engines have a time step, whatever you want, even if that timestep is too high, I does not matter because some of them have a continuous collision system. Unless you create your own (primitive) collision system where frecuency is important to avoid tunneling effect.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #21
What warmi said. Some physics engines might handle variable timesteps but most if not all provide a better simulation and might even run more efficiently when using a fixed step. Continuous collision can be very expensive, so even if your physics engine can do it you wouldn't necessarily turn it on for an iPhone game. CCD and fixed steps aren't mutually exclusive either - I'd still use fixed steps when using CCD 'cause they just make everything easier - AI, networking, demo recording, etc. can all benefit from fixed steps.

Here's the article I always point out when someone asks about fixed time steps (explains things better than I can): http://gafferongames.com/game-physics/fi...-timestep/

I should also note that this thread is pretty old and so is the code I posted - I no longer use NSTimer for one, but I still separate the logic/physics step from drawing 'cause that's just good for everybody.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Profiling the non-OpenGL parts of my game monteboyd 10 6,027 Oct 25, 2012 04:03 PM
Last Post: monteboyd