# academicdog/onmyoji_bot architecture

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

- Interactive diagram: https://gitdiagram.com/academicdog/onmyoji_bot
- Repository: https://github.com/academicdog/onmyoji_bot

## Overview

- GUI → Automation Modules → Core Control Layer
- Core Control Layer → Image Processing → Game Interface

- All modules → Utility Layer
- Automation Modules → Core Control Layer

##### Key Technical Elements to Highlight

a. Image Recognition System
- Connection between image_proc.py and screenshots directory
- Pattern matching flow

b. Game Control Flow
- Input/Output between game_ctl.py and the game client
- Scene recognition feedback loop

##### Additional Elements

- Python 3.7 (32-bit)
- Game Client (1136x640 resolution)
- Operating System Requirements

- conf_example.ini
- Requirements.txt

Important Considerations:

##### Keep the focus on the automation workflow
- Image recognition → Game state detection → Action execution

##### Modular design
- Separate automation strategies (explore, mitama, goryou)
- Common utilities and core functionality

##### Multi-mode support
- Single player vs. dual-player modes
- Leader vs. passenger roles

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        GameClient[Game Client]
        Python[Python 3.7 32-bit]
        OS[Operating System]
    end

    subgraph CoreControl
        GameLib[Game Library]:::core
        GameCtl[Game Control]:::core
        ImageProc[Image Processing]:::core
        GameScene[Scene Recognition]:::core
        Fighter[Combat System]:::core
    end

    subgraph Automation
        Explore[Exploration Module]:::auto
        Mitama[Mitama Module]:::auto
        Goryou[Single Fight Module]:::auto
    end

    subgraph UserInterface
        GUI[Tkinter GUI]:::ui
        MainUI[Main UI]:::ui
    end

    subgraph Utilities
        Utils[Utilities]:::util
        LogSystem[Logging System]:::util
        GamePos[Game Position]:::util
    end

    subgraph Config
        ConfFile[Configuration]:::config
        Requirements[Dependencies]:::config
    end

    %% Relationships
    GameClient <--> GameCtl
    Python --> GameLib
    OS --> GameClient

    GameLib --> GameCtl
    GameLib --> ImageProc
    GameLib --> GameScene
    GameLib --> Fighter

    Explore --> GameLib
    Mitama --> GameLib
    Goryou --> GameLib

    GUI --> Explore
    GUI --> Mitama
    GUI --> Goryou
    MainUI --> GUI

    GameCtl --> Utils
    ImageProc --> Utils
    GameScene --> Utils
    Fighter --> Utils
    LogSystem --> Utils
    GamePos --> Utils

    %% Click Events
    click GameLib "https://github.com/AcademicDog/onmyoji_bot/tree/master/gameLib/"
    click GameCtl "https://github.com/AcademicDog/onmyoji_bot/blob/master/gameLib/game_ctl.py"
    click ImageProc "https://github.com/AcademicDog/onmyoji_bot/blob/master/gameLib/image_proc.py"
    click GameScene "https://github.com/AcademicDog/onmyoji_bot/blob/master/gameLib/game_scene.py"
    click Fighter "https://github.com/AcademicDog/onmyoji_bot/blob/master/gameLib/fighter.py"
    click Explore "https://github.com/AcademicDog/onmyoji_bot/tree/master/explore/"
    click Mitama "https://github.com/AcademicDog/onmyoji_bot/tree/master/mitama/"
    click Goryou "https://github.com/AcademicDog/onmyoji_bot/tree/master/goryou/"
    click GUI "https://github.com/AcademicDog/onmyoji_bot/blob/master/gui/tkui.py"
    click MainUI "https://github.com/AcademicDog/onmyoji_bot/blob/master/ui.py"
    click Utils "https://github.com/AcademicDog/onmyoji_bot/blob/master/tools/utilities.py"
    click LogSystem "https://github.com/AcademicDog/onmyoji_bot/blob/master/tools/logsystem.py"
    click GamePos "https://github.com/AcademicDog/onmyoji_bot/blob/master/tools/game_pos.py"
    click ConfFile "https://github.com/AcademicDog/onmyoji_bot/blob/master/conf_example.ini"
    click Requirements "https://github.com/AcademicDog/onmyoji_bot/blob/master/requirements.txt"

    %% Styling
    classDef core fill:#a8d1f0,stroke:#333
    classDef auto fill:#90EE90,stroke:#333
    classDef ui fill:#FFB347,stroke:#333
    classDef util fill:#D3D3D3,stroke:#333
    classDef config fill:#FFE4B5,stroke:#333

    %% Legend
    subgraph Legend
        Core[Core Components]:::core
        Auto[Automation Modules]:::auto
        UIComp[UI Components]:::ui
        UtilComp[Utility Components]:::util
        ConfigComp[Configuration]:::config
    end
```
