# marc-borrell/web-game architecture

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

- Interactive diagram: https://gitdiagram.com/marc-borrell/web-game
- Repository: https://github.com/marc-borrell/web-game

## Overview

1. **Project purpose**: This repository describes a web application that embeds an interactive **Unity-based experience** inside a modern browser application. The core architectural idea is not a standalone game or a pure web site, but a **hybrid web + Unity client**.

2. **Primary subsystems**: The architecture centers on two client-side runtimes:
   - the **browser/web app** as the host UI and interaction layer
   - the **Unity runtime** as the interactive/game engine content

3. **Boundary between systems**: The key architectural boundary is the **integration bridge** between the web layer and Unity. This is the main seam to show in a diagram, because it separates standard web UI concerns from Unity-driven interactive rendering and logic.

4. **Bidirectional communication**: The README explicitly highlights **two-way communication** between browser and game engine. That means data flows in both directions:
   - browser → Unity: user actions, UI events, configuration, and control messages
   - Unity → browser: game state, interaction events, feedback, and possibly status updates

5. **Runtime composition**: The Unity experience is not described as a separate desktop app; it is part of the **browser-delivered experience**. So the browser is the execution container that hosts the embedded Unity content.

6. **Likely interaction model**: The architecture implies a **message-based integration pattern** rather than tight coupling. In a diagram, this is best represented as an explicit communication channel or adapter layer between the two runtimes.

7. **What is not visible here**: The provided tree contains only the README, so there is **no source-level visibility** into backend services, build pipelines, asset management, or deployment topology. Those cannot be asserted from the current repository snapshot.

8. **Diagram guidance**: The most accurate high-level diagram would show:
   - a **web application shell** in the browser
   - an **embedded Unity module/runtime** inside that shell
   - a **two-way event/message channel** connecting them
   - optional annotation that the repo demonstrates integration rather than a larger multi-service system

9. **Technology signal**: The only concrete technology named in the repository description is **Unity** alongside a “modern web application.” No external services or server-side components are mentioned in the README.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser App"]
  node_browser_shell["Web Shell<br/>browser host"]
  node_web_ui["Web UI<br/>ui layer"]
end

subgraph group_unity["Unity Runtime"]
  node_unity_runtime["Unity Runtime<br/>engine runtime"]
  node_unity_content(("Game Content<br/>interactive scene"))
end

node_bridge{{"Message Bridge<br/>integration adapter"}}

node_browser_shell -->|"hosts"| node_web_ui
node_browser_shell -->|"embeds"| node_bridge
node_web_ui -->|"user actions"| node_bridge
node_bridge -->|"commands"| node_unity_runtime
node_unity_runtime -->|"state events"| node_bridge
node_bridge -->|"updates"| node_web_ui
node_unity_runtime -->|"runs"| node_unity_content

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_browser_shell,node_web_ui toneBlue
class node_unity_runtime,node_unity_content toneAmber
class node_bridge toneNeutral
```

## Components

### Browser App

Web application shell running in the browser and hosting the embedded experience.

- **Web Shell**: browser host · Top-level browser application that presents the user-facing experience and embeds Unity.
- **Web UI**: ui layer · Browser-side interface for controls, interaction, and status display.

### Unity Runtime

Embedded Unity engine and interactive content delivered inside the browser experience.

- **Unity Runtime**: engine runtime · Unity engine executing the interactive experience inside the browser context.
- **Game Content**: interactive scene · The embedded Unity-driven experience rendered and controlled by the engine.

### Other components

- **Message Bridge**: integration adapter · Bidirectional communication layer between the web app and Unity runtime.

## Connections

- Web Shell → Web UI: hosts · The browser shell presents the web UI.
- Web Shell → Message Bridge: embeds · The browser container includes the integration layer for Unity communication.
- Web UI → Message Bridge: user actions · User interactions and configuration are sent from the browser UI to Unity.
- Message Bridge → Unity Runtime: commands · Browser-originated control messages are delivered to the Unity runtime.
- Unity Runtime → Message Bridge: state events · Unity publishes game state and interaction feedback back to the browser.
- Message Bridge → Web UI: updates · Returned state and feedback update the browser UI.
- Unity Runtime → Game Content: runs · The engine executes the embedded interactive experience.
