Private
Public Access
1
0

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

This commit is contained in:
Sebastian Unterschütz
2026-03-22 10:44:58 +01:00
parent 1dc5005cf3
commit aff505773a
12 changed files with 693 additions and 16 deletions

View File

@@ -79,6 +79,7 @@ type Room struct {
CollectedPowerups map[string]bool // Key: "chunkID_objectIndex"
ScoreAccum float64 // Akkumulator für Distanz-Score
CurrentSpeed float64 // Aktuelle Geschwindigkeit (steigt mit der Zeit)
DifficultyFactor float64 // 0.0 (Start) bis 1.0 (Maximum) skaliert Schwierigkeit
GameStartTime time.Time // Wann das Spiel gestartet wurde
// Chunk-Pool für fairen Random-Spawn
@@ -368,12 +369,17 @@ func (r *Room) Update() {
r.CurrentSpeed = config.RunSpeed
}
} else if r.Status == "RUNNING" {
// Geschwindigkeit erhöhen: +0.5 pro 10 Sekunden (max +5.0 nach 100 Sekunden)
elapsed := time.Since(r.GameStartTime).Seconds()
speedIncrease := (elapsed / 10.0) * 0.5
if speedIncrease > 5.0 {
speedIncrease = 5.0
// DifficultyFactor: 0.0 am Start, 1.0 nach MaxDifficultySeconds (180s)
r.DifficultyFactor = elapsed / config.MaxDifficultySeconds
if r.DifficultyFactor > 1.0 {
r.DifficultyFactor = 1.0
}
// Geschwindigkeit: quadratische Kurve → am Anfang langsam, dann immer schneller
// Bei MaxDifficultySeconds: +18 auf RunSpeed (39 total)
speedIncrease := r.DifficultyFactor * r.DifficultyFactor * 18.0
r.CurrentSpeed = config.RunSpeed + speedIncrease
r.GlobalScrollX += r.CurrentSpeed
@@ -429,7 +435,7 @@ func (r *Room) Update() {
}
// Gemeinsame Physik anwenden (1:1 wie Client!)
physics.ApplyPhysics(&state, physicsInput, r.CurrentSpeed, collisionChecker, physics.DefaultPlayerConstants())
physics.ApplyPhysics(&state, physicsInput, r.CurrentSpeed, r.DifficultyFactor, collisionChecker, physics.DefaultPlayerConstants())
// Ergebnis zurückschreiben
p.X = state.X
@@ -829,6 +835,7 @@ func (r *Room) Broadcast() {
MovingPlatforms: make([]game.MovingPlatformSync, 0, len(r.MovingPlatforms)),
Sequence: r.sequence,
CurrentSpeed: r.CurrentSpeed,
DifficultyFactor: r.DifficultyFactor,
}
for id, p := range r.Players {