How bnanz0/ok-duet-night-abyss works
1. Overall purpose
- This repository is a Windows-based Python automation tool for the game *Duet Night Abyss*.
- It does not inject into the game; the automation loop works by reading screen/UI state and sending simulated input, including support for background operation.
2. Core architecture style
- The code is organized around a task-driven automation engine.
- High-level tasks decide what to do next, while lower-level modules provide scene recognition, combat checks, character interaction, and input-triggered behaviors.
- The design is modular enough to support built-in automation and externally packaged “Mod” logic.
3. Entry points and runtime
- main.py is the normal launcher; main_debug.py is the verbose/debug launcher.
- The project targets Python 3.12 on Windows, and the README indicates the game should run at 1600×900 or higher for reliable image matching.
- Packaging and distribution are supported through GitHub releases and PyAppify-related configuration.
4. Task orchestration layer
- src/tasks is the main orchestration boundary.
- It contains specialized automation flows such as:
- general automation and exploration
- escort, fishing, excavation, expulsion, defense, hedge, skill use
- commission handling and one-time DNA tasks
- Subpackages split execution styles:
- fullauto for end-to-end autonomous loops
- trigger for reactive, condition-driven behaviors
- This is the primary place where the bot decides “what mode am I in?” and “what sequence should run now?”
5. Base task abstractions
- Shared task behavior appears to live in:
- BaseCombatTask
- BaseDNATask
- BaseListenerTask
- These likely define lifecycle, polling, state transitions, and the integration points between detection, combat, and input handling.
- CommissionsTask, DNAOneTimeTask, and similar classes are concrete flows built on those base abstractions.
6. Scene recognition and state detection
- src/scene/DNAScene.py is the most explicit scene module and likely encapsulates UI/state recognition for the game.
- assets/coco_annotations.json and the image assets indicate an image-recognition pipeline driven by reference screenshots or annotations.
- src/process_feature.py and src/globals.py suggest shared feature extraction / state context used across tasks.
7. Combat and character domain
- src/combat/CombatCheck.py handles combat-state detection or readiness checks.
- src/char/BaseChar.py suggests character-specific logic, likely abstracting skills, actions, or character capabilities.
- src/LabelEnum.py probably centralizes recognition labels used by detection and decision-making code.
8. Configuration and task parameters
- src/config.py is the global configuration boundary.
- Task-specific configuration is separated under src/tasks/config, including commission and skill-related settings.
- This separation implies the runtime behavior is shaped by user-facing configuration rather than hardcoded mode-specific values.
9. Mod/extensibility model
- The mod directory is a first-class extension mechanism.
- It includes built-in path definitions such as escort_paths.json and puzzle_paths.json, plus example community content with scripts and map assets.
- The README confirms users can drop external mods into mod/ and restart to load them, so the architecture explicitly supports pluggable automation logic and custom recognition materials.
10. Internationalization and assets
- The i18n directory contains compiled and source message catalogs for multiple locales: English, Chinese, Japanese, Korean, Spanish, and Traditional Chinese.
- This suggests the UI or logs are localized, while the automation logic remains language-aware through these catalogs.
- assets/images, icons, and annotation files are part of the recognition and packaging pipeline.
11. Testing and validation
- tests/TestMissonInterface.py and tests/images indicate automated validation around mission/UI recognition.
- The presence of GitHub workflows for build, test, stale cleanup, and release notes implies CI is used to verify packaging and basic behavior.
12. Important architectural boundary
- The main boundary in this repo is between:
- screen/state understanding via image recognition and scene checks
- decision logic in tasks and triggers
- action execution via simulated inputs and background-compatible interaction
- For an architecture diagram, the central flow is: game screen → recognition/state modules → task/trigger logic → input/output actions → back to game screen, with mod/ and configuration altering the behavior of that loop.
Main entry points: AutoGeneral.py General Auto · trigger Triggers · DNAScene.py DNA Scene · BaseDNATask.py Base Tasks
Components 23
Runtime
Launchers and packaging entrypoints
- main.py · Normal application launcher
main.py - main_debug.py · Verbose/debug launcher
main_debug.py
Automation Core
Task orchestration and execution modes
- General Auto · Top-level automation mode selection and loop control
src/tasks/AutoGeneral.py - Exploration · Free-roam and navigation automation
src/tasks/AutoExploration.py - Defense · Defense mission automation
src/tasks/AutoDefence.py - Excavation · Excavation mission automation
src/tasks/AutoExcavation.py - Expulsion · Expulsion mission automation
src/tasks/AutoExpulsion.py - Hedge · Hedge mission automation
src/tasks/AutoHedge.py - Skill Use · Skill-triggered automation flow
src/tasks/AutoSkill.py - Commissions · Commission handling workflow built on base task logic
src/tasks/CommissionsTask.py - DNA One-Time · One-shot automation flow for specific runs
src/tasks/DNAOneTimeTask.py - Full Auto · End-to-end autonomous task variants and packaged flows
src/tasks/fullauto - Triggers · Condition-driven listeners and in-combat helpers
src/tasks/trigger - Base Tasks · Shared lifecycle and state-machine foundations for automation tasks
src/tasks/BaseDNATask.py
Perception & State
Scene recognition, combat checks, and shared game state
- DNA Scene · Game scene and UI state recognition
src/scene/DNAScene.py - Combat Check · Combat-state and readiness detection
src/combat/CombatCheck.py - State Core · Shared globals, feature extraction, and label vocabulary
src/globals.py - Base Char · Character capability abstraction used by combat and action logic
src/char/BaseChar.py
Extensions & Assets
Mods, localization, and recognition assets
Connections 27
- main.py → General Auto: launches · Starts the normal automation runtime
- main_debug.py → General Auto: launches · Starts the verbose/debug runtime
- General Auto → Base Tasks: extends · Uses shared task lifecycle and state handling
- Base Tasks → Commissions: specializes · Concrete workflow built on base task abstractions
- Base Tasks → DNA One-Time: specializes · Concrete workflow built on base task abstractions
- General Auto → Exploration: routes · Selects exploration mode when roaming/navigation is needed
- General Auto → Defense: routes · Selects defense mission mode
- General Auto → Excavation: routes · Selects excavation mission mode
- General Auto → Expulsion: routes · Selects expulsion mission mode
- General Auto → Hedge: routes · Selects hedge mission mode
- General Auto → Skill Use: routes · Selects skill-driven automation mode
- General Auto → Commissions: routes · Selects commission workflow
- General Auto → DNA One-Time: routes · Selects one-time DNA workflow
- General Auto → Full Auto: routes · Selects end-to-end autonomous variants
- General Auto → Triggers: routes · Selects reactive trigger-driven helpers
- Triggers → Combat Check: depends on · Triggers react to combat and engagement state
- Triggers → Base Char: uses · Character-specific behavior and action handling
- General Auto → DNA Scene: reads · Decision-making depends on scene/UI recognition
- DNA Scene → State Core: shares state · Scene recognition contributes to shared state context
- Combat Check → State Core: shares state · Combat checks consume shared state and labels
- General Auto → Assets: matches against · Uses image templates and annotations for recognition
- DNA Scene → Assets: matches against · Scene detection is driven by reference assets
- mods → Full Auto: extends · Mods provide extra paths and scripted automation content
- mods → Triggers: extends · Mods can add reactive logic or path data
- i18n → General Auto: localizes · Provides translated UI/log strings for runtime
- Tests → DNA Scene: validates · Mission/UI recognition is exercised by tests
- CI/CD → Tests: runs · Workflow executes tests and packaging checks