Synchronization between game logic thread and rendering thread
Posted
by
user782220
on Game Development
See other posts from Game Development
or by user782220
Published on 2012-07-01T09:50:38Z
Indexed on
2012/07/01
15:24 UTC
Read the original article
Hit count: 387
How does one separate game logic and rendering? I know there seem to already be questions on here asking exactly that but the answers are not satisfactory to me.
From what I understand so far the point of separating them into different threads is so that game logic can start running for the next tick immediately instead of waiting for the next vsync where rendering finally returns from the swapbuffer call its been blocking on.
But specifically what data structures are used to prevent race conditions between the game logic thread and the rendering thread. Presumably the rendering thread needs access to various variables to figure out what to draw, but game logic could be updating these same variables.
Is there a de facto standard technique for handling this problem. Maybe like copy the data needed by the rendering thread after every execution of the game logic. Whatever the solution is will the overhead of synchronization or whatever be less than just running everything single threaded?
© Game Development or respective owner