From 6265d2bc1ef54580d6ea6a8f984c29445eb3d56c Mon Sep 17 00:00:00 2001 From: genxium Date: Wed, 21 Sep 2022 19:24:01 +0800 Subject: [PATCH] Minor fix. --- frontend/assets/scripts/BasePlayer.js | 2 -- frontend/assets/scripts/Map.js | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/assets/scripts/BasePlayer.js b/frontend/assets/scripts/BasePlayer.js index c496daf..e4ce7f0 100644 --- a/frontend/assets/scripts/BasePlayer.js +++ b/frontend/assets/scripts/BasePlayer.js @@ -363,8 +363,6 @@ module.export = cc.Class({ lateUpdate(dt) { const self = this; - self.activeDirection.dx = self.activeDirection.dx; - self.activeDirection.dy = self.activeDirection.dy; const now = new Date().getTime(); self.lastMovedAt = now; }, diff --git a/frontend/assets/scripts/Map.js b/frontend/assets/scripts/Map.js index a3414ef..a9fea70 100644 --- a/frontend/assets/scripts/Map.js +++ b/frontend/assets/scripts/Map.js @@ -338,7 +338,7 @@ cc.Class({ self.lastDownsyncInputFrameId = -1; self.lastAllConfirmedInputFrameId = -1; self.lastUpsyncInputFrameId = -1; - self.inputFrameUpsyncDelayTolerance = 1; + self.inputFrameUpsyncDelayTolerance = 3; self.recentFrameCache = {}; self.recentFrameCacheCurrentSize = 0; @@ -964,6 +964,9 @@ cc.Class({ playerScriptIns.scheduleNewDirection(decodedInput, true); if (invokeUpdateToo) { playerScriptIns.update(self.rollbackEstimatedDt); + // [WARNING] CocosCreator v2.2.1 uses a singleton "CCDirector" to schedule "tree descendent updates" and "collision detections" in different timers, thus the following manual trigger of collision detection might not produce the same outcome for the "selfPlayer" as the other peers. Moreover, the aforementioned use of different timers is an intrinsic source of error! + + cc.director._collisionManager.update(self.rollbackEstimatedDt); // Just to avoid unexpected wall penetration, no guarantee on determinism } } },