I'm making a game in C++ using Box2D and WebSocket++. The world needs to updated every
1/60 second. Meanwhile the WebSocket server handles players. How I should make the interval? I know there's no
setInterval function in C++, but I can do something like this:
• make async function - https://stackoverflow.com/questions/33234403/using-setinterval-in-c/33234557
• make async thread - https://codereview.stackexchange.com/questions/40915/simple-multithread-timer
or maybe there's a lib?
Note: this isn't a duplicate of How should I write a main game loop? because here I need asynchronous game loop. In linked topic there are synchronous game loops.
Why I won't use
while (sync loop):
- commands after
while (loop)are never excuted if
loopis set to