ZerothAngel's From the Depths Scripts
A collection of From the Depths Lua scripts I've written since I started playing (about the middle of 2016).
I'll only list the interesting scripts (the ones not used for research or testing).
Also see my notes about assumptions and possible gotchas.
These scripts wholly replace the "combat" and "fleetmove" behavior of the stock AI. (Still, using the stock Naval AI Card with these scripts is recommended, even for aircraft, as it provides a sane "patrol" behavior.)
All the combat-oriented scripts (everything but repair-ai and utility-ai) have the ability to dodge missiles that have been detected.
When using with an altitude control script, try using a combo script that includes the desired AI module (see below). It will have better integration (e.g. missile dodging also modifies altitude) and it will be more efficient in terms of CPU usage.
- airplane — This is actually just naval-ai below packaged in a combo script meant for anything that flies like an airplane, i.e. responds to yaw/pitch/roll/propulsion controls. Supports banked turns and like naval-ai, supports broadside and attack run behaviors. Similar to the stock Aerial AI, but potentially much smoother since it has a number of built-in PIDs. See the brief guide.
- drop-ai — Dropship/boarding AI which follows the closest enemy and keeps the ship directly above (or below) it. This comes as a combo script, a 6DoF jet/spinner version. There's currently no standalone version.
- gunship-ai — A standoff AI that attempts to keep at a set distance from the target while continuously facing it. Moves laterally and longitudinally (forward and backward) to do so. Comes as a combo script, a 6DoF jet/spinner version. No standalone version currently available.
- naval-ai — Naval AI (2D only) with terrain/friendly avoidance and pseudo-random evasive maneuvers. Supports both broadside and attack run behaviors. (Forum post)
- repair-ai — Advanced repair AI (2D only) with terrain/friendly avoidance. Fixates on the closest friendly and follows it throughout battle. However, it will head out to repair other nearby friendlies as well. (Forum post)
- utility-ai — Utility AI (2D only) with terrain/friendly avoidance. Meant for non-combatant ships in adventure mode. Has automatic wreck-collecting & resource gathering functions.
Altitude/Depth Control (Only)
These scripts only provide altitude or depth control. They are meant to be used alongside a 2-dimensional AI, like the Naval AI card (or many of my AI scripts above). They also work fine with manual yaw & propulsion. All scripts will also allow manual (analog) control of the altitude/depth using a drive maintainer.
Again, if you're going to use these with my AI scripts, using a combo script (below) provides better integration and is more efficient.
- aerostat — Controls helium pumps for lift and pitch/roll stabilization. I don't use this myself, so YMMV. (Forum post)
- subcontrol — Hydrofoil script with pitch, roll, depth control + manual depth option. (Forum post #1 Forum post #2)
- subpump — Controls air pumps for lift and pitch/roll stabilization. I don't use this myself as I prefer hydrofoil-based subs, but it's here for completeness. (Forum post)
- hover — Upward- or downward-facing jets and/or spinners for lift and pitch/roll control.
Note that the "unifiedmissile" module and all scripts based on it have been superceded by a newer, more general missile module (uncreatively named "generalmissile"). It can do everything unifiedmissile can do and more.
The generalmissile module is quite a bit harder to configure properly — using a Lua-aware editor is recommended — so I haven't bothered making any public posts about it. But it's available here.
These use the new configuration scheme detailed in this doc.
- generalmissile — Highly configurable missile script that supports dual-mode operation (AA or profile), an arbitrary number of profile phases, directional approach, and variable thrust control. Only bother with this script if you're interested in only having a single type of missile on your vehicle. Otherwise, use multiprofile below.
- multiprofile — Multiple profile missile script, based on generalmissile. Profiles can be selected by weapon slot, launcher direction (left, right, up, etc.) or launcher orientation (horizontal/vertical). (Documentation)
- smartmine — aka mobilemine. Rocket-propelled magnetic mines that automatically match depth and minimizes magnetic range when friendlies are nearby.
These all use generalmissile under the hood, but continue to be configured as they were before. I will most likely not add any new configuration options, but they should continue to work for the foreseeable future.
- pnmissile — Experimental script for pure proportional-navigation guidance.
- udualprofile — Dual-profile missile script, using a separate unifiedmissile instance for vertically- and horizontally-launched missiles. (Forum post)
- umultiprofile — Multiple profile missile script, up to one unifiedmissile instance for each weapon slot. (Forum post)
- unifiedmissile — Highly configurable advanced missile script that supports a variety of attack profiles. (Forum post)
I've only recently started dabbling in Lua-aimed cannon turrets. Frankly, I don't see any solid advantages yet (aside from making the LWC/receiver/failsafe combo unnecessary). And you lose quite a bit, like failsafes and the ability to have AI-assisted manual targeting.
But it was an interesting exercise, and it does seem to be quite a bit more accurate.
- cameratrack — Controls turrets on a single weapon group and points them at the highest-priority enemy. Meant for cameras (so you can have a non-cheaty pseudo-3rd person view in adventure mode), does not compute firing solutions for weapons. Also useful for directing sensor turrets without the need for a missile controller+LWC.
- cannoncontrol — Cannon fire control script. Uses the quartic (4th degree) ballistic trajectory formula, so it takes gravity (of course) and relative target velocity into account. Can control one or more weapon groups with a different set of targeting limitations for each.
- rocketcontrol — Turret controller for dumbfire rockets or torpedoes. The missiles must not have any fins or guidance.
I tend to build small and because of that, I avoid having more than a few Lua boxes. So I assemble and use combo scripts that are made up of many of my own scripts. This saves on Lua boxes and is also more efficient — stuff like targeting and weapon control only needs to happen once per run.
- airplane — Combo script: naval-ai + airplane + multiprofile + shieldmanager
- airship — Combo script: naval-ai + hover + multiprofile + shieldmanager
- carrier — Combo script: naval-ai + dockmanager + shieldmanager
- drop — Combo script: drop-ai + sixdof + shieldmanager
- gunship — Combo script: gunship-ai + sixdof + multiprofile + shieldmanager
- utility — Combo script: utility-ai + hover + dockmanager + shieldmanager
- utility6dof — Combo script: utility-ai + sixdof + dockmanager + shieldmanager
- utilitysub — Combo script: utility-ai + subcontrol + dockmanager + shieldmanager
- repair — Combo script: repair-ai + hover + shieldmanager
- repair6dof — Combo script: repair-ai + sixdof + shieldmanager
- repairsub — Combo script: repair-ai + subcontrol + shieldmanager
- scout — Combo script: naval-ai + hover + shieldmanager + cameratrack
- scout6dof — Combo script: gunship-ai + sixdof + shieldmanager + cameratrack
- minelayer — Combo script: gunship-ai + sixdof + mobilemine + shieldmanager
- submarine — Combo script: naval-ai + subcontrol + multiprofile + shieldmanager
- warship — Combo script: naval-ai + multiprofile + shieldmanager
- dediblademaintainer — Allows linking a drive maintainer to forward/reverse-oriented dediblades for propulsion. This gives you full manual analog control of dediblades, allowing a quick way to zero-out the throttle (as with the "water drive") and also go in reverse.
- interceptmanager — Fires a weapon slot (presumably a missile interceptor launcher) associated with one of the 4 directional quadrants whenever hostile missiles are detected. Distinguishes between incoming missiles & torpedoes. Saves ammo.
- shieldmanager — Only activates shields facing enemies. Saves power.
- dockmanager — Staggered release of tractor beams (front-to-back) after first enemy detection. Delayed recall of fighters after last enemy dies.
More or less functional, but still works-in-progress.
The "alldof" module is basically a version of the sixdof module that continuously calculates the facing of all propulsive elements, making it suitable for tilt-rotor & vectored thrust vehicles.
- airshipadof — Combo script: naval-ai + alldof + multiprofile + shieldmanager
- gunshipadof — Combo script: gunship-ai + alldof + multiprofile + shieldmanager
- quadtilt — Combo script: naval-ai + quadtilt + alldof + multiprofile + shieldmanager. Quad-tilt rotor/thruster script. I'm not really satisfied with the way it works (weak altitude control), I'll probably start anew if I ever get interested in these types of vehicles again. Very tricky to set up, just avoid using it.
- interceptor — Full-fledged Lua-guided missile interceptor script. Attempts to assign interceptors 1-to-1 to missiles, also uses quadratic predictive guidance to guide interceptors to their missile. Still useless since interceptors are pretty weak against missiles, especially with the missile HP buff.
- rocketlerp — Adaptive turret controller for dumbfire rockets. Linear interpolation version.
- rocketnn — Adaptive turret controller for dumbfire rockets. Neural network version.