Skip to content

Commit

Permalink
Increase the network update rate to ~66.67 Hz
Browse files Browse the repository at this point in the history
This should make players appear less jittery. Actions should also
be replicated faster.

This closes tomatenquark#31.
  • Loading branch information
Calinou committed Jun 13, 2020
1 parent cc6aa81 commit a60036c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/fpsgame/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ namespace game
void c2sinfo(bool force) // send update to the server
{
static int lastupdate = -1000;
if(totalmillis - lastupdate < 33 && !force) return; // don't update faster than 30fps
if(totalmillis - lastupdate < 15 && !force) return; // don't update faster than ~66.67fps
lastupdate = totalmillis;
sendpositions();
sendmessages();
Expand Down
4 changes: 2 additions & 2 deletions src/fpsgame/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,9 +1768,9 @@ namespace server
{
if(clients.empty() || (!hasnonlocalclients() && !demorecord)) return false;
enet_uint32 curtime = enet_time_get()-lastsend;
if(curtime<33 && !force) return false;
if(curtime<15 && !force) return false;
bool flush = buildworldstate();
lastsend += curtime - (curtime%33);
lastsend += curtime - (curtime%15);
return flush;
}

Expand Down

0 comments on commit a60036c

Please sign in to comment.