How matrixchung/edautopilot-v2 works
Project type and purpose
• EDAutopilot is a desktop automation tool (an “autopilot bot”) written in Python.
• It uses OpenCV for computer‐vision, DirectInput for sending keystrokes/mouse events, and PyQt‐style .ui files for its GUI.
• Its primary domain is automating Elite:Dangerous Horizons gameplay, especially the Robigo sightseeing mission, with a plugin script architecture.
File structure
• Top‐level entry points:
• gameui.py – loads the GUI, hosts the Script Loader, start/stop buttons.
• scripts/ – a plugin directory of mission scripts (ScriptBase.py, robigo.py, autojumper.py, example.py).
• assets/ – Qt Designer .ui files (main.ui, sub.ui) defining the GUI layout.
• utils/ – core libraries providing services:
• config.py – app and script configuration loading.
• session.py, status.py, journal.py – game session state & persistence.
• directinputs.py – keyboard/mouse injection.
• image.py – OpenCV wrappers (screenshot capture, template matching).
• keybinds.py – parsing game keybind settings.
• utils.py – misc helpers.
• templates/robigo/ – reference images for navigation map matching.
• requirements.txt – Python dependencies (OpenCV, PyQt5, etc.).
• scripts/__init__.py, utils/__init__.py – Python packages.
README for architectural insights
• Mentions a “gameSession API” accessible to scripts.
• Shows a high‐level structure image (GUI → Script Loader → Script → gameSession → utils → DirectInput/OpenCV).
• Emphasizes plugin extensibility via the scripts folder.
Components & their relationships
a. Main components:
1. GUI Layer (gameui.py + assets/*.ui)
2. Script Loader & Plugin Manager (in gameui.py, uses scripts/ScriptBase.py)
3. Script Plugins (scripts/*.py)
4. Core Engine (gameSession API + utils modules)
5. CV Engine (utils/image + templates/…)
6. Input Emulation (utils/directinputs.py)
7. External System: Elite:Dangerous game window
b. Interactions & data flow:
• User clicks “Load Script” in GUI → Script Loader instantiates a ScriptBase subclass.
• Script invokes gameSession API to query current state (session.py, status.py).
• gameSession uses utils/image to grab screenshots and template‐match against templates/ to detect UI elements.
• Based on CV output, gameSession calls directinputs to send keystrokes/mouse.
• The cycle repeats in the script’s main loop; status updates bubble back to the GUI.
c. Architectural patterns & design principles:
• Plugin architecture: ScriptBase interface + dynamic loading of scripts.
• Layered separation: Presentation (GUI), Application (Script Logic), Service (gameSession/utils), Infrastructure (CV, Input).
• Single Responsibility: each utils/*.py module encapsulates one concern (config, image, input).
d. Key technologies & libraries:
• Python 3.x
• OpenCV (cv2) for image processing
• PyQt5 (or PySide2) for GUI, with .ui files designed in Qt Designer
• DirectInput (via custom Python wrapper) for input injection
• Standard libs: threading, logging, configparser, etc.