diff --git a/cmd/client/game_render.go b/cmd/client/game_render.go index db4c98d..e3a1089 100644 --- a/cmd/client/game_render.go +++ b/cmd/client/game_render.go @@ -84,8 +84,8 @@ func (g *Game) UpdateGame() { // Lokale Physik sofort anwenden (Prediction) g.ApplyInput(input) - // Sanfte Korrektur anwenden (schnellere Interpolation für weniger Ruckeln) - const smoothingFactor = 0.4 // Erhöht von 0.2 auf 0.4 + // Sanfte Korrektur anwenden (langsamer bei 20 TPS für weniger Jitter) + const smoothingFactor = 0.15 // Reduziert für 20 TPS (war 0.4 bei 60 TPS) if g.correctionX != 0 || g.correctionY != 0 { g.predictedX += g.correctionX * smoothingFactor g.predictedY += g.correctionY * smoothingFactor @@ -93,8 +93,8 @@ func (g *Game) UpdateGame() { g.correctionX *= (1.0 - smoothingFactor) g.correctionY *= (1.0 - smoothingFactor) - // Korrektur beenden wenn sehr klein (kleinerer Threshold) - if g.correctionX*g.correctionX+g.correctionY*g.correctionY < 0.25 { + // Korrektur beenden wenn sehr klein + if g.correctionX*g.correctionX+g.correctionY*g.correctionY < 1.0 { g.correctionX = 0 g.correctionY = 0 } diff --git a/cmd/client/prediction.go b/cmd/client/prediction.go index 3d0c4cb..7d15681 100644 --- a/cmd/client/prediction.go +++ b/cmd/client/prediction.go @@ -38,7 +38,7 @@ func (g *Game) ApplyInput(input InputState) { // Sprung if input.Jump && g.predictedGround { - g.predictedVY = -42.0 // war -14.0 bei 60 TPS (-14.0 * 3) + g.predictedVY = -30.0 // Reduziert für besseres Spielgefühl bei 20 TPS g.predictedGround = false } @@ -114,8 +114,9 @@ func (g *Game) ReconcileWithServer(serverState game.PlayerState) { diffX := replayX - g.predictedX diffY := replayY - g.predictedY - // Nur korrigieren wenn Differenz signifikant (reduzierter Threshold für weniger Ruckeln) - const threshold = 2.0 // Reduziert von 5.0 auf 2.0 + // Nur korrigieren wenn Differenz signifikant + // Bei 20 TPS größerer Threshold wegen größerer normaler Abweichungen + const threshold = 5.0 // Erhöht für 20 TPS (war 2.0) if diffX*diffX+diffY*diffY > threshold*threshold { // Speichere Korrektur für sanfte Interpolation g.correctionX = diffX diff --git a/cmd/client/web/game.js b/cmd/client/web/game.js index ba4d6e9..038d271 100644 --- a/cmd/client/web/game.js +++ b/cmd/client/web/game.js @@ -234,7 +234,7 @@ window.onWasmReady = function() { }; // Cache Management - Version wird bei jedem Build aktualisiert -const CACHE_VERSION = 1767637179526; // Wird durch Build-Prozess ersetzt +const CACHE_VERSION = 1767639190355; // Wird durch Build-Prozess ersetzt // Fetch mit Cache-Busting async function fetchWithCache(url) { diff --git a/cmd/client/web/index.html b/cmd/client/web/index.html index 2f2d503..9b73def 100644 --- a/cmd/client/web/index.html +++ b/cmd/client/web/index.html @@ -291,7 +291,7 @@ diff --git a/cmd/client/web/main.wasm b/cmd/client/web/main.wasm index e3e9e3e..868162e 100755 Binary files a/cmd/client/web/main.wasm and b/cmd/client/web/main.wasm differ diff --git a/pkg/server/room.go b/pkg/server/room.go index aa62dcb..d585bb2 100644 --- a/pkg/server/room.go +++ b/pkg/server/room.go @@ -261,12 +261,12 @@ func (r *Room) HandleInput(input game.ClientInput) { switch input.Type { case "JUMP": if p.OnGround { - p.VY = -42.0 // war -14.0 bei 60 TPS (-14.0 * 3) + p.VY = -30.0 // Reduziert für besseres Spielgefühl bei 20 TPS p.OnGround = false p.DoubleJumpUsed = false // Reset double jump on ground jump } else if p.HasDoubleJump && !p.DoubleJumpUsed { // Double Jump in der Luft - p.VY = -42.0 // war -14.0 bei 60 TPS (-14.0 * 3) + p.VY = -30.0 // Reduziert für besseres Spielgefühl bei 20 TPS p.DoubleJumpUsed = true log.Printf("⚡ %s verwendet Double Jump!", p.Name) }