OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

AI, bot, documentation

Discussion about the game and its default mods.
Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

I like playing Skirmish games in OpenRA - Red Alert mod. I've been doing for a while now but I sometimes wonder:

How and where can I do i need to modify what, in order to:
1 - Adjust the current behaviour for the 4 Red Alert mod AI-bots (Rush, Normal, Turtle, Naval).
2 - Create a brand new, more tougher AI from scratch.
3 - Create "Training AI-bots" for a specific OpenRA (strategic) purpose such as:
Training new players to get familiar with OpenRA , before going online and play against human opponents


So far i've browsed the OpenRA Github wiki and found these - i guess "AI-bot related" - pages:
- https://github.com/OpenRA/OpenRA/wiki - Wiki homepage
- https://github.com/OpenRA/OpenRA/wiki/Hacking - Hacking
>>
- https://github.com/OpenRA/OpenRA/wiki/Hacky-AI - Idea about the OpenRA AI bots
- https://github.com/OpenRA/OpenRA/wiki/A ... Guidelines - AI development guidelines
- https://github.com/OpenRA/OpenRA/wiki/Lua-API - LUA API for scripting purposes
>>
- https://github.com/OpenRA/OpenRAModSDK - SDK for an entire new OpenRA MOD
- https://github.com/OpenRA/OpenRAModSDK/ ... ng-Started - How to get started with a whole new MOD
- https://github.com/OpenRA/OpenRA/wiki/Modding-Guide - General kind of Modding guide


I still have not found any type/form of documentation which shows:
- Internal architecture of the various AI-bots
- Which aspects of an AI-bot is controlled inside which configuration file (if there are any)?
- How the game_engine runs the various AI-bots ?
- How to adapt current AI-bots behaviour ?
- How to create a new AI from scratch ?

QUESTION:
Can anyone help me, by pointing me in the right direction, where and how to start with:
- Current AI-bot behaviour modification?
- Create a new AI-bot from scratch?

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

I have mindmapped out all present variables inside the AI.YAML file and exported the information into a one great overview and saved it as jpg. But.. since the still unknown file-size limit does not allow me to upload a big jpg file, i've put the info into a spread-sheet and converted into a PDF
openra_ai_yaml_parameter_overview_v3.pdf
(57.59 KiB) Downloaded 78 times

Matt
Posts: 1055
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Matt »

See https://docs.openra.net/en/latest/playt ... rbotmodule and the following. Those traits are enabled with the bot type as condition. The result is the current "modular bot" architecture. You can replace any of the modules in mod code which makes it kinda flexible. The architecture is still very monolithic and you will run into trouble when multiple bot controller modules fight over the control of a unit.

https://github.com/OpenHV/OpenHV/blob/m ... /bots.yaml
https://github.com/Dzierzan/OpenSA/blob ... es/ai.yaml

has some examples of slightly customized AI bots.

guerilla
Posts: 2
Joined: Mon Aug 03, 2020 9:20 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by guerilla »

Just read this and an idea popped up in my head. Any chances that someone will implement neuron-network based AI in OpenRA? There are several RTS Games, where OpenAI has learned to be tougher than human by analyzing thousands of replays. This AI wins most of the games, even against PRO-players. These kind of bots would be very good for OpenRa, especially in terms of training.

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

Matt wrote:
Wed Aug 19, 2020 4:32 pm
See https://docs.openra.net/en/latest/playt ... rbotmodule and the following.
Woaw, this is a big improvement from the previous Traits page. thanks for sharing this link!
Those traits are enabled with the bot type as condition. The result is the current "modular bot" architecture.
QUESTION: Is there some sort of graphical overview of the internal architecture from the OpenRA development team themselves?

So Far - these are the only (3rd party) OpenRa Architectural documents I've found online:
1_TU_Delft_OpenRA_game_overview.jpg
1_TU_Delft_OpenRA_game_overview.jpg (70.7 KiB) Viewed 7173 times
..
2_TU_Delft_OpenRA_mods_common_ra.jpg
2_TU_Delft_OpenRA_mods_common_ra.jpg (105.17 KiB) Viewed 7173 times
They belong to a group of TU-Delft students, who used OpenRa for software architecture analysis. You can see their project over here:
-https://delftswa.github.io/chapters/openra/

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

