Developing Player Plug-ins

The artificial intelligence algorithms used by computer players are defined in player plug-ins. Each player plug-in is a bundle that contain a subclass of ICComputerPlayer.

Class Documentation

Complete documentation for the classes you will need to interact with are available below.

You may also view the source of the ICComputerPlayer class.

Methods to override

Your subclass must override the following ICPlayer methods. Click each method name for a detailed description of what the method should do, including a sample implementation.

- pickCountry
- assignInitialArmies
- assignArmiesFromIncome
- assignArmiesFromConquer
- advanceArmiesFrom:to:
- attack
- fortify
- fortifyArmiesFrom:

Xcode will automatically create a project with a complete player implementation. You simply need to modify the code for the above methods.

Interacting with countries

Most of your activities will involve picking, placing armies in, or attacking countries. There are a few arrays of countries that facilitate these activities.

The game's unallocatedCountries array contains the unpicked countries that your player can pick from at the beginning of the game.

The destinationCountries array contains the countries in which you are allowed to place armies at the current point in the game. For example, when you receive a fortifyArmiesFrom: message, unallocatedCountries will contain the given country and its neighbors.

You can set the victims array to the countries you want to attack, and the attackers array to the countries you want to attack from. Convenience methods in ICComputerPlayer facilitate allocating armies to the attackers and attacking the victims.

Building your plug-in

When building player plug-ins, be sure that iConquer is located in your Applications folder (at /‍Applications‍/‍iConquer.app). This is necessary because player plug-ins link with the iConquerGame.framework, which is located inside the iConquer application bundle. You can then install and test your player plug-in.

Home | Maps | Developer | Download | Buy Now

© 2002-2006 KavaSoft.
All rights reserved.