mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-09 00:26:39 +00:00
Temp broken commit during refactoration of jsexport inputbuffer handling.
This commit is contained in:
@@ -67,7 +67,6 @@ cc.Class({
|
||||
this.speciesName = null;
|
||||
this.hp = 100;
|
||||
this.maxHp = 100;
|
||||
this.framesToRecover = 0;
|
||||
this.inAir = true;
|
||||
},
|
||||
|
||||
@@ -86,18 +85,18 @@ cc.Class({
|
||||
},
|
||||
|
||||
updateCharacterAnim(rdfPlayer, prevRdfPlayer, forceAnimSwitch) {
|
||||
// As this function might be called after many frames of a rollback, it's possible that the playing animation was predicted, different from "prevRdfPlayer.characterState" but same as "newCharacterState". More granular checks are needed to determine whether we should interrupt the playing animation.
|
||||
// As this function might be called after many frames of a rollback, it's possible that the playing animation was predicted, different from "prevRdfPlayer.CharacterState" but same as "newCharacterState". More granular checks are needed to determine whether we should interrupt the playing animation.
|
||||
|
||||
// Update directions
|
||||
if (this.animComp && this.animComp.node) {
|
||||
if (0 > rdfPlayer.dirX) {
|
||||
if (0 > rdfPlayer.DirX) {
|
||||
this.animComp.node.scaleX = (-1.0);
|
||||
} else if (0 < rdfPlayer.dirX) {
|
||||
} else if (0 < rdfPlayer.DirX) {
|
||||
this.animComp.node.scaleX = (1.0);
|
||||
}
|
||||
}
|
||||
|
||||
let newCharacterState = rdfPlayer.characterState;
|
||||
let newCharacterState = rdfPlayer.CharacterState;
|
||||
let newAnimName = window.ATK_CHARACTER_STATE_ARR[newCharacterState][1];
|
||||
let playingAnimName = null;
|
||||
let underlyingAnimationCtrl = null;
|
||||
@@ -110,7 +109,7 @@ cc.Class({
|
||||
playingAnimName = (!underlyingAnimationCtrl ? null : underlyingAnimationCtrl.name);
|
||||
}
|
||||
|
||||
// It turns out that "prevRdfPlayer.characterState" is not useful in this function :)
|
||||
// It turns out that "prevRdfPlayer.CharacterState" is not useful in this function :)
|
||||
if (newAnimName == playingAnimName && window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.has(newCharacterState)) {
|
||||
// No need to interrupt
|
||||
// console.warn(`JoinIndex=${rdfPlayer.joinIndex}, not interrupting ${newAnimName} while the playing anim is also ${playingAnimName}, player rdf changed from: ${null == prevRdfPlayer ? null : JSON.stringify(prevRdfPlayer)}, to: ${JSON.stringify(rdfPlayer)}`);
|
||||
@@ -131,7 +130,7 @@ cc.Class({
|
||||
underlyingAnimationCtrl.gotoAndPlayByFrame(newAnimName, 0, -1);
|
||||
} else {
|
||||
const animationData = underlyingAnimationCtrl._animations[newAnimName];
|
||||
let fromAnimFrame = (animationData.frameCount - rdfPlayer.framesToRecover);
|
||||
let fromAnimFrame = (animationData.frameCount - rdfPlayer.FramesToRecover);
|
||||
if (fromAnimFrame < 0) {
|
||||
// For Atk1 or Atk2, it's possible that the "meleeBullet.recoveryFrames" is configured to be slightly larger than corresponding animation duration frames
|
||||
fromAnimFrame = 0;
|
||||
@@ -149,7 +148,7 @@ cc.Class({
|
||||
}
|
||||
// The "playTimes" counterpart is managed by each "cc.AnimationClip.wrapMode", already preset in the editor.
|
||||
const targetClip = this.animComp.getClips()[newCharacterState]; // The clips follow the exact order in ATK_CHARACTER_STATE
|
||||
let fromTime = (targetClip.duration - rdfPlayer.framesToRecover / targetClip.sample); // TODO: Anyway to avoid using division here?
|
||||
let fromTime = (targetClip.duration - rdfPlayer.FramesToRecover / targetClip.sample); // TODO: Anyway to avoid using division here?
|
||||
if (fromTime < 0) {
|
||||
// For Atk1 or Atk2, it's possible that the "meleeBullet.recoveryFrames" is configured to be slightly larger than corresponding animation duration frames
|
||||
fromTime = 0;
|
||||
|
@@ -25,7 +25,7 @@ cc.Class({
|
||||
if (!self.mapScriptIns) return;
|
||||
if (!self.mapScriptIns.selfPlayerInfo) return;
|
||||
if (!self.mapScriptIns.playerRichInfoDict) return;
|
||||
const selfPlayerRichInfo = self.mapScriptIns.playerRichInfoDict.get(self.mapScriptIns.selfPlayerInfo.id);
|
||||
const selfPlayerRichInfo = self.mapScriptIns.playerRichInfoDict.get(self.mapScriptIns.selfPlayerInfo.Id);
|
||||
if (!selfPlayerRichInfo) return;
|
||||
const selfPlayerNode = selfPlayerRichInfo.node;
|
||||
if (!selfPlayerNode) return;
|
||||
|
@@ -140,28 +140,24 @@ cc.Class({
|
||||
|
||||
let previousSelfInput = null,
|
||||
currSelfInput = null;
|
||||
const joinIndex = self.selfPlayerInfo.joinIndex || self.selfPlayerInfo.JoinIndex;
|
||||
const existingInputFrame = self.recentInputCache.getByFrameId(inputFrameId);
|
||||
const joinIndex = self.selfPlayerInfo.JoinIndex;
|
||||
const existingInputFrame = self.recentInputCache.GetByFrameId(inputFrameId);
|
||||
const previousInputFrameDownsyncWithPrediction = self.getCachedInputFrameDownsyncWithPrediction(inputFrameId - 1);
|
||||
previousSelfInput = (null == previousInputFrameDownsyncWithPrediction ? null : previousInputFrameDownsyncWithPrediction.inputList[joinIndex - 1]);
|
||||
previousSelfInput = (null == previousInputFrameDownsyncWithPrediction ? null : previousInputFrameDownsyncWithPrediction.InputList[joinIndex - 1]);
|
||||
if (null != existingInputFrame) {
|
||||
// This could happen upon either [type#1] or [type#2] forceConfirmation, where "refRenderFrame" is accompanied by some "inputFrameDownsyncs". The check here also guarantees that we don't override history
|
||||
console.log(`noDelayInputFrameId=${inputFrameId} already exists in recentInputCache: recentInputCache=${self._stringifyRecentInputCache(false)}`);
|
||||
return [previousSelfInput, existingInputFrame.inputList[joinIndex - 1]];
|
||||
return [previousSelfInput, existingInputFrame.InputList[joinIndex - 1]];
|
||||
}
|
||||
|
||||
const prefabbedInputList = (null == previousInputFrameDownsyncWithPrediction ? new Array(self.playerRichInfoDict.size).fill(0) : previousInputFrameDownsyncWithPrediction.inputList.slice());
|
||||
const prefabbedInputList = (null == previousInputFrameDownsyncWithPrediction ? new Array(self.playerRichInfoDict.size).fill(0) : previousInputFrameDownsyncWithPrediction.InputList.slice());
|
||||
currSelfInput = self.ctrl.getEncodedInput(); // When "null == existingInputFrame", it'd be safe to say that the realtime "self.ctrl.getEncodedInput()" is for the requested "inputFrameId"
|
||||
prefabbedInputList[(joinIndex - 1)] = currSelfInput;
|
||||
while (self.recentInputCache.edFrameId <= inputFrameId) {
|
||||
while (self.recentInputCache.EdFrameId <= inputFrameId) {
|
||||
// Fill the gap
|
||||
const prefabbedInputFrameDownsync = window.pb.protos.InputFrameDownsync.create({
|
||||
inputFrameId: self.recentInputCache.edFrameId,
|
||||
inputList: prefabbedInputList,
|
||||
confirmedList: (1 << (joinIndex - 1))
|
||||
});
|
||||
// console.log(`Prefabbed inputFrameId=${prefabbedInputFrameDownsync.inputFrameId}`);
|
||||
self.recentInputCache.put(prefabbedInputFrameDownsync);
|
||||
const prefabbedInputFrameDownsync = gopkgs.NewInputFrameDownsync(self.recentInputCache.EdFrameId, prefabbedInputList.slice(), (1 << (joinIndex - 1)));
|
||||
// console.log(`Prefabbed inputFrameId=${prefabbedInputFrameDownsync.InputFrameId}`);
|
||||
self.recentInputCache.Put(prefabbedInputFrameDownsync);
|
||||
}
|
||||
|
||||
return [previousSelfInput, currSelfInput];
|
||||
@@ -184,18 +180,18 @@ cc.Class({
|
||||
const self = this;
|
||||
let inputFrameUpsyncBatch = [];
|
||||
let batchInputFrameIdSt = self.lastUpsyncInputFrameId + 1;
|
||||
if (batchInputFrameIdSt < self.recentInputCache.stFrameId) {
|
||||
if (batchInputFrameIdSt < self.recentInputCache.StFrameId) {
|
||||
// Upon resync, "self.lastUpsyncInputFrameId" might not have been updated properly.
|
||||
batchInputFrameIdSt = self.recentInputCache.stFrameId;
|
||||
batchInputFrameIdSt = self.recentInputCache.StFrameId;
|
||||
}
|
||||
for (let i = batchInputFrameIdSt; i <= latestLocalInputFrameId; ++i) {
|
||||
const inputFrameDownsync = self.recentInputCache.getByFrameId(i);
|
||||
const inputFrameDownsync = self.recentInputCache.GetByFrameId(i);
|
||||
if (null == inputFrameDownsync) {
|
||||
console.error(`sendInputFrameUpsyncBatch: recentInputCache is NOT having inputFrameId=i: latestLocalInputFrameId=${latestLocalInputFrameId}, recentInputCache=${self._stringifyRecentInputCache(false)}`);
|
||||
} else {
|
||||
const inputFrameUpsync = {
|
||||
inputFrameId: i,
|
||||
encoded: inputFrameDownsync.inputList[self.selfPlayerInfo.joinIndex - 1],
|
||||
encoded: inputFrameDownsync.InputList[self.selfPlayerInfo.JoinIndex - 1],
|
||||
};
|
||||
inputFrameUpsyncBatch.push(inputFrameUpsync);
|
||||
}
|
||||
@@ -204,15 +200,15 @@ cc.Class({
|
||||
// console.info(`inputFrameUpsyncBatch: ${JSON.stringify(inputFrameUpsyncBatch)}`);
|
||||
const reqData = window.pb.protos.WsReq.encode({
|
||||
msgId: Date.now(),
|
||||
playerId: self.selfPlayerInfo.id,
|
||||
playerId: self.selfPlayerInfo.Id,
|
||||
act: window.UPSYNC_MSG_ACT_PLAYER_CMD,
|
||||
joinIndex: self.selfPlayerInfo.joinIndex,
|
||||
joinIndex: self.selfPlayerInfo.JoinIndex,
|
||||
ackingInputFrameId: self.lastAllConfirmedInputFrameId,
|
||||
inputFrameUpsyncBatch: inputFrameUpsyncBatch,
|
||||
}).finish();
|
||||
window.sendSafely(reqData);
|
||||
self.lastUpsyncInputFrameId = latestLocalInputFrameId;
|
||||
if (self.lastUpsyncInputFrameId >= self.recentInputCache.edFrameId) {
|
||||
if (self.lastUpsyncInputFrameId >= self.recentInputCache.EdFrameId) {
|
||||
throw `noDelayInputFrameId=${self.lastUpsyncInputFrameId} == latestLocalInputFrameId=${latestLocalInputFrameId} seems not properly dumped #2: recentInputCache=${self._stringifyRecentInputCache(false)}`;
|
||||
}
|
||||
},
|
||||
@@ -305,7 +301,7 @@ cc.Class({
|
||||
self.recentRenderCache = new RingBuffer(self.renderCacheSize);
|
||||
|
||||
self.selfPlayerInfo = null; // This field is kept for distinguishing "self" and "others".
|
||||
self.recentInputCache = new RingBuffer((self.renderCacheSize >> 1) + 1);
|
||||
self.recentInputCache = gopkgs.NewRingBufferJs((self.renderCacheSize >> 1) + 1);
|
||||
|
||||
const spaceW = self.stageDiscreteW * self.stageTileW;
|
||||
const spaceH = self.stageDiscreteH * self.stageTileH;
|
||||
@@ -606,7 +602,7 @@ cc.Class({
|
||||
const shouldForceDumping1 = (window.MAGIC_ROOM_DOWNSYNC_FRAME_ID.BATTLE_START == rdf.Id);
|
||||
let shouldForceDumping2 = (rdf.Id >= self.renderFrameId + self.renderFrameIdLagTolerance);
|
||||
let shouldForceResync = pbRdf.shouldForceResync;
|
||||
const notSelfUnconfirmed = (0 == (pbRdf.backendUnconfirmedMask & (1 << (self.selfPlayerInfo.joinIndex - 1))));
|
||||
const notSelfUnconfirmed = (0 == (pbRdf.backendUnconfirmedMask & (1 << (self.selfPlayerInfo.JoinIndex - 1))));
|
||||
if (notSelfUnconfirmed) {
|
||||
shouldForceDumping2 = false;
|
||||
shouldForceResync = false;
|
||||
@@ -721,7 +717,7 @@ cc.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
onInputFrameDownsyncBatch(batch) {
|
||||
onInputFrameDownsyncBatch(batch /* []*pb.InputFrameDownsync */ ) {
|
||||
// TODO: find some kind of synchronization mechanism against "getOrPrefabInputFrameUpsync"!
|
||||
if (null == batch) {
|
||||
return;
|
||||
@@ -743,7 +739,7 @@ cc.Class({
|
||||
}
|
||||
// [WARNING] Take all "inputFrameDownsync" from backend as all-confirmed, it'll be later checked by "rollbackAndChase".
|
||||
self.lastAllConfirmedInputFrameId = inputFrameDownsyncId;
|
||||
const localInputFrame = self.recentInputCache.getByFrameId(inputFrameDownsyncId);
|
||||
const localInputFrame = self.recentInputCache.GetByFrameId(inputFrameDownsyncId);
|
||||
if (null != localInputFrame
|
||||
&&
|
||||
null == firstPredictedYetIncorrectInputFrameId
|
||||
@@ -753,8 +749,9 @@ cc.Class({
|
||||
firstPredictedYetIncorrectInputFrameId = inputFrameDownsyncId;
|
||||
}
|
||||
inputFrameDownsync.confirmedList = (1 << self.playerRichInfoDict.size) - 1;
|
||||
inputFrameDownsyncLocal = gopkgs.NewInputFrameDownsync(inputFrameDownsync.inputFrameId, inputFrameDownsync.inputList, inputFrameDownsync.confirmedList); // "battle.InputFrameDownsync" in "jsexport"
|
||||
//console.log(`Confirmed inputFrameId=${inputFrameDownsync.inputFrameId}`);
|
||||
const [ret, oldStFrameId, oldEdFrameId] = self.recentInputCache.setByFrameId(inputFrameDownsync, inputFrameDownsync.inputFrameId);
|
||||
const [ret, oldStFrameId, oldEdFrameId] = self.recentInputCache.SetByFrameId(inputFrameDownsync, inputFrameDownsync.inputFrameId);
|
||||
if (window.RING_BUFF_FAILED_TO_SET == ret) {
|
||||
throw `Failed to dump input cache (maybe recentInputCache too small)! inputFrameDownsync.inputFrameId=${inputFrameDownsync.inputFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}; recentRenderCache=${self._stringifyRecentRenderCache(false)}, recentInputCache=${self._stringifyRecentInputCache(false)}`;
|
||||
}
|
||||
@@ -829,7 +826,7 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
|
||||
const [wx, wy] = self.virtualGridToWorldPos(vx, vy);
|
||||
newPlayerNode.setPosition(wx, wy);
|
||||
playerScriptIns.mapNode = self.node;
|
||||
const colliderRadius = playerDownsyncInfo.colliderRadius || playerDownsyncInfo.ColliderRadius;
|
||||
const colliderRadius = playerDownsyncInfo.ColliderRadius;
|
||||
const halfColliderWidth = colliderRadius,
|
||||
halfColliderHeight = colliderRadius + colliderRadius; // avoid multiplying
|
||||
const colliderWidth = halfColliderWidth + halfColliderWidth,
|
||||
@@ -856,10 +853,6 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
|
||||
setLocalZOrder(newPlayerNode, 5);
|
||||
|
||||
newPlayerNode.active = true;
|
||||
playerDownsyncInfo.characterState = playerDownsyncInfo.CharacterState;
|
||||
playerDownsyncInfo.dirX = playerDownsyncInfo.DirX;
|
||||
playerDownsyncInfo.dirY = playerDownsyncInfo.DirY;
|
||||
playerDownsyncInfo.framesToRecover = playerDownsyncInfo.FrameToRecover;
|
||||
playerScriptIns.updateCharacterAnim(playerDownsyncInfo, null, true);
|
||||
|
||||
return [newPlayerNode, playerScriptIns];
|
||||
@@ -1063,10 +1056,6 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
const playerRichInfo = self.playerRichInfoArr[k];
|
||||
playerRichInfo.node.setPosition(wx, wy);
|
||||
playerRichInfo.scriptIns.updateSpeed(currPlayerDownsync.Speed);
|
||||
currPlayerDownsync.characterState = currPlayerDownsync.CharacterState;
|
||||
currPlayerDownsync.dirX = currPlayerDownsync.DirX;
|
||||
currPlayerDownsync.dirY = currPlayerDownsync.DirY;
|
||||
currPlayerDownsync.framesToRecover = currPlayerDownsync.FrameToRecover;
|
||||
playerRichInfo.scriptIns.updateCharacterAnim(currPlayerDownsync, prevRdfPlayer, false);
|
||||
}
|
||||
|
||||
@@ -1079,13 +1068,13 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
|
||||
getCachedInputFrameDownsyncWithPrediction(inputFrameId) {
|
||||
const self = this;
|
||||
const inputFrameDownsync = self.recentInputCache.getByFrameId(inputFrameId);
|
||||
const inputFrameDownsync = self.recentInputCache.GetByFrameId(inputFrameId); // "battle.InputFrameDownsync" in "jsexport"
|
||||
if (null != inputFrameDownsync && inputFrameId > self.lastAllConfirmedInputFrameId) {
|
||||
const lastAllConfirmedInputFrame = self.recentInputCache.getByFrameId(self.lastAllConfirmedInputFrameId);
|
||||
const lastAllConfirmedInputFrame = self.recentInputCache.GetByFrameId(self.lastAllConfirmedInputFrameId);
|
||||
if (null != lastAllConfirmedInputFrame) {
|
||||
for (let i = 0; i < inputFrameDownsync.inputList.length; ++i) {
|
||||
if (i == (self.selfPlayerInfo.joinIndex - 1)) continue;
|
||||
inputFrameDownsync.inputList[i] = (lastAllConfirmedInputFrame.inputList[i] & 15); // Don't predict attack input!
|
||||
for (let i = 0; i < inputFrameDownsync.InputList.length; ++i) {
|
||||
if (i == (self.selfPlayerInfo.JoinIndex - 1)) continue;
|
||||
inputFrameDownsync.InputList[i] = (lastAllConfirmedInputFrame.InputList[i] & 15); // Don't predict attack input!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1103,24 +1092,23 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
throw `Couldn't find renderFrame for i=${i} to rollback (are you using Firefox?), self.renderFrameId=${self.renderFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, might've been interruptted by onRoomDownsyncFrame`;
|
||||
}
|
||||
const j = self._convertToInputFrameId(i, self.inputDelayFrames);
|
||||
const delayedInputFrame = self.recentInputCache.getByFrameId(j); // Don't make prediction here, the inputFrameDownsyncs in recentInputCache was already predicted while prefabbing
|
||||
const delayedInputFrame = self.recentInputCache.GetByFrameId(j); // Don't make prediction here, the inputFrameDownsyncs in recentInputCache was already predicted while prefabbing
|
||||
if (null == delayedInputFrame) {
|
||||
// Shouldn't happen!
|
||||
throw `Failed to get cached delayedInputFrame for i=${i}, j=${j}, renderFrameId=${self.renderFrameId}, lastUpsyncInputFrameId=${self.lastUpsyncInputFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, chaserRenderFrameId=${self.chaserRenderFrameId}; recentRenderCache=${self._stringifyRecentRenderCache(false)}, recentInputCache=${self._stringifyRecentInputCache(false)}`;
|
||||
}
|
||||
|
||||
const jPrev = self._convertToInputFrameId(i - 1, self.inputDelayFrames);
|
||||
const delayedInputFrameForPrevRenderFrame = self.recentInputCache.getByFrameId(jPrev);
|
||||
if (self.frameDataLoggingEnabled) {
|
||||
const actuallyUsedInputClone = delayedInputFrame.inputList.slice();
|
||||
const actuallyUsedInputClone = delayedInputFrame.InputList.slice();
|
||||
const inputFrameDownsyncClone = {
|
||||
inputFrameId: delayedInputFrame.inputFrameId,
|
||||
inputFrameId: delayedInputFrame.InputFrameId,
|
||||
inputList: actuallyUsedInputClone,
|
||||
confirmedList: delayedInputFrame.confirmedList,
|
||||
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);
|
||||
const nextRdf = gopkgs.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs(self.recentInputCache, 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, self.playerOpPatternToSkillId);
|
||||
|
||||
if (true == isChasing) {
|
||||
// [WARNING] Move the cursor "self.chaserRenderFrameId" when "true == isChasing", keep in mind that "self.chaserRenderFrameId" is not monotonic!
|
||||
@@ -1140,7 +1128,7 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
const self = this;
|
||||
for (let k in playersArr) {
|
||||
const immediatePlayerInfo = playersArr[k];
|
||||
const playerId = immediatePlayerInfo.id || immediatePlayerInfo.Id;
|
||||
const playerId = immediatePlayerInfo.Id;
|
||||
if (self.playerRichInfoDict.has(playerId)) continue; // Skip already put keys
|
||||
self.playerRichInfoDict.set(playerId, immediatePlayerInfo);
|
||||
const joinIndex = immediatePlayerInfo.joinIndex || immediatePlayerInfo.JoinIndex;
|
||||
@@ -1153,9 +1141,9 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
scriptIns: nodeAndScriptIns[1],
|
||||
});
|
||||
|
||||
const selfPlayerId = self.selfPlayerInfo.id || self.selfPlayerInfo.Id;
|
||||
const selfPlayerId = self.selfPlayerInfo.Id;
|
||||
if (selfPlayerId == playerId) {
|
||||
self.selfPlayerInfo.joinIndex = immediatePlayerInfo.joinIndex || immediatePlayerInfo.JoinIndex;
|
||||
self.selfPlayerInfo.JoinIndex = immediatePlayerInfo.JoinIndex;
|
||||
nodeAndScriptIns[1].showArrowTipNode();
|
||||
}
|
||||
}
|
||||
@@ -1169,13 +1157,13 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
const self = this;
|
||||
if (true == usefullOutput) {
|
||||
let s = [];
|
||||
for (let i = self.recentInputCache.stFrameId; i < self.recentInputCache.edFrameId; ++i) {
|
||||
s.push(JSON.stringify(self.recentInputCache.getByFrameId(i)));
|
||||
for (let i = self.recentInputCache.StFrameId; i < self.recentInputCache.EdFrameId; ++i) {
|
||||
s.push(JSON.stringify(self.recentInputCache.GetByFrameId(i)));
|
||||
}
|
||||
|
||||
return s.join('\n');
|
||||
}
|
||||
return `[stInputFrameId=${self.recentInputCache.stFrameId}, edInputFrameId=${self.recentInputCache.edFrameId})`;
|
||||
return `[stInputFrameId=${self.recentInputCache.StFrameId}, edInputFrameId=${self.recentInputCache.EdFrameId})`;
|
||||
},
|
||||
|
||||
_stringifyGopkgRoomDownsyncFrame(rdf) {
|
||||
|
@@ -42,27 +42,11 @@ cc.Class({
|
||||
|
||||
self.worldToVirtualGridRatio = 1000;
|
||||
self.virtualGridToWorldRatio = 1.0 / self.worldToVirtualGridRatio;
|
||||
self.meleeSkillConfig = {
|
||||
1: {
|
||||
// for offender
|
||||
startupFrames: 10,
|
||||
activeFrames: 20,
|
||||
recoveryFrames: 34, // usually but not always "startupFrames+activeFrames", I hereby set it to be 1 frame more than the actual animation to avoid critical transition, i.e. when the animation is 1 frame from ending but "rdfPlayer.framesToRecover" is already counted 0 and the player triggers an other same attack, making an effective bullet trigger but no animation is played due to same animName is still playing
|
||||
recoveryFramesOnBlock: 34,
|
||||
recoveryFramesOnHit: 34,
|
||||
hitboxOffset: 12.0, // should be about the radius of the PlayerCollider
|
||||
// for defender
|
||||
hitStunFrames: 18,
|
||||
blockStunFrames: 9,
|
||||
pushback: 8.0,
|
||||
releaseTriggerType: 1, // 1: rising-edge, 2: falling-edge
|
||||
damage: 5,
|
||||
hitboxSizeX: 24.0,
|
||||
hitboxSizeY: 32.0,
|
||||
selfMoveforwardX: 0,
|
||||
selfMoveforwardY: 0,
|
||||
}
|
||||
};
|
||||
const opJoinIndexPrefix1 = (1 << 8);
|
||||
const opJoinIndexPrefix2 = (2 << 8);
|
||||
self.playerOpPatternToSkillId = {};
|
||||
self.playerOpPatternToSkillId[opJoinIndexPrefix1 + 0] = 1;
|
||||
self.playerOpPatternToSkillId[opJoinIndexPrefix2 + 0] = 1;
|
||||
|
||||
/*
|
||||
[WARNING] As when a character is standing on a barrier, if not carefully curated there MIGHT BE a bouncing sequence of "[(inAir -> dropIntoBarrier ->), (notInAir -> pushedOutOfBarrier ->)], [(inAir -> ..."
|
||||
@@ -195,11 +179,8 @@ cc.Class({
|
||||
});
|
||||
|
||||
self.selfPlayerInfo = {
|
||||
Id: 11,
|
||||
JoinIndex: 2,
|
||||
// For compatibility
|
||||
id: 11,
|
||||
joinIndex: 2,
|
||||
Id: 10,
|
||||
JoinIndex: 1,
|
||||
};
|
||||
self.onRoomDownsyncFrame(startRdf);
|
||||
|
||||
|
Reference in New Issue
Block a user