Advertisement
Madwand

Advanced aerial AI documentation, version 4.2

Sep 9th, 2015
7,378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.19 KB | None | 0 0
  1. -- BASIC OPTIONS
  2. -- When the vehicle is within "AngleBeforeRoll" degrees of its target, it will try to yaw towards
  3. -- (or away!) from its target such that its nose is pointed "AngleBeforeTurn" degrees away from it.
  4. -- If UsePreferredSide = true, use a positive value of AngleBeforeTurn to approach targets on the right,
  5. -- a negative value to approach targets on the left. Otherwise, always use a positive value.
  6. AngleBeforeTurn = 10
  7. -- If the vehicle is at greater than this angle from it's target, it will try to roll towards it.
  8. -- (and stop rolling when AngleBeforeTurn is reached).
  9. -- Set this to 180 to NEVER use roll.
  10. AngleBeforeRoll = 30
  11. -- Outside of this distance, the vehicle will try to close on it's target.
  12. -- NOTE: All distances are measured along the ground! (unlike the default AI)
  13. AttackRunDistance = 600
  14. -- Within this distance, the vehicle will just try to go straight until AttackRunDistance is triggered.
  15. AbortRunDistance = 300
  16. -- Outside of this distance, the AI will try to intercept its target by attempting
  17. -- to predict it's future position.
  18. ClosingDistance = 1000
  19. -- If AttackRunDistance hasn't been triggered within this time, force an attack run.
  20. ForceAttackTime = 15
  21. -- Altitude we will try to cruise at by default.
  22. CruiseAltitude = 100
  23. -- Maximum elevation angle, positive or negative, AI will attempt to use while climbing or descending.
  24. -- Usually refers to pitch, but AI will also try to yaw to this angle when rolled on it's side.
  25. MaxElevationAngle = 30
  26. -- Maximum throttle we'll cruise at when no enemies are present. Should be in the range of 0 to 5.
  27. CruiseSpeed = 5
  28. -- Throttle we'll use when engaged with enemies. Should be in the range of 0 to 5.
  29. AttackRunSpeed = 5 -- when on an attack run (angle to target is less than "AngleBeforeRoll") inside of ClosingDistance
  30. EscapeSpeed = 5    -- triggered after coming within "AbortRunDistance" until "AttackRunDistance" is reached
  31. RollingSpeed = 5   -- when rolling aircraft to face enemy (angle to target is greater than "AngleBeforeRoll")
  32. ClosingSpeed = 5   -- when outside of ClosingDistance AND not in a roll
  33. -- Whether to orbit the spawn point when there are no enemies, or just fly off in a straight line
  34. OrbitSpawn = true
  35.  
  36. -- AIRSHIP/HELICOPTER OPTIONS
  37. -- Use jets pointing up or down to assist in controlling altitude. WARNING: uses Nick's propulsion balancing code.
  38. UseAltitudeJets = false
  39. -- Use spinners (hopefully with helicopter blades) to try to control altitude.
  40. -- Automatically excludes any spinners used for vector thrust.
  41. -- See the "ExcludeSpinners" settings to specify an additional list of spinners to exclude.
  42. UseSpinners = false
  43. -- The helicopter blade speed to use when lowering altitude. Ranges between -30 to 30.
  44. -- Use AltitudeClamp to control how smoothly these speeds are transitioned between
  45. -- as your helicopter approaches it's target altitude.
  46. MinHelicopterBladeSpeed = 10
  47. -- The helicopter blade speed to use when gaining altitude. Ranges between -30 to 30.
  48. MaxHelicopterBladeSpeed = 30
  49. -- A third option for airships is to allow the AI to manually control downward-pointing engine drive
  50. -- fractions. This option can be turned off above a certain speed (in m/s) for VTOL takeoffs.
  51. -- Set "UseVTOLBeneathSpeed" to a large number to use VTOL all the time
  52. UseVTOLBeneathSpeed = 0
  53. -- A list of engine indices to use for VTOL. Set to 'all' to use all downward-pointing engines.
  54. -- Use a list format, i.e. {0,1,2,3} to specify exact engine indices. Engines may be attached to
  55. -- spin blocks for use with vector thrust, and will be rotated backwards when "UseVTOLBeneathSpeed"
  56. -- is exceeded. If engines are on spin blocks, you must specify their indices if the AI is to
  57. -- control their drive fraction. An spin block and engine control tool is available on the
  58. -- FtD forums to assist in identifying indices.
  59. -- For engines mounted to the hull, set each such engine to "Main".
  60. -- You can (and should) set the drive fractions of each engine you want to use with this AI,
  61. -- on the engine itself. The drive fraction on each engine specifies the maximum amount of
  62. -- power you want to use on that engine.
  63. VTOLEngines = nil
  64.  
  65. -- TERRAIN AVOIDANCE OPTIONS
  66. -- These settings allow a vehicle to avoid terrain by temporarily increasing it's altitude (only!).
  67. -- To avoid terrain by turning aside, see the TerrainAvoidanceWeight flocking setting.
  68. -- 0: Ignore terrain. Only recommended for spacecraft.
  69. -- 1: As normal aerial AI, just add CruiseAltitude to terrain when terrain is above sea level.
  70. --    This will respect "MinAltitude" and "MaxAltitude" constraints when possible.
  71. -- 2: Adjust altitude by minimum necessary to respect "MinAltitude" constraint.
  72. TerrainAvoidanceStrategy = 1
  73. -- The minimum relative altitude a vehicle will maintain above terrain. Higher priority than MaxAltitude.
  74. MinAltitude = 50
  75. -- The maximum sea-level altitude the vehicle will attempt when avoiding terrain.
  76. MaxAltitude = 400
  77. -- A set of multipliers on current velocity; how far we look ahead to avoid terrain.
  78. -- We'll look ahead at each of these points to see if terrain is in the way.
  79. TerrainLookahead = {0,1,2,4}
  80. -- Cap vehicle speed at this value when a possible collision is sensed.
  81. MaxTerrainSpeed = 5
  82.  
  83. -- WATER START OPTIONS
  84. -- Water start will deploy balloons when the center of mass is lower than this.
  85. -- If your vehicle has no water start balloons, set this to some large negative value.
  86. DeployAlt = 5
  87. -- Water start will release balloons when the center of mass is higher than this.
  88. ReleaseAlt = 15
  89. -- After water start has been triggered, will disable movement until this altitude has been reached.
  90. EnableEnginesAlt = 10
  91.  
  92. -- COLLISION AVOIDANCE OPTIONS
  93. -- Collision detection and avoidance tries to detect and optionally avoid possible collisions
  94. -- with the target (only!). The "TThreshold" parameter is how distant in time (in seconds)
  95. -- a potential collision will be considered dangerous. The "Height"
  96. -- parameter is how far above and below the vehicles current altitude it will check.
  97. -- The "Angle" parameter is the desired behavior on detecting a collision. Setting it to "0"
  98. -- means to go directly towards the enemy. "90" means go at right angles, and "180" means run away.
  99. CollisionTThreshold = 2
  100. CollisionDetectionHeight = 20
  101. CollisionAngle = 20
  102.  
  103. -- FLOCKING OPTIONS
  104. -- Start by reading more about flocking behavior here: http://www.red3d.com/cwr/boids/
  105. -- Flocking is an advanced behavior that allows formation-like flying and collision avoidance.
  106. -- Flocking controls azimuth only (not altitude).
  107. -- Start using flocking by setting "NeighborRadius" to a positive number (try 300, for example)
  108. NeighborRadius = 0  -- in meters
  109. -- For alignment and cohesion, ignore craft that are going below this speed (in m/s)
  110. IgnoreBelowSpeed = 0
  111. -- Set FlockWithBlueprintNames = 'all' to use alignment and cohesion with all friendly craft
  112. -- Enclose a comma-delimited list of vehicle names in curly braces {} to use alignment and cohesion
  113. -- with only craft with those names. Names given will match with any vehicle that starts with that
  114. -- combination of letters, for example {'Rapier'} will match with any vehicle named
  115. -- 'Rapier', 'Rapier-A', 'Rapier-E', etc.
  116. FlockWithBlueprintNames = 'all'
  117. -- The weight given to alignment, or the desire to match azimuth with friendly craft
  118. AlignmentWeight = 1
  119. -- The weight given to cohestion, or the desire to come closer to friendly craft
  120. CohesionWeight = 1
  121. -- The weight given to separation, or the desire to avoid coming too close to vehicles.
  122. -- Will also avoid enemy vehicles within CollisionDetectionHeight
  123. SeparationWeight = 1.5
  124. -- A cohesion weight for injured vehicles. May be useful for "medic ships"
  125. InjuredWeight = 0
  126. -- A cohesion weight for friendly vehicles at ranges outside NeighborRadius.
  127. LongRangeWeight = .5
  128. -- If positive, this weight will examine 8 compass directions around the vehicle at distance
  129. -- NeighborRadius, and if there is a danger of collision (as determined by the "MinAltitude" setting),
  130. -- will attempt to angle the aircraft away from the collision.
  131. -- It will still attempt to avoid terrain by gaining altitude as appropriate.
  132. TerrainAvoidanceWeight = 0
  133. -- The weight given to the "normal" target-specific behaviors of attack, escape, etc.
  134. TargetWeight = 1
  135.  
  136. -- "DOGFIGHTING" OPTIONS (changing behavior based on information about the target)
  137. -- Whether or not to try to match our altitude to the target.
  138. -- If set to "false", will use CruiseAltitude during combat.
  139. MatchTargetAltitude = false
  140. -- Range within which to attempt altitude matching. Beyond this range, uses CruiseAltitude.
  141. MatchAltitudeRange = 300
  142. -- Altitude above (or below, if negative) the target the vehicle will attempt to attain.
  143. -- Altitude will still be constrained by "MinAltitude" and "MaxAltitude" terrain avoidance constraints
  144. MatchAltitudeOffset = 50
  145. -- The minimum altitude the aircraft will go to when matching altitude
  146. MinMatchingAltitude = 100
  147.  
  148. -- VECTOR THRUST OPTIONS
  149. -- Vector thrust means placing jets on spin blocks, potentially allowing much more powerful yaw, pitch,
  150. -- or roll authority on a plane. Turn this option on by specifying a number of spinners
  151. -- to use with VTSpinners. Use VTSpinners = 'all' to use all spinners, or supply a comma-delimited
  152. -- list like this: {0,1,2}, where the index of a spinner is the order it was placed down on your ship,
  153. -- starting the count from index 0. Spinners placed vertically are for yaw. Spinners placed horizontally
  154. -- control roll and pitch (so I suggest placing them farther to the left and right of your CoM).
  155. -- Note that if you stop/start the AI, you will probably want to reload your aircraft so
  156. -- the AI can correctly re-learn the default orientation of each spinner.
  157. -- Also see the "ExcludeSpinners" setting to specify a list of spinners to exclude, if this is set to 'all'.
  158. VTSpinners = nil
  159. -- The maximum angle to set any particular spinner to. Roll and pitch angles are cumulative. The
  160. -- maximum angle you can specify is 90 degrees. Set to 0 to not use that particular kind of vector
  161. -- thrust. You can use negative angles to reverse the angle direction.
  162. -- The VTOL angle is the downwards angle VTOL spinners will be set to in VTOL mode.
  163. MaxVTAngle = {30,30,30,90} -- yaw, roll, pitch, VTOL
  164. -- These next two settings probably don't need to be messed with. They set the interaction between
  165. -- a decision to move a particular direction and how powerfully the spinner angles respond to that impulse.
  166. -- These are roughly similar to the parameters of a PI-controller.
  167. VTProportional = {1,1,1}
  168. VTDelta = {1/12,1/12,0}
  169. -- The set of VTOL spinners to use when in VTOL mode. Set to 'all' to select all spinners capable of
  170. -- pointing downwards. Otherwise, choose a list of spinner indices like: {0,1,2,3}. You can
  171. -- use a tool (also provided) to help you select the correct indices.
  172. -- VTOL spinners will angle downwards at their given MaxVTAngle when in VTOL mode, otherwise
  173. -- they will point backwards and operate as normal vectored thrust.
  174. -- Also see the "ExcludeSpinners" setting to specify a list of spinners to exclude, if this is set to 'all'.
  175. VTOLSpinners = 'all'
  176.  
  177. -- MISSILE AVOIDANCE OPTIONS
  178. -- Try to avoid missiles. Set "WarningMainframe = -1" to ignore missiles. Set it to the index
  179. -- of the mainframe with missile warners, if you have missile warners. If you only have one mainframe,
  180. -- then WarningMainframe = 0.
  181. WarningMainframe = -1
  182. -- If missiles are within this time-to-target threshold, ship will try to run away from them
  183. RunAwayTTT = 2
  184. -- The angle at which to dodge missiles. You will usually want this at 180 to run away,
  185. -- but you can run *towards* the missiles by setting this to 0, or at right angles by setting it to 90, etc.
  186. RunAngle = 180
  187. -- If missiles get within this time threshold, ship will try a specialized dodging maneuver.
  188. DodgeTTT = 1
  189. -- Usually between 10 and 90 degrees, describes how close to the desired roll angle the ship should
  190. -- be before pitching up during the roll. Set to larger values if you don't care about steady rolls
  191. -- and just want to get out of the way of a missile ASAP.
  192. DodgingRollTolerance = 60
  193. -- The speed (in m/s) your ship is usually able to go when dodging missiles.
  194. NormalSpeed = 100
  195. -- The radius (usually half the length of your ship, in meters) of your ship
  196. CraftRadius = 21
  197. -- The throttle value you want to use when dodging missiles OR collisions
  198. DodgingSpeed = 5
  199. -- You shouldn't need to mess with this. Helps decide when a missile might be dangerous.
  200. DangerRadius = 20
  201.  
  202. -- ADVANCED OPTIONS (You shouldn't need to mess with these most of the time.)
  203. -- 0 for water mode, 1 for land mode, 2 for air mode. You can try it for non-aircraft, but YMMV.
  204. MODE = 2
  205. -- This AI automatically clamps "MaxElevationAngle" according to how near the aircraft is to it's target
  206. -- altitude to prevent overshooting (i.e. going into space) when changing altitude. Higher values of
  207. -- "AltitudeClamp" decrease this effect, allowing steeper climbs. Lower values help prevent overshooting.
  208. -- AltitudeClamp also controls how gradually airships approach thier target altitude.
  209. AltitudeClamp = .2
  210. -- Damping parameters to mitigate wobbling in high-performance vehicles. Higher values can help
  211. -- control wobbling, lower values allow faster turns but may overshoot and cause wobble more often.
  212. PitchDamping = 90
  213. YawDamping = 90
  214. RollDamping = 45
  215. -- The default roll angle to maintain. Set it to 90 to have the vehicle usually on it's side.
  216. -- You may want to set "AngleBeforeTurn" to 0 if you do this, so you never yaw.
  217. DefaultRollAngle = 0
  218. -- There are three kinds of ways this AI can use to control forward speed (i.e., main drive):
  219. -- MainDriveControlType = 0: Uses standard throttle control. Most ships will want this option.
  220. -- MainDriveControlType = 1: Use forward (only) propulsion balancing. This may help to compensate
  221. --   for damage to thrusters, or unbalanced thruster placement compared to the center of mass.
  222. --   WARNING: Propulsion balancing can be very unreliable. YMMV.
  223. -- MainDriveControlType = 2: Control throttle by varying drive fraction. The AI will try to guess
  224. --   which thrusters are forward thrusters. It will EXCLUDE any thrusters on spin blocks, so vectored
  225. --   thrust continues to operate at full power for greatest possible maneuverability.
  226. MainDriveControlType = 0
  227. -- The minimum speed you want your aircraft to go. If your speed ever goes to less than this,
  228. -- the throttle will be temporarily set to 5 until you are above the minimum speed.
  229. MinimumSpeed = 0
  230. -- The maximum speed you want your aircraft to go. If this is exceeded, the AI will temporarily
  231. -- reduce throttle to 20% of maximum. Some tournaments have specified a maximum speed.
  232. MaximumSpeed = 999
  233. -- The maximum roll angle your vehicle will take during a roll. Set this lower if your vehicle is
  234. -- going into the sea during a roll.
  235. MaxRollAngle = 120
  236. -- How close you want your aircraft to be to the "desired" roll angle before pitching up. Set this too
  237. -- high and you may gain or lose too much altitude during a turn.
  238. RollTolerance = 30
  239. -- Set this to true if you are interested in knowing what the AI is "thinking" as it operates.
  240. DebugMode = false
  241. -- Prefer to approach the enemy on only one side of the aircraft or not. Set AngleBeforeTurn positive'
  242. -- or negative to choose the side.
  243. UsePreferredSide = false
  244. -- Predictive guidance tries to guess where the enemy will be by the time the aircraft will reach it,
  245. -- and head in that direction instead of the current position of the enemy. Set this to "true"
  246. -- when you don't care about pointing directly at the enemy, and you wish to prioritize "cutting the
  247. -- circle" on a fast orbiter, or if you want to ram the enemy. Set to "false" if it is more important
  248. -- to orient yourself in relation to the enemies current position during the attack run, for example if
  249. -- all your weapons are in a fixed-forward firing position. Future altitude is also estimated, for
  250. -- when "MatchTargetAltitude" is true.
  251. UsePredictiveGuidance = false
  252. -- AltitudeOffset is useful when you wish to create multiple vehicles of the same type, and you
  253. -- don't want to individually set all the various altitude settings so they won't crash into each
  254. -- other. This value adjusts CruiseAltitude, MaxAltitude, MatchAltitudeOffset, and MinMatchingAltitude
  255. -- simultaneously. You can also give it two table values, e.g. {0,100}. This will randomly generate
  256. -- an offset in the range [0,100], so your aircraft may be less likely to collide with other's of it's kind.
  257. AltitudeOffset = 0
  258. -- AngleOfEscape is the angle relative to the enemy that is set when going from "attack mode" to "escape mode".
  259. -- It is set once when entering escape mode, and does not adjust to enemy movements.
  260. -- By default, it is set to AngleBeforeTurn (and follows the same rules). You can set it to anything
  261. -- you like though, for example "AngleOfEscape = 90" will turn off at 90 degrees, or
  262. -- "AngleOfEscape = 180" will have the vehicle try to turn around.
  263. AngleOfEscape = AngleBeforeTurn
  264. -- An additional option for helicopters, vector thrust, and VTOL, ExcludeSpinners allows you
  265. -- to specify spinner indices to be excluded from use by this AI (if you use the 'all' option
  266. -- for VTSpinners or VTOLSpinners). If used, this must be a comma-delimited list surrounded
  267. -- by curly braces, for example "ExcludeSpinners = {0,5}"
  268. ExcludeSpinners = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement