From The Depths

From The Depths

Hover gunship/airplane AI (OBSOLETE)
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.
CHOO CHOO 6 Apr, 2019 @ 1:17pm 
2-4-1 is generally a bit fucky.
nary_believe 6 Apr, 2019 @ 1:10pm 
Is anyone else finding this to not work in v2.4.1? For me the balloons function but thrusters are never activated
SuspiciousBicycle63 26 Mar, 2019 @ 3:07pm 
sometimes it flies like a normal aerial ai? help
Advanced Plant 12 Jan, 2019 @ 1:43pm 
I have attempted to make a gunship sort-of-thing. However when it fights naval vessels, primarily the walrus, It slowly floats down into the water and tries to become a boat. Any help with this at all?
LS-Swapped HMT Olympic 24 Nov, 2018 @ 2:45pm 
This will be extremely helpful, seeing as I don't know programming. Keep up the good work as part of the dev team, the missile update has been insanely useful and VERY fun!
CHOO CHOO 13 Nov, 2018 @ 2:16pm 
@D.TheSilverWolf: Coat them in rubber?
D.TheSilverWolf 13 Nov, 2018 @ 1:20pm 
Is there any way to make your Airships not crash into each other. I'm making little speed flyers using the attack run mode but they like to crash into each other when turning away from the target.
CHOO CHOO 28 Oct, 2018 @ 3:16am 
"right" and "left" mode don't work for me; the vehicle always bahaves as if in "orbiter" mode. Any idea what might cause this?
Lune 4 Oct, 2018 @ 2:03pm 
Updates the thrust output of every engine, every frame. Which causes immediate desync in multiplayer. Needs to not do that.
™DRACO ✟ 31 Jul, 2018 @ 8:03am 
Thanks for this
Draba  [author] 30 Jul, 2018 @ 2:13am 
Ofc, the purpose the script is up is to be shared :)
Changing explosion mechanics is pretty complicated, you should check out Gladyon's posts on the forums or on discord to get an idea.
dichebach 29 Jul, 2018 @ 2:43pm 
Sweet, should be able to figure out the Lua with THIS puppy! :)

I like the "V2TacticalNukeDrone" by PurpleEleven, but it is honestly a bit deficient in its responsiveness to enemies. Might try to use your code to soup up that kamikaze bomber. If I do maange to get it to work and post it on here, I'll definitely credit you! Is that cool?

Also: any tip from anyone on how the stats on the tac nuke might be buffed?

Had one of the V2s clip a Wanda (all wood airship) and the detonation was like 5 meters from the ship's center and it barely scratched it.
dszombiex 6 Mar, 2018 @ 3:04pm 
@Draba Thank you sir I'll make sure it's properly annotated.
Draba  [author] 6 Mar, 2018 @ 2:50pm 
Yep, in general you can do whatever you want with any of my code/mods
dszombiex 6 Mar, 2018 @ 2:48pm 
Draba, may I use your PID code in another Lua?
Extinction 28 Jan, 2018 @ 1:13pm 
Hi is it somehow possible to create a nuke with this? There are some minor things that stop the posibility on actually creating a stable flying nuke. All other scripts are so wonky that they are just no usefull at all.
TRG 9 Dec, 2017 @ 10:07am 
Alright, this is the URL of the ship: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1224580359&searchtext=NIS+Nautikus+mark+6
Back with the old LUA script, it always took the optimal altitude when AI was active in combat mode. But with the new LUA script, now it goes directly to the minimal altitude. This happens with the other ships with the new script. They goes for the minimal altitude.
Draba  [author] 9 Dec, 2017 @ 1:46am 
In combat/patrol mode it does so because the waypoint is there.
If the mainframe is off I don't know, would need to take a look.
TRG 7 Dec, 2017 @ 10:17am 
Draba, nevermind. I realised what i did wrong. I didn't realise there was 2 different blueprints. I thought it was going to update on the same so i was using the old one. It works now.
I have a new problem though. Now the ship wil go for the minimal altitute directly instead of going and staying on the optimal altitute like it used to. Which is a problem since the Nautikus series goes underwater like a sub at the same as it hovers in air so the minimal altitute is -70.
Draba  [author] 7 Dec, 2017 @ 12:10am 
Did exactly that for testing the minor update, works for me.
TRG 6 Dec, 2017 @ 7:37pm 
I could give you the script on another ship. Because I am still working on the current one. You can find the ship in my workshop, "NIS Atlantis". It has the same problem.
Draba  [author] 6 Dec, 2017 @ 6:58pm 
Should work, upload the blueprint somewhere and I'll take a look.
TRG 6 Dec, 2017 @ 2:53pm 
I did how you asked me to. I still am getting movement not a complete stop. Still guided by the weight of mass.
Draba  [author] 6 Dec, 2017 @ 2:20pm 
Workshop is a bit convoluted, retrofit isn't what you are looking for :)
Open workshop, vehicle workshop, download subscriptions, download, click to overwrite existing file.
Spawn the blueprint you downloaded in designer and lift the new code from the lua box, should work without changing anything beyond altitude/distance limits.
TRG 6 Dec, 2017 @ 1:57pm 
I tried retrofit the blueprint in vehicle designer, but said i had the latest version.
Draba  [author] 6 Dec, 2017 @ 1:50pm 
You are using an older version on your workshop items, there was a major rewrite that introduced combat mode falling back to patrol and hovering at the waypoint when no enemies are around.
Was preoccupied with attackruns so missed it from the changelog :)

