Private
Public Access
1
0

fix game
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 7m29s

This commit is contained in:
Sebastian Unterschütz
2026-03-22 10:14:20 +01:00
parent 7a86a8596e
commit 1dc5005cf3
2 changed files with 92 additions and 28 deletions

View File

@@ -100,6 +100,17 @@ type Game struct {
lastRecvSeq uint32 // Letzte empfangene Server-Sequenznummer (für Out-of-Order-Erkennung)
lastInputTime time.Time // Letzter Input-Send (für 20 TPS Throttling)
// Interpolation (60fps Draw ↔ 20hz Physics)
prevPredictedX float64 // Position vor letztem Physics-Step (für Interpolation)
prevPredictedY float64
lastPhysicsTime time.Time // Zeitpunkt des letzten Physics-Steps
// Jump Buffer: Sprung kurz vor Landung speichern → löst beim Aufkommen aus
jumpBufferFrames int // Countdown in Physics-Frames (bei 0: kein Buffer)
// Coyote Time: Sprung kurz nach Abgang von Kante erlauben
coyoteFrames int // Countdown in Physics-Frames
// Smooth Correction (Debug-Info)
correctionX float64 // Letzte Korrektur-Magnitude X
correctionY float64 // Letzte Korrektur-Magnitude Y
@@ -176,6 +187,9 @@ func NewGame() *Game {
fpsSampleTime: time.Now(),
lastUpdateTime: time.Now(),
// Interpolation
lastPhysicsTime: time.Now(),
joyBaseX: 150, joyBaseY: ScreenHeight - 150,
joyStickX: 150, joyStickY: ScreenHeight - 150,
}