Adjust physics constants and movement logic for 20 TPS, scale velocities and gravity by a factor of 3, and update cache-busting version for client assets.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m0s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m0s
This commit is contained in:
@@ -21,7 +21,8 @@ func (g *Game) ApplyInput(input InputState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Geschwindigkeit skaliert mit Joystick-Intensität
|
// Geschwindigkeit skaliert mit Joystick-Intensität
|
||||||
speed := config.RunSpeed + (moveX * 4.0)
|
// war 4.0 bei 60 TPS (4.0 * 3 = 12.0)
|
||||||
|
speed := config.RunSpeed + (moveX * 12.0)
|
||||||
g.predictedX += speed
|
g.predictedX += speed
|
||||||
|
|
||||||
// Gravitation
|
// Gravitation
|
||||||
@@ -32,12 +33,12 @@ func (g *Game) ApplyInput(input InputState) {
|
|||||||
|
|
||||||
// Fast Fall
|
// Fast Fall
|
||||||
if input.Down {
|
if input.Down {
|
||||||
g.predictedVY = 15.0
|
g.predictedVY = 45.0 // war 15.0 bei 60 TPS (15.0 * 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sprung
|
// Sprung
|
||||||
if input.Jump && g.predictedGround {
|
if input.Jump && g.predictedGround {
|
||||||
g.predictedVY = -14.0
|
g.predictedVY = -42.0 // war -14.0 bei 60 TPS (-14.0 * 3)
|
||||||
g.predictedGround = false
|
g.predictedGround = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ window.onWasmReady = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cache Management - Version wird bei jedem Build aktualisiert
|
// Cache Management - Version wird bei jedem Build aktualisiert
|
||||||
const CACHE_VERSION = 1767636391983; // Wird durch Build-Prozess ersetzt
|
const CACHE_VERSION = 1767637179526; // Wird durch Build-Prozess ersetzt
|
||||||
|
|
||||||
// Fetch mit Cache-Busting
|
// Fetch mit Cache-Busting
|
||||||
async function fetchWithCache(url) {
|
async function fetchWithCache(url) {
|
||||||
|
|||||||
@@ -291,7 +291,7 @@
|
|||||||
<!-- WASM Execution -->
|
<!-- WASM Execution -->
|
||||||
<script>
|
<script>
|
||||||
// Cache-Busting für JavaScript-Dateien (wird beim Build aktualisiert)
|
// Cache-Busting für JavaScript-Dateien (wird beim Build aktualisiert)
|
||||||
const BUILD_VERSION = 1767636391983;
|
const BUILD_VERSION = 1767637179526;
|
||||||
document.write('<script src="wasm_exec.js?v=' + BUILD_VERSION + '"><\/script>');
|
document.write('<script src="wasm_exec.js?v=' + BUILD_VERSION + '"><\/script>');
|
||||||
document.write('<script src="game.js?v=' + BUILD_VERSION + '"><\/script>');
|
document.write('<script src="game.js?v=' + BUILD_VERSION + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Binary file not shown.
@@ -8,15 +8,17 @@ const (
|
|||||||
AssetPath = "./cmd/client/web/assets/assets.json"
|
AssetPath = "./cmd/client/web/assets/assets.json"
|
||||||
ChunkDir = "./cmd/client/web/assets/chunks"
|
ChunkDir = "./cmd/client/web/assets/chunks"
|
||||||
|
|
||||||
// Physics
|
// Physics (angepasst für 20 TPS statt 60 TPS)
|
||||||
Gravity = 0.5
|
// Bei 20 TPS ist jeder Tick 3x länger (50ms statt 16.67ms)
|
||||||
MaxFall = 15.0
|
// Geschwindigkeiten müssen mit 3 multipliziert werden
|
||||||
|
Gravity = 1.5 // war 0.5 bei 60 TPS
|
||||||
|
MaxFall = 45.0 // war 15.0 bei 60 TPS
|
||||||
TileSize = 64
|
TileSize = 64
|
||||||
|
|
||||||
// Gameplay
|
// Gameplay
|
||||||
RunSpeed = 7.0
|
RunSpeed = 21.0 // war 7.0 bei 60 TPS (7.0 * 3)
|
||||||
StartTime = 5 // Sekunden Countdown
|
StartTime = 5 // Sekunden Countdown
|
||||||
TickRate = time.Millisecond * 16 // ~60 FPS
|
TickRate = time.Millisecond * 50 // 20 TPS (war 16ms für 60 TPS)
|
||||||
|
|
||||||
// NATS Subjects Templates
|
// NATS Subjects Templates
|
||||||
SubjectInput = "game.room.%s.input"
|
SubjectInput = "game.room.%s.input"
|
||||||
|
|||||||
@@ -261,17 +261,17 @@ func (r *Room) HandleInput(input game.ClientInput) {
|
|||||||
switch input.Type {
|
switch input.Type {
|
||||||
case "JUMP":
|
case "JUMP":
|
||||||
if p.OnGround {
|
if p.OnGround {
|
||||||
p.VY = -14.0
|
p.VY = -42.0 // war -14.0 bei 60 TPS (-14.0 * 3)
|
||||||
p.OnGround = false
|
p.OnGround = false
|
||||||
p.DoubleJumpUsed = false // Reset double jump on ground jump
|
p.DoubleJumpUsed = false // Reset double jump on ground jump
|
||||||
} else if p.HasDoubleJump && !p.DoubleJumpUsed {
|
} else if p.HasDoubleJump && !p.DoubleJumpUsed {
|
||||||
// Double Jump in der Luft
|
// Double Jump in der Luft
|
||||||
p.VY = -14.0
|
p.VY = -42.0 // war -14.0 bei 60 TPS (-14.0 * 3)
|
||||||
p.DoubleJumpUsed = true
|
p.DoubleJumpUsed = true
|
||||||
log.Printf("⚡ %s verwendet Double Jump!", p.Name)
|
log.Printf("⚡ %s verwendet Double Jump!", p.Name)
|
||||||
}
|
}
|
||||||
case "DOWN":
|
case "DOWN":
|
||||||
p.VY = 15.0
|
p.VY = 45.0 // war 15.0 bei 60 TPS (15.0 * 3)
|
||||||
case "LEFT_DOWN":
|
case "LEFT_DOWN":
|
||||||
p.InputX = -1
|
p.InputX = -1
|
||||||
case "LEFT_UP":
|
case "LEFT_UP":
|
||||||
@@ -356,9 +356,10 @@ func (r *Room) Update() {
|
|||||||
|
|
||||||
// X Bewegung
|
// X Bewegung
|
||||||
// Symmetrische Geschwindigkeit: Links = Rechts
|
// Symmetrische Geschwindigkeit: Links = Rechts
|
||||||
// Nach rechts: CurrentSpeed + 11, Nach links: CurrentSpeed - 11
|
// Nach rechts: CurrentSpeed + 33, Nach links: CurrentSpeed - 33
|
||||||
// Verwendet r.CurrentSpeed statt config.RunSpeed für dynamische Geschwindigkeit
|
// Verwendet r.CurrentSpeed statt config.RunSpeed für dynamische Geschwindigkeit
|
||||||
currentSpeed := r.CurrentSpeed + (p.InputX * 11.0)
|
// war 11.0 bei 60 TPS (11.0 * 3 = 33.0)
|
||||||
|
currentSpeed := r.CurrentSpeed + (p.InputX * 33.0)
|
||||||
nextX := p.X + currentSpeed
|
nextX := p.X + currentSpeed
|
||||||
|
|
||||||
hitX, typeX := r.CheckCollision(nextX+r.pDrawOffX+r.pHitboxOffX, p.Y+r.pDrawOffY+r.pHitboxOffY, r.pW, r.pH)
|
hitX, typeX := r.CheckCollision(nextX+r.pDrawOffX+r.pHitboxOffX, p.Y+r.pDrawOffY+r.pHitboxOffY, r.pW, r.pH)
|
||||||
@@ -407,13 +408,13 @@ func (r *Room) Update() {
|
|||||||
if p.OnWall {
|
if p.OnWall {
|
||||||
// Wandrutschen (langsame Fallgeschwindigkeit)
|
// Wandrutschen (langsame Fallgeschwindigkeit)
|
||||||
p.VY += config.Gravity * 0.3 // 30% Gravität an der Wand
|
p.VY += config.Gravity * 0.3 // 30% Gravität an der Wand
|
||||||
if p.VY > 3.0 {
|
if p.VY > 9.0 { // war 3.0 bei 60 TPS (3.0 * 3)
|
||||||
p.VY = 3.0 // Maximal 3.0 beim Rutschen
|
p.VY = 9.0 // Maximal 9.0 beim Rutschen
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hochklettern wenn nach oben gedrückt (InputX in Wandrichtung)
|
// Hochklettern wenn nach oben gedrückt (InputX in Wandrichtung)
|
||||||
if p.InputX != 0 {
|
if p.InputX != 0 {
|
||||||
p.VY = -5.0 // Kletter-Geschwindigkeit nach oben
|
p.VY = -15.0 // war -5.0 bei 60 TPS (-5.0 * 3)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Normal: Volle Gravität
|
// Normal: Volle Gravität
|
||||||
|
|||||||
Reference in New Issue
Block a user