# jnnshschl/ameisennavigation architecture

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

- Interactive diagram: https://gitdiagram.com/jnnshschl/ameisennavigation
- Repository: https://github.com/jnnshschl/ameisennavigation

## Overview

##### Main Components
- Navigation Server Module – This is found under “AmeisenNavigation.Server” and is responsible for receiving TCP requests, managing configurations, logging events, and orchestrating navigation tasks.
- Core Navigation Library – The “AmeisenNavigation” project folder provides the central pathfinding logic, including client definitions, helper functions, navigation sources (which support different MMAP formats), and smoothing algorithms (found under Smoothing, Utils, and NavSources directories).
- Data Exporter – “AmeisenNavigation.Exporter” contains code to extract and convert WoW navigation data (including modules like Mpq, Wow, and custom processors) into a format the navigation library can use.
- Asset Packager – “AmeisenNavigation.Pack” appears to be responsible for packaging or bundling assets (using components like miniz) needed by the navigation server.
- Tester/Client UI – “AmeisenNavigation.Tester” is a C# project utilizing XAML which likely provides a graphical test client or a debugging interface to interact with the navigation server.
- External Libraries – The project depends on several external libraries:
o recastnavigation (including Detour and Recast components) for mesh generation and pathfinding computations.
o AnTCP library (found in the “dep/AnTCP.Server” folder) to implement TCP-based communication.
o StormLib used (from the “dep/StormLib” folder) possibly in handling WoW-specific file formats.

##### Out Relationships and Interactions
- The Tester communicates with the Navigation Server through a TCP connection (facilitated by the AnTCP library) to initiate pathfinding requests and retrieve results.
- The Server uses configurations (from its Config folder), and logs (from its Logging module) before delegating tasks to the core navigation library.
- The Core Navigation Library is central; it interacts with:
o Various navigation sources provided under NavSources (both Anp and Mmap formats) to load and process world data.
o Smoothing algorithms (Bezier, Chaikin, Catmull-Rom) to smooth out raw path data.
o Helper utilities and client state management.
- The Exporter runs as a separate utility to ingest raw WoW data (possibly from Mpq reading and Wow-specific modules) and export it in a usable format.
- The Packager provides additional support to bundle these assets (maybe compress and prepare files) for server loading.
- The recastnavigation integration (with Detour and Recast components) supplies the underlying algorithms for mesh construction and spatial queries.

##### Architectural Patterns and Design Principles
- Layered/Modular Architecture: Separate projects for server, exporter, core navigation, and tester indicate a clear separation of concerns.
- Reusability & Extensibility: The distinct libraries (navigation processors, smoothing techniques, navigation sources) showcase the modular design that could be extended (e.g., integrating new MMAP formats or adding Flying Path Generation).
- Dependency Injection & Loose Coupling: Although not explicitly stated, the design hints that components such as configuration management, logging, and navigation computation are abstracted to support flexibility.
- Use of External Libraries: Third-party dependencies (AnTCP, recastnavigation, StormLib) provide critical functionality and suggest integrating these as clearly defined external services/modules.

##### Putting It All Together
– Display side components: the Exporter and Packager feeding processed navigation data into the core library.
– Show the integration of external libraries (AnTCP for TCP communication; recastnavigation with its Detour/Recast for mesh/path computations; StormLib for file operations) into the server or processing components.
– Ensure there is a clear flow between the modules and annotate any critical configuration or dependency injection flows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Communication Layer
    subgraph "Communication Layer"
        T["Tester: AmeisenNavigation.Tester"]:::client
    end

    %% Service Layer
    subgraph "Service Layer"
        NS["Navigation Server: AmeisenNavigation.Server"]:::server
        CFG["Config (Server)"]:::server
        LOG["Logging (Server)"]:::server
    end

    %% Data Preparation Layer
    subgraph "Data Preparation Layer"
        EXP["Data Exporter: AmeisenNavigation.Exporter"]:::dataprep
        PKG["Asset Packager: AmeisenNavigation.Pack"]:::dataprep
    end

    %% Processing Layer
    subgraph "Processing Layer"
        CL["Core Navigation Library: AmeisenNavigation"]:::processing
    end

    %% External Dependencies
    subgraph "External Dependencies"
        RC["recastnavigation (Detour & Recast)"]:::external
        AT["AnTCP Library"]:::external
        ST["StormLib"]:::external
    end

    %% Flow of information
    T -->|"TCPRequest"| NS
    NS -->|"uses"| CFG
    NS -->|"logs"| LOG
    NS -->|"delegates"| CL
    EXP -->|"exports"| CL
    PKG -->|"packages"| CL
    CL -->|"mesh_compute"| RC
    NS -->|"tcp_handle"| AT
    EXP -->|"file_ops"| ST

    %% Click Events
    click T "https://github.com/jnnshschl/ameisennavigation/blob/master/AmeisenNavigation.Tester"
    click NS "https://github.com/jnnshschl/ameisennavigation/blob/master/AmeisenNavigation.Server"
    click CFG "https://github.com/jnnshschl/ameisennavigation/tree/master/AmeisenNavigation.Server/src/Config"
    click LOG "https://github.com/jnnshschl/ameisennavigation/tree/master/AmeisenNavigation.Server/src/Logging"
    click CL "https://github.com/jnnshschl/ameisennavigation/tree/master/AmeisenNavigation/src"
    click EXP "https://github.com/jnnshschl/ameisennavigation/tree/master/AmeisenNavigation.Exporter/src"
    click PKG "https://github.com/jnnshschl/ameisennavigation/tree/master/AmeisenNavigation.Pack/src"
    click RC "https://github.com/jnnshschl/ameisennavigation/tree/master/recastnavigation"
    click AT "https://github.com/jnnshschl/ameisennavigation/blob/master/dep/AnTCP.Server"
    click ST "https://github.com/jnnshschl/ameisennavigation/tree/master/dep/StormLib"

    %% Styles
    classDef client fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef server fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef dataprep fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef processing fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
```
