Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 1 and Version 2 of code/doc/AI


Ignore:
Timestamp:
Nov 30, 2015, 2:28:53 PM (9 years ago)
Author:
gania
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/AI

    v1 v2  
    1 AI
     1= AI =
     2[[TracNav(TracNav/TOC_Development)]]
     3
     4== Overview ==
     5Current AI is implemented in the hierarchy of classes FormationController, ArtificialController, AIController, WaypointController and WaypointPatrolController.
     6
     7New set of classes are being created in this: ticket:263.
     8
     9The basic features of new AI are:
     10 * Fighting: AI tries to dodge bullets
     11 * Flying: AI flies in divisions of 4 spaceships
     12 * Actionpoints: Just like waypoints, actionpoints can be set in XML file.
     13
     14==Structure==
     15When alone, every AI class does the same. To make AI fight smart, different AI Controllers are to be assigned to several spaceships:
     16
     17DivisionController makes 4 spaceships fly in formation. It manages most of the logics of the division, which consists of 1 DivisionController, 1 SectionController and 2 Wingmen.
     18
     19==Fighting==
     20When fighting, DivisionController fights in pair with its WingmanController and SectionController in pair with its Wingman. Those two sections of two ships try to attack different targets in order to achieve maximum damage output.
     21
     22AI tries to separate Wingman in Leader into attacker and defender, so that enemies waste their time trying to kill one while another finishes them off.
     23
     24==Formations==
     25In XML file different formation types can be set to DivisionController: WALL, FINGER4 and DIAMOND. Although they don't have a great effect on a gameplay, one might find DIAMOND or FINGER4 to look nicer than a simple WALL.
     26
     27==Actionpoints==
     28Actionpoints are implemented as state machines in their own class called ActionpointController, which is a parent class of Division-, Section-, and WingmanController. Basic states are:
     29 *NONE: spaceship tries to pop the next actionpoint from the stack
     30 *FIGHTALL: spaceship fights all the enemies on the map (if DivisionController, its division fights together with it) until all the enemies are dead.
     31 *ATTACK: attacks a specific target until target is dead.
     32 *PROTECT: follows a specific target until no protection required (when that spaceship dies).
     33 *FLY: flies to a specific point.
     34More than one Actionpoint can be attached to a controller, resulting in a slightly complex behaviour, for example, following code would result in a spaceship firstly attacking a spaceship with a name "attack", then trying to protect a human player, if none is spawned or human dies, it protects a spaceship with a name "protect", then it fights all enemies on the map:
     35{{{
     36<SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
     37      <templates>
     38        <Template link=spaceshipassff />
     39      </templates>
     40      <controller>
     41        <DivisionController team=0 formationMode="finger4">
     42          <actionpoints>
     43            <Actionpoint position="0,0,0" action="FLY" />
     44            <Actionpoint position="-1000,750,-500" action="ATTACK" attack="attack" />
     45            <Actionpoint position="-1000,750,-500" action="PROTECt" protectMe=true />
     46            <Actionpoint position="-1000,750,-500" action="PROTECt" protect="protect" />
     47            <Actionpoint position="-1000,750,-500" action="FIGHTALL" />
     48           </actionpoints>
     49        </DivisionController>
     50      </controller>
     51</SpaceShip>
     52}}}