diff --git a/frontend/assets/scripts/Map.js b/frontend/assets/scripts/Map.js index f8faba0..0ff0609 100644 --- a/frontend/assets/scripts/Map.js +++ b/frontend/assets/scripts/Map.js @@ -748,8 +748,9 @@ cc.Class({ self.battleState = ALL_BATTLE_STATES.IN_BATTLE; } + // [WARNING] "cc.Node.removeChild" would trigger massive update of rendering nodes, thus a performance impact at the beginning of battle, avoid it by just moving the widget to infinitely far away! if (self.countdownToBeginGameNode && self.countdownToBeginGameNode.parent) { - self.countdownToBeginGameNode.parent.removeChild(self.countdownToBeginGameNode); + self.countdownToBeginGameNode.setPosition(cc.v2(Number.MAX_VALUE, Number.MAX_VALUE)); } if (null != self.musicEffectManagerScriptIns) { @@ -1233,8 +1234,10 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame hideFindingPlayersGUI(rdf) { const self = this; - if (null == self.findingPlayerNode.parent) return; - self.findingPlayerNode.parent.removeChild(self.findingPlayerNode); + // [WARNING] "cc.Node.removeChild" would trigger massive update of rendering nodes, thus a performance impact at the beginning of battle, avoid it by just moving the widget to infinitely far away! + if (self.findingPlayerNode && self.findingPlayerNode.parent) { + self.findingPlayerNode.setPosition(cc.v2(Number.MAX_VALUE, Number.MAX_VALUE)); + } }, onBattleReadyToStart(rdf /* pb.RoomDownsyncFrame */ ) { diff --git a/jsexport/battle/battle.go b/jsexport/battle/battle.go index 7609025..d072aab 100644 --- a/jsexport/battle/battle.go +++ b/jsexport/battle/battle.go @@ -22,7 +22,12 @@ const ( GRAVITY_X = int32(0) GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases - INPUT_DELAY_FRAMES = int32(6) // in the count of render frames + INPUT_DELAY_FRAMES = int32(6) // in the count of render frames + + /* + [WARNING] + Experimentally having an input rate > 15 (e.g., 60 >> 2) doesn't improve multiplayer smoothness, in fact higher input rate often results in higher packet loss (both TCP and UDP) thus higher wrong prediction rate! + */ INPUT_SCALE_FRAMES = uint32(2) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames) SP_ATK_LOOKUP_FRAMES = int32(5)