# oakwarrior/deathandtaxes architecture

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

- Interactive diagram: https://gitdiagram.com/oakwarrior/deathandtaxes
- Repository: https://github.com/oakwarrior/deathandtaxes

## Overview

##### Main Project Type and Purpose
- Project Type: Unity game.
- Purpose: DeathAndTaxes is a game released on Steam. Although the code isn’t “perfect,” it’s released open source to serve as a learning resource and inspiration for other developers.
- Key Features: Integration with art assets, narrative content generation (via Articy), a variety of game systems (Core, Desktop, Dialogue, Elevator, Shop, UI, etc.), and support for external libraries like TwitchLib for additional functionality.

##### File Structure to Define Components
- Assets Folder: Contains everything “Unity” related.
- ArticyContent & ArticyImporter: These directories include generated scripts and settings for narrative management coming from articy:draft. They form the narrative data layer that feeds into in-game dialogue, conditions, and events.
- Gizmos and Plugins: These include visual aids, editor utilities, and third-party libraries (such as TwitchLib licensing information) used by the game.
- _Scripts Directory: This is the core of the game’s functionality and is further subdivided into modules:
▫ Core: Contains core managers (GameManager, AudioManager, ProfileManager, SaveManager, etc.).
▫ UI: Handles all user interface elements (DialogueScreen, HUDManager, SpeechBubble, etc.).
▫ Desktop: Manages desktop interactions and objects that appear in that section (with subfolders for objects like Bed, Mirror, etc.).
▫ Dialogue: Contains dialogue management (DialogueManager and related components).
▫ Elevator: Contains components for elevator interactions, notifications, and scene management.
▫ Comic, Shop, Particles, Util, and Bedroom: All specialized modules each responsible for a part of the game’s logic (comic panels presentation, in-game shopping, particle effects, utility functions, and bedroom interactions).
- Other Directories: Packages and ProjectSettings house Unity configuration and dependency info.

- Base Layer – Unity Engine:
- Unity game engine, which acts as the container running the game.
- Narrative & Content Generation:
- ArticyContent and ArticyImporter components, which:
▫ Provide auto-generated scripts (like Dialogue, GlobalVariables, etc.).
▫ Feed narrative data and branching logic into the game.
▫ Communicate with Core and Dialogue modules.
- Core Game Management:
- Core module inside _Scripts (GameManager, AudioManager, SaveManager, etc.) acts as the backbone.
- Gameplay Systems Modules:
- Desktop, Elevator, Bedroom, and Comic: Each module represents distinct game scenes or interactive environments.
▫ Emphasize integration with external input management (InputManager in Core), which aggregates user input.
- Presentation and User Interface:
- UI folder components (DialogueScreen, HUDManager, SpeechBubble, etc.) represent the game’s visual feedback.
▫ Connect these components with both the Core and individual gameplay modules (e.g., Desktop, Elevator) to display game state and interactions.
- External Libraries and Plugins:
- Utility and Helper Systems:
- Util and the various Editor/Gizmos assets: These underpin debugging, editor visualization, and general helper functions.
▫ They support development and are linked to multiple modules, especially during runtime diagnostics.

##### Architectural Principles and Patterns
- Separation of Concerns: The project clearly separates gameplay elements (Desktop, Elevator, Comic, etc.) from core systems and narrative handling.
- Modularization: Each subfolder in _Scripts groups related functionality, making it easier to replace or extend modules.
- Data Flow: Data flows from narrative content (ArticyContent) to game logic (Core, Dialogue) and out to the UI.
- External Dependencies: Note the integration with TwitchLib for network-based or streaming functionalities.

##### Recommended Elements
- Use clear labels for each component. For example:
▫ “Unity Engine / Runtime”
▫ “Core Managers (GameManager, AudioManager, etc.)”
▫ “Articy Content & Importer (Narrative Generator)”
▫ “Gameplay Modules: Desktop, Elevator, Bedroom, Comic, Shop”
▫ “UI Components”
▫ “External Plugins (TwitchLib, etc.)”
▫ Data flow from narrative content to game logic.
▫ Interactions between core managers and gameplay modules.
▫ UI updates triggered by gameplay events.
▫ Each module from the _Scripts folder should be a component.
▫ The relationship between the generated code (Articy content) and the core gameplay systems should be explicitly drawn.

## Diagram (Mermaid)

```mermaid
flowchart TD
    UEngine["Unity Engine / Runtime"]:::engine

    subgraph "Narrative & Content Generation"
        AC["ArticyContent (Generated)"]:::narrative
        AI["ArticyImporter"]:::narrative
    end

    Core["Core Managers (GameManager, AudioManager, etc.)"]:::core

    subgraph "Gameplay Modules"
        DESK["Desktop"]:::gameplay
        ELE["Elevator"]:::gameplay
        BDRM["Bedroom"]:::gameplay
        COM["Comic"]:::gameplay
        SHOP["Shop"]:::gameplay
    end

    UI["UI Components (DialogueScreen, HUDManager, etc.)"]:::ui

    Plugins["External Libraries & Plugins"]:::external

    subgraph "Utility & Helper Systems"
        UTIL["Util"]:::util
        GIZMO["Gizmos"]:::util
    end

    UEngine --> AC
    UEngine --> AI
    UEngine --> Core

    AC -->|"feeds_narrative"| Core
    AI -->|"feeds_narrative"| Core

    Core -->|"updates_state"| UI
    Core -->|"controls"| DESK
    Core -->|"controls"| ELE
    Core -->|"controls"| BDRM
    Core -->|"controls"| COM
    Core -->|"controls"| SHOP

    DESK -->|"triggers_UI"| UI
    ELE -->|"triggers_UI"| UI
    BDRM -->|"triggers_UI"| UI
    COM -->|"triggers_UI"| UI
    SHOP -->|"triggers_UI"| UI

    Plugins -->|"integrates_with"| Core
    Plugins -->|"integrates_with"| UI

    UTIL -->|"supports"| Core
    UTIL -->|"supports"| DESK
    UTIL -->|"supports"| ELE
    UTIL -->|"supports"| BDRM
    UTIL -->|"supports"| COM
    UTIL -->|"supports"| SHOP

    GIZMO -->|"supports"| Core

    click AC "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/ArticyContent"
    click AI "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/ArticyImporter"
    click Core "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Core"
    click DESK "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Desktop"
    click ELE "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Elevator"
    click BDRM "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Bedroom"
    click COM "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Comic"
    click SHOP "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Shop"
    click UI "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/UI"
    click Plugins "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/Plugins"
    click UTIL "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/_Scripts/Util"
    click GIZMO "https://github.com/oakwarrior/deathandtaxes/tree/master/Assets/Gizmos"

    classDef engine fill:#f9c,stroke:#333,stroke-width:2px;
    classDef narrative fill:#bbf,stroke:#333,stroke-width:2px;
    classDef core fill:#ffa,stroke:#333,stroke-width:2px;
    classDef gameplay fill:#cfc,stroke:#333,stroke-width:2px;
    classDef ui fill:#fc9,stroke:#333,stroke-width:2px;
    classDef external fill:#fcc,stroke:#333,stroke-width:2px;
    classDef util fill:#def,stroke:#333,stroke-width:2px;
```
