Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
Is there a way to stop server input when the client is not focused on?

I have a multiplayer online game I am making, it uses node.js, and the communication between the server and the client is as follows:

In the beginning, all of the needed models are sent from the server to the client when the client asks for it. From then on, the server sends all connected clients get sent all position data 60 times a second. As of now, the only things that the client sends the server are keyboard inputs, other than that there is a chat that is working fine when both the client and server are fine, but that is besides the issue.

The server manages all of the physics, and the client manages all of the rendering.

The problem is, besides the fact that it doesnt even work in the first place if the server sending speed is 60 a second but only on the inisialisation of the client, as in when the client is done joining it can be turned from like 1 or 5 or 10 back up to 60, is that when it does work, and the browser tab is taken out of focus, all calculations and recieving from the server stops. I don't know why that is, but it causes an issue when the page gets focus again, as in when the page gets focus again the game goes through rendering all that has happened at a fast speed while the client was away. This causes issues as it can take a while before it is ready to use again, and any inputs have a magnified effect and get put at the end of the rewind thing.

I have tried making it stop rendering while the screen was turned away, but that didn't work. I don't know how to fix the issue, besides maybe making the server check each and every player to see if it is active or not before sending the files individually, which doesn't seem to be a good solution. I would prefer to still be able to use the "io.emit" method.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!