Loading...
  OR  Zero-K Name:    Password:   

Creating a script that creates a AI vs AI skirmish game

6 posts, 423 views
Post comment
Filter:    Player:  
sort
5 years ago
Hi all,

Apologies in advance about the long post.

I have been looking through the source code of the game with the intention of creating a script that can create an AI vs AI match in the SinglePlayer skirmish lobby, start the game, log the result and then rinse and repeat a specified number of times. I intend to use this in order to train a custom AI using machine learning. I should specify now that I have no intention of using this in multiplayer, this is purely for my personal use.

I have been struggling to understand the process by which the Spring Engine actually launches a match and how it creates the skirmish lobby. I have been using Visual Studio code and basically just searching through the folders of the base steam game, trying to find the methods that cause this to happen. More recently I have been searching the Zero-K Infrastructure folder, but I was also unable to form a proper understanding of how to game works from there.

Would anyone be able to recommend which files to have a look at in order to gain the understanding required to create the script mentioned above?


Thank you in advance, sorry about being so clueless.
+5 / -0
Hey I've been planning to do so as well for quite a while, we could join our forces. Do you want to meet on discord to talk about it?

You can't browse through game files because they are compressed into binary files. In order to do so here are instructions:
https://zero-k.info/mediawiki/index.php?title=Mod_Creation
+0 / -0
5 years ago
Hey, I just discovered the discord, been looking through it for the last few minutes, I'll drop you a message.
+0 / -0

5 years ago
Check https://github.com/gajop/MyAI/tree/master/scripts in particular script.txt

This is how I was testing MyAI vs other spring AIs, although for BA instead of ZK. Just give the full path to that file as a command line argument to Spring, and it'll run the game with appropriate configuration.
+2 / -0
5 years ago
Thanks man, after some consideration I might try and use a different game but your help is appreciated.
+0 / -0
JPrankgajop hasn't said how to get a script or how to even run one. I'll do everything here in terms of the Steam root folder for Zero-K.
  • "_script.txt" contains the script for your most recently run game, so you can use the menu UI to create the script that you want.
  • Run "engine/win32/104.0.1-287-gf7b0fcc/spring.exe" with your script. To do so you will need to copy the required file from each of from "games" and "maps" to "engine/win32/104.0.1-287-gf7b0fcc/games" and "engine/win32/104.0.1-287-gf7b0fcc/maps" respectively. You may also want to copy settings, such as springsettings.cfg and luaUI.

What you really want to do is run "engine/win32/104.0.1-287-gf7b0fcc/spring.exe" with your script as an argument and the root Zero-K folder set as the working directory. I attempted two methods of setting working directory (power shell and the shortcut creation UI) and both failed. This is approximately how the Zero-K wrapper works, so something along these lines should be possible. For now you can simply move the map and game.

You were looking in the wrong place for modifying the skirmish lobby.

Also, https://github.com/rlcevg/CircuitAI is the repository for the main AI that comes with ZK. There are others, in other languages, that can be found if you ask around.

+0 / -0