I am trying to implementing multi-threaded game loop in iOS. (Actaully, two thread - Render and Update)
This is my structure.
Update Loop
- Has logic and at the end of loop, save update state. (Basically copy buffer for Render)
Render Loop
- Using CADsiplayLink
- It is on Main
- Everytime, it triggers method, get the state, and draw.
Questions:
- 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!!!