Private
Public Access
1
0

Adjust physics constants for better 20 TPS gameplay feel, refine smoothing and correction thresholds, and update cache-busting version for client assets.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m15s

This commit is contained in:
Sebastian Unterschütz
2026-01-05 19:54:07 +01:00
parent 0ae6c58eb9
commit dc5136ca21
6 changed files with 12 additions and 11 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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) {

View File

@@ -291,7 +291,7 @@
<!-- WASM Execution -->
<script>
// Cache-Busting für JavaScript-Dateien (wird beim Build aktualisiert)
const BUILD_VERSION = 1767637179526;
const BUILD_VERSION = 1767639190355;
document.write('<script src="wasm_exec.js?v=' + BUILD_VERSION + '"><\/script>');
document.write('<script src="game.js?v=' + BUILD_VERSION + '"><\/script>');
</script>

Binary file not shown.

View File

@@ -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)
}