Matt wrote:
Wed Aug 19, 2020 4:32 pm
You can replace any of the modules in mod code which makes it kinda flexible. The architecture is still very monolithic
and you will run into trouble when multiple bot controller modules fight over the control of a unit.
Thanks for the warning Matt.

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

guerilla wrote:
Wed Aug 19, 2020 10:20 pm
Just read this and an idea popped up in my head. Any chances that someone will implement neuron-network based AI in OpenRA?
Now this idea sounds to me like OpenRa with "Next Generation" AI-Bots Guerilla, nice thinking.
guerilla wrote:
Wed Aug 19, 2020 10:20 pm
There are several RTS Games, where OpenAI has learned to be tougher than human by analysing thousands of replays.
This AI wins most of the games, even against PRO-players.
Now where is the fun in playing against an opponent that beats you every time :-} ?
guerilla wrote:
Wed Aug 19, 2020 10:20 pm
These kind of bots would be very good for OpenRa, especially in terms of training.
Again.. nice train(-ing) of thoughts here. This way we could use almost any OpenRA replay in its history for training

IMAGINE (as newcomer or seasoned OpenRA veteran) to be able to:
-train or just play against an AI-Bot with the strength of the current OpenRA Master players ???
-train exactly according to the current OpenRA Academy standard openings (single ref / double ref / warfactory first / ....)
How about that for a massive training enhancement (for newcomers) via a set of build-in - highly customizable training-bots ???

BUT - the other side - I do think the training must be done in such a way that one still can win from it.


OTHER OPTION:
How about an AI-BOT which can learn from:
- yourself (a human player) playing against you, by monitoring the moves you make?
- an entire Multi-player server of humans and bots playing against each-other?
- (a set of) other pre-coded, pre-missioned AI-Bots as "sparring partners" for their own training-purpose?

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

ANOTHER IDEA(2) which drops in my mind right now:

How about having an on-the-fly OpenRA "AI-Bot Creation Wizard" build into the game?
This Wizard can allow human players to fully customize ever aspect of their AI-Bots inside Skirmish games.
Possible AI-Bot parameter setup can be:
- Attack medium(s):
[x] Air, [x] Land, [x]Sea

- Attacking Units:
[x]Infantry, [n] units
[x]Vehicles , [n]units
[x]Fixed Wing Aircraft, [n] units
[x]Helicopters, [n] units
[x]Surface-vessels (boats) [n] units
[x]Sub-surface vessels (submarines) [n] units
[x]SuperWeapons [n] units

- Attack Delay interval / Chosen individual units/ group of units
For example:
- 10 Infantry units start to attack after 5 minutes
- 2 jeeps attack after 10 minutes

- Attack vector(s) to (a) given (human player or AI-bot) target / Chosen units/ Group of units:
For example:
- Infantry units only attack other infantry and aircraft.
- Vehicles can attack base defences and static structures
- Aircraft can attack all air / land / water target

And so on ...
Last edited by Ronald on Thu Aug 20, 2020 12:58 pm, edited 1 time in total.

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

NEXT IDEA(3) AI-BOT MISSION BUILDER
By allowing this "DYNAMIC AI-BOT Creation wizard", one can even take OpenRA AI-bots to an entire next level.
It can enable a kind of OpenRA AI-Bot mission builder like other (real-time combat simulation) games have onboard.
Examples:
- DCS-World and Falcon BMS build in (single) mission builders and campaign design tools:
--https://wiki.hoggitworld.com/view/DCS_mission_editor
--https://pmc.editing.wiki/doku.php?id=falcon4:campaign

- Prepar3d and Microsoft Flight Simulator X - Mission builder tools
-- https://www.fsmissioneditor.com/product ... on-editor/
-- https://www.prepar3d.com/


