Enable AI for player

Mod to enable AI for a player

Information and discussion for custom maps and mods.
Doom2
Posts: 1
Joined: Sat Aug 16, 2025 5:47 pm

Enable AI for player

Post by Doom2 »

Good afternoon.

I would like to make a mod that allows to enable AI for the player. So that the player has AI support. That is, the side is controlled by 2 players.

Is it possible to do this in OpenRA? Does the engine allow it?

If so, how do I do this, and where do I start?
abcdefg30
Posts: 674
Joined: Mon Aug 18, 2014 7:00 pm

Re: Enable AI for player

Post by abcdefg30 »

Hi, unfortunately the engine does not support this.
Vintorez91
Posts: 2
Joined: Sun Oct 11, 2026 8:48 pm

Re: Enable AI for player

Post by Vintorez91 »

I did this just a few days ago with ChatGPT and Codex.

A clarification about my earlier reply: I built a custom control bridge with ChatGPT/Codex, rather than enabling a stock OpenRA bot for a human player.

What we made

The human player remained in control of their side, while Codex could read live game data and send commands to that same side. Normal mouse controls continued to work.
  • A custom C# trait exported snapshots of owned units, visible enemies, resources and production queues.
  • Codex read those snapshots and wrote command requests into a local inbox.
  • The game checked the session, actor ownership, target visibility and whether the requested action was valid.
  • Accepted requests were submitted through OpenRA’s normal World.IssueOrder mechanism.
  • Commands and results were logged so we could check what actually happened.
This allowed assistance with movement, attacks, production and building placement without using screenshots. The controller received the human player’s information, rather than unrestricted spectator data.

You can build this with a coding assistant

The implementation sounds technical, but you do not have to write it all yourself. I described the behaviour I wanted, Codex helped implement it, and we tested it in small steps.

A useful starting prompt would be:
Help me build a local AI-assistance mod for my exact OpenRA release. Keep me in control of my player, export my units and visible enemies to live snapshots, and let an external controller submit validated commands through World.IssueOrder.

Start with moving one owned unit. Then add production, attacks and building placement. Keep the extension separate from stock unit and weapon rules, and include logging, an enable/disable switch and a timeout.
Give the coding assistant access to the corresponding OpenRA source. Start with one working command and expand from there. AI can help write, compile and debug the code, but the resulting behaviour still needs testing.

Implementation starting points

The extension uses a World trait with ITick to export snapshots and process requests. Commands identify actors by ID and are translated into normal OpenRA orders. Requests should be written atomically, validated in-game and checked against later snapshots.

For a more polished assistant, manual commands should take priority and temporarily reserve those units from automated control.

My source snapshot includes AITestControl.cs, AITestTelemetry.cs and AITestHarness.cs:

Source and development code

These are experimental components to adapt, not an assistance mode enabled by the normal Spearhead installer.

Important distinction

The earlier answer is correct regarding standard engine support. My approach is a custom extension for external assistance, not built-in shared control between a human and a stock bot.

It was tested locally. It does not include a complete autonomous strategy controller, and multiplayer synchronization remains untested. Human and external commands can override each other unless you explicitly handle that.

Who is online

Users browsing this forum: Sleipnir and 0 guests