Page 1 of 1

How create Bot using Python

Posted: Sun Mar 10, 2024 4:30 pm
by gerssonmg
I want to use OpenRA to create a bot with Python scripting (Researching Artificial Intelligence in Games).

What I have accomplished:
- I can run the engine on my Ubuntu using ./OpenRA-Red-Alert-x86_64.AppImage
Create a game, play, etc...

What I haven't been able to do:
- Find in the documentation how to integrate with the API using Python
- Import this Python script into the engine.

Re: How create Bot using Python

Posted: Sun Mar 10, 2024 10:49 pm
by abcdefg30
OpenRA does not expose an API for Python. We only have a Lua API for scripting missions: https://docs.openra.net/en/release/lua/

Re: How create Bot using Python

Posted: Mon Mar 11, 2024 12:49 pm
by gerssonmg
Incredible. Thanks for the feedback.

I read the documentation on, but still don't understand, how to use my custom script in a single player party.

My objective:
Create a SinglePlayer game, where I play against my Lua script

I ventured into several links, but I still need help.
Some of what I read. I read others too
https://github.com/OpenRA/OpenRA/wiki/Map-scripting
https://github.com/search?q=repo%3AOpen ... &type=Code
https://docs.openra.net/en/release/lua/

Re: How create Bot using Python

Posted: Wed Mar 13, 2024 9:12 am
by Punsho
gerssonmg wrote:
Mon Mar 11, 2024 12:49 pm
I read the documentation on, but still don't understand, how to use my custom script in a single player party.

My objective:
Create a SinglePlayer game, where I play against my Lua script
The AI is currently written in C# and works in modules. In yaml, the modules are defined and tweaked, see ai.yaml.

Our lua integration is currently insufficient to fully support bots; too few variables and functions are exposed. The lua integration was made for mission scripting and even then it's functionality is a bit lacking. F.e. some missions for d2k are still yet to be made as the lua controlled bots need to be able to build a base. To see the source code behind the integration see C# files that end with *Properties.cs