# hutsell-games/civil-war-strategy architecture

> Architecture diagram of the GitHub repository hutsell-games/civil-war-strategy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hutsell-games/civil-war-strategy
- Repository: https://github.com/hutsell-games/civil-war-strategy

## Overview

##### Game Engine Layer
- Represented by CWSTRAT.BAS (the main game file)

##### Data Storage Components
- ALTLEAD.DAT / CWSLEAD.DAT (leader data)
- HISCORE.CWS (high scores)

##### Configuration Layer
- Configuration files:
- CWS.CFG
- CWS.INI
- ALTMAP.INI

##### Asset Resources
- FACE1-5.VGA (character faces)
- FORT0-2.VGA (fortification graphics)
- MTN.VGA (mountain graphics)

##### System
- Map-related files:
- ALTMAP.GRD
- ALTMAP.BAT
- CITIES.GRD
- Connection to the game engine

##### Core Architecture
- Game engine (CWSTRAT.BAS) in the center
- Other components in logical groups around the core

##### Data Flow
- User input → Game Engine
- Game Engine → Display Output
- Game Engine ↔ Data Storage
- Configuration → Game Engine
- Assets → Game Engine

##### Component Relationships
- Clear dependencies between components
- Critical paths with thicker lines

Special Considerations:

##### QB64 Specific Elements
- QB64 compiler/runtime environment as a foundational layer
- How the BASIC source code compiles to executable

##### Game State Management
- How game state flows between components
- Save/load mechanics with data files

##### Resource Management
- Demonstrate how visual assets are loaded and managed
- Configuration file processing

- Component groupings

Level of Detail:
- Version information (main/minimal-changes branches)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        GE["Game Engine<br/>(CWSTRAT.BAS)"]:::core
    end

    subgraph "Data Storage"
        DS1["Leader Database<br/>(ALTLEAD.DAT/CWSLEAD.DAT)"]:::data
        DS2["High Score System<br/>(HISCORE.CWS)"]:::data
    end

    subgraph "Configuration"
        CF1["Main Config<br/>(CWS.CFG/CWS.INI)"]:::config
        CF2["Map Config<br/>(ALTMAP.INI)"]:::config
    end

    subgraph "Visual Assets"
        VA1["Character Portraits<br/>(FACE1-5.VGA)"]:::asset
        VA2["Fortification Graphics<br/>(FORT0-2.VGA)"]:::asset
        VA3["Terrain Graphics<br/>(MTN.VGA)"]:::asset
        VA4["UI Elements<br/>(CWSICON.VGA)"]:::asset
    end

    subgraph "Map System"
        MS1["Map Data<br/>(ALTMAP.GRD/CITIES.GRD)"]:::map
        MS2["Map Tools<br/>(ALTMAP.BAT)"]:::map
    end

    subgraph "Documentation"
        DOC1["Game Documentation<br/>(CWSDOC.TXT/CWS.TXT)"]:::doc
        DOC2["Development Guidelines"]:::doc
        DOC3["Change History"]:::doc
    end

    subgraph "QB64 Runtime Environment"
        QB["QB64 Compiler/Runtime"]:::runtime
    end

    %% Connections
    GE --> QB
    DS1 <--> GE
    DS2 <--> GE
    CF1 --> GE
    CF2 --> GE
    VA1 --> GE
    VA2 --> GE
    VA3 --> GE
    VA4 --> GE
    MS1 <--> GE
    MS2 --> GE
    DOC1 -.-> GE
    DOC2 -.-> GE
    DOC3 -.-> GE

    %% Click Events
    click GE "https://github.com/hutsell-games/civil-war-strategy/blob/main/CWSTRAT.BAS"
    click DS1 "https://github.com/hutsell-games/civil-war-strategy/blob/main/ALTLEAD.DAT"
    click DS2 "https://github.com/hutsell-games/civil-war-strategy/blob/main/HISCORE.CWS"
    click CF1 "https://github.com/hutsell-games/civil-war-strategy/blob/main/CWS.CFG"
    click CF2 "https://github.com/hutsell-games/civil-war-strategy/blob/main/ALTMAP.INI"
    click VA1 "https://github.com/hutsell-games/civil-war-strategy/blob/main/FACE1.VGA"
    click VA2 "https://github.com/hutsell-games/civil-war-strategy/blob/main/FORT0.VGA"
    click VA3 "https://github.com/hutsell-games/civil-war-strategy/blob/main/MTN.VGA"
    click VA4 "https://github.com/hutsell-games/civil-war-strategy/blob/main/CWSICON.VGA"
    click MS1 "https://github.com/hutsell-games/civil-war-strategy/blob/main/ALTMAP.GRD"
    click MS2 "https://github.com/hutsell-games/civil-war-strategy/blob/main/ALTMAP.BAT"
    click DOC1 "https://github.com/hutsell-games/civil-war-strategy/blob/main/CWSDOC.TXT"
    click DOC2 "https://github.com/hutsell-games/civil-war-strategy/blob/main/dev/CONTRIBUTING.md"
    click DOC3 "https://github.com/hutsell-games/civil-war-strategy/blob/main/dev/changelog.md"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef data fill:#e74c3c,stroke:#c0392b,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black
    classDef asset fill:#2ecc71,stroke:#27ae60,color:white
    classDef map fill:#9b59b6,stroke:#8e44ad,color:white
    classDef doc fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef runtime fill:#34495e,stroke:#2c3e50,color:white
```
