____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

Module - AI

What is it?

Stratagus uses a very simple scripted AI. There are no optimizations yet. The complete AI was written on one weekend. Until no AI specialist joins, I keep this AI.

What is scripted AI?

The AI script tells the engine build 4 workers, than build 3 footman, than attack the player, than sleep 100 frames.

The AI API

Management calls

Manage the inititialse and cleanup of the AI players.

InitAiModule(void)

Initialise all global varaibles and structures. Called before AiInit, or before game loading.

AiInit(::Player)

Called for each player, to setup the AI structures Player::Aiin the player structure. It can use Player::AiName to select different AI's.

CleanAi(void)

Called to release all the memory for all AI structures. Must handle self which players contains AI structures.

SaveAi(::FILE *)

Save the AI structures of all players to file. Must handle self which players contains AI structures.

Periodic calls

This functions are called regular for all AI players.

AiEachCycle(::Player)

Called each game cycle, to handle quick checks, which needs less CPU.

AiEachSecond(::Player)

Called each second, to handle more CPU intensive things.

Event call-backs

This functions are called, when some special events happens.

AiHelpMe()

Called if a unit owned by the AI is attacked.

AiUnitKilled()

Called if a unit owned by the AI is killed.

AiNeedMoreSupply()

Called if an trained unit is ready, but not enough food is available for it.

AiWorkComplete()

Called if a unit has completed its work.

AiCanNotBuild()

Called if the AI unit can't build the requested unit-type.

AiCanNotReach()

Called if the AI unit can't reach the building place.

AiTrainingComplete()

Called if AI unit has completed training a new unit.


Generated on Sat Feb 21 00:28:22 2009 for Bos Wars by  doxygen 1.5.6