Skip to content

Commit

Permalink
Merge pull request #209 from candirugame/enhancement-use-volatile-emits
Browse files Browse the repository at this point in the history
perf: make playerData emits volatile
  • Loading branch information
IsaacThoman authored Jan 3, 2025
2 parents 21eda33 + 75fd65f commit cc90eef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client/core/Networking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class Networking {
return;
}

this.socket.emit('playerData', this.localPlayer);
this.socket.volatile.emit('playerData', this.localPlayer);
this.lastUploadedLocalPlayer = {
position: this.localPlayer.position.clone(),
quaternion: this.localPlayer.quaternion.clone(),
Expand Down
2 changes: 1 addition & 1 deletion src/server/GameEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class GameEngine {
// Emit player data if there are updates or enough time has passed
if (this.playerUpdateSinceLastEmit || currentTime - this.lastPlayerTickTimestamp > 1 / config.server.tickRate) {
try {
this.io.emit('remotePlayerData', this.playerManager.getAllPlayers());
this.io.volatile.emit('remotePlayerData', this.playerManager.getAllPlayers());
this.playerUpdateSinceLastEmit = false;
this.lastPlayerTickTimestamp = currentTime;
} catch (err) {
Expand Down

0 comments on commit cc90eef

Please sign in to comment.