# ryan-wong123/sgh architecture

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

- Interactive diagram: https://gitdiagram.com/ryan-wong123/sgh
- Repository: https://github.com/ryan-wong123/sgh

## Overview

This repository contains a Photon multiplayer Unity puzzle game and a small ASP.NET endpoint for emailing gameplay CSVs. The documented player workflow runs from room setup and character spawn through world interaction, inventory and clues, and coordinated puzzle progression. The graph preserves the README’s major gameplay capabilities; Unity script details were not sampled, so those nodes use the documented Assets/Scripts directory and documented links. The backend flow is grounded in the sampled source; its connection to gameplay is not shown.

Main entry points: [`Assets/Scripts`](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts) (Puzzle Stage Controller), [`backend/SghCsvEmailApi/Program.cs`](https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Program.cs) (CSV Upload API), [`backend/SghCsvEmailApi/Services/CsvEmailSender.cs`](https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Services/CsvEmailSender.cs) (CSV Email Sender), [`backend/SghCsvEmailApi/Options/GmailOptions.cs`](https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Options/GmailOptions.cs) (SMTP Options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_multiplayer["Multiplayer Setup"]
  node_room["Room Lobby"]
  node_character["Character Selection"]
  node_spawn["Player Spawn"]
  node_chat["Room Chat"]
end

subgraph group_interaction["Player Interaction"]
  node_movement["Player Movement"]
  node_interactor["World Interaction"]
  node_guidance["Waypoint Guidance"]
  node_inventory["Inventory And Clues"]
  node_sidebar["Sidebar And Popups"]
  node_keypad["Keypad"]
  node_door["Door Interaction"]
end

subgraph group_puzzles["Puzzle Gameplay"]
  node_puzzleflow["Puzzle Stage Controller"]
  node_timer["Puzzle Timer"]
  node_story["Storyline Events"]
  node_drag["Drag Card Stack"]
  node_puzzlemgr["Puzzle Managers"]
  node_sync["Networked Feedback"]
end

subgraph group_backend["CSV Email Backend"]
  node_api["CSV Upload API<br/>[Program.cs]"]
  node_options["SMTP Options<br/>[GmailOptions.cs]"]
  node_sender["CSV Email Sender<br/>[CsvEmailSender.cs]"]
end

node_player(("Player"))
node_smtp(("Gmail SMTP"))

node_player -->|"joins room"| node_room
node_room -->|"selects character"| node_character
node_room -->|"spawns player"| node_spawn
node_room -->|"connects chat"| node_chat
node_player -->|"controls"| node_movement
node_player -->|"targets objects"| node_interactor
node_interactor -->|"collects clues"| node_inventory
node_player -->|"follows targets"| node_guidance
node_player -->|"opens panels"| node_sidebar
node_interactor -->|"starts puzzle"| node_puzzleflow
node_puzzleflow -->|"checks answers"| node_puzzlemgr
node_puzzleflow -->|"starts timer"| node_timer
node_timer -->|"reloads puzzle"| node_puzzleflow
node_puzzleflow -->|"advances stage"| node_story
node_puzzlemgr -->|"uses card stack"| node_drag
node_puzzlemgr -->|"syncs feedback"| node_sync
node_player -->|"enters code"| node_keypad
node_keypad -->|"unlocks door"| node_door
node_player -.->|"uploads CSV"| node_api
node_api -->|"binds settings"| node_options
node_api -->|"sends attachment"| node_sender
node_sender -->|"sends email"| node_smtp

click node_room "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_character "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_spawn "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_chat "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_movement "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_interactor "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_guidance "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_inventory "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_sidebar "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_puzzleflow "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_timer "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_story "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_drag "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_puzzlemgr "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_sync "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_keypad "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_door "https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts"
click node_api "https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Program.cs"
click node_options "https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Options/GmailOptions.cs"
click node_sender "https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Services/CsvEmailSender.cs"

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_room,node_character,node_spawn,node_chat toneBlue
class node_movement,node_interactor,node_guidance,node_inventory,node_sidebar,node_keypad,node_door toneAmber
class node_puzzleflow,node_timer,node_story,node_drag,node_puzzlemgr,node_sync toneMint
class node_api,node_options,node_sender toneRose
class node_player,node_smtp toneIndigo
```

## Components

### Multiplayer Setup

- [Room Lobby](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Character Selection](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Player Spawn](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Room Chat](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`

### Player Interaction

- [Player Movement](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [World Interaction](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Waypoint Guidance](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Inventory And Clues](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Sidebar And Popups](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Keypad](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Door Interaction](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`

### Puzzle Gameplay

- [Puzzle Stage Controller](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Puzzle Timer](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Storyline Events](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Drag Card Stack](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Puzzle Managers](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`
- [Networked Feedback](https://github.com/ryan-wong123/sgh/tree/main/Assets/Scripts): `Assets/Scripts`

### CSV Email Backend

- [CSV Upload API](https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Program.cs): `backend/SghCsvEmailApi/Program.cs`
- [SMTP Options](https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Options/GmailOptions.cs): `backend/SghCsvEmailApi/Options/GmailOptions.cs`
- [CSV Email Sender](https://github.com/ryan-wong123/sgh/blob/main/backend/SghCsvEmailApi/Services/CsvEmailSender.cs): `backend/SghCsvEmailApi/Services/CsvEmailSender.cs`

### Other components

- **Player**
- **Gmail SMTP**

## Connections

- Player → Room Lobby: joins room
- Room Lobby → Character Selection: selects character
- Room Lobby → Player Spawn: spawns player
- Room Lobby → Room Chat: connects chat
- Player → Player Movement: controls
- Player → World Interaction: targets objects
- World Interaction → Inventory And Clues: collects clues
- Player → Waypoint Guidance: follows targets
- Player → Sidebar And Popups: opens panels
- World Interaction → Puzzle Stage Controller: starts puzzle
- Puzzle Stage Controller → Puzzle Managers: checks answers
- Puzzle Stage Controller → Puzzle Timer: starts timer
- Puzzle Timer → Puzzle Stage Controller: reloads puzzle
- Puzzle Stage Controller → Storyline Events: advances stage
- Puzzle Managers → Drag Card Stack: uses card stack
- Puzzle Managers → Networked Feedback: syncs feedback
- Player → Keypad: enters code
- Keypad → Door Interaction: unlocks door
- Player → CSV Upload API: uploads CSV
- CSV Upload API → SMTP Options: binds settings (evidence: `backend/SghCsvEmailApi/Program.cs`)
- CSV Upload API → CSV Email Sender: sends attachment (evidence: `backend/SghCsvEmailApi/Program.cs`)
- CSV Email Sender → Gmail SMTP: sends email (evidence: `backend/SghCsvEmailApi/Services/CsvEmailSender.cs`)
