# sabbirahmedsr/arduinowordgame architecture

> Architecture diagram of the GitHub repository sabbirahmedsr/arduinowordgame, 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/sabbirahmedsr/arduinowordgame
- Repository: https://github.com/sabbirahmedsr/arduinowordgame

## Overview

This is a browser-based, letter-learning runner game: the player advances through a word by entering each required letter, primarily via an Arduino connected over Web Serial, with keyboard fallback and an on-screen bit/letter HUD. GameEngine orchestrates level setup, input, obstacle progress, transitions, and the animation loop; rendering and feedback are delegated to background, word, particle, asset, and UI components. The tree and excerpts establish these principal calls. The README is empty, and other data and markup files were not sampled, so their specific runtime wiring is not asserted.

Main entry points: [`js/GameEngine.js`](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameEngine.js) (Game Engine), [`js/SerialController.js`](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/SerialController.js) (Serial Controller), [`js/AssetManager.js`](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/AssetManager.js) (Asset Manager), [`js/WordItem.js`](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/WordItem.js) (Word Item)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Gameplay Flow"]
  node_game["Game Engine<br/>[GameEngine.js]"]
  node_word["Word Item<br/>[WordItem.js]"]
end

subgraph group_visuals["Rendering &amp; Effects"]
  node_parallax["Parallax Background"]
  node_particles["Particle System<br/>[ParticleSystem.js]"]
  node_canvas["Browser Canvas"]
end

subgraph group_input["Input &amp; HUD"]
  node_ui["HUD &amp; Word UI<br/>[UIController.js]"]
  node_serial["Serial Controller"]
  node_keyboard["Keyboard Input<br/>[GameEngine.js]"]
  node_arduino["Arduino Device"]
end

subgraph group_content["Game Content"]
  node_assets["Asset Manager<br/>[AssetManager.js]"]
  node_config["Game Config<br/>[GameConfig.js]"]
  node_resources["Resource Config<br/>[resources.json]"]
  node_leveldata["Level Data<br/>[levelData.json]"]
  node_lettermap["Letter Map<br/>[letterMap.json]"]
  node_environment["Environment Config"]
end

node_player(("Player"))

node_player -->|"enters letters"| node_game
node_game -->|"handles input"| node_serial
node_game -->|"handles keys"| node_keyboard
node_arduino -.->|"streams bits"| node_serial
node_serial -->|"sends letters"| node_game
node_serial -->|"loads mapping"| node_lettermap
node_serial -->|"updates HUD"| node_ui
node_game -->|"updates progress"| node_ui
node_game -->|"sets and draws"| node_word
node_game -->|"updates effects"| node_particles
node_game -->|"initializes and draws"| node_parallax
node_game -->|"loads resources"| node_assets
node_assets -->|"fetches config"| node_resources
node_assets -.->|"reads paths"| node_environment
node_game -->|"uses settings"| node_config
node_game -.->|"selects words"| node_leveldata
node_parallax -->|"gets images"| node_assets
node_word -->|"spawns effects"| node_particles
node_game -->|"renders frame"| node_canvas

click node_game "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameEngine.js"
click node_word "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/WordItem.js"
click node_assets "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/AssetManager.js"
click node_config "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameConfig.js"
click node_resources "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/resources.json"
click node_leveldata "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/levelData.json"
click node_lettermap "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/letterMap.json"
click node_environment "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/environmentConfig.json"
click node_parallax "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/ParallaxBackground.js"
click node_particles "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/ParticleSystem.js"
click node_ui "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/UIController.js"
click node_serial "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/SerialController.js"
click node_keyboard "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameEngine.js"
click node_arduino "https://github.com/sabbirahmedsr/arduinowordgame/blob/main/arduino/8bit_serial_input/8bit_serial_input.ino"

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_word toneBlue
class node_parallax,node_particles,node_canvas toneAmber
class node_ui,node_serial,node_keyboard,node_arduino toneMint
class node_assets,node_config,node_resources,node_leveldata,node_lettermap,node_environment toneRose
class node_player toneIndigo
```

## Components

### Gameplay Flow

- [Game Engine](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameEngine.js): `js/GameEngine.js`
- [Word Item](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/WordItem.js): `js/WordItem.js`

### Rendering & Effects

- [Parallax Background](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/ParallaxBackground.js): `js/ParallaxBackground.js`
- [Particle System](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/ParticleSystem.js): `js/ParticleSystem.js`
- **Browser Canvas**

### Input & HUD

- [HUD & Word UI](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/UIController.js): `js/UIController.js`
- [Serial Controller](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/SerialController.js): `js/SerialController.js`
- [Keyboard Input](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameEngine.js): `js/GameEngine.js`
- [Arduino Device](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/arduino/8bit_serial_input/8bit_serial_input.ino): `arduino/8bit_serial_input/8bit_serial_input.ino`

### Game Content

- [Asset Manager](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/AssetManager.js): `js/AssetManager.js`
- [Game Config](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/js/GameConfig.js): `js/GameConfig.js`
- [Resource Config](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/resources.json): `data/resources.json`
- [Level Data](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/levelData.json): `data/levelData.json`
- [Letter Map](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/letterMap.json): `data/letterMap.json`
- [Environment Config](https://github.com/sabbirahmedsr/arduinowordgame/blob/main/data/environmentConfig.json): `data/environmentConfig.json`

### Other components

- **Player**

## Connections

- Player → Game Engine: enters letters (evidence: `js/GameEngine.js`)
- Game Engine → Serial Controller: handles input (evidence: `js/GameEngine.js`)
- Game Engine → Keyboard Input: handles keys (evidence: `js/GameEngine.js`)
- Arduino Device → Serial Controller: streams bits
- Serial Controller → Game Engine: sends letters (evidence: `js/GameEngine.js`)
- Serial Controller → Letter Map: loads mapping (evidence: `js/SerialController.js`)
- Serial Controller → HUD & Word UI: updates HUD (evidence: `js/SerialController.js`)
- Game Engine → HUD & Word UI: updates progress (evidence: `js/GameEngine.js`)
- Game Engine → Word Item: sets and draws (evidence: `js/GameEngine.js`)
- Game Engine → Particle System: updates effects (evidence: `js/GameEngine.js`)
- Game Engine → Parallax Background: initializes and draws (evidence: `js/GameEngine.js`)
- Game Engine → Asset Manager: loads resources (evidence: `js/GameEngine.js`)
- Asset Manager → Resource Config: fetches config (evidence: `js/AssetManager.js`)
- Asset Manager → Environment Config: reads paths
- Game Engine → Game Config: uses settings (evidence: `js/GameEngine.js`)
- Game Engine → Level Data: selects words
- Parallax Background → Asset Manager: gets images (evidence: `js/ParallaxBackground.js`)
- Word Item → Particle System: spawns effects (evidence: `js/WordItem.js`)
- Game Engine → Browser Canvas: renders frame (evidence: `js/GameEngine.js`)
