Private
Public Access
1
0

Add WebAssembly support for assets and chunks, implement gameover screen rendering, and enhance server gameplay logic with dynamic speeds, team naming, and score components.

This commit is contained in:
Sebastian Unterschütz
2026-01-04 14:30:31 +01:00
parent ce51a2ba4f
commit 95d61bf66e
68 changed files with 913 additions and 424 deletions

View File

@@ -66,10 +66,11 @@ type LoginPayload struct {
// Input vom Spieler während des Spiels
type ClientInput struct {
Type string `json:"type"` // "JUMP", "START", "LEFT_DOWN", "RIGHT_DOWN", etc.
Type string `json:"type"` // "JUMP", "START", "LEFT_DOWN", "RIGHT_DOWN", "SET_TEAM_NAME", etc.
RoomID string `json:"room_id"`
PlayerID string `json:"player_id"`
Sequence uint32 `json:"sequence"` // Sequenznummer für Client Prediction
Sequence uint32 `json:"sequence"` // Sequenznummer für Client Prediction
TeamName string `json:"team_name,omitempty"` // Für SET_TEAM_NAME Input
}
type JoinRequest struct {
@@ -105,6 +106,7 @@ type GameState struct {
TimeLeft int `json:"time_left"`
WorldChunks []ActiveChunk `json:"world_chunks"`
HostID string `json:"host_id"`
TeamName string `json:"team_name"` // Team-Name (vom Host gesetzt)
ScrollX float64 `json:"scroll_x"`
CollectedCoins map[string]bool `json:"collected_coins"` // Welche Coins wurden eingesammelt (Key: ChunkID_ObjectIndex)
CollectedPowerups map[string]bool `json:"collected_powerups"` // Welche Powerups wurden eingesammelt
@@ -125,7 +127,8 @@ 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
Timestamp int64 `json:"timestamp"` // Unix-Timestamp
ProofCode string `json:"proof_code"` // Beweis-Code zum Verifizieren des Scores
}
// Score-Submission vom Client an Server
@@ -133,8 +136,16 @@ type ScoreSubmission struct {
PlayerName string `json:"player_name"`
PlayerCode string `json:"player_code"`
Score int `json:"score"`
Name string `json:"name"` // Alternativer Name-Feld (für Kompatibilität)
Mode string `json:"mode"` // "solo" oder "coop"
Name string `json:"name"` // Alternativer Name-Feld (für Kompatibilität)
Mode string `json:"mode"` // "solo" oder "coop"
TeamName string `json:"team_name"` // Team-Name für Coop-Mode
}
// Score-Submission Response vom Server an Client
type ScoreSubmissionResponse struct {
Success bool `json:"success"`
ProofCode string `json:"proof_code"`
Score int `json:"score"`
}
// Start-Request vom Client

View File

@@ -83,7 +83,7 @@ func (w *World) GenerateColliders(activeChunks []ActiveChunk) []Collider {
continue
}
if def.Type == "obstacle" || def.Type == "platform" {
if def.Type == "obstacle" || def.Type == "platform" || def.Type == "wall" {
c := Collider{
Rect: Rect{
OffsetX: ac.X + obj.X + def.DrawOffX + def.Hitbox.OffsetX,