input desynchro, rollback to instant handle.

This commit is contained in:
LuckyLaszlo
2022-11-30 04:00:55 +01:00
parent 01023d67b5
commit 68e529fec2
14 changed files with 123 additions and 66 deletions

View File

@@ -1,4 +1,5 @@
import * as c from "./constants.js";
import { gc, clientInfo } from "./global.js";
let actual_time: number = Date.now();
@@ -7,9 +8,12 @@ let delta_time: number;
function gameLoop()
{
last_time = actual_time;
/* last_time = actual_time;
actual_time = Date.now();
delta_time = (actual_time - last_time) / 1000;
delta_time = (actual_time - last_time) / 1000; */
delta_time = c.fixedDeltaTime;
// console.log(`delta_gameLoop: ${delta_time}`);
// interpolation
// console.log(`dir.y: ${clientInfo.opponent.dir.y}, pos.y: ${clientInfo.opponent.pos.y}, opponentNextPos.y: ${clientInfo.opponentNextPos.y}`);