Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the client/server update rate to 125 Hz and 100 Hz #982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/game/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ namespace client
void c2sinfo(bool force) // send update to the server
{
static int lastupdate = -1000;
if(totalmillis-lastupdate < 40 && !force) return; // don't update faster than 25fps
if(totalmillis-lastupdate < 8 && !force) return; // don't update faster than 125 FPS
lastupdate = totalmillis ? totalmillis : 1;
sendpositions();
sendmessages();
Expand Down
7 changes: 5 additions & 2 deletions src/game/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5932,9 +5932,12 @@ namespace server
{
if(clients.empty() || (!hasnonlocalclients() && !demorecord)) return false;
enet_uint32 millis = enet_time_get()-lastsend;
if(millis < 40 && !force) return false;
// Send packets at 100 Hz. Higher update rates result in lower effective latency.
// This update rate should be slower than the one defined on the client to avoid "slipped" frames,
// which makes interpolation look worse.
if(millis < 10 && !force) return false;
bool flush = buildworldstate();
lastsend += millis - (millis%40);
lastsend += millis - (millis%10);
return flush;
}

Expand Down