I have created a simple snake clone and would like to execute game logic every 100ms while rendering as fast as possible. How can I achieve this when the program might run with very different frame rates?
For example when compiling the code to a native executable I have over 1000 where I can just wait until 100ms are passed before executing the next logic step. But when compiling to asm.js I get frame rates of about 20 which means the period between two logic steps could be everything from 100ms to 149ms which would result in visible stutter (one movement is faster than another).
InvokeRepeating
seams to be a feature Unity or maby C# but I'm using C. Thanks nevertheless :) \$\endgroup\$