# Calculating spaceship course

There is an idea for (soft) sf strategy game following me for a long time but I need to get a grasp of some math before moving further with it.

Lets assume there is a spaceship traveling (in space) with some velocity and its engines can generate some acceleration - with maximum acceleration much smaller in magnitude than obtainable velocity. Now given the planned use of engine (acceleration in time) I think ti is fairly straightforward to calculate movement of the ship.

But the problem I need to solve is reverse - given starting position, velocity and desired destination I need to find a plan of engine usage (acceleration over time) that will guide the ship to the destination in minimal time.

There may be some complications like

• The ship can only accelerate in one direction and turning (changing direction) takes time
• There are some large bodies with gravitational pull that affects ship course
• The destination point is moving in time - for example it is relative to planet or moon orbiting larger body
• The timing is important - for example the ship is flying in fleet and need to arrive on target at roughly same time as her companions

Now I do not expect to get ready to use solution but my question is where I could look for clues? What I should study? What similar problems or related algorithms can help?

As this is for a game the solution may be simplified and even involve some "cheating" that would not work in real life.

• We have some past Q&A on planning routes for a ship that can accelerate only in a fixed direction using Bézier splines and on intercepting an object with circular motion. Putting these together into an arbitrary path planner that also accounts for gravity of moving planets is non-trivial however. Commented Dec 3, 2019 at 12:45
• @DMGregory I suspected that the problem is far from trivial - that is why I'm asking more about where to look for (even partial) solutions. Commented Dec 3, 2019 at 18:23
• You are formulating an optimal control problem. There is the Pontryagin maximum principle that transforms this into a boundary value problem for a differential-algebraic system of equations. The "algebraic" part is a low-dimensional constrained optimization problem. One has to be careful with fast discretizations, as they may severely constrain the set of possible trajectories, leading to sub-optimal solutions of the control problem. Commented Dec 7, 2019 at 16:20
• @Dr.LutzLehmann - maybe You could expand on your comment and make an answer of that? By expansion I mean elaborating what key areas and topics one could research to get better understanding of problem and possible approaches. Commented Dec 8, 2019 at 20:38
• How deep you go really depends on how real or scifi your scenario is. A) You can look up for instance in the astronomy.SE how actual space probes are sent to outer planets by short engine burns to traverse a carefully selected sequence of elliptical orbits. And how complicated it is to bleed off potential energy to enter a close orbit around the sun. B) If you have no such realistic constraints on rocket fuel and technology, then much more straightforward maneuvers are possible. But then you come also to the reason that "inertial compensators/dampeners" were introduced in scifi. Commented Dec 8, 2019 at 21:15