# aderinsola22/enable3dfootball architecture

> Architecture diagram of the GitHub repository aderinsola22/enable3dfootball, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aderinsola22/enable3dfootball
- Repository: https://github.com/aderinsola22/enable3dfootball

## Overview

This repository implements a browser-based 3D soccer match simulation. The workflow starts when the page loads, boots the physics-enabled MatchScene, and creates the match world and teams; player and goalkeeper behavior then combines user control, ball interactions, and state-machine logic, while field-boundary events handle scoring and offside logic checks play. Animation assets support player actions. The graph emphasizes these gameplay stages and the scene’s orchestration role. Evidence is limited to the README (empty), source index, and shown excerpts; unsampled connections are omitted.

Main entry points: [`src/core/MatchScene.js`](https://github.com/aderinsola22/enable3dfootball/blob/master/src/core/MatchScene.js) (Match Scene), [`src/objects/Team.js`](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Team.js) (Teams), [`src/objects/Keeper.js`](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Keeper.js) (Goalkeeper), [`src/objects/Ball.js`](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Ball.js) (Ball)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and Match"]
  node_entry["Game Entry<br/>[main.js]"]
  node_scene["Match Scene<br/>[MatchScene.js]"]
end

subgraph group_world["Match World"]
  node_field["Field<br/>[Field.js]"]
  node_ball["Ball<br/>[Ball.js]"]
  node_posts["Goal Posts<br/>[Post.js]"]
  node_flags["Match Flags<br/>[Flag.js]"]
  node_animations["Action Animations"]
end

subgraph group_actors["Teams and Control"]
  node_teams["Teams<br/>[Team.js]"]
  node_players["Outfield Players<br/>[Player.js]"]
  node_keeper["Goalkeeper<br/>[Keeper.js]"]
  node_director["Player Director<br/>[Director.js]"]
end

subgraph group_behavior["Player Behavior"]
  node_fieldplay["Field Player States<br/>[OutFieldStates.js]"]
  node_keeperplay["Keeper States<br/>[KeeperStates.js]"]
  node_shared["Shared States<br/>[SharedStates.js]"]
end

subgraph group_rules["Match Rules"]
  node_offside["Offside Checker<br/>[Offside.js]"]
end

node_browser(("Browser"))

node_browser -->|"loads page"| node_entry
node_entry -->|"starts scene"| node_scene
node_scene -->|"creates field"| node_field
node_scene -->|"creates ball"| node_ball
node_scene -->|"creates posts"| node_posts
node_scene -->|"creates flags"| node_flags
node_scene -->|"creates teams"| node_teams
node_scene -->|"creates director"| node_director
node_scene -->|"creates checkers"| node_offside
node_teams -->|"creates players"| node_players
node_teams -->|"creates keeper"| node_keeper
node_players -->|"uses states"| node_fieldplay
node_keeper -->|"uses states"| node_keeperplay
node_fieldplay -->|"imports states"| node_shared
node_keeperplay -->|"imports states"| node_shared
node_keeper -->|"loads animations"| node_animations
node_field -->|"handles collisions"| node_ball
node_offside -->|"checks possession"| node_ball

click node_entry "https://github.com/aderinsola22/enable3dfootball/blob/master/src/main.js"
click node_scene "https://github.com/aderinsola22/enable3dfootball/blob/master/src/core/MatchScene.js"
click node_field "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Field.js"
click node_ball "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Ball.js"
click node_posts "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Post.js"
click node_flags "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Flag.js"
click node_teams "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Team.js"
click node_players "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Player.js"
click node_keeper "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Keeper.js"
click node_director "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Director.js"
click node_offside "https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Offside.js"
click node_fieldplay "https://github.com/aderinsola22/enable3dfootball/blob/master/src/statemachine/OutFieldStates.js"
click node_keeperplay "https://github.com/aderinsola22/enable3dfootball/blob/master/src/statemachine/KeeperStates.js"
click node_shared "https://github.com/aderinsola22/enable3dfootball/blob/master/src/statemachine/SharedStates.js"
click node_animations "https://github.com/aderinsola22/enable3dfootball/tree/master/animations/Player_Actions"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_scene,node_browser toneBlue
class node_field,node_ball,node_posts,node_flags,node_animations toneAmber
class node_teams,node_players,node_keeper,node_director toneMint
class node_fieldplay,node_keeperplay,node_shared toneRose
class node_offside toneIndigo
```

## Components

### Runtime and Match

- [Game Entry](https://github.com/aderinsola22/enable3dfootball/blob/master/src/main.js): `src/main.js`
- [Match Scene](https://github.com/aderinsola22/enable3dfootball/blob/master/src/core/MatchScene.js): `src/core/MatchScene.js`

### Match World

- [Field](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Field.js): `src/objects/Field.js`
- [Ball](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Ball.js): `src/objects/Ball.js`
- [Goal Posts](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Post.js): `src/objects/Post.js`
- [Match Flags](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Flag.js): `src/objects/Flag.js`
- [Action Animations](https://github.com/aderinsola22/enable3dfootball/tree/master/animations/Player_Actions): `animations/Player_Actions`

### Teams and Control

- [Teams](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Team.js): `src/objects/Team.js`
- [Outfield Players](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Player.js): `src/objects/Player.js`
- [Goalkeeper](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Keeper.js): `src/objects/Keeper.js`
- [Player Director](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Director.js): `src/objects/Director.js`

### Player Behavior

- [Field Player States](https://github.com/aderinsola22/enable3dfootball/blob/master/src/statemachine/OutFieldStates.js): `src/statemachine/OutFieldStates.js`
- [Keeper States](https://github.com/aderinsola22/enable3dfootball/blob/master/src/statemachine/KeeperStates.js): `src/statemachine/KeeperStates.js`
- [Shared States](https://github.com/aderinsola22/enable3dfootball/blob/master/src/statemachine/SharedStates.js): `src/statemachine/SharedStates.js`

### Match Rules

- [Offside Checker](https://github.com/aderinsola22/enable3dfootball/blob/master/src/objects/Offside.js): `src/objects/Offside.js`

### Other components

- **Browser**

## Connections

- Browser → Game Entry: loads page (evidence: `src/main.js`)
- Game Entry → Match Scene: starts scene (evidence: `src/main.js`)
- Match Scene → Field: creates field (evidence: `src/core/MatchScene.js`)
- Match Scene → Ball: creates ball (evidence: `src/core/MatchScene.js`)
- Match Scene → Goal Posts: creates posts (evidence: `src/core/MatchScene.js`)
- Match Scene → Match Flags: creates flags (evidence: `src/core/MatchScene.js`)
- Match Scene → Teams: creates teams (evidence: `src/core/MatchScene.js`)
- Match Scene → Player Director: creates director (evidence: `src/core/MatchScene.js`)
- Match Scene → Offside Checker: creates checkers (evidence: `src/core/MatchScene.js`)
- Teams → Outfield Players: creates players (evidence: `src/objects/Team.js`)
- Teams → Goalkeeper: creates keeper (evidence: `src/objects/Team.js`)
- Outfield Players → Field Player States: uses states (evidence: `src/objects/Player.js`)
- Goalkeeper → Keeper States: uses states (evidence: `src/objects/Keeper.js`)
- Field Player States → Shared States: imports states (evidence: `src/statemachine/OutFieldStates.js`)
- Keeper States → Shared States: imports states (evidence: `src/statemachine/KeeperStates.js`)
- Goalkeeper → Action Animations: loads animations (evidence: `src/objects/Keeper.js`)
- Field → Ball: handles collisions (evidence: `src/objects/Field.js`)
- Offside Checker → Ball: checks possession (evidence: `src/objects/Offside.js`)
