Private
Public Access
1
0

add offline mode for solo play with local game state simulation
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m47s

This commit is contained in:
Sebastian Unterschütz
2026-04-22 12:37:52 +02:00
parent e295d1ad61
commit de87b76005
4 changed files with 147 additions and 6 deletions

View File

@@ -185,9 +185,14 @@ func (g *Game) UpdateGame() {
}
// --- 5. INPUT SENDEN (MIT CLIENT PREDICTION, 20 TPS) ---
if g.connected && time.Since(g.lastInputTime) >= physicsStep {
if (g.connected || g.isOffline) && time.Since(g.lastInputTime) >= physicsStep {
g.lastInputTime = time.Now()
// Offline: Update Scroll & World logic locally
if g.isOffline {
g.updateOfflineLoop()
}
g.predictionMutex.Lock()
wasOnGround := g.predictedGround
g.predictionMutex.Unlock()