# loreanxavier/pt-pc architecture

> Architecture diagram of the GitHub repository loreanxavier/pt-pc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/loreanxavier/pt-pc
- Repository: https://github.com/loreanxavier/pt-pc

## Overview

P.T. for PC is a native Vulkan port that rebuilds the teaser’s game logic and loads assets from the player’s own game files. The principal workflow is startup and input, game-step control, stage and asset loading, then scene rendering and UI/audio presentation. The repository also contains substantial support for mods, settings, voice recognition, graphics options, and optional VR. Some runtime links are documented or named but their call sites were not sampled; those links are marked unverified rather than asserted as observed.

Main entry points: [`src/game/game.cpp`](https://github.com/loreanxavier/pt-pc/blob/main/src/game/game.cpp) (Game State), [`src/game/stage_manager.cpp`](https://github.com/loreanxavier/pt-pc/blob/main/src/game/stage_manager.cpp) (Stage Manager), [`src/engine/render/scene_renderer.cpp`](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/scene_renderer.cpp) (Scene Renderer), [`src/engine/fs/vfs.cpp`](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/vfs.cpp) (Virtual Filesystem)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_entry["Application Entry<br/>[main.cpp]"]
  node_controller["Game Controller"]
  node_game["Game State<br/>[game.cpp]"]
  node_stages["Stage Manager<br/>[stage_manager.cpp]"]
  node_gameui["Game UI<br/>[game_ui.cpp]"]
  node_input["Input System<br/>[input.cpp]"]
  node_collision["Collision World"]
end

subgraph group_assets["Game Data"]
  node_vfs["Virtual Filesystem<br/>[vfs.cpp]"]
  node_archives["Game Archives<br/>[psarc.cpp]"]
  node_mods["Mod Overrides<br/>[mods.cpp]"]
  node_models["Model Cache<br/>[model_cache.cpp]"]
  node_textures["Texture Manager"]
end

subgraph group_graphics["Graphics"]
  node_renderer["Scene Renderer<br/>[scene_renderer.cpp]"]
  node_vk["Vulkan Context<br/>[vk_context.cpp]"]
  node_upscale["Upscaling<br/>[upscale.cpp]"]
  node_vfx["Visual Effects<br/>[vfx_system.cpp]"]
end

subgraph group_media["Media"]
  node_audio["Sound Engine<br/>[sound_engine.cpp]"]
  node_voice["Voice Recognition"]
end

subgraph group_extensions["Extensions"]
  node_scripts["Lua Mod Scripts<br/>[mod_lua.cpp]"]
  node_vr["OpenXR Host<br/>[xr_host.cpp]"]
  node_updater["Update Check<br/>[update_check.cpp]"]
end

node_player(("Player"))
node_microphone(("Microphone"))
node_openxr["OpenXR Runtime"]
node_release_service["Release Service"]

node_player -.->|"starts game"| node_entry
node_entry -.->|"runs game"| node_controller
node_player -.->|"provides controls"| node_input
node_controller -->|"updates"| node_game
node_controller -->|"updates UI"| node_gameui
node_game -.->|"requests stages"| node_stages
node_stages -->|"reads files"| node_vfs
node_stages -->|"loads models"| node_models
node_stages -.->|"builds collision"| node_collision
node_vfs -.->|"reads archives"| node_archives
node_vfs -.->|"applies overrides"| node_mods
node_models -.->|"reads assets"| node_vfs
node_models -.->|"loads textures"| node_textures
node_game -.->|"submits scene"| node_renderer
node_renderer -->|"renders with"| node_vk
node_renderer -->|"upscales frames"| node_upscale
node_renderer -.->|"applies effects"| node_vfx
node_game -.->|"plays sound"| node_audio
node_microphone -.->|"provides speech"| node_voice
node_game -.->|"uses recognition"| node_voice
node_game -.->|"runs mod scripts"| node_scripts
node_player -.->|"enters VR"| node_vr
node_vr -.->|"uses runtime"| node_openxr
node_entry -.->|"checks updates"| node_updater
node_updater -.->|"checks releases"| node_release_service

click node_entry "https://github.com/loreanxavier/pt-pc/blob/main/src/main.cpp"
click node_controller "https://github.com/loreanxavier/pt-pc/blob/main/src/game/game_controller.cpp"
click node_game "https://github.com/loreanxavier/pt-pc/blob/main/src/game/game.cpp"
click node_stages "https://github.com/loreanxavier/pt-pc/blob/main/src/game/stage_manager.cpp"
click node_gameui "https://github.com/loreanxavier/pt-pc/blob/main/src/game/ui/game_ui.cpp"
click node_input "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/platform/input.cpp"
click node_vfs "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/vfs.cpp"
click node_archives "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/psarc.cpp"
click node_mods "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/mods.cpp"
click node_models "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/model_cache.cpp"
click node_textures "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/texture_manager.cpp"
click node_collision "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/physics/collision_world.cpp"
click node_renderer "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/scene_renderer.cpp"
click node_vk "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/vk_context.cpp"
click node_upscale "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/upscale/upscale.cpp"
click node_vfx "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/vfx/vfx_system.cpp"
click node_audio "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/audio/sound_engine.cpp"
click node_voice "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/voice/voice_recognizer.cpp"
click node_scripts "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/script/mod_lua.cpp"
click node_vr "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/xr/xr_host.cpp"
click node_updater "https://github.com/loreanxavier/pt-pc/blob/main/src/engine/platform/update_check.cpp"

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_controller,node_game,node_stages,node_gameui,node_input,node_collision toneBlue
class node_vfs,node_archives,node_mods,node_models,node_textures toneAmber
class node_renderer,node_vk,node_upscale,node_vfx toneMint
class node_audio,node_voice toneRose
class node_scripts,node_vr,node_updater,node_player,node_microphone,node_openxr,node_release_service toneIndigo
```

## Components

### Game Runtime

- [Application Entry](https://github.com/loreanxavier/pt-pc/blob/main/src/main.cpp): `src/main.cpp`
- [Game Controller](https://github.com/loreanxavier/pt-pc/blob/main/src/game/game_controller.cpp): `src/game/game_controller.cpp`
- [Game State](https://github.com/loreanxavier/pt-pc/blob/main/src/game/game.cpp): `src/game/game.cpp`
- [Stage Manager](https://github.com/loreanxavier/pt-pc/blob/main/src/game/stage_manager.cpp): `src/game/stage_manager.cpp`
- [Game UI](https://github.com/loreanxavier/pt-pc/blob/main/src/game/ui/game_ui.cpp): `src/game/ui/game_ui.cpp`
- [Input System](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/platform/input.cpp): `src/engine/platform/input.cpp`
- [Collision World](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/physics/collision_world.cpp): `src/engine/physics/collision_world.cpp`

### Game Data

- [Virtual Filesystem](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/vfs.cpp): `src/engine/fs/vfs.cpp`
- [Game Archives](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/psarc.cpp): `src/engine/fs/psarc.cpp`
- [Mod Overrides](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/fs/mods.cpp): `src/engine/fs/mods.cpp`
- [Model Cache](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/model_cache.cpp): `src/engine/render/model_cache.cpp`
- [Texture Manager](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/texture_manager.cpp): `src/engine/render/texture_manager.cpp`

### Graphics

- [Scene Renderer](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/scene_renderer.cpp): `src/engine/render/scene_renderer.cpp`
- [Vulkan Context](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/vk_context.cpp): `src/engine/render/vk_context.cpp`
- [Upscaling](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/render/upscale/upscale.cpp): `src/engine/render/upscale/upscale.cpp`
- [Visual Effects](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/vfx/vfx_system.cpp): `src/engine/vfx/vfx_system.cpp`

### Media

- [Sound Engine](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/audio/sound_engine.cpp): `src/engine/audio/sound_engine.cpp`
- [Voice Recognition](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/voice/voice_recognizer.cpp): `src/engine/voice/voice_recognizer.cpp`

### Extensions

- [Lua Mod Scripts](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/script/mod_lua.cpp): `src/engine/script/mod_lua.cpp`
- [OpenXR Host](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/xr/xr_host.cpp): `src/engine/xr/xr_host.cpp`
- [Update Check](https://github.com/loreanxavier/pt-pc/blob/main/src/engine/platform/update_check.cpp): `src/engine/platform/update_check.cpp`

### Other components

- **Player**
- **Microphone**
- **OpenXR Runtime**
- **Release Service**

## Connections

- Player → Application Entry: starts game (evidence: `README.md`)
- Application Entry → Game Controller: runs game
- Player → Input System: provides controls (evidence: `README.md`)
- Game Controller → Game State: updates (evidence: `src/game/game_controller.cpp`)
- Game Controller → Game UI: updates UI (evidence: `src/game/game_controller.cpp`)
- Game State → Stage Manager: requests stages
- Stage Manager → Virtual Filesystem: reads files (evidence: `src/game/stage_manager.cpp`)
- Stage Manager → Model Cache: loads models (evidence: `src/game/stage_manager.cpp`)
- Stage Manager → Collision World: builds collision
- Virtual Filesystem → Game Archives: reads archives
- Virtual Filesystem → Mod Overrides: applies overrides
- Model Cache → Virtual Filesystem: reads assets
- Model Cache → Texture Manager: loads textures
- Game State → Scene Renderer: submits scene
- Scene Renderer → Vulkan Context: renders with
- Scene Renderer → Upscaling: upscales frames
- Scene Renderer → Visual Effects: applies effects
- Game State → Sound Engine: plays sound (evidence: `README.md`)
- Microphone → Voice Recognition: provides speech (evidence: `README.md`)
- Game State → Voice Recognition: uses recognition (evidence: `README.md`)
- Game State → Lua Mod Scripts: runs mod scripts (evidence: `README.md`)
- Player → OpenXR Host: enters VR (evidence: `README.md`)
- OpenXR Host → OpenXR Runtime: uses runtime (evidence: `README.md`)
- Application Entry → Update Check: checks updates (evidence: `README.md`)
- Update Check → Release Service: checks releases (evidence: `README.md`)
