Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to implementing multi-threaded game loop in iOS. (Actaully, two thread - Render and Update)

This is my structure.

  1. Update Loop

    • Has logic and at the end of loop, save update state. (Basically copy buffer for Render)
  2. Render Loop

    • Using CADsiplayLink
    • It is on Main
    • Everytime, it triggers method, get the state, and draw.

Questions:

  1. I am seeing some stuttering, and I am thinking render loop is just faster than update loop, and also inconsistent "Render" call.

So, like

  • Update #1 -> Render #1
  • Update #2 -> Render #1
  • Update #2 -> Render #2

How can I synchronize this??


  • I heard that Render thread should be not on Main Thread.
    • I am using CADisplayLink with default setting. (Call MainLoop)
    • Is it running on Main thread?
    • If running on different thread, is better, can I get some suggestions working with CADisplayLink???
    • Could be I just lack of understand about CADisplayLink.

Please feel free to comment my current structure. (Like some parts must be changed to something differently etc.) (You can say "change completely". But please guide me with explanation).

(Sorry for not well-formed question. Don't know why but editor not working properly. :< )

Thank you!!!

share|improve this question
    
what's the point of multithreading here? After all the render method has to wait for update every frame, so there won't be any benefits from running them on separate threads. Instead multithread algorithms such as game logic or draw order sorting or preparing vertex buffers. –  LearnCocos2D Feb 21 at 0:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.