Testing Bots

For AI and campaign script related discussions and questions
Post Reply
Volzotan Smeik
New user
Posts: 1
Joined: 21 Oct 2022, 18:17

Testing Bots

Post by Volzotan Smeik »

Hi there!

I am new to WZ development, but experienced in development, Javascript and linux. I am trying to play around with AI development. Specifically, I am trying to find a way to automatically instantiate AI-only matches. First, via the Wiki, I arrived at https://developer.wz2100.net/wiki/AiTutorial, which seems outdated to me.
Then, via google, I found viewtopic.php?t=12873, which brought me to the command options "--skirmish=<mytestfile.json> --autogame". Using the file "data/mp/tests/highground.json", I managed to start an autogame. However, the players don't seem to be controlled by the AI defined in the file, I believe only the scavengers are actually doing something. Plus, the game runs at infinite speed, which prevents me from seeing what the AIs are doing.
Then, I asked on discord, where I got the answer "open the debug menu and attach one to the player". After some searching, I found "SHIFT + BACKSPACE => DEBUG MODE" and "CTRL + O => Open Menu" and finally managed to instantiate an AI-only match.

However, doing this manually is an awful lot of keystrokes if I want to play around with my own AI and see how its character changes every few minutes. How are you doing this? I am still looking for a way to automatically start such a game (obviously, in variable speed) from the command line. If I save the game after attaching an AI to my player, the AI is no longer attached after reloading it manually or using "--loadskirmish" (I am getting error messages on the command line like "[findInstanceForPlayer:732] Script context for player 0 and script name bonecrusher not found"). Fiddling around with the saved file didn't work.

Any hints anybody?
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Testing Bots

Post by Berserk Cyborg »

Attaching via the debug menu is the way to go for examining bot behavior. You won't need to save anyway (it won't work as you found out). I usually set the speed to 10x or 20x when I test Cobra. Bigger maps with more AIs will be more stressful on a system and take longer so I usually limit myself to 6 player maps at most. You can get maps from either the addons section at this site or from here.

I rarely use autogames as I prefer to watch what the bot is doing as these are merely tests to quickly simulate a pure and fair match between bots or see if something broke.

There is no guide for making AIs so you'll just have to take a look at the others. SemperFi is the most simple AI and one of the strongest against other bots 1v1. Though feel free to look at the API docs and such (especially Scripting.md): https://github.com/Warzone2100/warzone2 ... master/doc.
Post Reply