Here's a video showing the steering AI in action. The steering AI is told to stop a ship that is moving vertically. The ship's thrusters are placed the same way every time, but the thrusters are rotated randomly between runs. This is a good test case, since the AI can't make any assumptions about the usable direction of thrust or the thrusters being balanced in a given way.
The AI works by first finding the vector of maximum acceleration for a ship, pointing the ship in that direction, then firing thrusters in a configuration that will result in translational acceleration while maintaining the rotational acceleration at zero. Note also how the turning AI optimizes for propellant use while turning by only using the thrusters that cause the most rotational acceleration per unit of thrust applied.
This kind of highly adaptive AI is necessary even for ships that don't have their thrusters placed at random angles. Since our ships can be damaged, that means a ship can lose thrusters that are vital to its steering, and a less general AI would lose control of the ship far faster than necessary. This AI can easily adapt to destroyed thrusters, as shown in the following video:
Here the AI is told to maintain maximal thrust towards the left, while keeping the ship's rotation velocity at 0. Destroying the engines will not stop the AI from steering towards the target until there are no possible thrust configurations that would result in an out of control spin. This means that as long as any two thrusters' thrust axes are located in different sides of the center of mass, the ship can steer succesfully.
This physically correct model of thrusters causes some issues for trajectory design too. Traveling from point A to point B becomes a complicated problem when you need to account for ship turning times and allow some errors in the steering AI to be corrected. Here's a video showing a ship traveling on AI control to points the player clicks on the map:
Note how the ship has a difficult time at pointing its thrusters to the designed direction, and it ends up making a slight error in the resulting burn vector. This is caused by the turning thrusters imparting a linear acceleration on the ship, which slightly changes the required burn vector. This ends up in a feedback loop that needs to be accounted for by adding some safety margins into the steering AI, so that it doesn't even try to do 100% perfect burns. Instead, it's content with accelerating in almost the correct direction and continuously correcting the angle of acceleration during the acceleration burn.
Finally, here's a video showing a ship traveling to a point 10 kilometers away. It's acceleration is 20 m/s^2, so the optimal time for this trip, including a braking burn, is roughly 45 seconds. My steering AI manages to do it in 63 seconds including some overhead due to the roll to point the main thrusters backwards halfway through the trip, so it gets quite close to an optimal travel time.
No comments:
Post a Comment