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:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user