mirror of
https://github.com/thilo-behnke/wasm-pong.git
synced 2026-07-11 02:29:25 +00:00
still duplicated ticks?
This commit is contained in:
@@ -7,10 +7,18 @@
|
||||
|
||||
let frame: number;
|
||||
|
||||
let lastTick;
|
||||
|
||||
$: if (networkTickEvents && $networkTickEvents.hasNext) {
|
||||
const tick = networkTickEvents.next() as HostSessionSnapshot;
|
||||
if (tick != null) {
|
||||
gameField.update(tick.objects, tick.state);
|
||||
if (lastTick && lastTick.ts >= tick.ts) {
|
||||
// TODO: How is this possible?
|
||||
console.warn(`!!!! Duplicated Tick ${tick.ts} (vs ${lastTick.ts}) !!!!`)
|
||||
} else {
|
||||
gameField.update(tick.objects, tick.state);
|
||||
lastTick = tick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user