# lucasnarciso/crazyrooms.js architecture

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

- Interactive diagram: https://gitdiagram.com/lucasnarciso/crazyrooms.js
- Repository: https://github.com/lucasnarciso/crazyrooms.js

## Overview

Crazy Rooms is a browser-based procedural RPG. The main playable path is selecting or creating a character, loading its dataset, starting a game, generating or restoring a room, and interacting with a chest and its loot. Character and room progress are stored in browser localStorage. The README also describes NPC purchases, combat, equipment, and installable mobile access, but these are documented capabilities not established by the sampled runtime excerpts; those links are marked unverified.

Main entry points: [`Personagens/Script.js`](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Personagens/Script.js) (Character management), [`GlobalScript.js`](https://github.com/lucasnarciso/crazyrooms.js/blob/main/GlobalScript.js) (Page navigation), [`Jogo/GameSystem.js`](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameSystem.js) (Game startup), [`Jogo/GameLayout.js`](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameLayout.js) (Room and inventory flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Navigation and pages"]
  node_navigation["Page navigation<br/>[GlobalScript.js]"]
  node_menu["Menu<br/>[Script.js]"]
  node_other_pages["Options and about<br/>[index.html]"]
  node_install["Mobile installation<br/>[manifest.json]"]
end

subgraph group_characters["Characters and data"]
  node_character_ui["Character management<br/>[Script.js]"]
  node_character_store[("Character save data")]
  node_default_dataset["Default dataset<br/>[DatasetPadrao.json]"]
  node_custom_dataset["Custom dataset<br/>[Meu-Dataset.json]"]
end

subgraph group_gameplay["Room gameplay"]
  node_game_entry["Game startup<br/>[GameSystem.js]"]
  node_game_model["Player and room model<br/>[GameElements.js]"]
  node_game_data["Game data tables<br/>[GameData.js]"]
  node_chest["Chest event and loot<br/>[GameElements.js]"]
  node_room_flow["Room and inventory flow<br/>[GameLayout.js]"]
  node_game_store[("Saved character progress")]
  node_npc["NPC interactions"]
  node_combat["Enemy battles"]
  node_equipment["Equipment and shops"]
end

subgraph group_presentation["Game presentation"]
  node_game_view["Game interface<br/>[Game.html]"]
end

node_player(("Player"))

node_player -->|"chooses pages"| node_navigation
node_navigation -->|"routes to"| node_menu
node_navigation -->|"routes to"| node_character_ui
node_navigation -->|"routes to"| node_game_view
node_navigation -->|"routes to"| node_other_pages
node_character_ui -->|"reads and writes"| node_character_store
node_character_ui -->|"fetches"| node_default_dataset
node_player -->|"creates character"| node_character_ui
node_player -.->|"may upload"| node_custom_dataset
node_character_ui -->|"validates upload"| node_custom_dataset
node_character_ui -->|"starts game"| node_game_entry
node_game_entry -->|"loads selection"| node_character_store
node_game_entry -->|"creates model"| node_game_model
node_game_entry -->|"opens room"| node_room_flow
node_game_model -->|"creates events"| node_chest
node_chest -->|"renders interactions"| node_room_flow
node_room_flow -->|"creates room"| node_game_model
node_room_flow -->|"saves progress"| node_game_store
node_player -.->|"may trade"| node_npc
node_player -.->|"may battle"| node_combat
node_player -.->|"may equip or buy"| node_equipment
node_player -.->|"may install"| node_install

click node_navigation "https://github.com/lucasnarciso/crazyrooms.js/blob/main/GlobalScript.js"
click node_menu "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Menu/Script.js"
click node_character_ui "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Personagens/Script.js"
click node_default_dataset "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Datasets/DatasetPadrao.json"
click node_custom_dataset "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Datasets/Meu-Dataset.json"
click node_game_entry "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameSystem.js"
click node_game_model "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameElements.js"
click node_game_data "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameData.js"
click node_chest "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameElements.js"
click node_room_flow "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameLayout.js"
click node_game_view "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/Game.html"
click node_other_pages "https://github.com/lucasnarciso/crazyrooms.js/blob/main/Opcoes/index.html"
click node_install "https://github.com/lucasnarciso/crazyrooms.js/blob/main/manifest.json"

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_navigation,node_menu,node_other_pages,node_install toneBlue
class node_character_ui,node_character_store,node_default_dataset,node_custom_dataset toneAmber
class node_game_entry,node_game_model,node_game_data,node_chest,node_room_flow,node_game_store,node_npc,node_combat,node_equipment toneMint
class node_game_view toneRose
class node_player toneIndigo
```

## Components

### Navigation and pages

- [Page navigation](https://github.com/lucasnarciso/crazyrooms.js/blob/main/GlobalScript.js): `GlobalScript.js`
- [Menu](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Menu/Script.js): `Menu/Script.js`
- [Options and about](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Opcoes/index.html): `Opcoes/index.html`
- [Mobile installation](https://github.com/lucasnarciso/crazyrooms.js/blob/main/manifest.json): `manifest.json`

### Characters and data

- [Character management](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Personagens/Script.js): `Personagens/Script.js`
- **Character save data**
- [Default dataset](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Datasets/DatasetPadrao.json): `Datasets/DatasetPadrao.json`
- [Custom dataset](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Datasets/Meu-Dataset.json): `Datasets/Meu-Dataset.json`

### Room gameplay

- [Game startup](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameSystem.js): `Jogo/GameSystem.js`
- [Player and room model](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameElements.js): `Jogo/GameElements.js`
- [Game data tables](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameData.js): `Jogo/GameData.js`
- [Chest event and loot](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameElements.js): `Jogo/GameElements.js`
- [Room and inventory flow](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/GameLayout.js): `Jogo/GameLayout.js`
- **Saved character progress**
- **NPC interactions**
- **Enemy battles**
- **Equipment and shops**

### Game presentation

- [Game interface](https://github.com/lucasnarciso/crazyrooms.js/blob/main/Jogo/Game.html): `Jogo/Game.html`

### Other components

- **Player**

## Connections

- Player → Page navigation: chooses pages (evidence: `GlobalScript.js`)
- Page navigation → Menu: routes to (evidence: `GlobalScript.js`)
- Page navigation → Character management: routes to (evidence: `GlobalScript.js`)
- Page navigation → Game interface: routes to (evidence: `GlobalScript.js`)
- Page navigation → Options and about: routes to (evidence: `GlobalScript.js`)
- Character management → Character save data: reads and writes (evidence: `Personagens/Script.js`)
- Character management → Default dataset: fetches (evidence: `Personagens/Script.js`)
- Player → Character management: creates character (evidence: `Personagens/Script.js`)
- Player → Custom dataset: may upload (evidence: `README.md`)
- Character management → Custom dataset: validates upload (evidence: `Personagens/Script.js`)
- Character management → Game startup: starts game (evidence: `Personagens/Script.js`)
- Game startup → Character save data: loads selection (evidence: `Jogo/GameSystem.js`)
- Game startup → Player and room model: creates model (evidence: `Jogo/GameSystem.js`)
- Game startup → Room and inventory flow: opens room (evidence: `Jogo/GameSystem.js`)
- Player and room model → Chest event and loot: creates events (evidence: `Jogo/GameElements.js`)
- Chest event and loot → Room and inventory flow: renders interactions (evidence: `Jogo/GameElements.js`)
- Room and inventory flow → Player and room model: creates room (evidence: `Jogo/GameLayout.js`)
- Room and inventory flow → Saved character progress: saves progress (evidence: `Jogo/GameLayout.js`)
- Player → NPC interactions: may trade (evidence: `README.md`)
- Player → Enemy battles: may battle (evidence: `README.md`)
- Player → Equipment and shops: may equip or buy (evidence: `README.md`)
- Player → Mobile installation: may install (evidence: `README.md`)
