I'm making a multiplayer game with a Node.js server, and I'm searching for how to write the game loop.
I'm currently using a setinterval
every 15ms, but someone told me that if the code inside the setinterval
hasn't finished running after 15ms, it will add delay, and lags.
I have searched and found things like setimmediate
, process.nextTick
, but I don't know what should I use.
So what is the best way to loop, with he best performance?