"AI AI Gone" by Troy H. Cheek on Aug 31, 2009
For the last month or so, I've been working hard on a project: a Lua-based computer-controlled opponent (aka Skirmish AI) for the RTS game XTA on the Spring Engine. The project has come to a screeching halt. I recently went to make some changes and found that all my files and backups were missing. In fact, everything in that folder was missing. I'm not sure how that happened.
I once read that the problem with Artificial Intelligence is that eventually they become smart enough to contemplate their own mortality. The mark of a truly good AI is that it kills itself. Maybe that happened here.
Not too long ago, I went to move some files around and found that I didn't have enough space available on the destination drive. This spurred a flurry of file deletions. I had some old games installed that I hadn't played in a while. Out they went. I had some video files I'd set aside to watch that, according to the file dates, I hadn't watched in the year or so since I'd converted them. Out they went. I had videos and games and utilities that had been sitting in my Downloads directory for months that I hadn't even looked at. Out they went. I had half a dozen Spring installers which I had downloaded. Out they went I also had about three different versions of Spring installed in as many directories. Out they went.
What I thought I had done was determine which installation of Spring I had been using for development, uninstall all the others, and then download and install the latest test version of Spring. I was very sure I had done this. I also remember clearly playing a game or three of XTA after the Great File Cleanup and finding that Spring ran just fine, except of course that the included Skirmish AIs kicked my AI's butt.
However, after a few days of considering just how the included AIs had kicked my AI's butt and coming up with a few ideas which should have turned the tables, I opened up my Widgets directory and found it empty. All of my Lua scripts -- the ones that ship with the Spring installer, the ones that I'd downloaded later, the ones I'd written myself, and the ones which composed my unnamed AI -- were gone. The folder was completely empty. The Recycle Bin had no trace of them. They were gone.
I'm not sure how that happened. The few files which were in the Recycle Bin were remnants from the Great File Cleanup, which means I hadn't used any ordinary means of file deletion since. I'm certain that I'd played XTA since I deleted those files without noticing anything missing. I may (or may not) have installed a newer version of Spring since then, but installing new Spring versions had never cleared my Widgets directory before. Even if it had, I should have still had the widgets which ship with the Spring installer.
It's a complete and utter mystery. It also puts me back to Square One when it comes to the AI. While I do have a backup of the Lua scripts I use to play XTA on another drive, these are the "finished" versions of widgets that I've written, downloaded, or customized. The scripts under construction were in the main game folder, along with most of the earlier revisions. It'll take a while just to replicate any recent changes in these, as my work with the AI had shown me new ways of handling some of the old problems. Also, the most recent version of the Spring Engine introduced a few changes that I'll have to account for.
The single new file that made up the bulk of the AI, however, is completely gone. The AI hadn't reached the point to where I considered it usable, so it hadn't made it into the archives yet. If I want to recreate the AI, I'll have to start over from scratch.
Perhaps this is for the best. Some of the advances I'd made in understanding Lua had gone into the Skirmish AI when they should have gone into other widgets I'd already written. My Harass AI, which automagically sends out units to harass the enemy, needs a complete overhaul based on some new techniques I've discovered lately. I've been meaning to rewrite my custom Retreat AI which, as the name suggests, allows combat units to retreat until they've recovered from any damages sustained in battle. My work with the Skirmish AI has given me a great idea on how to calculate a good retreat point.
A couple of things which were in the Skrimish AI should have been independent helper AIs from the beginning. The first was that the Skirmish AI set all newly constructed airplanes to land at the nearest repair pad when they reached less than 80% health. The choices are Never, 30%, 50%, and 80% with the default being 30%. This is a little low for some planes and entirely too low for some others. While 80% is a little high for most of them, I'd rather have the plane retreat too early than too late. With enough repair pads servicing enough planes, I can keep up an unending attack on any position. Planes can retreat, repair, and return so fast that it seems like there's always a constant number over the battlefield.
The other helper AI also involves planes. My unnamed Skirmish AI didn't use cheats to reveal the location of enemy strongholds like some other AI opponents. Instead, it counted on radar coverage to scout out the enemy's units. The XTA Advanced Airplane Plant produced two radar planes for each faction: a fast scout with lesser radar coverage and a slower but tougher scout with greater radar coverage. There is also a sonar plane which, as the name implies, locates underwater units with sonar. This is important because underwater targets are invisible or at least hard to spot from most planes, including the few that can attack underwater targets. The Skirmish AI would, as soon as it was able, build radar and sonar scouts and send them on a grand tour of all metal outcroppings and geothermal vents. Metal is necessary for a wartime economy, and metal mines placed on metal spots are many times more effective than metal converters which create metal from energy, so enemy units are almost always found near metal outcroppings. Geothermal vents are a great source of energy, many times more effective than wind or solar plants and many times cheaper than fusion generators, but some maps have few or even no vents, and some players ignore them anyway because they are such obvious targets. Still, even if a player tries to completely avoid metal spots and geothermal vents, they are still scattered about to the point that a radar plane visiting all of them will probably be within radar range of every point of the map at some time or another. In any case, my AI's planes would find them, which would allow my Harass AI to send units to take them out.
However, I may not rebuild the Skirmish AI. I was making this AI for two reasons: 1) I could beat the existing AIs, and 2) there appeared to be no new AI development. Since starting the AI, there have been changes made to the Spring Engine which make AIs more effective. I hope it's not something cheap like just giving AIs more resources or more resistance to damage or something like that. Whatever it is, it seems to be working. The few practice games I've played recently gave me much more challenge than before. By this, I mean that I played a half-assed game using the strategies which worked before and got that half of my ass handed to me. Secondly, a new AI named something like E323AI has a scouting/harassing attack which looks mighty familiar. It was thoroughly tromping my AI and the included AIs the last time I checked it out, so I think with a little more work it will be a worthy opponent. The world may not need my AI.
On the other hand, when has that ever stopped me.