diff --git a/client/src/modules/Timer.js b/client/src/modules/Timer.js index ff0c180..c435754 100644 --- a/client/src/modules/Timer.js +++ b/client/src/modules/Timer.js @@ -3,7 +3,8 @@ A timer using setTimeout that compensates for drift. Drift can happen for severa https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#reasons_for_delays This means the timer may very well be late in executing the next call (but never early). -This timer is accurate to within a few ms for any amount of time provided. It's meant to be utilized as a Web Worker. +This timer is accurate to within a few ms for any amount of time provided. This is the client-side version of this module, +and is meant to be utilized as a Web Worker. See: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API */ diff --git a/client/src/scripts/game.js b/client/src/scripts/game.js index 0b3edaf..45c459d 100644 --- a/client/src/scripts/game.js +++ b/client/src/scripts/game.js @@ -20,7 +20,6 @@ const game = () => { toast('Disconnected. Attempting reconnect...', 'error', true, false); }); socket.on('connect', () => { - console.log('fired connect event'); socket.emit(globals.COMMANDS.GET_ENVIRONMENT, function (returnedEnvironment) { timerWorker = new Worker(new URL('../modules/Timer.js', import.meta.url)); prepareGamePage(returnedEnvironment, socket, timerWorker); diff --git a/server/modules/ServerTimer.js b/server/modules/ServerTimer.js index ad29705..8e96e3d 100644 --- a/server/modules/ServerTimer.js +++ b/server/modules/ServerTimer.js @@ -1,3 +1,10 @@ +/* +A timer using setTimeout that compensates for drift. Drift can happen for several reasons: +https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#reasons_for_delays + +This means the timer may very well be late in executing the next call (but never early). +This timer is accurate to within a few ms for any amount of time provided. + */ function stepFn (serverTimerInstance, expected) { const now = Date.now(); //