Add leaderboard functionality with Redis integration for scores. This includes a global leaderboard system, server-side score submission handling, and real-time player ranking updates. Refactor and improve collision logic and game state management for better player experience.

This commit is contained in:
Sebastian Unterschütz committed 2026-01-01 19:23:09 +01:00
1 parent 5e6b8a2304
commit de64329ce4
12 files changed
+768 -43

No files matched your search

+15
View File
@@ -91,3 +91,18 @@ type GameState struct {
ScrollX float64 `json:"scroll_x"`
CollectedCoins map[string]bool `json:"collected_coins"` // Welche Coins wurden eingesammelt (Key: ChunkID_ObjectIndex)
}
// Leaderboard-Eintrag
type LeaderboardEntry struct {
PlayerName string `json:"player_name"`
PlayerCode string `json:"player_code"` // Eindeutiger Code für Verifikation
Score int `json:"score"`
Timestamp int64 `json:"timestamp"` // Unix-Timestamp
}
// Score-Submission vom Client an Server
type ScoreSubmission struct {
PlayerName string `json:"player_name"`
PlayerCode string `json:"player_code"`
Score int `json:"score"`
}