Skip to content

Comments

Add Codex Arena PvP bot with multibox support and HeroAI combat#18

Draft
Copilot wants to merge 5 commits intoewoogdevfrom
copilot/create-codex-pvp-bot
Draft

Add Codex Arena PvP bot with multibox support and HeroAI combat#18
Copilot wants to merge 5 commits intoewoogdevfrom
copilot/create-codex-pvp-bot

Conversation

Copy link

Copilot AI commented Nov 19, 2025

Implements automated Codex Arena PvP gameplay for 4-account multibox teams. Bot detects arena type, locates enemy spawn, navigates to enemy location, and uses HeroAI for automatic combat targeting.

Implementation

Core Logic (Bots/Codex_PvP_Bot.py)

  • detect_arena_and_spawns(): Identifies map ID and calculates spawn coordinates from agent allegiances
  • wait_for_arena_entry(): Monitors map transitions from outpost (796) to arena instances
  • navigate_to_enemies(): Auto-paths to enemy location using existing pathfinding
  • engage_combat(): Waits in combat area while HeroAI handles targeting and combat
  • handle_loss_or_victory(): Detects outpost return and increments match counter

Spawn Detection

  • Team spawn: Average position of all allied agents
  • Enemy spawn: Average of visible enemies, or map boundary estimation if none visible

Match Flow

def codex_pvp_match_routine(bot: Botting) -> Generator:
    yield from wait_for_arena_entry(bot)
    map_id, team_spawn, enemy_spawn = detect_arena_and_spawns()
    yield from navigate_to_enemies(bot, enemy_spawn)
    yield from engage_combat(bot)  # HeroAI handles targeting
    yield from handle_loss_or_victory(bot)

Combat System

  • Uses HeroAI (upkeep_hero_ai_active=True) for automatic targeting
  • HeroAI targets enemy players and hostile henchmen in PvP
  • No manual targeting logic required - multibox helper system manages combat
  • Bot navigates to combat area and lets HeroAI handle all targeting and skill usage

Multibox Coordination

  • Party management via bot.Multibox.InviteAllAccounts()
  • All accounts run identical logic synchronously
  • HeroAI handles combat for coordinated team fights

UI

  • Real-time status: match count, arena name, spawn coordinates
  • Supports 10 known arena maps (308, 314, 318, 319, 322, 339, 340, 343, 353, 354)

Files

  • Bots/Codex_PvP_Bot.py: 318 lines, main implementation
  • Bots/Codex_PvP_Bot_README.md: User documentation with setup, troubleshooting, technical details
Original prompt

make a bot that plays the Codex PvP mode in Guild Wars1. We will use the multi box library and run with four accounts. The issue is that codex has different random arenas. Once in the arena the bot will need to detect the arena, detect the players team/spawn location, then move on a path to the other teams location to kill them. It should also be able to handle a loss, where we are reset back to the Codex Arena outpost.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 19, 2025 11:47
Co-authored-by: Ewoog <72410352+Ewoog@users.noreply.github.com>
Co-authored-by: Ewoog <72410352+Ewoog@users.noreply.github.com>
Copilot AI changed the title [WIP] Add bot for Codex PvP mode in Guild Wars 1 Add Codex Arena PvP bot with multibox support and dynamic arena detection Nov 19, 2025
Copilot AI requested a review from Ewoog November 19, 2025 11:53
@Ewoog
Copy link
Owner

Ewoog commented Nov 19, 2025

@copilot what information do you need from me to complete this project? (MapIDs, Paths, Coords)

Copy link
Author

Copilot AI commented Nov 19, 2025

@copilot what information do you need from me to complete this project? (MapIDs, Paths, Coords)

The current implementation uses dynamic detection and auto-pathing, which should work for basic functionality. However, to make the bot more reliable and efficient, the following information would be helpful for each Codex arena:

For each arena (308, 314, 318, 319, 322, 339, 340, 343, 353, 354):

  1. Team Spawn Coordinates - Exact starting positions for each team (e.g., Red team spawn, Blue team spawn)

    • Format: (x, y) coordinates
  2. Enemy Spawn Coordinates - Where the opposing team spawns

    • Format: (x, y) coordinates
  3. Optimal Paths - Predefined waypoint paths from team spawn to enemy spawn

    • Format: [(x1, y1), (x2, y2), (x3, y3), ...] like in other bots
    • This avoids pathing errors and ensures efficient routes
  4. Strategic Positions (optional) - Key positions for combat advantage

    • Choke points, high ground, flag locations (if applicable)
  5. Map-Specific Notes (optional)

    • Obstacles to avoid
    • Best engagement positions
    • Arena layout quirks

Example format needed:

ARENA_DATA = {
    308: {  # Ascalon Arena
        "name": "Ascalon Arena",
        "team_spawns": {"red": (x1, y1), "blue": (x2, y2)},
        "paths": {
            "red_to_blue": [(x1, y1), (x3, y3), ..., (x2, y2)],
            "blue_to_red": [(x2, y2), (x4, y4), ..., (x1, y1)]
        }
    },
    # ... other arenas
}

Without this data, the bot will continue using:

  • Dynamic spawn detection from ally/enemy positions
  • Auto-pathing system (which may have issues in PvP arenas)
  • Estimated enemy locations from map boundaries

Which specific arenas do you want to prioritize? I can update the bot to use predefined data once you provide coordinates for one or more arenas.

@Ewoog
Copy link
Owner

Ewoog commented Nov 19, 2025

@copilot for ease of use, can we removing the targeting and combat logic and just use the Multibox helper in the Botting class. HeroAI now targets players and hostile henchman so it would work here.

Co-authored-by: Ewoog <72410352+Ewoog@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 19, 2025

@copilot for ease of use, can we removing the targeting and combat logic and just use the Multibox helper in the Botting class. HeroAI now targets players and hostile henchman so it would work here.

Done in commit 455f107. Changes made:

  1. Switched to HeroAI: Changed from upkeep_auto_combat_active=True to upkeep_hero_ai_active=True
  2. Simplified combat logic: Removed all manual targeting code (GetEnemyAttacking, distance calculations, approach logic)
  3. Updated engage_combat(): Now just waits in the combat area while HeroAI handles all targeting and skill usage
  4. Updated documentation: README now reflects that HeroAI handles combat against enemy players and henchmen

The bot now:

  • Navigates to enemy spawn area
  • Waits there while HeroAI automatically targets and fights enemies
  • Still handles death checks and match end detection
  • Uses multibox helper system as intended

This makes the code cleaner and leverages HeroAI's PvP targeting capabilities.

Copilot AI changed the title Add Codex Arena PvP bot with multibox support and dynamic arena detection Add Codex Arena PvP bot with multibox support and HeroAI combat Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants