diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-29 12:05:02 -0600 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-29 12:05:02 -0600 |
commit | fd1bb1cca9521348ae2849ef30be09264503681e (patch) | |
tree | 6859c24c53fdd2a83ed0a92ee10272aa70b6c55d /engine/entities | |
parent | 8a4ab8d79b5ce1dabb431168398b5d5111fe326c (diff) | |
download | jumpstorm-fd1bb1cca9521348ae2849ef30be09264503681e.tar.gz jumpstorm-fd1bb1cca9521348ae2849ef30be09264503681e.zip |
don't update controllable entities on the client
Diffstat (limited to 'engine/entities')
-rw-r--r-- | engine/entities/Player.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/engine/entities/Player.ts b/engine/entities/Player.ts index 4d91c6f..a7a41f8 100644 --- a/engine/entities/Player.ts +++ b/engine/entities/Player.ts @@ -82,7 +82,7 @@ export class Player extends Entity { } public setFrom(args: Record<string, any>) { - const { control, velocity, forces, boundingBox } = args; + const { control, forces, velocity, boundingBox } = args; let center = boundingBox.center; @@ -92,7 +92,8 @@ export class Player extends Entity { const distance = Math.sqrt( Math.pow(center.y - myCenter.y, 2) + Math.pow(center.x - myCenter.x, 2) ); - if (distance < 30) center = myCenter; + const clientServerPredictionCenterThreshold = 30; + if (distance < clientServerPredictionCenterThreshold) center = myCenter; [ Object.assign(new Control(control.controllableBy), control), |