WowClassicGrindBot

repository·dev·Indexed 43 days ago

https://github.com/xian55/wowclassicgrindbot

A non-invasive game automation system for World of Warcraft Classic and Legacy clients. It uses a Lua addon to encode game state into pixel colors, which are processed by a .NET 10 backend to simulate player input. Features include a Navmesh engine based on a DotRecast fork for pathfinding and support for various client versions including Vanilla, Burning Crusade, Wrath of the Lich King, Cataclysm, and Mist of Pandaria.

Tokens
49.3K
Snippets
102
Records
209
Agent score
56%

What's inside WowClassicGrindBot

  1. Overview of Web UI Components

    dev

    The Web UI is the primary interface for interacting with the bot, providing configuration, monitoring, and debugging tools. Key components include:

    ComponentPurposeWhen to Use
    ScreenshotVisual feedback of what the bot "sees"Debugging detection issues
    Player SummaryCharacter stats and target infoMonitoring bot state
    RoutePath visualization and navigationCreating/editing grind routes
    GoalShows current AI decision stateUnderstanding bot behavior
    Key BindingsView detected keybindingsVerifying bindings, testing keys
    Spell BookView known spells with IDsFinding spell IDs for profiles
  2. Performance optimization findings for DotRecast navmesh baking

    dev

    This document provides a detailed report on performance optimizations for the DotRecast library (a C# port of Recast) specifically for high-throughput, in-process navmesh baking. The findings are based on a workload of baking a ~34,000 yard world on a user's machine while a 3D application is running.

    Key Performance Gains (Summary):

    • Total warm bake: Reduced from 2515 ms to 1196 ms.
    • Memory Allocation: Reduced from 751 MB to 85 MB.
    • Gen0 Collections: Reduced from 116 to 12.

    Major Optimization Drivers:

    • Span Pooling: Replacing new RcSpan() calls with a pooled struct approach (using int[] column heads and 16-byte structs in pooled pages) significantly reduced allocations and improved RASTERIZE_TRIANGLES performance.
    • Algorithmic Improvements: Replacing full heightfield scans with level-based bucketing in the watershed stage.
    • Type Narrowing: Reducing chf.areas to byte[] and RcCompactSpan to 8 bytes (using bit-packing for con and h properties) improved BUILD_REGIONS stages.
  3. Extract NPC IDs and names using ReadItems

    dev

    The ReadItems utility is used to extract NPC IDs and names from database files.

    Database Compatibility Note:

    • For SoM (Servants of Mithrandir), use the TBC DB files.
    • For Classic, use the Classic DB files.
    • For WOTLK, use the WOTLK DB files.

    To use this utility, you must provide the appropriate .sql database files from the cmangos repositories.

  4. Supported Client Versions

    dev

    The bot supports various versions of World of Warcraft across Legacy and Classic eras:

    Legacy

    • 4.3.4 Cataclysm (2011): Supported
    • 5.4.8 Mist of Pandaria (2013): Not yet playable (pathing/navmesh/data are ready, but addon needs Mists-specific work).

    Classic (Since 2019)

    • 1.13.x Vanilla Classic: Supported
    • 1.14.x Season of Mastery: Supported
    • 1.15.x Era, Hardcore, Anniversary, Season of Discovery: Supported
      • Note: Season of Discovery runes and new abilities are not yet implemented (see issue 559).
    • 2.5.x Burning Crusade: Supported
    • 3.4.x Wrath of the Lich King: Supported
    • 4.4.x Cataclysm: Supported
    • 5.5.x Mist of Pandaria: Not yet playable (same status as 5.4.8).

    Important: Wrath 3.3.5 is not planned because the bot requires the interact with target functionality which is missing in that client and requires client modification.

  5. Phasing of Headless Pathing Server development

    dev

    The development of the Headless Pathing Server follows these phases:

    • P1 — Retarget + carve: Retargeting the pathing chain to net10.0, creating a minimal PathingServer hosting PPatherController + PPatherService, and smoke-testing routes against baked tiles.
    • P2 — Docker + CI: Implementing multi-stage, multi-arch Dockerfiles and GHCR publish Actions (submodule-aware).
    • P3 — Provisioning + polish: Adding an R2-fetch entrypoint option, optional native self-contained RID builds, and an optional split between PPather.Query and PPather.Bake.
    • P4 — macOS bake host: Enabling Apple-silicon machines to act as bake machines (independent of the query server).
  6. Understand the wowclassicgrindbot solution structure

    dev

    The project is organized into three main categories: Hosts, Libraries, and Tools.

    Hosts

    • BlazorServer: The primary web UI based on ASP.NET Core Blazor Server.
    • HeadlessServer: A console application for CLI automation without a UI.
    • PathingAPI: A standalone ASP.NET Core Web API acting as a pathfinding microservice.

    Libraries

    • Core: Contains business logic, bot control, addon readers, databases, DI orchestration, screen analysis, and NPC detection.
    • Frontend: A Razor component library (Leaflet maps, keyboard overlay, etc.) shared across hosts.
    • Game: Windows-specific interaction (process management, DXGI/WGC screen capture, input).
    • SharedLib: Utilities, NPC finder algorithms, image processing, and configuration models.
    • PPather: The in-process pathfinding engine (DotRecast navmesh).
    • DataConfig: Handles expansion-aware data path resolution.
    • WowheadDB: Integration with external game databases.
    • WinAPI: P/Invoke bindings for Windows system calls.

    Tools & Addons

    • Utilities: DBC extraction, navmesh baking, and data processing (not part of the main .sln build).
    • Addons/DataToColor: A Lua addon used to encode game state into pixel colors for C# decoding.
  7. Understand the Lua to C# Data Bridge

    dev

    Since there is no direct memory access, the Lua addon and C# core communicate via pixel color encoding. This is a high-performance bridge that uses:

    • 32-bit integer packing: Data is packed into RGB components as B | (G << 8) | (R << 16).
    • Fixed-point math: Used for sub-meter precision coordinates.
    • UTF-8 encoding: Text is encoded as color values (3 characters per pixel).
    • Sentinel pixels: Used for validating frame integrity.
    • Event-driven caching: Reduces API calls from 56/frame to 5/frame.
  8. Understand the two expression scopes for requirements

    dev

    The bot uses two distinct expression scopes to prevent logic leakage between player-state requirements and creature-state filters. While they share similar syntax, they use different variable tables.

    1. Requirements (Player Scope): Used for standard goal requirements (e.g., "Level < 5" refers to the player's level).
    2. Generate.Mobs (Creature Scope): Used within the route generation logic to filter which mobs to include in a path (e.g., "Level < 5" refers to the creature's level).

    Key Differences:

    • The creature scope includes PlayerLevel as an explicit variable, but does not include player-only variables like Health%.
    • If you use a player-only variable in a Generate.Mobs filter, it will throw a parse-time error rather than failing silently.
    • Log lines for generated paths will print the resolved filter and the matched creature count to help debug these scopes.
  9. Understand what items are mailed

    dev

    The bot follows specific rules to decide which items are eligible for mailing:

    Mailed items must be:

    • Meeting the MinimumItemQuality threshold.
    • Not present in the ExcludedItemIds list.
    • Tradable (not soulbound, not quest items).

    Items that are NEVER mailed:

    • Soulbound items.
    • Quest items.
    • Bind-on-Pickup (BoP) items.
    • Items in the ExcludedItemIds list.
    • Hearthstones (it is recommended to add Hearthstone ID 6948 to your exclusion list).
  10. Use IntVariables for complex logic and aura tracking

    dev

    IntVariables allow you to define global integer or integer array variables within the class configuration scope.

    Aura Tracking: Using the prefix Buff_, Debuff_, TDebuff_, TBuff_, or FBuff_ allows you to track icon IDs. If you provide an array of IDs, the variable evaluates to the maximum remaining time across all IDs in that array. This is useful for checking if any of a set of debuffs/buffs is active.

    Example usage in Requirements: If Debuff_POISON is defined as an array of icon IDs, you can use: "Debuff_POISON > 1" to check if any poison is active.

    "IntVariables": {
        "DOT_MIN_HEALTH%": 35,
        "TDebuff_Frost Fever": 237522,
        "Debuff_POISON": [136006, 136007, 136016, 136064, 136067, 136077, 136093, 134437, 132273, 132274, 132105],
        "Debuff_DISEASE": [136127, 136134, 134324, 135914]
    }
    
    // Requirement usage:
    "Requirements": ["Debuff_POISON > 1 || Debuff_DISEASE > 1"]
  11. Understand the DotRecast fork in WowClassicGrindBot

    dev

    WowClassicGrindBot uses a custom fork of DotRecast (Xian55/DotRecast @ wow-mods) to handle navmesh generation.

    Unlike standard Recast workloads which are typically baked offline on build servers, this bot requires navmeshes to be baked on the player's local machine upon their first visit to an area, while the game client is simultaneously running. The fork is specifically optimized for this high-pressure, real-time constraint, focusing on reducing CPU time, memory allocation, and Garbage Collection (GC) pressure.

  12. Use CanRun requirements for action priority

    dev

    The CanRun:_KeyAction_Name_ requirement allows you to check if a specific KeyAction (identified by its Name) is currently eligible to be executed. This is useful for interrupt logic or prioritizing instant spells over long cast times.

    // Example: Only allow this action if 'Frost Shock' is not currently running/castable
    "Requirement": "!CanRun:Frost Shock"
    
    // Example: Allow if 'Fire Blast' can be run
    "Requirement": "CanRun:Fire Blast"