Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here is an example of an ’.ai’ file that defines an AI called "Semperfi JS":

 

Code Block
themeEclipse
languagenone
titleExample "semperfi.ai" file
linenumberstrue
[AI]
name = "Semperfi JS"
js = semperfi.js

...

The ”extra” key sets up an additional script to be run during the challenge. The ”rules” key sets up an alternative rules file, which means that the ”rules.js” mentioned above is not run. In this case, you must implement your own rules for winning and losing, among other things. Here is an example of such a scripts section: 

Code Block
themeEclipse
languagenone
titleDefining custom rules for a challenge game
linenumberstrue
[scripts]
rules = towerdefense.js

You can also specify which AI scripts are to be run for each player in the challenge. These are read from the ”multiplay/skirmish” directory. If you do not want an AI script to be loaded for a player (for example, if you want this player to be controlled from one of your challenge scripts), then you can give it the special value ”null”. Here is an example if a challenge player definition with its AI specified: 

Code Block
themeEclipse
languagenone
titleSetting player 2 to use the Semperfi AI
linenumberstrue
[player_2]
team = 1
difficulty = "Medium"
position = 4
ai = semperfi.js

...