Jump to content

  • Log In with Google      Sign In   
  • Create Account

What's Your Ios Game Loop?

  • You cannot reply to this topic
No replies to this topic

#1 zokeefe   GDNet+   -  Reputation: 104


Posted Yesterday, 04:06 PM

Just looking at what other people have done, what's been successful, and what pitfalls to avoid.


Current Prototype:

  • Game update is variable update time
  • Game update and rendering done in CADisplayLink callback running on main thread.
  • Audio update occurs on separate thread controlled by AudioUnit.
  • (Game-specific context): Game update takes ~5ms to complete



  • I feel like variable-time game update might be OK on mobile given we don't have to worry about being preempted as much.
  • Don't know if this is how CADisplayLink is designed to work - perhaps should run game logic on background thread and only render in CADisplayLink callback? Not sure what synchronization issues arise here. Game logic could be allowed to update as fast as possible - or could cap to screen refresh rate.
  • Similarly, could push rendering into same background thread as game update. Again, not sure what synchronization issues arise here.

Goals (The same as everyone else?):

  1. Minimize input -> display latency
  2. Every screen refresh, the device should have an new/updated frame buffer to display.

(Placed in Graphics Programming and Theory because of CPU/GPU synchronization issues - of which I am most uninformed)

Edited by zokeefe, Yesterday, 04:28 PM.