Skip to main content
typos
Source Link
DMGregory
  • 141k
  • 23
  • 258
  • 401

Best way How to make an update loop in a Node.js game server

i'm actuallyI'm making a multiplayer game wihtwith a nodejsNode.js server, and I'm searching what is the best wayfor how to loop, and at what interval should Iwrite the game loop.

I'm actuallycurrently using a setintervalsetinterval every 15ms, but someone saidtold me that if the code inside the setinterval haven'tsetinterval hasn't finished to runrunning after 15ms, it will add delay, and lags.

I have searched and found things like setimmediatesetimmediate, process.nextThickprocess.nextTick, but I don't know what should I use.

So what is the best way to loop witht, with he best performances performance?

Best way to make an update loop in game server

i'm actually making a multiplayer game wiht a nodejs server, and I'm searching what is the best way to loop, and at what interval should I loop.

I'm actually using a setinterval every 15ms, but someone said me that if the code inside the setinterval haven't finished to run after 15ms, it will add delay, and lags.

I have searched and found things like setimmediate, process.nextThick, but I don't know what should I use

So what is the best way to loop witht he best performances ?

How to make an update loop in a Node.js game server

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?

Source Link

Best way to make an update loop in game server

i'm actually making a multiplayer game wiht a nodejs server, and I'm searching what is the best way to loop, and at what interval should I loop.

I'm actually using a setinterval every 15ms, but someone said me that if the code inside the setinterval haven't finished to run after 15ms, it will add delay, and lags.

I have searched and found things like setimmediate, process.nextThick, but I don't know what should I use

So what is the best way to loop witht he best performances ?