Page 1 of 1

AI crashes large ships when undocking

Posted: Sun Jan 18, 2015 9:43 pm
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!

Re: AI crashes large ships when undocking

Posted: Mon Jan 19, 2015 4:37 am
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.

Re: AI crashes large ships when undocking

Posted: Tue Jan 20, 2015 6:12 pm
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)?

Re: AI crashes large ships when undocking

Posted: Wed Jan 21, 2015 11:20 am
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 :(

Re: AI crashes large ships when undocking

Posted: Wed Jan 21, 2015 11:26 am
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.

Re: AI crashes large ships when undocking

Posted: Wed Jan 21, 2015 11:46 am
by clausimu
Is there a way to control thrusters from lua? That way we can control the undocking time from a script?

Re: AI crashes large ships when undocking

Posted: Wed Jan 21, 2015 11:48 am
by FluffyFreak
Maybe but the other way is this PR I just submitted for review.