# iwnuplynottyan/lura architecture

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

- Interactive diagram: https://gitdiagram.com/iwnuplynottyan/lura
- Repository: https://github.com/iwnuplynottyan/lura

## Overview

##### Project type and purpose
- Lura is a single‐binary, CLI turn‐based roguelike game written in Go, with support for user‐supplied mods in Lua.
- It provides a text‐based game loop (explore, fight, dialog, buffs), RNG‐driven mechanics, and a debug console.

##### File structure
- Top‐level Go source files encapsulate the core engine:
- main.go – bootstrap, argument parsing (–debug), entry into game loop
- data.go – model definitions for monsters, weapons, maps (assets/)
- rng.go – random number generator service
- fight.go, dialog.go, buffs.go – key gameplay subsystems
- mods.go – plugin manager for loading/applying Lua mods
- debug.go – REPL‐style debug console overlay
- template – packaging template for Void Linux
- assets/ holds plain‐text maps or scenes (forest.txt, cave.txt)
- Build & deployment files: go.mod/go.sum, Makefile, justfile, flake.nix, shell.nix, PKGBUILD

##### README for additional insights
- Describes installation methods across OS (Windows, Arch, Nix, Void)
- Documents the mod folder location, Lua API (Monster.new, Weapon.new, removeByName)
- Notes the font dependency (Nerd Fonts)
- Emphasizes debug flag and commands

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        CLI["CLI Interface/Renderer"]:::ui
    end

    %% Control Layer
    subgraph "Control Layer"
        Loop["Game Loop & Controller"]:::control
        Debug["Debug Console"]:::control
    end

    %% Core Logic
    subgraph "Core Logic"
        Fight["Fight Engine"]:::core
        Dialog["Dialog Engine"]:::core
        Buffs["Buff System"]:::core
    end

    %% Services
    subgraph "Services"
        Data["Data & Asset Loader"]:::service
        RNG["RNG Service"]:::service
        Mods["Mod System (Lua VM)"]:::service
    end

    %% Development Tools
    subgraph "Build & Deployment Pipeline"
        Makefile["Makefile"]:::tools
        Justfile["justfile"]:::tools
        Flake["flake.nix"]:::tools
        Shell["shell.nix"]:::tools
        PKGBUILD["PKGBUILD"]:::tools
        Template["template"]:::tools
    end

    %% Relationships
    CLI -->|"input"| Loop
    Loop -->|"render"| CLI

    Loop -->|"delegate turns"| Fight
    Loop -->|"delegate turns"| Dialog
    Loop -->|"delegate turns"| Buffs

    Fight -->|"random outcomes"| RNG
    Dialog -->|"random outcomes"| RNG
    Buffs -->|"random outcomes"| RNG

    Loop -->|"load data at startup"| Data
    Fight -->|"load data on start"| Data
    Dialog -->|"load data on start"| Data
    Buffs -->|"load data on start"| Data

    Loop -->|"apply mods at startup"| Mods
    Data -->|"check overrides"| Mods
    Fight -->|"mod hooks"| Mods
    Dialog -->|"mod hooks"| Mods
    Buffs -->|"mod hooks"| Mods

    CLI -->|"–debug flag"| Debug
    Debug -.->|"intercept commands"| Loop

    Makefile -->|"build binary"| CLI
    Justfile -->|"build binary"| CLI
    Flake -->|"build binary"| CLI
    Shell -->|"build binary"| CLI
    PKGBUILD -->|"build binary"| CLI
    Template -->|"build binary"| CLI

    %% Click Events
    click CLI "https://github.com/iwnuplynottyan/lura/blob/main/main.go"
    click Loop "https://github.com/iwnuplynottyan/lura/blob/main/main.go"
    click Fight "https://github.com/iwnuplynottyan/lura/blob/main/fight.go"
    click Dialog "https://github.com/iwnuplynottyan/lura/blob/main/dialog.go"
    click Buffs "https://github.com/iwnuplynottyan/lura/blob/main/buffs.go"
    click RNG "https://github.com/iwnuplynottyan/lura/blob/main/rng.go"
    click Data "https://github.com/iwnuplynottyan/lura/blob/main/data.go"
    click Data "https://github.com/iwnuplynottyan/lura/tree/main/assets/"
    click Mods "https://github.com/iwnuplynottyan/lura/blob/main/mods.go"
    click Debug "https://github.com/iwnuplynottyan/lura/blob/main/debug.go"
    click Makefile "https://github.com/iwnuplynottyan/lura/tree/main/Makefile"
    click Justfile "https://github.com/iwnuplynottyan/lura/tree/main/justfile"
    click Flake "https://github.com/iwnuplynottyan/lura/blob/main/flake.nix"
    click Shell "https://github.com/iwnuplynottyan/lura/blob/main/shell.nix"
    click PKGBUILD "https://github.com/iwnuplynottyan/lura/tree/main/PKGBUILD"
    click Template "https://github.com/iwnuplynottyan/lura/tree/main/template"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef control fill:#87CEEB,stroke:#333,stroke-width:1px;
    classDef core fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef service fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef tools fill:#D3D3D3,stroke:#333,stroke-width:1px;
```
