FreeCraft Configuration Language Description: Artificial Intelligence (AI)


     ___________		     _________		      _____  __
     \_	  _____/______   ____   ____ \_   ___ \____________ _/ ____\/  |_
      |    __) \_  __ \_/ __ \_/ __ \/    \  \/\_  __ \__  \\   __\\   __|
      |     \   |  | \/\  ___/\  ___/\     \____|  | \// __ \|  |   |  |
      \___  /   |__|    \___  >\___  >\______  /|__|  (____  /__|   |__|
	  \/		    \/	   \/	     \/		   \/
    ______________________                           ______________________
			  T H E   W A R   B E G I N S
	   FreeCraft - A free fantasy real time strategy game engine

(C) Copyright 2002-2003 by The FreeCraft Project. Distributed under the "GNU General Public License"


FreeCraft Readme FAQ CCL PREV NEXT Index
define-ai define-ai-helper define-ai-player define-ai-wc-names ai:attack-with-force ai:check-force ai:debug ai:dump ai:force ai:force-role ai:get-race ai:get-sleep-cycles ai:need ai:player ai:research ai:restart ai:script ai:set ai:set-collect! ai:set-reserve! ai:sleep ai:upgrade-to ai:wait ai:wait-force

Intro - Introduction to AI functions and variables

Everything around the control of the FreeCraft AI.

Functions

define-ai

Description

This defines how a special AI works. Each level can use his own AI definition.

Syntax

(define-ai name race class script)
name
Unique name of this AI definitions.
race
Name of the race for what this definition can be used, if the definition can be used for any race use "*".
class
Class name of this definition. Used to chooce the AI for computer players. The puds contains numbers which are mapped by the C table AiTypeWcNames into internal names. Some common used names are "passive", "land-attack", "sea-attack", "air-attack".
script
A list of scheme statements executed one after another.

( (code-1) (code-2) ... (code-n) )

code-1 can be any valid scheme statement. Currently each second this statement is executed, if the statement returns not #t, than the next time the next statement is executed. No statement should use more than 3 ms.

Example

(define-ai "wc2-passive" "*" "passive"
  '((ai:sleep	10000)
  (ai:restart) ))

Defines the passive computer AI, which does nothing.

Used

$LIBARYPATH/ccl/ai.ccl

define-ai-helper

Description

The AI is complete configurable, nothing is hardcoded. The AI knows nothing about any units without this table. This table defines F.E. what unit can build and what they can build and many other things that the AI must know.

Syntax

(define-ai-helper (list))
list
A list of features: