FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál

What is the best rate at which to send updates to clients for a first person shooter NodeJS WebSocket server?

I developed a multiplayer FPS using WebGL, Nodejs and WebSockets. So far it is running great.

I am currently using setInterval(sendPlayerPositions, 16); to send updates to WebGL clients. Ideally I would use 16.66667 but this is not possible to my understanding.

So I wonder if I should change to setInterval(sendPlayerPositions, 10); to make up for the drift. And in general it might be a good idea to send stuff faster than the client frame rate (60 in most cases).

I also recently learned about process.nextTick and setImmediate and I wonder if I should use those instead...

Any advice ?

PS: I am currently using Nodejs 10 on my Linux server and Nodejs 14 on my dev machine.

❌
❌