mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 03:39:00 +00:00
Enhanced frontend logging.
This commit is contained in:
parent
14bb6fa1ea
commit
faee73ae50
@ -878,7 +878,7 @@ func (pR *Room) OnPlayerDisconnected(playerId int32) {
|
||||
default:
|
||||
atomic.StoreInt32(&(pR.Players[playerId].BattleState), PlayerBattleStateIns.DISCONNECTED)
|
||||
pR.clearPlayerNetworkSession(playerId) // Still need clear the network session pointers, because "OnPlayerDisconnected" is only triggered from "signalToCloseConnOfThisPlayer" in "ws/serve.go", when the same player reconnects the network session pointers will be re-assigned
|
||||
Logger.Warn("OnPlayerDisconnected finished:", zap.Any("roomId", pR.Id), zap.Any("playerId", playerId), zap.Any("playerBattleState", pR.Players[playerId].BattleState), zap.Any("nowRoomBattleState", pR.State), zap.Any("nowRoomEffectivePlayerCount", pR.EffectivePlayerCount), zap.Any("now InputsBuffer", pR.InputsBufferString(true)))
|
||||
Logger.Warn("OnPlayerDisconnected finished:", zap.Any("roomId", pR.Id), zap.Any("playerId", playerId), zap.Any("playerBattleState", pR.Players[playerId].BattleState), zap.Any("nowRoomBattleState", pR.State), zap.Any("nowRoomEffectivePlayerCount", pR.EffectivePlayerCount))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,11 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
|
||||
if moveToCollide {
|
||||
effPushback := Vec2D{X: float64(0), Y: float64(0)}
|
||||
toTestPlayerCollider := playerColliders[0]
|
||||
//colliderWidth, colliderHeight := playerColliderRadius*2, playerColliderRadius*4
|
||||
//newVx, newVy := int32(27999), int32(-420270)
|
||||
//toTestPlayerCollider.X, toTestPlayerCollider.Y = VirtualGridToPolygonColliderBLPos(newVx, newVy, colliderWidth, colliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, virtualGridToWorldRatio)
|
||||
colliderWidth, colliderHeight := playerColliderRadius*2, playerColliderRadius*4
|
||||
newVx, newVy := int32(-189000), int32(-497000)
|
||||
toTestPlayerCollider.X, toTestPlayerCollider.Y = VirtualGridToPolygonColliderBLPos(newVx, newVy, colliderWidth, colliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, virtualGridToWorldRatio)
|
||||
playerColliders[1].X, playerColliders[1].Y = VirtualGridToPolygonColliderBLPos(int32(-165000), int32(-504000), colliderWidth, colliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, virtualGridToWorldRatio)
|
||||
playerColliders[1].Update()
|
||||
|
||||
Logger.Info(fmt.Sprintf("Checking collision for playerShape=%v", ConvexPolygonStr(toTestPlayerCollider.Shape.(*resolv.ConvexPolygon))))
|
||||
|
||||
|
@ -440,7 +440,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
210.4441731196186,
|
||||
209.73151519075364,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -117,6 +117,10 @@ cc.Class({
|
||||
return ((inputFrameId << this.inputScaleFrames) + inputDelayFrames);
|
||||
},
|
||||
|
||||
_convertToLastUsedRenderFrameId(inputFrameId, inputDelayFrames) {
|
||||
return ((inputFrameId << this.inputScaleFrames) + inputDelayFrames + (1 << this.inputScaleFrames) - 1);
|
||||
},
|
||||
|
||||
shouldGenerateInputFrameUpsync(renderFrameId) {
|
||||
return ((renderFrameId & ((1 << this.inputScaleFrames) - 1)) == 0);
|
||||
},
|
||||
@ -779,28 +783,15 @@ lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}`);
|
||||
findingPlayerScriptIns.updatePlayersInfo(rdf.players);
|
||||
},
|
||||
|
||||
logBattleStats() {
|
||||
const self = this;
|
||||
let s = [];
|
||||
s.push(`Battle stats: renderFrameId=${self.renderFrameId}, lastUpsyncInputFrameId=${self.lastUpsyncInputFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, chaserRenderFrameId=${self.chaserRenderFrameId}; recentRenderCache=${self._stringifyRecentRenderCache(false)}, recentInputCache=${self._stringifyRecentInputCache(false)}`);
|
||||
|
||||
for (let i = self.recentInputCache.stFrameId; i < self.recentInputCache.edFrameId; ++i) {
|
||||
const inputFrameDownsync = self.recentInputCache.getByFrameId(i);
|
||||
s.push(JSON.stringify(inputFrameDownsync));
|
||||
}
|
||||
|
||||
console.log(s.join('\n'));
|
||||
},
|
||||
|
||||
onBattleStopped() {
|
||||
const self = this;
|
||||
if (ALL_BATTLE_STATES.IN_BATTLE != self.battleState) {
|
||||
return;
|
||||
}
|
||||
self._stringifyRecentInputAndRenderCacheCorrespondingly();
|
||||
window.closeWSConnection(constants.RET_CODE.BATTLE_STOPPED);
|
||||
self.battleState = ALL_BATTLE_STATES.IN_SETTLEMENT;
|
||||
self.countdownNanos = null;
|
||||
self.logBattleStats();
|
||||
if (self.musicEffectManagerScriptIns) {
|
||||
self.musicEffectManagerScriptIns.stopAllMusic();
|
||||
}
|
||||
@ -908,14 +899,14 @@ lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}`);
|
||||
const delayedInputFrameId = self._convertToInputFrameId(rdf.id, 0);
|
||||
const othersForcedDownsyncRenderFrame = self.othersForcedDownsyncRenderFrameDict.get(rdf.id);
|
||||
if (self.lastAllConfirmedInputFrameId >= delayedInputFrameId && !self.equalRoomDownsyncFrames(othersForcedDownsyncRenderFrame, rdf)) {
|
||||
console.warn(`Mismatched render frame@rdf.id=${rdf.id} w/ inputFrameId=${delayedInputFrameId}, @lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, @chaserRenderFrameId=${self.chaserRenderFrameId}:
|
||||
console.warn(`Mismatched render frame@rdf.id=${rdf.id} w/ inputFrameId=${delayedInputFrameId}:
|
||||
rdf=${JSON.stringify(rdf)}
|
||||
othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame)}
|
||||
recentRenderCache=${self._stringifyRecentRenderCache(true)}
|
||||
recentInputCache=${self._stringifyRecentInputCache(true)}`);
|
||||
closeWSConnection(constants.RET_CODE.CLIENT_MISMATCHED_RENDER_FRAME, "");
|
||||
self.onManualRejoinRequired("[DEBUG] CLIENT_MISMATCHED_RENDER_FRAME");
|
||||
${self._stringifyRecentInputAndRenderCacheCorrespondingly()}`);
|
||||
// closeWSConnection(constants.RET_CODE.CLIENT_MISMATCHED_RENDER_FRAME, "");
|
||||
// self.onManualRejoinRequired("[DEBUG] CLIENT_MISMATCHED_RENDER_FRAME");
|
||||
rdf = othersForcedDownsyncRenderFrame;
|
||||
self.othersForcedDownsyncRenderFrameDict.delete(rdf.id);
|
||||
}
|
||||
}
|
||||
self.applyRoomDownsyncFrameDynamics(rdf, prevRdf);
|
||||
@ -1603,6 +1594,22 @@ playerColliderPos=${self.stringifyColliderCenterInWorld(playerCollider, halfColl
|
||||
return `[stRenderFrameId=${self.recentRenderCache.stFrameId}, edRenderFrameId=${self.recentRenderCache.edFrameId})`;
|
||||
},
|
||||
|
||||
_stringifyRecentInputAndRenderCacheCorrespondingly() {
|
||||
const self = this;
|
||||
let s = [];
|
||||
s.push(`@lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, @renderFrameId=${self.renderFrameId}, @chaserRenderFrameId=${self.chaserRenderFrameId}`);
|
||||
|
||||
for (let i = self.recentRenderCache.stFrameId; i < self.recentRenderCache.edFrameId; ++i) {
|
||||
let jPrev = self._convertToInputFrameId(i - 1, self.inputDelayFrames);
|
||||
let j = self._convertToInputFrameId(i, self.inputDelayFrames);
|
||||
if (i == self.recentRenderCache.stFrameId || j > jPrev) {
|
||||
s.push(JSON.stringify(self.recentInputCache.getByFrameId(j)));
|
||||
}
|
||||
s.push(JSON.stringify(self.recentRenderCache.getByFrameId(i)));
|
||||
}
|
||||
return s.join('\n');
|
||||
},
|
||||
|
||||
worldToVirtualGridPos(x, y) {
|
||||
// [WARNING] Introduces loss of precision!
|
||||
const self = this;
|
||||
|
@ -211,8 +211,7 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
||||
case constants.RET_CODE.PLAYER_NOT_FOUND:
|
||||
case constants.RET_CODE.PLAYER_CHEATING:
|
||||
case 1006: // Peer(i.e. the backend) gone unexpectedly
|
||||
console.warn(`recentRenderCache=${mapIns._stringifyRecentRenderCache(true)}
|
||||
recentInputCache=${mapIns._stringifyRecentInputCache(true)}`);
|
||||
console.warn(`${mapIns._stringifyRecentInputAndRenderCacheCorrespondingly()}`);
|
||||
window.clearLocalStorageAndBackToLoginScene(true);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user