Difference between revisions of "Ai.tbl"

From FreeSpace Wiki
Jump to: navigation, search
(modular features)
m (+nocreate)
 
Line 11: Line 11:
  
 
===+nocreate===
 
===+nocreate===
{{Table224|
+
{{Table232|
 
*Optional
 
*Optional
 
*Allows editing of the ai class entry without creating a new entry}}
 
*Allows editing of the ai class entry without creating a new entry}}

Latest revision as of 14:08, 14 February 2023

Revision information.....

FSO Git Commit: Date: 2018-06-29 SHA: 9d907c9
Note: Please update the revision information when the page is updated. If your edit had nothing to do with new code entries then please do not edit the revision information


List of Tables and related code files
* Notes Modular Tables
** Notes tables which only use modular tables
Ai.tbl* /ai/aicode.cpp
Ai_profiles.tbl* /ai/ai_profiles.cpp
Animation.tbl** /model/modelanimation.cpp
Armor.tbl* /ship/ship.cpp
Asteroid.tbl* /asteroid/asteroid.cpp
Autopilot.tbl* /autopilot/autopilot.cpp
Cheats.tbl* /cheats_table/cheats_table.cpp
Colors.tbl* /globalincs/alphacolors.cpp
Curves.tbl* /math/curves.cpp
Controlconfigdefaults.tbl /controlconfig/controlsconfigcommon.cpp
Credits.tbl* /menuui/credits.cpp
Cutscenes.tbl* /cutscene/cutscenes.cpp
Decals.tbl** /decals/decals.cpp
Fireball.tbl* /fireball/fireballs.cpp
Fonts.tbl* /graphics/font.cpp
Game_settings.tbl* /mod_table/mod_table.cpp
Glowpoints.tbl* /model/modelread.cpp
Help.tbl* /gamehelp/contexthelp.cpp
Hud_gauges.tbl* /hud/hudparse.cpp
Icons.tbl* /mission/missionbriefcommon.cpp
Iff_defs.tbl* /iff_defs/iff_defs.cpp
Keywords.tbl* Not In Codebase
Lighting_Profiles.tbl* /lighting/lighting_profiles.cpp
Lightning.tbl* /nebula/neblightning.cpp
Mainhall.tbl* /menuui/mainhallmenu.cpp
Medals.tbl* /stats/medals.cpp
Messages.tbl* /mission/missionmessage.cpp
Mflash.tbl* /weapon/muzzleflash.cpp
Music.tbl* /gamesnd/eventmusic.cpp
Nebula.tbl* /nebula/neb.cpp
Objecttypes.tbl* /ship/ship.cpp
Options.tbl* Not In Codebase
Particle effects(-part.tbm)** /particle/effects...
Post_processing.tbl /graphics/gropenglpostprocessing.cpp
Rank.tbl* /stats/scoring.cpp
Scpui.tbl* Not In Codebase
Scripting.tbl* /parse/scripting.cpp
Ships.tbl* /ship/ship.cpp
Sexps.tbl** /parse/sexp/sexp_lookup.cpp
Sounds.tbl* /gamesnd/gamesnd.cpp
Species_defs.tbl* /species_defs/species_defs.cpp
Species.tbl* /menuui/techmenu.cpp
Ssm.tbl* /hud/hudartillery.cpp
Stars.tbl* /starfield/starfield.cpp
Strings.tbl* /localization/localize.cpp
Tips.tbl* /menuui/playermenu.cpp
Traitor.tbl* /stats/scoring.cpp
Tstrings.tbl* /localization/localize.cpp
Virtual_pofs.tbl* /model/modelreplace.cpp
Weapon_expl.tbl* /weapon/weapons.cpp
Weapons.tbl* /weapon/weapons.cpp

The ai.tbl file defines the AI classes used in the game. This table is used to define each AI class with four abilities for each of the five difficulty levels.

This table is one of the Modular Tables and can be extended with xxx-aic.tbm

Required Elements

