mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 11:48:56 +00:00
Fixed non-integer barrier boundaries.
This commit is contained in:
parent
847607f3e6
commit
9eb6ad26ef
@ -1175,13 +1175,13 @@ func (pR *Room) markConfirmationIfApplicable(inputFrameUpsyncBatch []*InputFrame
|
|||||||
|
|
||||||
if 0 < newAllConfirmedCount {
|
if 0 < newAllConfirmedCount {
|
||||||
/*
|
/*
|
||||||
[WARNING]
|
[WARNING]
|
||||||
|
|
||||||
If "pR.InputsBufferLock" was previously held by "doBattleMainLoopPerTickBackendDynamicsWithProperLocking", then "snapshotStFrameId" would be just (LastAllConfirmedInputFrameId - newAllConfirmedCount).
|
If "pR.InputsBufferLock" was previously held by "doBattleMainLoopPerTickBackendDynamicsWithProperLocking", then "snapshotStFrameId" would be just (LastAllConfirmedInputFrameId - newAllConfirmedCount).
|
||||||
|
|
||||||
However if "pR.InputsBufferLock" was previously held by another "OnBattleCmdReceived", the proper value for "snapshotStFrameId" might be smaller than (pR.LastAllConfirmedInputFrameId - newAllConfirmedCount) -- but why? Especially when we've already wrapped this whole function in "InputsBufferLock", the order of "markConfirmationIfApplicable" generated snapshots is preserved for sending, isn't (LastAllConfirmedInputFrameId - newAllConfirmedCount) good enough here?
|
However if "pR.InputsBufferLock" was previously held by another "OnBattleCmdReceived", the proper value for "snapshotStFrameId" might be smaller than (pR.LastAllConfirmedInputFrameId - newAllConfirmedCount) -- but why? Especially when we've already wrapped this whole function in "InputsBufferLock", the order of "markConfirmationIfApplicable" generated snapshots is preserved for sending, isn't (LastAllConfirmedInputFrameId - newAllConfirmedCount) good enough here?
|
||||||
|
|
||||||
Unfortunately no, for a reconnected player to get recovered asap (of course with BackendDynamicsEnabled), we put a check of READDED_BATTLE_COLLIDER_ACKED in "downsyncToSinglePlayer" -- which could be called right after "markConfirmationIfApplicable" yet without going through "forceConfirmationIfApplicable" -- and if a READDED_BATTLE_COLLIDER_ACKED player is found there we need a proper "(refRenderFrameId, snapshotStFrameId)" pair for that player!
|
Unfortunately no, for a reconnected player to get recovered asap (of course with BackendDynamicsEnabled), we put a check of READDED_BATTLE_COLLIDER_ACKED in "downsyncToSinglePlayer" -- which could be called right after "markConfirmationIfApplicable" yet without going through "forceConfirmationIfApplicable" -- and if a READDED_BATTLE_COLLIDER_ACKED player is found there we need a proper "(refRenderFrameId, snapshotStFrameId)" pair for that player!
|
||||||
*/
|
*/
|
||||||
snapshotStFrameId := (pR.LastAllConfirmedInputFrameId - newAllConfirmedCount)
|
snapshotStFrameId := (pR.LastAllConfirmedInputFrameId - newAllConfirmedCount)
|
||||||
refRenderFrameIdIfNeeded := pR.CurDynamicsRenderFrameId - 1
|
refRenderFrameIdIfNeeded := pR.CurDynamicsRenderFrameId - 1
|
||||||
@ -1621,9 +1621,9 @@ func (pR *Room) applyInputFrameDownsyncDynamicsOnSingleRenderFrame(delayedInputF
|
|||||||
|
|
||||||
if 1 == thatPlayerInNextFrame.JoinIndex {
|
if 1 == thatPlayerInNextFrame.JoinIndex {
|
||||||
if currPlayerDownsync.InAir && !thatPlayerInNextFrame.InAir {
|
if currPlayerDownsync.InAir && !thatPlayerInNextFrame.InAir {
|
||||||
//Logger.Warn(fmt.Sprintf("playerId=%d, joinIndex=%d fallStopping#2:\n{nextRenderFrame.id: %d, nextVirtualX: %d, nextVirtualY: %d, nextVelX: %d, nextVelY: %d}\n\tcalculated from <- playerColliderPos=%v, effPushback={%.3f, %.3f}", playerId, joinIndex, currRenderFrame.Id+1, thatPlayerInNextFrame.VirtualGridX, thatPlayerInNextFrame.VirtualGridY, thatPlayerInNextFrame.VelX, thatPlayerInNextFrame.VelY, RectCenterStr(playerCollider, halfColliderWidth, halfColliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY), effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y))
|
Logger.Warn(fmt.Sprintf("playerId=%d, joinIndex=%d fallStopping#2:\n{nextRenderFrame.id: %d, nextVirtualX: %d, nextVirtualY: %d, nextVelX: %d, nextVelY: %d}\n\tcalculated from <- playerColliderPos=%v, effPushback={%.3f, %.3f}", playerId, joinIndex, currRenderFrame.Id+1, thatPlayerInNextFrame.VirtualGridX, thatPlayerInNextFrame.VirtualGridY, thatPlayerInNextFrame.VelX, thatPlayerInNextFrame.VelY, RectCenterStr(playerCollider, halfColliderWidth, halfColliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY), effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y))
|
||||||
} else if !currPlayerDownsync.InAir && thatPlayerInNextFrame.InAir {
|
} else if !currPlayerDownsync.InAir && thatPlayerInNextFrame.InAir {
|
||||||
//Logger.Warn(fmt.Sprintf("playerId=%d, joinIndex=%d took off:\n{nextRenderFrame.id: %d, nextVirtualX: %d, nextVirtualY: %d, nextVelX: %d, nextVelY: %d}\n\tcalculated from <- playerColliderPos=%v, effPushback={%.3f, %.3f}", playerId, joinIndex, currRenderFrame.Id+1, thatPlayerInNextFrame.VirtualGridX, thatPlayerInNextFrame.VirtualGridY, thatPlayerInNextFrame.VelX, thatPlayerInNextFrame.VelY, RectCenterStr(playerCollider, halfColliderWidth, halfColliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY), effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y))
|
Logger.Warn(fmt.Sprintf("playerId=%d, joinIndex=%d took off:\n{nextRenderFrame.id: %d, nextVirtualX: %d, nextVirtualY: %d, nextVelX: %d, nextVelY: %d}\n\tcalculated from <- playerColliderPos=%v, effPushback={%.3f, %.3f}", playerId, joinIndex, currRenderFrame.Id+1, thatPlayerInNextFrame.VirtualGridX, thatPlayerInNextFrame.VirtualGridY, thatPlayerInNextFrame.VelX, thatPlayerInNextFrame.VelY, RectCenterStr(playerCollider, halfColliderWidth, halfColliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY), effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y))
|
||||||
} else if thatPlayerInNextFrame.InAir && (0 != thatPlayerInNextFrame.VelY) {
|
} else if thatPlayerInNextFrame.InAir && (0 != thatPlayerInNextFrame.VelY) {
|
||||||
//Logger.Info(fmt.Sprintf("playerId=%d, joinIndex=%d inAir trajectory:\n{nextRenderFrame.id: %d, nextVirtualX: %d, nextVirtualY: %d, nextVelX: %d, nextVelY: %d}\n\tcalculated from <- playerColliderPos=%v, effPushback={%.3f, %.3f}", playerId, joinIndex, currRenderFrame.Id+1, thatPlayerInNextFrame.VirtualGridX, thatPlayerInNextFrame.VirtualGridY, thatPlayerInNextFrame.VelX, thatPlayerInNextFrame.VelY, RectCenterStr(playerCollider, halfColliderWidth, halfColliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY), effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y))
|
//Logger.Info(fmt.Sprintf("playerId=%d, joinIndex=%d inAir trajectory:\n{nextRenderFrame.id: %d, nextVirtualX: %d, nextVirtualY: %d, nextVelX: %d, nextVelY: %d}\n\tcalculated from <- playerColliderPos=%v, effPushback={%.3f, %.3f}", playerId, joinIndex, currRenderFrame.Id+1, thatPlayerInNextFrame.VirtualGridX, thatPlayerInNextFrame.VirtualGridY, thatPlayerInNextFrame.VelX, thatPlayerInNextFrame.VelY, RectCenterStr(playerCollider, halfColliderWidth, halfColliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, pR.collisionSpaceOffsetX, pR.collisionSpaceOffsetY), effPushbacks[joinIndex-1].X, effPushbacks[joinIndex-1].Y))
|
||||||
}
|
}
|
||||||
|
@ -377,10 +377,6 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, singleObjInTmxFile := range objGroup.Objects {
|
for _, singleObjInTmxFile := range objGroup.Objects {
|
||||||
if nil == singleObjInTmxFile.Properties.Property || "boundary_type" != singleObjInTmxFile.Properties.Property[0].Name || "barrier" != singleObjInTmxFile.Properties.Property[0].Value {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if nil == singleObjInTmxFile.Polyline {
|
if nil == singleObjInTmxFile.Polyline {
|
||||||
pts := make([]*Vec2D, 4)
|
pts := make([]*Vec2D, 4)
|
||||||
s := make([]string, 0)
|
s := make([]string, 0)
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup id="1" name="PlayerStartingPos">
|
<objectgroup id="1" name="PlayerStartingPos">
|
||||||
<object id="135" x="1290" y="1401.33">
|
<object id="135" x="999" y="1608">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="137" x="1648.33" y="1430.67">
|
<object id="137" x="1164" y="1548">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="55" x="735" y="1552" width="113.5" height="15.5">
|
<object id="55" x="736" y="1552" width="112" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
@ -80,12 +80,12 @@
|
|||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="73" x="783.75" y="1567.5" width="96.25" height="15.5">
|
<object id="73" x="784" y="1568" width="96" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="74" x="815.75" y="1583.75" width="96.25" height="15.5">
|
<object id="74" x="816" y="1584" width="96" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -440,7 +440,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
216.05530045313827,
|
216.50635094610968,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -460,7 +460,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
216.05530045313827,
|
216.50635094610968,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -116,31 +116,28 @@ TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNod
|
|||||||
const allObjectGroups = tiledMapIns.getObjectGroups();
|
const allObjectGroups = tiledMapIns.getObjectGroups();
|
||||||
for (let i = 0; i < allObjectGroups.length; ++i) {
|
for (let i = 0; i < allObjectGroups.length; ++i) {
|
||||||
var objectGroup = allObjectGroups[i];
|
var objectGroup = allObjectGroups[i];
|
||||||
if ("PlayerStartingPos" == objectGroup.getGroupName()) {
|
|
||||||
var allObjects = objectGroup.getObjects();
|
|
||||||
for (let j = 0; j < allObjects.length; ++j) {
|
|
||||||
const cccMaskedX = allObjects[j].x,
|
|
||||||
cccMaskedY = allObjects[j].y;
|
|
||||||
const origX = cccMaskedX,
|
|
||||||
origY = withTiledMapNode.getContentSize().height - cccMaskedY; // FIXME: I don't know why CocosCreator did this, it's stupid and MIGHT NOT WORK IN ISOMETRIC orientation!
|
|
||||||
let wpos = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, cc.v2(origX, origY));
|
|
||||||
toRet.playerStartingPositions.push(wpos);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ("barrier_and_shelter" != objectGroup.getProperty("type")) continue;
|
|
||||||
var allObjects = objectGroup.getObjects();
|
var allObjects = objectGroup.getObjects();
|
||||||
for (let j = 0; j < allObjects.length; ++j) {
|
switch (objectGroup.getGroupName()) {
|
||||||
let object = allObjects[j];
|
case "PlayerStartingPos":
|
||||||
let gid = object.gid;
|
for (let j = 0; j < allObjects.length; ++j) {
|
||||||
if (0 < gid) {
|
const cccMaskedX = allObjects[j].x,
|
||||||
continue;
|
cccMaskedY = allObjects[j].y;
|
||||||
}
|
const origX = cccMaskedX,
|
||||||
const boundaryType = object.boundary_type;
|
origY = withTiledMapNode.getContentSize().height - cccMaskedY; // FIXME: I don't know why CocosCreator did this, it's stupid and MIGHT NOT WORK IN ISOMETRIC orientation!
|
||||||
let toPushBarrier = [];
|
let wpos = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, cc.v2(origX, origY));
|
||||||
toPushBarrier.boundaryType = boundaryType;
|
toRet.playerStartingPositions.push(wpos);
|
||||||
switch (boundaryType) {
|
}
|
||||||
case "barrier":
|
break;
|
||||||
|
case "Barrier":
|
||||||
|
for (let j = 0; j < allObjects.length; ++j) {
|
||||||
|
let object = allObjects[j];
|
||||||
|
let gid = object.gid;
|
||||||
|
if (0 < gid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const boundaryType = object.boundary_type;
|
||||||
|
let toPushBarrier = [];
|
||||||
|
toPushBarrier.boundaryType = boundaryType;
|
||||||
let polylinePoints = object.polylinePoints;
|
let polylinePoints = object.polylinePoints;
|
||||||
if (null == polylinePoints) {
|
if (null == polylinePoints) {
|
||||||
polylinePoints = [{
|
polylinePoints = [{
|
||||||
@ -163,10 +160,8 @@ TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNod
|
|||||||
}
|
}
|
||||||
toPushBarrier.anchor = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset); // DON'T use "(object.x, object.y)" which are wrong/meaningless!
|
toPushBarrier.anchor = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset); // DON'T use "(object.x, object.y)" which are wrong/meaningless!
|
||||||
toRet.barriers.push(toPushBarrier);
|
toRet.barriers.push(toPushBarrier);
|
||||||
break;
|
}
|
||||||
default:
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user