This would make a great OpenRA Academy training tool too. This tools can allow the ORA teacher-team to create OpenRA training-mission packs for all the different levels of the ORA Academy: For example:
LEVEL - MISSION GOAL:
- Lvl 1 - Build and defend your own base against an incoming attack (over land / air / water) (in n/m/o minutes).
- Lvl 2 - Attack a (little /medium /big) prebuild, pre-defined enemy base on the map (under x minutes).
- Lvl 3 - Achieve total "Map-Resources dominane" across an entire map ("Economic Warfare training) playing against AI-Bots(s).
- Lvl 4 - Play and win a training mission against an RAGL- strength AI-Bot (team? of 1,2,n bots).
and so on...

I wonder what the ORA-trainers-team think of this AI-Bot driven training-mission-building-tool idea?
Last edited by Ronald on Thu Aug 20, 2020 1:00 pm, edited 1 time in total.

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

IDEA[4] Extend the OpenRA Resource Center website

So everyone in the community can upload and share:
- not only their self-created OpenRA maps

but also:
- Self created AI-Bots
- Self created AI-Bot training missions
with the rest of the OpenRA community

guerilla
Posts: 2
Joined: Mon Aug 03, 2020 9:20 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by guerilla »

Yup, these ideas are very interesting, but I think that mission (levels, scenarios) are not as complicated in terms of AI. I mean, you still can make this with a simple code, without using an actual AI.

I am interested in architecture of OpenRA bots. How does the AI actually work?

I am not sure about this, but I suppose that when a human starts game versus bots, there is only one computer-AI, which controls an enemy "player" (buildings, troops, special abilities etc). I also suppose, that the bot has maphack (computer has no fog of war). If such statement is correct, than we face the real problem — AI knows environment and acts of human without actual investigation by troops. I did not see such behaviour in-game, but I think that AI only imitates fog of war by algorithm, and a computer-player have maphack. Thus, it is a cheat. Correct me, if I am wrong. One possible resolution is to add more AI's in-game, which will be separated. For example, Fog of War is implemented and controlled by one algorithm, and the actions of PC-player — by another. Algorithms are separated, so the computer player can not see what human does without investigation. Alien Isolation has such concept, check it out.

I am also interested about AI on the map itself. For example, there are civilians on some maps, or neutral tanks, buildings. Same with badgers. Which AI controls these? The same, which controls an AI-player, right?

Ronald, the thoughts about Wizard and trainings are very interesting. The idea of "undefeatable" AI, in my opinion, works well. If an artificial intelligence is decently human-alike, than you will have no problems by using it during training-session. The problem is, that the current AI may have "cheats". It builds faster, it produces units faster, AI may have constant maphack etc. Every human player, even from the master-league, will sometimes (at least several times during a game) forget (for a brief moment) to build something, or there will be kind of delay. Also human players can't have as good macro- and micro-, as AI (in theory). Especially micro. We are also limited in our devices. We can see only part of the map, there is a delay before we make a decision and use keyboard or mouse. Current AI can imitate such delays, but it is not fair anyway.

Everything below is sarcasm:

Actually, we already have an AI, which can win everyone. This AI also can start to learn from scratch, by analyzing replays. I am going to use it during the next tournament — I downloaded gigabytes of OpenRa replays, so now I have games of almost every player in the game. I will start a new iteration of AI before every game versus my opponent. The AI will learn patterns of behavior for each player, thus I can win everyone. The only thing i need is to spend several days before the match playing versus AI-copy. I will win next tournaments and am going to take all the cash////

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

Yup, these ideas are very interesting,
Thanks for your reply on my ideas Guerilla. nice to notice that these ideas already live inside the OpenRA community.
I think that mission (levels, scenarios) are not as complicated in terms of AI. I mean, you still can make this with a simple code, without using an actual AI.
I do not know yet, since I have no experience (yet) in playing the build-in missions and/or creating my own OpenRA missions.
I am interested in architecture of OpenRA bots. How does the AI actually work?
I am not sure about this, but I suppose that when a human starts game versus bots, there is only one computer-AI, which controls an enemy "player" (buildings, troops, special abilities etc). [/quote]
** May I ask: How and where did you get this information?
- Do you create your own OpenRA mods?
- Have you hacked the OpenRA game engine?
- Have you worked on the OpenRA AI before (as 1 of the official developer)?
- Do you know your way around the OpenRA Code_base? Open source files?
- Option, 5,6,n?
I also suppose, that the bot has maphack (computer has no fog of war). If such statement is correct, than we face the real problem
What is a "maphack"?

AI knows environment and acts of human without actual investigation by troops.
.
I did not see such behaviour in-game, but I think that AI only imitates fog of war by algorithm, and a computer-player have maphack. Thus, it is a cheat.
Is this an - on game logic based - assumption or is this (f)actually true in the way how the OpenRA game-engine works?
Correct me, if I am wrong.
*That is something I can not do (yet) since i'm only beginning to scratch the surface of this topic.
One possible resolution is to add more AI's in-game, which will be separated. For example, Fog of War is implemented and controlled by one algorithm, and the actions of PC-player — by another. Algorithms are separated, so the computer player can not see what human does without investigation.

Alien Isolation has such concept, check it out.
What is "Alien Isolation" exactly? Where can I learn more about it?

(to be continued below)

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

I am also interested about AI on the map itself.
For example, there are civilians on some maps, or neutral tanks, buildings. Same with badgers.
What do you mean by this "AI on the map"?
Is it something like is being implemented by .... on - for example - the map: "Center of Attention Redux 2" by Buddha
- https://resource.openra.net/maps/13633/

In the center of this nice map, a neutral 3rd party of AI-units simply attacks everything which tries to pass their own territory.

Which AI controls these? The same, which controls an AI-player, right?
See *, I'm just beginning to investigate how it works (myself) since I've not found any usable - beginner-level documentation on this AI-topic inside the OpenRA community.
Ronald, the thoughts about Wizard and trainings are very interesting. The idea of "undefeatable" AI, in my opinion, works well. If an artificial intelligence is decently human-alike, than you will have no problems by using it during training-session.
That is another thing to think about.. how can one make an AI which "acts" like a human opponent. Great question Guerilla.

The problem is, that the current AI may have "cheats". It builds faster, it produces units faster, AI may have constant maphack etc.
See **. How and where do you get this information?:
- Is this based on your own coding-skills, analysing logic? reverse engineering skills?
- Have you worked on AI-bots before with another mod / game-engine perhaps?
- Option 3,4,n?

Every human player, even from the master-league, will sometimes (at least several times during a game) forget (for a brief moment) to build something, or there will be kind of delay.
That is what makes them human. BUT at the other hand: If AI-Bot_code can be equipped with a list of random build(order) / placement(location) failures, human behaviour can be mimicked very closely. One can even think about into organizing these error in a player-style template.

Example: Microsoft Flight Simulator X has the option to generate random aircraft system failures , which disable / cripple certain parts of the aircraft and a given interval. Here you will find 2 examples of how this works:
FSX own build-in failure module options:
- https://www.flyaoamedia.com/flightsim-t ... king-real/
3rd party add-on failure module options:
- https://www.fs-flightcontrol.com/en/man ... s/failures

Also human players can't have as good macro- and micro-, as AI (in theory). Especially micro. We are also limited in our devices. We can see only part of the map, there is a delay before we make a decision and use keyboard or mouse. Current AI can imitate such delays, but it is not fair anyway.
I think everything "AI_bot related" you can imagine, can be coded into it. If you can think about it. you can make it happen ;-)
Everything below is sarcasm:
LOL, It all comes down to the intention of the human who's using it.

Thanks for your response, It makes nice food-for-AI-Bot thoughts Guerilla. I'm looking forward to read your replies.

Goldvin
Posts: 1
Joined: Thu Oct 01, 2020 1:15 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Goldvin »

Here's an interesting article about ai development and using it - https://www.cleveroad.com/blog/ai-in-ed ... -can-gain-. It's definitely worth reading

Ronald
Posts: 192
Joined: Fri Aug 30, 2019 9:05 pm

Re: OpenRA - How to adapt an existing AI-bot / Create a new AI-bot from scratch?

Post by Ronald »

Goldvin wrote:
Thu Oct 01, 2020 1:22 pm
Here's an interesting article about ai development and using it - https://www.cleveroad.com/blog/ai-in-ed ... -can-gain-. It's definitely worth reading
Thanks for sharing GoldVin, That article was an interesting read.

Post Reply