$Name:

  • Defines a name for the AI class that can be used with ships.tbl and also with FRED
  • Syntax: String, name of the AI class

+nocreate

FS2 Open, 23.2:
  • Optional
  • Allows editing of the ai class entry without creating a new entry

$Accuracy:

FS2 Open, 23.2:
  • This element is now optional
  • How accurately the ship fires its weapons. Value is used to scale the error in the AI aim. With repeated shots, AI aim will improve. Note that the AI is always 100% accurate when aiming for subsystems, according to Retail code.
  • Value from 0.0 to 1.0
  • Syntax: Float list, five comma separated floats, one for each difficulty, very easy, easy, moderate, hard, insane difficulty levels respectively
  • $Evasion:

    FS2 Open, 23.2:
    • This element is now optional
  • How good the ship is at evading. Value defines the frequency of AI course changes while it is evading.
  • Value from 0 to 100
  • Syntax: Float list, five comma separated floats, one for each difficulty, very easy, easy, moderate, hard, insane difficulty levels respectively
  • $Courage:

    FS2 Open, 23.2:
    • This element is now optional
  • How likely the ship is to chance danger to accomplish goals. Basically the lower the value sooner the AI will start evading when attacked and its less likely to target turrets.
  • Value from 0 to 100
  • Syntax: Float list, five comma separated floats, one for each difficulty, very easy, easy, moderate, hard, insane difficulty levels respectively
  • $Patience:

    FS2 Open, 23.2:
    • This element is now optional
  • How willing the ship is to wait for an advantage before pursuing goals. Never actually implemented - It does absolutely nothing.
  • FS2 Open, 3.6.12: This value affects how quickly the AI will attempt to "break" a stalemate situation if one is detected. Only applies if $Stalemate Time Threshold and $Stalemate Distance Threshold are used. The higher the patience, the longer the ship will wait in "stalemate" before breaking. If patience is 100, the AI will never break.
    • Value from 0 to 100
    • Syntax: Float list, five comma separated floats, one for each difficulty, very easy, easy, moderate, hard, insane difficulty levels respectively

    Optional Elements

    Other AI Class Attributes

    IMPORTANT NOTE: If the following attributes are NOT specified, the code uses the index of the AI class instead. Use these if you want finer-grained control over the AI classes and/or you don't want the order of the AI classes to affect their behavior. If these are not specified, the behaviors described will be determined by the order of the AI class relative to the others in the file. Furthermore, having a different number of AI classes than retail can result in strange behavior if these are NOT set. It is recommended that if you make heavy use of custom AI classes, you specify all of these and set $Autoscale by AI Class Index to NO.

    $Afterburner Use Factor:

    FS2 Open, 3.6.12:
    • Affects how probably it is that the AI will use afterburners in "maybe" situations. A value of 1 means always, 2 means half the time, 3 a third of the time, etc.
    • Syntax: Int list, five comma separated integers, one for each difficulty.

    $Shockwave Evade Chances Per Second:

    FS2 Open, 3.6.12:
    • Controls how likely it is for a ship to try to start evading a shockwave. The higher the number, the more "chances per second" the ship has to evade.
    • Syntax: Float list, five comma separated float, one for each difficulty.

    $Get Away Chance:

    FS2 Open, 3.6.12:
    • How likely the AI is to use a "get away" maneuver instead of simply making evasive turns. "Get away" usually involves the AI flying straight away, usually on afterburner, and making small jinking motions (instead of large evasive turns). Higher values result in more "jousting" fights.
    • Range: between 0.0 (never) and 1.0 (always)
    • Syntax: Float list, five comma separated float, one for each difficulty.

    $Secondary Range Multiplier:

    FS2 Open, 3.6.12:
    • Multiplier which affects from how far away the AI will begin firing secondary weapons. Capped by the actual maximum range of the weapon. Penalty for firing in nebula still applies above and beyond this.
    • Range: between 0.0 (point blank/never fires) and 1.0 (fires from maximum range).
    • Syntax: Float list, five comma separated float, one for each difficulty.

    $Autoscale by AI Class Index:

    FS2 Open, 3.6.12:
    • If set to YES (default), a number of miscellaneous AI probabilities are affected by the order of the AI class in the file (for example, the chance to fire countermeasures). Classes near the beginning of the file are generally weaker than classes at the end. If set to NO, this flag will turn off that auto scaling behavior (so that the order of the AI class does not affect AI behavior).
    • Note that even if this is set to NO, the other options above will still be controlled by AI class index (so if you want complete independence, you need to set all of the options listed in the "Other AI Class Attributes" category).
    • Default: YES
    • Syntax: Boolean flag (YES/NO)


    AI Profiles Overrides

    FS2 Open, 3.6.12: The following values can be inserted as overrides for their equivalent Ai_profiles.tbl values. They are all optional. If not set for an AI class, the values in AI Profiles will be used.

    Syntax is the same as their AI Profiles counterparts.

    • $AI Countermeasure Firing Chance:
    • $AI In Range Time:
    • $AI Always Links Ammo Weapons:
    • $AI Maybe Links Ammo Weapons:
    • $Primary Ammo Burst Multiplier:
    • $AI Always Links Energy Weapons:
    • $AI Maybe Links Energy Weapons:
    • $Predict Position Delay:
    • $AI Shield Manage Delay:
    • $Friendly AI Fire Delay Scale:
    • $Hostile AI Fire Delay Scale:
    • $AI Turn Time Scale:
    • $Glide Attack Percent:
    • $Circle Strafe Percent:
    • $Glide Strafe Percent:
    • $Stalemate Time Threshold:
    • $Stalemate Distance Threshold:
    • $Chance AI Has to Fire Missiles at Player:
    • $Max Aim Update Delay:
    • $Turret Max Aim Update Delay:

    AI Profiles Flag Overrides

    FS2 Open, 3.6.12: The following flags can be inserted to override their equivalent Ai_profiles.tbl flag values. They are all optional. If not set for an AI Class, the AI Profiles value will be used.
    • $big ships can attack beam turrets on untargeted ships:
    • $smart primary weapon selection:
    • $smart secondary weapon selection:
    • $smart shield management:
    • $smart afterburner management:
    • $allow rapid secondary dumbfire:
    • $huge turret weapons ignore bombs:
    • $don't insert random turret fire delay:
    • $prevent turrets targeting too distant bombs:
    • $smart subsystem targeting for turrets:
    • $allow turrets target weapons freely:
    • $allow vertical dodge:
    • $No extra collision avoidance vs player:
    FS2 Open, 3.6.14:
    • $all ships manage shields:
    FS2 Open, 3.8:
    • $ai can slow down when attacking big ships:
    FS2 Open, 19.0:
    • $use actual primary range:

    Sample Entry

      #AI Classes
      $Name:         Captain
      $accuracy:     0.5      0.55     0.6      0.65     0.7
      $evasion:      10,      20,      30,      40,      50
      $courage:      10,      20,      30,      40,      50
      $patience:     10,      20,      30,      40,      50
      #End
    


    FS2 Open, 3.6.12: (Sample entry using some optional elements)
      #AI Classes
      $Name:         Captain
      $accuracy:                      0.5      0.55     0.6      0.65     0.7
      $evasion:                       10,      20,      30,      40,      50
      $courage:                       10,      20,      30,      40,      50
      $patience:                      10,      20,      30,      40,      50
      $Get Away Chance:               0.40,    0.45,    0.50,    0.55,    0.6
      $Autoscale by AI Class Index:     NO
      $AI In Range Time:              2,       1.6,     1.2,     0.8,     0.4
      $Primary Ammo Burst Multiplier: 0.6,     0.65,    0.7,     0.75,    0.8
      $Glide Attack Percent:          30,      40,      50,      60,      70
      $allow rapid secondary dumbfire:  NO
      $allow vertical dodge:            YES
      #End