mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
move sync??
This commit is contained in:
parent
015588feb0
commit
43181b687c
3 changed files with 7 additions and 3 deletions
|
|
@ -1725,6 +1725,7 @@ class Marble extends GameObject {
|
|||
var moveId = 65535;
|
||||
if (!this.controllable && this.connection != null && Net.isHost) {
|
||||
var nextMove = this.connection.moveManager.getNextMove();
|
||||
// trace('Moves left: ${@:privateAccess this.connection.moveManager.queuedMoves.length}');
|
||||
if (nextMove == null) {
|
||||
var axis = getMarbleAxis()[1];
|
||||
var innerMove = new Move();
|
||||
|
|
|
|||
|
|
@ -1058,7 +1058,7 @@ class MarbleWorld extends Scheduler {
|
|||
var ackLag = @:privateAccess Net.clientConnection.moveManager.queuedMoves.length;
|
||||
var mvStored = null;
|
||||
if (!lastMoves.ourMoveApplied)
|
||||
mvStored = Net.clientConnection.moveManager.acknowledgeMove(ourLastMove.move.id);
|
||||
mvStored = Net.clientConnection.moveManager.acknowledgeMove(ourLastMove.move.id, timeState);
|
||||
else
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,9 @@ class MoveManager {
|
|||
var nextMoveId:Int;
|
||||
var lastMove:NetMove;
|
||||
var lastAckMoveId:Int = -1;
|
||||
var ackRTT:Int = -1;
|
||||
|
||||
static var maxMoves = 45;
|
||||
var maxMoves = 45;
|
||||
|
||||
public function new(connection:ClientConnection) {
|
||||
queuedMoves = [];
|
||||
|
|
@ -153,7 +154,7 @@ class MoveManager {
|
|||
}
|
||||
}
|
||||
|
||||
public function acknowledgeMove(m:Int) {
|
||||
public function acknowledgeMove(m:Int, timeState:TimeState) {
|
||||
if (m == 65535 || m == -1)
|
||||
return null;
|
||||
if (m <= lastAckMoveId)
|
||||
|
|
@ -168,6 +169,8 @@ class MoveManager {
|
|||
if (m == queuedMoves[0].id) {
|
||||
delta = queuedMoves[0].id - lastAckMoveId;
|
||||
mv = queuedMoves.shift();
|
||||
ackRTT = timeState.ticks - mv.timeState.ticks;
|
||||
maxMoves = Std.int(ackRTT * 1.5);
|
||||
}
|
||||
lastAckMoveId = m;
|
||||
return mv;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue