AI crashes large ships when undocking

Post Reply
clausimu
Posts: 111
Joined: Tue Jan 06, 2015 8:31 pm

AI crashes large ships when undocking

Post by clausimu »

In my efforts to simulate local starport-to-starport traffic I have run into the problem that the AI can't seem to start large ships right from a ground base. After giving the undock command (ship:Undock()) I set a new starport destination and have the AI fly there (ship:AIDockWith(starport)). Small ships have no problem with that. But the Malabar or Vatakara crash after liftoff. They undock fine, but don't seem to lift off high enough. When they tilt the nose up to fly to the new destination the rear crashes into the ground base. It actually gets stuck there, the ships never move but end up with thrusters on and taking damage the whole time.

I have tried setting a new docking target right after undocking or setting the AI to fly to the limit of the starport frame (ship:AIFlyTo(starport)) first. Same result.

How do I get these large ships to lift off higher when undocking? Or is that a problem in the game core?

Thanks!
bszlrd
Posts: 1084
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: AI crashes large ships when undocking

Post by bszlrd »

What if you delay the dock command a bit? I'm suspecting that heavier ships will have problems leaving the orbital station too, because they might start to rotate towards their target before they cleared the dock, due to their low acceleration.

I'll check the station tags when I get to my computer, but I think that the only thing I can do with those is to put the ships on rails and move them higher up that way, but that will look ugly. That's why I kept that to the minimum in the orbital.
clausimu
Posts: 111
Joined: Tue Jan 06, 2015 8:31 pm

Re: AI crashes large ships when undocking

Post by clausimu »

Shouldn't the undock command lift the ship up enough to be free to move? I am currently checking for the event "onShipUndocked" to trigger the next stage (find new target and fly there). I thought that the act of undocking propels the ship up from the base (in case of a ground station) to a certain height. Or is undocking actually a timed event (and large ships just don't make it to an appropriate height in that time)?
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: AI crashes large ships when undocking

Post by FluffyFreak »

I think that it's currently just timed, so big ships don't get much height.

The whole docking/undocking thing needs a rewrite but it's very difficult to work up the enthusiasm to work on it again, I've already done a huge amount too it :(
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: AI crashes large ships when undocking

Post by FluffyFreak »

Yeah there's a member called `m_launchLockTimeout` that gets set to 2.0 for a second thruster burn but this is regardless of the size of a ship.
So a shuttle will leap off the pad to a great height whereas a freighter will have barely begun to move.
clausimu
Posts: 111
Joined: Tue Jan 06, 2015 8:31 pm

Re: AI crashes large ships when undocking

Post by clausimu »

Is there a way to control thrusters from lua? That way we can control the undocking time from a script?
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: AI crashes large ships when undocking

Post by FluffyFreak »

Maybe but the other way is this PR I just submitted for review.
Post Reply