AI SDK Info

This SDK contains everything you need to write your own computer AI for Lux and Vox. The SDK uses the Java programming language and is made up of a series of public API as well as example source code implementations.

The Agent Interfaces
Each AI is a class that implements the LuxAgent (or VoxAgent for Castle Vox) interface. The interface comes with lots of comments, and should probably be the first thing you examine.

If you are unfamiliar with java interfaces, it is basically just a list of function prototypes. To write a class that implements the interface, you just fill in the code for all of the prototypes.

The Game API
Other then the Agent interface, agents must interact with the game. This is done using the public game API. Have a look at the Lux API javadocs or Vox API javadocs to see what is available.

Examples
The source code of many example agents are included, inside the src/com/sillysoft/lux/agent directory. The code is licensed for non-profit use.

To Compile
Method #1: Use the included apache ant build.xml file to build using ant.
Method #2: Copy the java files inside src into your preferred IDE.

Installing
Once you have finished writing an agent, place your compiled .class file inside the Agents folder inside the game's support folder. Your agent should appear in the agent select-boxes when the game is next run. If you use ant to compile then modify the build.xml file to specify your support folder and you can automatically move the newly compiled file into place.

Debugging
Here are instructions for setting up debugging in some popular IDE environments.

Multiple Classes
To get a multiple-class AI to load: put the main class that implements the Agent interface directly in the Agents folder, then also create a package-folder hierarchy inside that same folder and put all secondary classes into their proper package folder.

 
Random Notes:
Find other BotMasters and discussion in the online Robot House Forum (and especially the Helpful Links thread).

All method calls into AIs are inside try/catch statements. This means that errors within agents should not cause the game to crash. Whenever an exception is caught it is printed to standard out including a stacktrace.

As well, a message is printed to standard out whenever an agent sends an improper command. (eg. it tries to attack a country that it owns)

(Under MacOS X, standard out of all the running applications can be seen with the Console application, located in /Applications/Utilities/

For testing purposes it is sometimes useful to run game after game after game. Start Lux from the command line and pass it the -superfast option to get a mode that uses less graphics. You'll still have to start a game and turn on the Autoplay feature in the Preferences.
 

Lux AI Example Notes:

The source code for all of the built-in agents come included with this SDK inside the 'src/com/sillysoft/lux/agent' directory. You are free to use this code for non-profit purposes.

The example AIs aren't HTML formatted, so I won't link to them. They are all java classes with lots of comments. Meant to be viewed in your text editor of choice.

I recommend that you look at Angry.java first for an example of a simple agent. That should give you a good idea of how agents interact with Lux's API.

After that, you probably want to take a gander at SmartAgentBase.java which is a utility superclass used by all of my more advanced agents.

Cluster.java is a good example of a subclass of SmartAgentBase. The general strategy of Cluster is to work on expanding a cluster of Countries. Subclasses improve on his behavior by limiting their attacks, or trying to focus them better. Subclasses of Cluster include: Shaft, Quo, Yakool, and Boscoe.

Pixie.java is based on a totally different premise from the Cluster-family. She examines each continent seperately, and decides which ones she has a chance of taking over. Then she will place armies and attack in those continents. EvilPixie and BetterPixie use the same technique as Pixie, with BetterPixie being the most advanced.

Killbot.java is an agent that uses the behaviour of Vulture.java to eliminate weak players. Killbot pairs up Vulture and BetterPixie behaviour.

 

Thank you very much for downloading this SDK. If you have any questions/comments please let me know.

 

Your friend in world domination,
Dustin Quasar Sacks
dustin@sillysoft.net