From The Depths

From The Depths

50 ratings
Hover gunship/airplane AI (OBSOLETE)
   
Award
Favorite
Favorited
Unfavorite
Blueprints: AI, Lua
File Size
Posted
Updated
93.122 KB
24 Jun, 2016 @ 5:16am
6 Dec, 2017 @ 1:32pm
11 Change Notes ( view )

Subscribe to download
Hover gunship/airplane AI (OBSOLETE)

Description
A demo flyer containing a drop-in replacement for the stock AI, built to be as easy to use as possible.
Use this if you have trouble in the campaign, the gunship and orbiter modes are probably the best ways in the game to increase combat-efficiency.
With the builtin evasion you can stop worrying about cannons.

If you need help or have any questions drop a comment or post here:
http://www.fromthedepthsgame.com/forum/showthread.php?tid=15393

Can be used to:
  • Build a gunship that stays at a set distance and always faces the target(can pitch to aim hardmount weapons).
  • Make a plane that circles the target at a fixed distance(can be told to always show the left or right side, can roll to aim hardmount or 1-axis weapons).
  • Build bomber/fighter/ramming planes
  • Create orbital cannons that rain down fire on surface targets.
  • Make support craft that automatically approach and repair damaged allies, or hover in formation with the flagship and engage enemies.
  • Build personal speeders, the AI takes care of altitude/pitch/roll, you just have to steer and fire. Can also control altitude by hand to help in capturing.

Ways it's better than the stock AI:
  • Much more stable and tolerates damage better.
  • Much more accurate in aiming hardmounts.
  • Better terrain avoidance.
  • Great evasion.
  • Automatic configuration, should work with most craft without modifying anything.

How to use:
  • Spawn in the chair of the demo craft. The Lua box is directly in front of you, open it, save the code and copy it to a Lua box on your own flyer.
    If you want to change something options at the start have a brief description about what they do.
    Important! The code is around 800 lines long, the Lua box can only display ~400.
    To get the full code select it with ctrl+a and then copy with ctrl-c (or the equivalent on your machine).
  • Automatically detects all jets and dediblades, no need to set them up as main/roll/altitude/... controls.
  • To use dedispinners make sure that when they receive positive input they create a force that points from their bottom to their top(flip the blades if it's the other way around).
  • Only watches AI mode on the first mainframe listed in the 'C' menu. If you want to use a different one remove every other mainframe until only that one remains then put the removed ones back.
  • If your craft is too jumpy/reacts too slowly take a look at the PID configurations at the start.
    The PID values are saved on spawn, pull the craft out of play and then back when you make changes

AI modes:
  • Off: Parking mode, hovers in place
  • On: Manual mode, only controls altitude/pitch/roll, you can drive around like it was a boat just in the air
  • Combat:
    Falls back to patrolling if there are no enemies around

    - maintains a preset distance and always faces the target, performs evasive manouvers if it's configured to do so
    - in orbiter mode circles optimalDistance away from the target, can evade by wildly changing pitch
    - in attackrun mode does head-on attack passes
    - in repairmode helps damaged allies, when everyone is at full health falls back to fleetmove instead of patrol if the craft isn't a flagship
  • Patrol: follows waypoints and stabilizes at 0 speed when not fighting, follows waypoints while facing the target otherwise
  • Fleetmove: it's glued to its position in the fleet(relative to the flagship). Out of combat matches the direction the flagship is facing, in combat faces the target and uses side/forward thrusters to follow the flagship without turning.

Altitude control:
  • If you add a hydrofoil it'll be used to control the base altitude in 'Off'/'On'/'Combat' modes.
    -45° is the minimum altitude, 45° the max(I recommend binding the hydrofoil to a complex controller).

"HoverAI" blueprint manual controls:
- I, K: forward, backward
- J, L: turn left, turn right
- U, O: move left, move right
- uparrow, downarrow: increase/decrease altitude

Shamelessly lifted the PID/sidespeed calculation functions from goduranus/CP75, quaternion upvector is from Evil4Zerggin.
Can use all jets/dediblades/spinblock rotors as long as they provide a force pointing from their base to their top on positive input.
96 Comments
Lord Fuzzle 20 May, 2023 @ 5:26am 
Oh yea what you want is "Point at" and "Hover AI" in base game for something like this im so glad nick added your script it makes thrustercraft so much easier to make there my favorite!
Draba  [author] 28 Jan, 2020 @ 10:13am 
They are in the "Preconfigured cards" section now.
Esper 28 Jan, 2020 @ 7:18am 
Not seeing "Simple AI" cards.
Draba  [author] 10 Aug, 2019 @ 3:21am 
This script is now in the base game, with slight changes to work with the new AI system.
Look for the "Simple AI" cards in the AI tab.
Haz 9 Aug, 2019 @ 1:57pm 
i beg of you plz, my crafts, i cant get them to work, its tearing me appart
TRG 21 Jun, 2019 @ 2:34pm 
Not gonna be updated? Darn, the majority of my crafts given on workshop depended on this script to function.
Haz 1 Jun, 2019 @ 3:05am 
Anyone know what part of the update that broke it?
Raf's 12 May, 2019 @ 5:15pm 
If Draba doesn't mind since he is not updating the script, has anyone figured a fix or does anyone have a fixed version?
CHOO CHOO 17 Apr, 2019 @ 10:22am 
Well, it was a good ride. Got some mileage out of modifying it with additional behavior, too.

I hope the breadboard and AI will be up to snuff!

Draba  [author] 17 Apr, 2019 @ 8:54am 
Yep, this script was broken by the AI update and won't be updated any further.
Expect to see something similar/better as part of the base game in the near future.