Some new information has come to light which changes how I have to handle the BARC/Wargus interface. Originally, I thought I could just write out a Lua file during the run to control the AI, and have the Wargus engine execute it. This file would be overwritten on each state change. I then discovered that all of the AI Lua files are loaded on startup, so this idea wouldn't work. I then decided to try having all of the files written out, and then using BARC to select which one was currently executing. This idea gained some traction, until I discovered that Wargus only executes one AI script per game.
Finally, I came up with a new way to handle controlling the AI with BARC. Wargus will launch the AI with a custom script. This script will tell the AI to execute the starting tactic, and then make a call to an interface. The interface will take the game information (from the call of the Wargus AI), and then call advanaceState() on BARC. BARC will return the next tactic to use to the interface. The interface will then load the next tactic (which will be written out already, but not loaded), leading to Wargus executing the new file. At the end of this file, the cycle repeats. When it reaches the states which have nothing following them, the states will loop instead of calling on BARC.
No comments:
Post a Comment