Difference between revisions of "Ai.tbl"

From FreeSpace Wiki
Jump to: navigation, search
(Patience)
(Adding "$Use Actual Primary Range:")
(31 intermediate revisions by 8 users not shown)
Line 1: Line 1:
*The AI.tbl file defines the AI classed used in the game. This table is used to define each AI class with four abilities for each of the five difficulty levels.
+
{{TableVersionGit|2018-06-29|9d907c9}}
  
==Ability==
+
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.
*Higher number means better ability
 
  
===Accuracy===
 
*How accurately ship uses its weapons
 
  
===Evasion===
+
[[Tables|List of Tables]]
*How good the ship is at evading
 
  
===Courage===
+
==Required Elements==
*How likely the ship is to chance danger to accomplish goals
 
  
===Patience===
+
===$Name:===
*How willing the ship is to wait for an advantage before pursuing goals (Never actually implemented - It does nothing)
+
*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
  
==Table Entry==
+
===$Accuracy:===
'''$Name:'''
+
*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.
*Defines a name for the AI class that can be used with ships.tbl and also with FRED
 
*Syntax: ''Name''
 
'''$accuracy:'''
 
 
*Value from 0.0 to 1.0
 
*Value from 0.0 to 1.0
*Syntax: ''Value, Value, Value, Value, Value''
+
*Syntax: '''Float list''', five comma separated '''floats''', one for each difficulty, very easy, easy, moderate, hard, insane difficulty levels respectively
**Very Easy, Easy, Moderate, Hard, Very Hard difficulty levels respectively
+
 
'''$evasion:''', '''$courage:''' and '''$patience:'''
+
===$Evasion:===
 +
*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:===
 +
*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:===
 +
*How willing the ship is to wait for an advantage before pursuing goals. Never actually implemented - It does absolutely nothing.
 +
{{Table3611|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
 
*Value from 0 to 100
*Syntax: ''Value, Value, Value, Value, Value''
+
*Syntax: '''Float list''', five comma separated '''floats''', one for each difficulty, very easy, easy, moderate, hard, insane difficulty levels respectively
**Very Easy, Easy, Moderate, Hard, Very Hard 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:====
 +
{{Table3611|
 +
* 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:====
 +
{{Table3611|
 +
* 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:====
 +
{{Table3611|
 +
* 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:====
 +
{{Table3611|
 +
* 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:====
 +
{{Table3611|
 +
* 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===
 +
{{Table3611|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===
 +
{{Table3611|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:
 +
}}
 +
{{Table3613|
 +
* $all ships manage shields:
 +
}}
 +
{{Table38|
 +
* $ai can slow down when attacking big ships:
 +
}}
 +
{{Table382|
 +
* $use actual primary range:
 +
}}
  
 
==Sample Entry==
 
==Sample Entry==
Line 39: Line 134:
 
   #End
 
   #End
  
 +
{{Table3611| (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
 +
}}
 
[[Category:Tables]]
 
[[Category:Tables]]

Revision as of 23:03, 7 July 2018

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


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.


List of Tables

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

$Accuracy:

  • 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:

  • 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:

  • 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:

  • 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