Also updated the code now so when controlling mainframe is set to "off" it'll reduce speed to ~0.
TRG 6 Dec, 2017 @ 12:03pm 
Draba, if you're still around, I have a concern.
How can I find a way for the LUA script keep my ships stabilized in one place? I have 3 ships already that keep moving backwards when idle guided by the weight of the center of mass.
Is there are way to prevent that and make the ship keep a total stop?
Draba  [author] 26 Oct, 2017 @ 2:32am 
OutMin and OutMax are the limits on how much of a propulsion component's strength a given PID can use. For example, with altitude set to -0.8, 0.8 changing altitude will never use jets/dedis at over 80% max output in either direction.
This way there is always reserve thrust for maintaining pitch/roll.

IMin and IMax are the limits of how strong the integral part can grow(still limited by OutMin and OutMax).

You almost never need to touch these, having some extra propulsion and tuning lower usually gives better results.
Just here for the extreme cases.
NtheGrand 25 Oct, 2017 @ 6:52pm 
question: what is outmax, outmin, imax, imin
Draba  [author] 22 Oct, 2017 @ 4:46am 
By the time I got around to it forgot what was the problem so here's the list of changes :)
- Disabled patrol fallback for combat mode. Now if there are no enemies around it'll hover in place and obey user input.
- Minimum altitude changed to 30m(if it hits water dedis do not give enough lift to get out anyway)
- Added a few lift thrusters in the front, disabled movement pitch assist(at ~4-5° it wouldn't have enough lift to keep altitude when going forward)
- Increased altitude / roll PID strengths

You can download the attachment in the forums without signing up:
http://www.fromthedepthsgame.com/forum/showthread.php?tid=15393&pid=351093#pid351093

Let me now if you deleted post contained something else that I forgot.
Mortazel 18 Oct, 2017 @ 5:56pm 
Here's a .zip with the old and new BP and some screenshots of the scripts to make it easier.
UBlock Origin suggested (or some good ad blocker): http://www.filedropper.com/mortazelhoverai-luascirptproblem
Thank you!
Draba  [author] 18 Oct, 2017 @ 11:50am 
Nerdifire just have to move the line in FrontalFight():
SetForwardSpeedForDistance(VehicleState.target.GroundDistance - optimalDistance, false)

Goes from the end of the function to there:

if math.abs(VehicleState.target.Azimuth) < 10 then

AddSlipOutput(evasion.slip)
SetRoll(-rollMovementAssist * evasion.slip)
SetForwardSpeedForDistance(VehicleState.target.GroundDistance - optimalDistance, false)

else

SetRoll(0)

end



Mortazel sorry accidentally deleted your comment while trying to edit mine,
post the blueprint somewhere and I'll take a look.
NtheGrand 11 Oct, 2017 @ 7:20pm 
i was wondering if it would be possible to make it so the main thrusters do not fire unless facing the enemy? this is an idea for space combat to prevent the craft from orbiting a target when it is supposed to be in satelite mode. im having difficulty attempting to code it myself, one grand idea i had was to have the pid code slow the ship down with reverse thrusters once it got close to a target because of the lack of drag. just like altitude works but forward and reverse instead of up and downl, and only move forward once facing the enemy
Draba  [author] 3 Aug, 2017 @ 3:23am 
Are you using an older version?
The june 9 update was targeting a problem just like the one you describe.
Could you upload the vehicle having the problem otherwise?
FURRYHUSKY1000 29 Jul, 2017 @ 10:10pm 
I just found out that I have to swap the positions of the ion thrusters and jet engine positions.. that time it goes full speed... strange...

(I did not replace anything, just the positions of the ion thruster and jet engine)
FURRYHUSKY1000 29 Jul, 2017 @ 9:55pm 
For some reasons the craft I'm building is capped at 22m/s however, if I put it to "ON" then controll it manually it can go as fast as 42m/s

I'm clueless why is it capped at such speeds even if it goes alone, or included in a fleet that can go fast as 100m/s
space king 18 Jul, 2017 @ 1:51pm 
it keeps running away and only moving backwards in 'combat' mode :/
Draba  [author] 5 Jul, 2017 @ 2:02pm 
For manual control the first mainframe has to be set to 'On' in the C menu.
Not much can be done about falling without power, gotta keep the batteries at a level where electric engine gives enough charge.

Flipping at high altitude is probably caused by one side being much weaker and not being able to compensate when air density goes down.
Need more thrusters on the weak side, maybe try tinkering with/limiting pitch/roll PID values or increasing altitude ones.

Didn't get too much time lately, will look into the orbiting min/max distance and forcing a direction.
Thanks!
Holuden 30 Jun, 2017 @ 7:21am 
Also, when I shoot lasers jets get significant power decrease(though there is alot of power left in batteries) and the ship starts to fall untill the batteries are full again.
Holuden 30 Jun, 2017 @ 4:25am 
I cannot manualy controll anything but altitude... Any ideas?