Post Reply 
 
Thread Rating:
  • 13 Votes - 4.15 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hover AI: differential yaw/pitch, attack runs, pitch for altitude
2017-11-20, 10:18 PM
Post: #491
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
It overwrites regular AI.
Problem might be with propellers, it doesn't use props/rudders/hydrofoils/tailplanes by default.
If you link your ship I'll take a look when I have some time.
Find all posts by this user
Quote this message in a reply
2017-12-06, 05:46 PM
Post: #492
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
looks like the latest update has broken your ai. It just flies in a straight line i can see the thrusters trying to activate but nothing happens. Can fly the ship fine manually and everything else with the code works. Worked perfect;y before patch.
I included the blueprint in case its specific to my ship.


Attached File(s)
.blueprint  Proteus_AirCruiser_THICC.blueprint (Size: 499.89 KB / Downloads: 22)
Find all posts by this user
Quote this message in a reply
2017-12-06, 05:50 PM
Post: #493
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
(2017-12-06 05:46 PM)Karnivool Wrote:  looks like the latest update has broken your ai. It just flies in a straight line i can see the thrusters trying to activate but nothing happens. Can fly the ship fine manually and everything else with the code works. Worked perfect;y before patch.
I included the blueprint in case its specific to my ship.

Ill look later just for the fun of it.

Though... i wasnt aware of any recent updates.
Visit this user's website Find all posts by this user
Quote this message in a reply
2017-12-06, 05:57 PM
Post: #494
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
(2017-12-06 05:46 PM)Karnivool Wrote:  looks like the latest update has broken your ai. It just flies in a straight line i can see the thrusters trying to activate but nothing happens. Can fly the ship fine manually and everything else with the code works. Worked perfect;y before patch.
I included the blueprint in case its specific to my ship.

Yep, Gladyon mentioned Lua and spinblocks getting reshuffled.
I'll wait a bit for the big bugs to be squashed and then check out if the script is still broken.
Find all posts by this user
Quote this message in a reply
2017-12-08, 06:49 PM (This post was last modified: 2017-12-08 07:10 PM by Kiriko.)
Post: #495
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
(2017-12-06 05:57 PM)draba Wrote:  
(2017-12-06 05:46 PM)Karnivool Wrote:  looks like the latest update has broken your ai. It just flies in a straight line i can see the thrusters trying to activate but nothing happens. Can fly the ship fine manually and everything else with the code works. Worked perfect;y before patch.
I included the blueprint in case its specific to my ship.

Yep, Gladyon mentioned Lua and spinblocks getting reshuffled.
I'll wait a bit for the big bugs to be squashed and then check out if the script is still broken.

It doesn't seem to be anything directly connected to spinblocks. The script still controls the jets just fine, but for some reason it fails to activate anything other than the up/down thrusters. I didn't have time to look through the actual lua box code either, so just applied occam's razor to it, so to speak:

A quick hack that seems to make the script work, I changed the EnableAllJets() function:

Code:
-- Take over all jets, not just vertical ones
function EnableAllJets()
    VehicleState.jetsAtMax = 0

    if useJets then
        for i=0,11 do
            API:RequestThrustControl(i)
            API:RequestControl(2, i, 1)
        end
    end
end

Added a line API:RequestControl(2, i, 1).
Without that line, the controls still work if you feed them manual impulse, f.ex. if you have side thrusters set with manual yaw control through complex controller, then pressing yaw left or yaw right will activate them, and as long as you keep the control pressed down the script will work.

Again, not sure what exactly has changed, but this did make it run.

Here's the blueprint with the line added as an example:

.blueprint  Proteus_AirCruiser_THICC_hack.blueprint (Size: 509.78 KB / Downloads: 28)

Waiting to see if it gets fixed might be the right way to go just now, but this works if you're impatient about making the ships run right now. Nice ship by the way Big Grin

