aethex.live/docs/PHASE_6_GAMING.md

4.3 KiB

Phase 6: Gaming & Esports - Implementation Guide

Duration: Weeks 24-29 | Complexity: Very High | Team Size: 3-4 devs

Executive Summary

Phase 6 transforms AeThex into an esports and gaming hub with tournament hosting, competitive leaderboards, team management, and spectator features.


Phase 6 Goals

  • Tournament bracket system (single/double elimination)
  • Game-specific leaderboards
  • Team management and matchmaking
  • Spectator/observer mode
  • Prize pool management and payouts

Key Features

1. Tournaments (40% of work)

Tournament Lifecycle:
1. Creator creates tournament
2. Players register/apply
3. Bracket generated (8-512 players)
4. Matches scheduled
5. VODs linked to matches
6. Winners determined
7. Prizes distributed

Bracket Types:
- Single elimination (fastest)
- Double elimination (fairer)
- Round-robin (groups)
- Ladder/leagues (ongoing)

Database:
- Tournament
- Team
- Match
- MatchResult
- PrizePool

2. Leaderboards (25%)

Types:
- Global: All players, all-time
- Game-specific: e.g., "Valorant 1v1"
- Time-based: Weekly, monthly, seasonal
- Skill-based: Ranked divisions

Fields:
- Position
- Player name/team
- Wins/losses
- Rating/score
- Recent matches

3. Team Management (20%)

Features:
- Create team
- Invite players
- Pick captain
- Team roster management
- Team discord/communication
- Unified team streams

4. Spectator Mode (15%)

Features:
- Multiple camera angles
- Player POV toggles
- Minimap/analysis overlays
- Instant replay
- Multi-viewer sync

Implementation

Core Database

model Tournament {
  id String @id
  creatorId String
  name String
  description String
  
  gameId String // "valorant", "csgo", etc
  format String // SINGLE_ELIM, DOUBLE_ELIM, ROUND_ROBIN
  playerCount Int // Max players
  currentPlayerCount Int
  
  startDate DateTime
  status String // DRAFT, REGISTERING, IN_PROGRESS, COMPLETED
  
  prizePool Int // Total prize money in cents
  rules String?
  
  registrations Registration[]
  matches Match[]
  
  createdAt DateTime
  updatedAt DateTime
}

model Team {
  id String @id
  tournamentId String
  tournament Tournament @relation(fields: [tournamentId])
  
  name String
  logo String?
  captain String
  
  players User[] // via membership
  members TeamMember[]
  
  wins Int @default(0)
  losses Int @default(0)
}

model TeamMember {
  userId String
  teamId String
  team Team @relation(fields: [teamId])
  
  role String // CAPTAIN, PLAYER, SUBSTITUTE
  joinedAt DateTime
  
  @@unique([userId, teamId])
}

model Match {
  id String @id
  tournamentId String
  
  team1Id String
  team2Id String
  
  scheduledTime DateTime?
  startTime DateTime?
  endTime DateTime?
  
  team1Score Int?
  team2Score Int?
  winnerId String?
  
  vodLink String? // Link to stream VOD
  
  createdAt DateTime
}

model Leaderboard {
  id String @id
  gameId String
  timeframe String // ALL_TIME, WEEKLY, MONTHLY
  
  rankings LeaderboardEntry[]
}

model LeaderboardEntry {
  id String @id
  leaderboardId String
  userId String
  
  position Int
  rating Int
  wins Int
  losses Int
  
  lastUpdated DateTime
}

Key APIs

Tournaments:
- POST /api/tournaments (create)
- GET /api/tournaments (browse)
- GET /api/tournaments/:id (details)
- POST /api/tournaments/:id/register (join)
- PUT /api/tournaments/:id/bracket (generate)
- GET /api/tournaments/:id/matches

Leaderboards:
- GET /api/leaderboards/:game
- GET /api/leaderboards/:game/:timeframe
- GET /api/players/:id/ranking

Teams:
- POST /api/teams (create)
- PUT /api/teams/:id (edit)
- POST /api/teams/:id/invite
- POST /api/teams/:id/members/:userId (add)

Matches:
- POST /api/matches/:id/report (submit score)
- GET /api/matches/:id/details
- POST /api/matches/:id/reschedule

Success Metrics

  • 20+ tournaments created
  • 500+ competing players
  • 10k+ viewers per major tournament
  • 50k+ prize pools distributed
  • 99% match scheduling accuracy

Timeline

Week Focus
24 Tournament creation, bracket logic
25 Registration, team management
26 Match scheduling, VOD linking
27 Leaderboards, spectator mode
28-29 Testing, deployment, prizes

Completion: Week 29 (by July 18, 2025)
Next: Phase 7 - Music & DJ Features

See PHASE_7_MUSIC.md