# mateusdigital/game-same-game architecture

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

- Interactive diagram: https://gitdiagram.com/mateusdigital/game-same-game
- Repository: https://github.com/mateusdigital/game-same-game

## Overview

The Same Game is a Pixi.js matching game. A player enters through the browser game, which initializes resources and settings, selects a scene, and runs the game loop; gameplay handles brick interactions, scoring, and scene transitions. The repository also includes a leaderboard service and a reusable JavaScript utility layer. Edges are limited to relationships visible in the excerpts or documented by the README; the frontend-to-leaderboard API connection is not established by the sampled source.

Main entry points: [`src/main.js`](https://github.com/mateusdigital/game-same-game/blob/master/src/main.js) (Game entry), [`libs/mcow_js_pixi/Application.js`](https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Application.js) (Pixi application), [`libs/mcow_js_pixi/Scene_Manager.js`](https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Scene_Manager.js) (Scene manager), [`src/Scenes`](https://github.com/mateusdigital/game-same-game/tree/master/src/Scenes) (Game scenes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_entry["Game entry<br/>[main.js]"]
  node_pixi_app["Pixi application<br/>[Application.js]"]
  node_scene_manager["Scene manager<br/>[Scene_Manager.js]"]
  node_resources["Resource loading<br/>[RES.js]"]
  node_input["Input handling<br/>[Input.js]"]
end

subgraph group_gameplay["Game experience"]
  node_scene["Game scenes"]
  node_game_scene["Match gameplay<br/>[GameScene.js]"]
  node_brick["Brick<br/>[Brick.js]"]
  node_scenario["Scenario<br/>[Scenario.js]"]
  node_sky["Sky background<br/>[SkyBackground.js]"]
  node_game_ui["Game UI"]
  node_audio["Audio<br/>[Audio.js]"]
  node_settings["Game settings<br/>[GameSettings.js]"]
end

subgraph group_shared["Shared libraries"]
  node_core_utils["Core utilities"]
  node_pixi_helpers["Pixi helpers"]
end

subgraph group_leaderboards["Leaderboards"]
  node_leaderboard_client["Leaderboard UI"]
  node_leaderboard_utils["Leaderboard utilities"]
  node_leaderboard_api["Leaderboard API<br/>[app.py]"]
  node_leaderboard_db[("Leaderboard database<br/>[app.py]")]
end

node_player(("Player"))
node_browser["Browser canvas"]
node_visitor(("Leaderboard client"))

node_player -->|"plays in"| node_browser
node_browser -->|"starts"| node_entry
node_entry -->|"creates and starts"| node_pixi_app
node_entry -->|"loads resources"| node_resources
node_entry -->|"initializes"| node_settings
node_entry -->|"initializes"| node_scenario
node_entry -->|"selects scene"| node_scene_manager
node_entry -->|"preloads and plays"| node_audio
node_entry -->|"installs handler"| node_input
node_pixi_app -->|"updates"| node_scene_manager
node_pixi_app -->|"updates"| node_input
node_scene_manager -->|"runs lifecycle"| node_scene
node_scene -.->|"includes"| node_game_scene
node_scenario -->|"updates from loop"| node_pixi_app
node_visitor -.->|"requests scores"| node_leaderboard_api
node_leaderboard_api -->|"queries and writes"| node_leaderboard_db
node_leaderboard_client -.->|"uses"| node_leaderboard_utils

click node_entry "https://github.com/mateusdigital/game-same-game/blob/master/src/main.js"
click node_pixi_app "https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Application.js"
click node_scene_manager "https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Scene_Manager.js"
click node_scene "https://github.com/mateusdigital/game-same-game/tree/master/src/Scenes"
click node_game_scene "https://github.com/mateusdigital/game-same-game/blob/master/src/Scenes/GameScene.js"
click node_brick "https://github.com/mateusdigital/game-same-game/blob/master/src/Gameplay/Brick.js"
click node_scenario "https://github.com/mateusdigital/game-same-game/blob/master/src/Scenario/Scenario.js"
click node_sky "https://github.com/mateusdigital/game-same-game/blob/master/src/Scenario/SkyBackground.js"
click node_game_ui "https://github.com/mateusdigital/game-same-game/tree/master/src/UI"
click node_audio "https://github.com/mateusdigital/game-same-game/blob/master/src/Audio.js"
click node_settings "https://github.com/mateusdigital/game-same-game/blob/master/src/GameSettings.js"
click node_resources "https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/RES.js"
click node_input "https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Input.js"
click node_core_utils "https://github.com/mateusdigital/game-same-game/tree/master/libs/mcow_js_core/src"
click node_pixi_helpers "https://github.com/mateusdigital/game-same-game/tree/master/libs/mcow_js_pixi"
click node_leaderboard_client "https://github.com/mateusdigital/game-same-game/blob/master/src/Scenes/LeaderboardsScene.js"
click node_leaderboard_utils "https://github.com/mateusdigital/game-same-game/blob/master/src/LeaderboardsUtils.js"
click node_leaderboard_api "https://github.com/mateusdigital/game-same-game/blob/master/server/same_game_leaderboards/app.py"
click node_leaderboard_db "https://github.com/mateusdigital/game-same-game/blob/master/server/same_game_leaderboards/app.py"

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_pixi_app,node_scene_manager,node_resources,node_input,node_browser,node_visitor toneBlue
class node_scene,node_game_scene,node_brick,node_scenario,node_sky,node_game_ui,node_audio,node_settings toneAmber
class node_core_utils,node_pixi_helpers toneMint
class node_leaderboard_client,node_leaderboard_utils,node_leaderboard_api,node_leaderboard_db toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game entry](https://github.com/mateusdigital/game-same-game/blob/master/src/main.js): `src/main.js`
- [Pixi application](https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Application.js): `libs/mcow_js_pixi/Application.js`
- [Scene manager](https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Scene_Manager.js): `libs/mcow_js_pixi/Scene_Manager.js`
- [Resource loading](https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/RES.js): `libs/mcow_js_pixi/RES.js`
- [Input handling](https://github.com/mateusdigital/game-same-game/blob/master/libs/mcow_js_pixi/Input.js): `libs/mcow_js_pixi/Input.js`

### Game experience

- [Game scenes](https://github.com/mateusdigital/game-same-game/tree/master/src/Scenes): `src/Scenes`
- [Match gameplay](https://github.com/mateusdigital/game-same-game/blob/master/src/Scenes/GameScene.js): `src/Scenes/GameScene.js`
- [Brick](https://github.com/mateusdigital/game-same-game/blob/master/src/Gameplay/Brick.js): `src/Gameplay/Brick.js`
- [Scenario](https://github.com/mateusdigital/game-same-game/blob/master/src/Scenario/Scenario.js): `src/Scenario/Scenario.js`
- [Sky background](https://github.com/mateusdigital/game-same-game/blob/master/src/Scenario/SkyBackground.js): `src/Scenario/SkyBackground.js`
- [Game UI](https://github.com/mateusdigital/game-same-game/tree/master/src/UI): `src/UI`
- [Audio](https://github.com/mateusdigital/game-same-game/blob/master/src/Audio.js): `src/Audio.js`
- [Game settings](https://github.com/mateusdigital/game-same-game/blob/master/src/GameSettings.js): `src/GameSettings.js`

### Shared libraries

- [Core utilities](https://github.com/mateusdigital/game-same-game/tree/master/libs/mcow_js_core/src): `libs/mcow_js_core/src`
- [Pixi helpers](https://github.com/mateusdigital/game-same-game/tree/master/libs/mcow_js_pixi): `libs/mcow_js_pixi`

### Leaderboards

- [Leaderboard UI](https://github.com/mateusdigital/game-same-game/blob/master/src/Scenes/LeaderboardsScene.js): `src/Scenes/LeaderboardsScene.js`
- [Leaderboard utilities](https://github.com/mateusdigital/game-same-game/blob/master/src/LeaderboardsUtils.js): `src/LeaderboardsUtils.js`
- [Leaderboard API](https://github.com/mateusdigital/game-same-game/blob/master/server/same_game_leaderboards/app.py): `server/same_game_leaderboards/app.py`
- [Leaderboard database](https://github.com/mateusdigital/game-same-game/blob/master/server/same_game_leaderboards/app.py): `server/same_game_leaderboards/app.py`

### Other components

- **Player**
- **Browser canvas**
- **Leaderboard client**

## Connections

- Player → Browser canvas: plays in
- Browser canvas → Game entry: starts (evidence: `src/main.js`)
- Game entry → Pixi application: creates and starts (evidence: `src/main.js`)
- Game entry → Resource loading: loads resources (evidence: `src/main.js`)
- Game entry → Game settings: initializes (evidence: `src/main.js`)
- Game entry → Scenario: initializes (evidence: `src/main.js`)
- Game entry → Scene manager: selects scene (evidence: `src/main.js`)
- Game entry → Audio: preloads and plays (evidence: `src/main.js`)
- Game entry → Input handling: installs handler (evidence: `src/main.js`)
- Pixi application → Scene manager: updates (evidence: `libs/mcow_js_pixi/Application.js`)
- Pixi application → Input handling: updates (evidence: `libs/mcow_js_pixi/Application.js`)
- Scene manager → Game scenes: runs lifecycle (evidence: `libs/mcow_js_pixi/Scene_Manager.js`)
- Game scenes → Match gameplay: includes
- Scenario → Pixi application: updates from loop
- Leaderboard client → Leaderboard API: requests scores
- Leaderboard API → Leaderboard database: queries and writes (evidence: `server/same_game_leaderboards/app.py`)
- Leaderboard UI → Leaderboard utilities: uses
