# bloumy/spheregame architecture

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

- Interactive diagram: https://gitdiagram.com/bloumy/spheregame
- Repository: https://github.com/bloumy/spheregame

## Overview

This is a browser-based 3D sphere game built with Three.js. The apparent gameplay loop is to control a ship, fire at moving enemies, gain experience when enemies are destroyed, and see ship/level status in the scene. The sampled source also shows scene and camera setup, starfield background, and looping background music. The main implementation is concentrated in one large file; omitted excerpts limit confidence about input wiring and the full animation/render loop.

Main entry points: [`js/3d.js`](https://github.com/bloumy/spheregame/blob/master/js/3d.js) (Game Runtime), [`bgm/bgm1.ogg`](https://github.com/bloumy/spheregame/blob/master/bgm/bgm1.ogg) (Music Track)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_world["3D World"]
  node_game["Game Runtime<br/>[3d.js]"]
  node_scene["Scene and Camera<br/>[3d.js]"]
  node_background["Starfield Background<br/>[3d.js]"]
end

subgraph group_combat["Gameplay"]
  node_player["Player Ship<br/>[3d.js]"]
  node_controls["Ship Controls<br/>[3d.js]"]
  node_projectiles["Projectiles<br/>[3d.js]"]
  node_enemies["Enemies<br/>[3d.js]"]
end

subgraph group_progress["Progression and Audio"]
  node_progression["Experience and Levels<br/>[3d.js]"]
  node_status["Ship and Level Bars<br/>[3d.js]"]
  node_audio["Background Audio<br/>[3d.js]"]
  node_music["Music Track<br/>[bgm1.ogg]"]
end

node_browser(("Player"))
node_three["Three.js"]

node_browser -.->|"plays"| node_game
node_game -->|"initializes"| node_scene
node_game -->|"creates"| node_background
node_game -->|"initializes"| node_audio
node_game -->|"uses"| node_three
node_controls -->|"moves"| node_player
node_player -->|"launches"| node_projectiles
node_projectiles -->|"damages"| node_enemies
node_enemies -->|"grants experience"| node_progression
node_player -->|"tracks level"| node_progression
node_player -->|"creates bars"| node_status
node_progression -.->|"shows level"| node_status
node_audio -->|"loads"| node_music

click node_player "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_controls "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_projectiles "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_enemies "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_game "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_scene "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_background "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_progression "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_status "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_audio "https://github.com/bloumy/spheregame/blob/master/js/3d.js"
click node_music "https://github.com/bloumy/spheregame/blob/master/bgm/bgm1.ogg"

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_game,node_scene,node_background toneBlue
class node_player,node_controls,node_projectiles,node_enemies toneAmber
class node_progression,node_status,node_audio,node_music toneMint
class node_browser,node_three toneIndigo
```

## Components

### 3D World

- [Game Runtime](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Scene and Camera](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Starfield Background](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`

### Gameplay

- [Player Ship](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Ship Controls](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Projectiles](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Enemies](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`

### Progression and Audio

- [Experience and Levels](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Ship and Level Bars](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Background Audio](https://github.com/bloumy/spheregame/blob/master/js/3d.js): `js/3d.js`
- [Music Track](https://github.com/bloumy/spheregame/blob/master/bgm/bgm1.ogg): `bgm/bgm1.ogg`

### Other components

- **Player**
- **Three.js**

## Connections

- Player → Game Runtime: plays
- Game Runtime → Scene and Camera: initializes (evidence: `js/3d.js`)
- Game Runtime → Starfield Background: creates (evidence: `js/3d.js`)
- Game Runtime → Background Audio: initializes (evidence: `js/3d.js`)
- Game Runtime → Three.js: uses
- Ship Controls → Player Ship: moves (evidence: `js/3d.js`)
- Player Ship → Projectiles: launches (evidence: `js/3d.js`)
- Projectiles → Enemies: damages (evidence: `js/3d.js`)
- Enemies → Experience and Levels: grants experience (evidence: `js/3d.js`)
- Player Ship → Experience and Levels: tracks level (evidence: `js/3d.js`)
- Player Ship → Ship and Level Bars: creates bars (evidence: `js/3d.js`)
- Experience and Levels → Ship and Level Bars: shows level (evidence: `js/3d.js`)
- Background Audio → Music Track: loads (evidence: `js/3d.js`)
