AI

AI - Computer Players

As of v0.3, ChessCraft includes support for AI (Computer) chess players, using the GPL'd jChecs AI engine.

AI support was significantly rewritten as of v2.0.0, with support added for external chess engines using the XBoard protocol (aka Winboard/CECP). See XBoard Support below for more information.

The AI_settings.yml file format was also changed as of v2.0.0, and should no longer be edited. A new user-editable AI.yml file was added, defining AI aliases and useful parameters.

Playing against the AI

The simplest way to do this is to create a game and start it without inviting a human opponent. If you do this, a random AI will automatically be chosen for you. This AI opponent could be very weak, or very challenging (for a casual player - none of the built-in AI's should seriously challenge a strong player).

Choosing an AI opponent

To see what AI's are available:

/chess list ai

You can see more detail about an AI with /chess list ai <ai-name>.

For the builtin (jChecs) AI, there are 17 possibilities (12 usable by default) using a combination of search algorithms and search depths. In general, the higher the search depth, the more dangerous the opponent. The algorithms supported are:

  • AlphaBeta (depths 3-6)
  • MiniMax (depths 1-4)
  • MiniMax++ (depths 2-5)
  • NegaScout (depths 3-6)
  • Random (depth 1)

Random is completely dumb, and really only useful for debugging, so is disabled by default. The MiniMax++ definitions are also disabled by default, since the algorithm is currently buggy and throws exceptions occasionally.

To invite a specific AI, you can use the /chess invite command, just as if you were inviting a human opponent:

/chess invite jcab3

Customising the AI definitions

You can edit the file AI.yml in the plugins/ChessCraft folder. The file is well commented, and the layout should be fairly clear.

Each entry is a keyed by the AI's public name (i.e. what gets shown in games, and can be invited with /chess invite). Each entry can take several parameter definitions, described below.

The valid parameters are:

Parameter NameApplies toDescription
aiallThis is the only mandatory parameter, and must refer to an AI definition in the AI_settings.yml file (note that AI_settings.yml should not be edited)
enabledallIf true, this AI will be listed in /chess list ai output, and may be picked at random to join games. If false, the AI won't be listed or randomly picked, but may be explicitly invited to a game with /chess invite <ai-name>.
commentallA user-visible comment, displayed when /chess list ai <ai-name> is used.
payout_multiplierallFor games with a stake, this controls how much a player will win when beating this AI. Default is 1.0. You may wish to raise this for tougher AI opponents, or lower it if your human players are doing too well :)
commandXBoardThis is the command that will be run to launch the external XBoard chess engine, e.g. gnuchess xboard. If you don't use a full path here, you should ensure that the command is on the $PATH (%PATH for Windows) of the user who launched CraftBukkit.

You are free to edit AI.yml and add or modify entries. You can have multiple entries for the same "ai" definition if you wish, e.g. the distributed file includes (disabled) entries for gnuchess1 and gnuchess2 with identical parameters.

Once you've finished editing this file, use /chess reload ai to reload it (or reload/restart the server).

XBoard Support

As of v2.0.0, ChessCraft can talk to external chess engines using the XBoard protocol. It has been tested with the Gnuchess and Crafty engines, both of which offer a significantly stronger game than the builtin jChecs AI (Crafty in particular is a very strong opponent).

The plugin ships with disabled entries for two Gnuchess AI's (gnuchess1 and gnuchess2), and one Crafty AI (crafty), all disabled by default. To play against these AI's:

  1. Install the corresponding game engine on your system (this may pose problems if you are running CraftBukkit on a hosted server)
  2. Ensure that the user you start CraftBukkit can also run the engine you installed. If you need to give a full path to the command, you'll also need to configure that in the AI.yml file.
  3. Start CraftBukkit as normal, and log in to Minecraft. Create a chess game as normal, and try /chess invite gnuchess1 (or whichever player you want to invite). If this works, you're in business! If not, check the server log for any errors.

It's important that any external chess engine you start is placed in XBoard mode immediately. For gnuchess and crafty, this means passing "xboard" as a command line argument. You'll see this is already done in AI.yml.

Once you're happy the external engine is working properly, you can edit AI.yml to enable the definitions (setting "enabled: true"), and possibly add more definitions. You can even disable or comment out the built-in definitions if you want everyone to play against an XBoard AI.


Comments

Posts Quoted:
Reply
Clear All Quotes