# achrefelouafi/vfxplayground2gen2threejs architecture

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

- Interactive diagram: https://gitdiagram.com/achrefelouafi/vfxplayground2gen2threejs
- Repository: https://github.com/achrefelouafi/vfxplayground2gen2threejs

## Overview

VFX Shots 2 is a browser-based real-time spell sandbox: players select or aim a spell, cast it into a rune arena, and inspect the rendered result. Its editor supports live tuning, playback scrubbing with deterministic re-simulation, and JSON presets; README also documents showcase and MOBA modes. The map groups the ten spell implementations together while retaining their shared materials, simulation services, arena, and rendering layers. Some subsystem links are based on README or SOURCE INDEX references because their implementation excerpts were not provided.

Main entry points: [`src/core/App.js`](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/App.js) (App orchestration), [`src/abilities/shots`](https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/abilities/shots) (Spell implementations), [`src/main.js`](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/main.js) (Browser entry), [`src/ui/Editor.js`](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/Editor.js) (Spell editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_app["App orchestration<br/>[App.js]"]
  node_input["Input manager<br/>[InputManager.js]"]
  node_camera["Camera rig<br/>[CameraRig.js]"]
  node_main["Browser entry<br/>[main.js]"]
  node_rng["Seeded randomness<br/>[rng.js]"]
end

subgraph group_casting["Spell casting"]
  node_ability_manager["Ability manager<br/>[AbilityManager.js]"]
  node_spell_impl["Spell implementations"]
  node_aim["Aim controller<br/>[AimController.js]"]
end

subgraph group_arena["Arena simulation"]
  node_environment["Environment<br/>[Environment.js]"]
  node_arena["Arena and scenery"]
  node_dummy_field["Training dummies<br/>[DummyField.js]"]
  node_character["Caster animation"]
end

subgraph group_rendering["Rendering"]
  node_spell_materials["Spell geometry and materials"]
  node_particles["Particle systems<br/>[ParticleEngine.js]"]
  node_decals["Ground decals<br/>[GroundDecals.js]"]
  node_post["Post processing<br/>[PostProcessing.js]"]
  node_frame_uniforms["Frame uniforms<br/>[FrameUniforms.js]"]
  node_shaders["Shader utilities"]
  node_renderer["WebGPU renderer<br/>[Renderer.js]"]
end

subgraph group_controls["Controls and tuning"]
  node_settings["Live settings<br/>[settings.js]"]
  node_editor["Spell editor<br/>[Editor.js]"]
  node_presets["Preset manager<br/>[PresetManager.js]"]
  node_hud["HUD<br/>[HUD.js]"]
end

node_player(("Player"))

node_player -->|"opens app"| node_main
node_main -->|"starts"| node_app
node_main -->|"creates"| node_hud
node_app -->|"creates"| node_input
node_app -->|"creates"| node_camera
node_app -->|"builds"| node_environment
node_app -->|"creates"| node_dummy_field
node_app -->|"loads"| node_character
node_player -->|"controls"| node_input
node_player -->|"tunes spells"| node_editor
node_editor -->|"edits"| node_settings
node_editor -->|"uses"| node_presets
node_player -->|"aims cast"| node_aim
node_app -.->|"casts through"| node_ability_manager
node_ability_manager -->|"dispatches"| node_spell_impl
node_spell_impl -->|"uses"| node_spell_materials
node_app -->|"reseeds for seek"| node_rng
node_app -->|"assembles"| node_arena
node_environment -->|"creates sky"| node_arena
node_spell_impl -->|"creates decals"| node_decals
node_spell_impl -.->|"emits effects"| node_particles
node_app -->|"initializes"| node_renderer
node_renderer -.->|"composites"| node_post
node_post -->|"reads"| node_frame_uniforms
node_spell_materials -->|"uses shader utilities"| node_shaders
node_spell_impl -->|"reads controls"| node_settings
node_player -->|"selects spell"| node_ability_manager

click node_app "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/App.js"
click node_input "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/input/InputManager.js"
click node_camera "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/CameraRig.js"
click node_ability_manager "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/abilities/AbilityManager.js"
click node_spell_impl "https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/abilities/shots"
click node_spell_materials "https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/materials/shots"
click node_aim "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/input/AimController.js"
click node_settings "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/config/settings.js"
click node_editor "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/Editor.js"
click node_presets "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/PresetManager.js"
click node_hud "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/HUD.js"
click node_environment "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/world/Environment.js"
click node_arena "https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/world"
click node_dummy_field "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/combat/DummyField.js"
click node_character "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/animation/CharacterController.js"
click node_particles "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/particles/ParticleEngine.js"
click node_decals "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/effects/GroundDecals.js"
click node_post "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/postprocessing/PostProcessing.js"
click node_frame_uniforms "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/FrameUniforms.js"
click node_shaders "https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/shaders/tsl"
click node_renderer "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/Renderer.js"
click node_main "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/main.js"
click node_rng "https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/utils/rng.js"

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_app,node_input,node_camera,node_main,node_rng toneBlue
class node_ability_manager,node_spell_impl,node_aim toneAmber
class node_environment,node_arena,node_dummy_field,node_character toneMint
class node_spell_materials,node_particles,node_decals,node_post,node_frame_uniforms,node_shaders,node_renderer toneRose
class node_settings,node_editor,node_presets,node_hud,node_player toneIndigo
```

## Components

### App runtime

- [App orchestration](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/App.js): `src/core/App.js`
- [Input manager](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/input/InputManager.js): `src/input/InputManager.js`
- [Camera rig](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/CameraRig.js): `src/core/CameraRig.js`
- [Browser entry](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/main.js): `src/main.js`
- [Seeded randomness](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/utils/rng.js): `src/utils/rng.js`

### Spell casting

- [Ability manager](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/abilities/AbilityManager.js): `src/abilities/AbilityManager.js`
- [Spell implementations](https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/abilities/shots): `src/abilities/shots`
- [Aim controller](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/input/AimController.js): `src/input/AimController.js`

### Arena simulation

- [Environment](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/world/Environment.js): `src/world/Environment.js`
- [Arena and scenery](https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/world): `src/world`
- [Training dummies](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/combat/DummyField.js): `src/combat/DummyField.js`
- [Caster animation](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/animation/CharacterController.js): `src/animation/CharacterController.js`

### Rendering

- [Spell geometry and materials](https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/materials/shots): `src/materials/shots`
- [Particle systems](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/particles/ParticleEngine.js): `src/particles/ParticleEngine.js`
- [Ground decals](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/effects/GroundDecals.js): `src/effects/GroundDecals.js`
- [Post processing](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/postprocessing/PostProcessing.js): `src/postprocessing/PostProcessing.js`
- [Frame uniforms](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/FrameUniforms.js): `src/core/FrameUniforms.js`
- [Shader utilities](https://github.com/achrefelouafi/vfxplayground2gen2threejs/tree/main/src/shaders/tsl): `src/shaders/tsl`
- [WebGPU renderer](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/core/Renderer.js): `src/core/Renderer.js`

### Controls and tuning

- [Live settings](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/config/settings.js): `src/config/settings.js`
- [Spell editor](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/Editor.js): `src/ui/Editor.js`
- [Preset manager](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/PresetManager.js): `src/ui/PresetManager.js`
- [HUD](https://github.com/achrefelouafi/vfxplayground2gen2threejs/blob/main/src/ui/HUD.js): `src/ui/HUD.js`

### Other components

- **Player**

## Connections

- Player → Browser entry: opens app
- Browser entry → App orchestration: starts (evidence: `src/main.js`)
- Browser entry → HUD: creates (evidence: `src/main.js`)
- App orchestration → Input manager: creates (evidence: `src/core/App.js`)
- App orchestration → Camera rig: creates (evidence: `src/core/App.js`)
- App orchestration → Environment: builds (evidence: `src/core/App.js`)
- App orchestration → Training dummies: creates (evidence: `src/core/App.js`)
- App orchestration → Caster animation: loads (evidence: `src/core/App.js`)
- Player → Input manager: controls
- Player → Spell editor: tunes spells
- Spell editor → Live settings: edits (evidence: `src/ui/Editor.js`)
- Spell editor → Preset manager: uses (evidence: `src/ui/Editor.js`)
- Player → Aim controller: aims cast
- App orchestration → Ability manager: casts through (evidence: `src/core/App.js`)
- Ability manager → Spell implementations: dispatches (evidence: `src/abilities/AbilityManager.js`)
- Spell implementations → Spell geometry and materials: uses (evidence: `src/abilities/shots/BladesAbility.js`)
- App orchestration → Seeded randomness: reseeds for seek (evidence: `src/core/App.js`)
- App orchestration → Arena and scenery: assembles (evidence: `src/core/App.js`)
- Environment → Arena and scenery: creates sky (evidence: `src/world/Environment.js`)
- Spell implementations → Ground decals: creates decals (evidence: `src/abilities/shots/BladesAbility.js`)
- Spell implementations → Particle systems: emits effects
- App orchestration → WebGPU renderer: initializes (evidence: `src/core/App.js`)
- WebGPU renderer → Post processing: composites
- Post processing → Frame uniforms: reads (evidence: `src/postprocessing/PostProcessing.js`)
- Spell geometry and materials → Shader utilities: uses shader utilities (evidence: `src/materials/shots/starfall/StarfallMaterials.js`)
- Spell implementations → Live settings: reads controls (evidence: `src/abilities/shots/BladesAbility.js`)
- Player → Ability manager: selects spell
