How crescentschaos/football-prototype works
Apex Football Simulator is a browser-based football simulation product. Users select teams and tactics, run a match or competition, then inspect live events, reports, standings, statistics, and history. The match engine models possession through shots and goalkeeper outcomes; season and tournament systems extend play into domestic and international competitions. The README documents these capabilities and the match-stage sequence; sampled source excerpts are partial, so some internal links rely on README statements rather than inspected call sites.
Main entry points: matchEngine.js Match engine · seasonEngine.js Season simulation · possession.js Possession and movement · tournamentEngine.js Tournament simulation
Components 33
Browser application
- App startup
js/main.js - Application state
js/state.js - Seeded randomness
js/rng.js
Match simulation
- Match engine
engine/matchEngine.js - Possession and movement
engine/possession.js - Ball decisions
engine/decisionModel.js - Passing
engine/passing.js - Defending
engine/defending.js - Transitions
engine/transitions.js - Shooting
engine/shooting.js - Goalkeeping
engine/goalkeeper.js - Offside decisions
engine/offside.js - Set pieces
engine/setpieces.js - Fitness and injuries
engine/injuries.js
Competitions and seasons
- Season simulation
simulation/seasonEngine.js - International calendar
simulation/worldEngine.js - Tournament simulation
simulation/tournamentEngine.js - League tournaments
simulation/leagueTournamentEngine.js - Knockout cups
simulation/knockoutEngine.js - Transfers
simulation/transferEngine.js
Football data and AI
- Team database
data/teamDatabase.js - Player database
data/playerDatabase.js - Competition definitions
data/competitions.js - Manager tactics
ai/managerAI.js
User interfaces
- Match interface
ui/matchUI.js - Season interface
ui/seasonUI.js - League interface
ui/leagueTournamentUI.js - Player interface
ui/playerUI.js - Players browser
ui/playersUI.js - Team interface
ui/teamUI.js - Statistics interface
ui/statisticsUI.js - Injury interface
ui/hospitalUI.js
Other components
- Player
Connections 37
- Player → App startup: opens
- App startup → Application state: initializes
js/main.js - Player → Match interface: selects teams
- Match interface → Match engine: starts match
- Team database → Player database: provides squads
data/playerDatabase.js - Match engine → Possession and movement: simulates possession
- Possession and movement → Ball decisions: evaluates actions
engine/possession.js - Possession and movement → Passing: attempts passes
- Possession and movement → Defending: contests possession
- Match engine → Transitions: handles transitions
- Match engine → Shooting: creates shots
- Shooting → Goalkeeping: resolves shots
- Match engine → Offside decisions: checks offside
- Match engine → Set pieces: handles set pieces
- Match engine → Fitness and injuries: tracks fitness
- Manager tactics → Match engine: influences tactics
- Seeded randomness → Match engine: seeds simulation
- Match engine → Match interface: provides events
- Player → Season interface: runs seasons
- Season interface → Season simulation: advances calendar
- Season simulation → Match engine: simulates fixtures
- Season simulation → International calendar: schedules internationals
simulation/worldEngine.js - Player → League interface: runs competitions
- League interface → League tournaments: starts league format
simulation/leagueTournamentEngine.js - League tournaments → Season simulation: reuses standings logic
simulation/leagueTournamentEngine.js - Player → Tournament simulation: starts tournament
- Tournament simulation → Knockout cups: seeds cup bracket
simulation/knockoutEngine.js - Tournament simulation → Match engine: simulates fixtures
- Competition definitions → Tournament simulation: defines formats
- Player → Players browser: browses players
- Players browser → Player database: browses records
- Player → Team interface: views teams
- Player → Player interface: views players
- Season simulation → Statistics interface: tracks records
- Fitness and injuries → Injury interface: reports injuries
- Season simulation → Season interface: shows progress
- Transfers → Team database: updates squads