DEFCON AI API Documentation

Help Docs

Issues

  • Fleet assignment: When assigning fleets, only assign one at a time. The easiest way to check if your assignment was successful is to keep track yourself of the number of fleets you have assigned so far. If this matches with the length of the array returned by getOwnFleetIds(), you can assign the next fleet.

Hints and Techniques

Here I'll put everything that I notice is worth highlighting, mostly small issues with Defcon or Visual Studio settings.

  • Run DEFCON in Windowed Mode while debugging: in DEFCON, select Options - Screen - Windowed
  • Start DEFCON from within Visual Studio: Project Properties - Configuration Properties - Debugging - Command: Enter path to Defcon.exe here, e.g. C:\Defcon\Defcon.exe. Command Arguments: Enter command line arguments here, for example ai=“AI/simplebot/simplebot.dll” host to automatically host a game, with the simplebot bot preselected. Working Directoy: Set this to the directory where Defcon.exe is, for example to ../../..
  • Note that each issued command by the API has a short delay to take effect, because of the client-server structure of the game. So when you set a state of an object (say, switch a carrier to “Launch Fighters”) and then do an action immediately afterwards (say, launch a fighter to some place), the state might not yet have changed (and for example might still be “Launch Bombers”).



Back to DEFCON API main page