Formalized use of frame data logging.

This commit is contained in:
genxium
2022-12-27 10:09:53 +08:00
parent 335e11e925
commit c017aaa7ed
13 changed files with 123 additions and 83 deletions

File diff suppressed because one or more lines are too long

View File

@@ -147,6 +147,8 @@ message BattleColliderInfo {
int32 gravityX = 28;
int32 gravityY = 29;
int32 collisionMinStep = 30;
bool frameDataLoggingEnabled = 999;
}
message RoomDownsyncFrame {

View File

@@ -1,7 +1,6 @@
const i18n = require('LanguageData');
i18n.init(window.language); // languageID should be equal to the one we input in New Language ID input field
const collisions = require('./modules/Collisions');
const RingBuffer = require('./RingBuffer');
window.ALL_MAP_STATES = {
@@ -1112,13 +1111,15 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
const jPrev = self._convertToInputFrameId(i - 1, self.inputDelayFrames);
const delayedInputFrameForPrevRenderFrame = self.recentInputCache.getByFrameId(jPrev);
const actuallyUsedInputClone = delayedInputFrame.inputList.slice();
const inputFrameDownsyncClone = {
inputFrameId: delayedInputFrame.inputFrameId,
inputList: actuallyUsedInputClone,
confirmedList: delayedInputFrame.confirmedList,
};
self.rdfIdToActuallyUsedInput.set(currRdf.Id, inputFrameDownsyncClone);
if (self.frameDataLoggingEnabled) {
const actuallyUsedInputClone = delayedInputFrame.inputList.slice();
const inputFrameDownsyncClone = {
inputFrameId: delayedInputFrame.inputFrameId,
inputList: actuallyUsedInputClone,
confirmedList: delayedInputFrame.confirmedList,
};
self.rdfIdToActuallyUsedInput.set(currRdf.Id, inputFrameDownsyncClone);
}
const nextRdf = gopkgs.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs(delayedInputFrame.inputList, (null == delayedInputFrameForPrevRenderFrame ? null : delayedInputFrameForPrevRenderFrame.inputList), currRdf, collisionSys, collisionSysMap, self.gravityX, self.gravityY, self.jumpingInitVelY, self.inputDelayFrames, self.inputScaleFrames, self.spaceOffsetX, self.spaceOffsetY, self.snapIntoPlatformOverlap, self.snapIntoPlatformThreshold, self.worldToVirtualGridRatio, self.virtualGridToWorldRatio);
if (true == isChasing) {

View File

@@ -197,7 +197,9 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
break;
case constants.RET_CODE.BATTLE_STOPPED:
// deliberately do nothing
//console.warn(`${mapIns._stringifyRdfIdToActuallyUsedInput()}`);
if (mapIns.frameDataLoggingEnabled) {
console.warn(`${mapIns._stringifyRdfIdToActuallyUsedInput()}`);
}
break;
case constants.RET_CODE.PLAYER_NOT_ADDABLE_TO_ROOM:
case constants.RET_CODE.PLAYER_NOT_READDABLE_TO_ROOM:
@@ -212,7 +214,9 @@ 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(`${mapIns._stringifyRdfIdToActuallyUsedInput()}`);
if (mapIns.frameDataLoggingEnabled) {
console.warn(`${mapIns._stringifyRdfIdToActuallyUsedInput()}`);
}
window.clearLocalStorageAndBackToLoginScene(true);
break;
default:

View File

@@ -4608,6 +4608,7 @@ $root.protos = (function() {
* @property {number|null} [gravityX] BattleColliderInfo gravityX
* @property {number|null} [gravityY] BattleColliderInfo gravityY
* @property {number|null} [collisionMinStep] BattleColliderInfo collisionMinStep
* @property {boolean|null} [frameDataLoggingEnabled] BattleColliderInfo frameDataLoggingEnabled
*/
/**
@@ -4866,6 +4867,14 @@ $root.protos = (function() {
*/
BattleColliderInfo.prototype.collisionMinStep = 0;
/**
* BattleColliderInfo frameDataLoggingEnabled.
* @member {boolean} frameDataLoggingEnabled
* @memberof protos.BattleColliderInfo
* @instance
*/
BattleColliderInfo.prototype.frameDataLoggingEnabled = false;
/**
* Creates a new BattleColliderInfo instance using the specified properties.
* @function create
@@ -4953,6 +4962,8 @@ $root.protos = (function() {
writer.uint32(/* id 29, wireType 0 =*/232).int32(message.gravityY);
if (message.collisionMinStep != null && Object.hasOwnProperty.call(message, "collisionMinStep"))
writer.uint32(/* id 30, wireType 0 =*/240).int32(message.collisionMinStep);
if (message.frameDataLoggingEnabled != null && Object.hasOwnProperty.call(message, "frameDataLoggingEnabled"))
writer.uint32(/* id 999, wireType 0 =*/7992).bool(message.frameDataLoggingEnabled);
return writer;
};
@@ -5126,6 +5137,10 @@ $root.protos = (function() {
message.collisionMinStep = reader.int32();
break;
}
case 999: {
message.frameDataLoggingEnabled = reader.bool();
break;
}
default:
reader.skipType(tag & 7);
break;
@@ -5262,6 +5277,9 @@ $root.protos = (function() {
if (message.collisionMinStep != null && message.hasOwnProperty("collisionMinStep"))
if (!$util.isInteger(message.collisionMinStep))
return "collisionMinStep: integer expected";
if (message.frameDataLoggingEnabled != null && message.hasOwnProperty("frameDataLoggingEnabled"))
if (typeof message.frameDataLoggingEnabled !== "boolean")
return "frameDataLoggingEnabled: boolean expected";
return null;
};
@@ -5359,6 +5377,8 @@ $root.protos = (function() {
message.gravityY = object.gravityY | 0;
if (object.collisionMinStep != null)
message.collisionMinStep = object.collisionMinStep | 0;
if (object.frameDataLoggingEnabled != null)
message.frameDataLoggingEnabled = Boolean(object.frameDataLoggingEnabled);
return message;
};
@@ -5415,6 +5435,7 @@ $root.protos = (function() {
object.gravityX = 0;
object.gravityY = 0;
object.collisionMinStep = 0;
object.frameDataLoggingEnabled = false;
}
if (message.stageName != null && message.hasOwnProperty("stageName"))
object.stageName = message.stageName;
@@ -5486,6 +5507,8 @@ $root.protos = (function() {
object.gravityY = message.gravityY;
if (message.collisionMinStep != null && message.hasOwnProperty("collisionMinStep"))
object.collisionMinStep = message.collisionMinStep;
if (message.frameDataLoggingEnabled != null && message.hasOwnProperty("frameDataLoggingEnabled"))
object.frameDataLoggingEnabled = message.frameDataLoggingEnabled;
return object;
};