Workshop: Voidware, INARI and more.
Find all posts by this user
Quote this message in a reply
2017-12-10, 06:51 AM
Post: #496
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
As a relatively simple request, would you be able to set it so I can feed the lua AI a set of spinners to ignore? The idea is to create a propeller plane and just use the dedispinner as propulsion, as is the AI will override it and try to hover with the propeller the moment I pitch up.
Find all posts by this user
Quote this message in a reply
2017-12-11, 03:16 AM (This post was last modified: 2017-12-11 03:51 AM by Kiriko.)
Post: #497
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
(2017-12-10 06:51 AM)SynthTwo Wrote:  As a relatively simple request, would you be able to set it so I can feed the lua AI a set of spinners to ignore? The idea is to create a propeller plane and just use the dedispinner as propulsion, as is the AI will override it and try to hover with the propeller the moment I pitch up.

What exactly is the setup you use here? Do you have dedispinners facing on other directions on the plane?

One solution might be to build the propeller(s) with regular spinners, and set the script to manage only dedispinners.

Workshop: Voidware, INARI and more.
Find all posts by this user
Quote this message in a reply
2017-12-11, 04:04 AM
Post: #498
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
I was hoping to use Willie's impractical propulsion dedispinners.
I will look into it after finals but atm I can't spare the time to modify the code.
Find all posts by this user
Quote this message in a reply
2017-12-11, 06:01 PM (This post was last modified: 2017-12-11 06:24 PM by Kiriko.)
Post: #499
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
(2017-12-11 04:04 AM)SynthTwo Wrote:  I was hoping to use Willie's impractical propulsion dedispinners.
I will look into it after finals but atm I can't spare the time to modify the code.

So you'd want to use the hover lua for altitude and steering, but leave out the main propulsion and use different lua script to control that?

The SetupPropulsion() function has a part of it that looks kind of like this:

Code:
    PropulsionComponents = {}
        for i=1,table.getn(PropulsionManagers),1 do
            for j=0,PropulsionManagers[i].propulsionCount-1,1 do
                local component             = PropulsionManagers[i].GetComponent(j)
                local globalOrientation     = PropulsionManagers[i].GetFowardVector(component)
                local localOrientation      = VehicleState.normalRotation * globalOrientation
                local horizontalOrientation = VehicleState.projectionRotation * globalOrientation
                local position              = VehicleState.normalRotation * (component.Position - VehicleState.centerOfMass)
                if localOrientation.z < 0.9 then
                local currentComponent = {
                    serial                = j,
                    position              = position,
                    globalOrientation     = globalOrientation,
                    localOrientation      = localOrientation,
                    horizontalOrientation = horizontalOrientation,
                    sendImpulse           = PropulsionManagers[i].SetImpulse,
                    type                  = PropulsionManagers[i].type
                }
                table.insert(PropulsionComponents, currentComponent)
                end
            end
        end
    end

Adding the condition if localOrientation.z < 0.9 then should leave out any propulsion component that's facing forward (although depending on orientation of the dedispinner you might need to test for if localOrientation.z > -0.9 instead ).

Additionally you'd probably need to keep the hover lua from taking over control of main thrust, so you'd need to alter the EnableAllJets() function to something like:

Code:
function EnableAllJets()
    VehicleState.jetsAtMax = 0

    if useJets then
        for i=2,11 do
            API:RequestThrustControl(i)
        end
        for i=0,5 do
            API:RequestControl(2, i, 1)
        end
    end
end

this should skip the RequestThrustControl() values 0 and 1 (forwards and backwards), and leave out the RequestControl() values 6, 7 and 8. I'm not sure of the 6 and 7, documentation says they are for "increase" and "decrease", but didn't specify inc/dec what. 8 is main propulsion though, so at least that one you should leave out.

Original code doesn't have the RequestControl loop at all, I added it because the latest development branch patch broke things without it.. so have to keep an eye on that one.

Of course there's a lot of redundant code this way - since the script will still keep calculating the forward speed, and just not applying it.

Hope this helps.

Workshop: Voidware, INARI and more.
Find all posts by this user
Quote this message in a reply
2017-12-11, 08:55 PM
Post: #500
RE: Hover AI: differential yaw/pitch, attack runs, pitch for altitude
Oh neat. Thanks for the treatise that'll make it easier once I get to it.

Cheers!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)