Plotting the course of a spaceship
Posted 28 August 2009 - 10:49 PM
The assumptions are as follows: Planets, moons etc, will be moving in a solar system in elliptical orbits (according to Kepler) and exert gravity. I want a player to know in advance given a start time of T0 where he needs to apply his engines and if he has enough fuel to complete the mission. The ship will then follow a predetermined course according to the calculation. The course might use the slingshot effect of planets to help him on his way. I know NASA does this stuff all time so they must have some software to do it, but I can't find anything definitive on the web. Anyone know anything about this?
Posted 28 August 2009 - 11:11 PM
One basic maneuver is the Hohmann transfer, which lets you raise or lower your orbital altitude. For slingshots check out the gravity assist page. Finally another interesting thing to look at is the so-called Interplanetary Transport Network, which is a system of low-energy (but very slow) paths between various Lagrange points in the solar system.
I don't know of any software for designing space missions / plotting orbital trajectories, but it seems like it might not be too hard to homebrew something that will work well enough for a game with realistic orbital mechanics.
Posted 28 August 2009 - 11:26 PM
#author - Try contacting the author of this (it's closed source freeware, although I think that guy might give you better answers than us).
Posted 30 August 2009 - 05:56 PM
If your just looking at how to plot the course you could make a duplicate ship of the initial ship and sense your using a physics model you probably have time as a variable in there , just make the duplicates time 0 through all your gravity and duplicate ship calculations. If suppose that you would instead like to use a line for the ships course then you could set up an array and, instead of placing the duplicate ship at each calculated x,y,z point, store the coordinates in the array and use the array to plot the line.
Posted 31 August 2009 - 09:30 PM
I not that enamored with first person space flight we get in many games. It just seems kind of cheese ball to me. I would rather leave the first person stuff to the character part of the game and have the space flight view be a 3D picture of a solar system, with your ship and other ships marked out on the map. You would then be able to select a planet and issue a "plot a course to orbit of planet X" command or something of that nature. The game would then calculate a course or courses considering the moving planets, their gravity wells, slingshot effects and the required fuel. Obviously time scales would be compressed. The player would select the desired course from a list and initiate countdown.
I'm not so sure. I would imagine all this requires some fairly complex prediction. Over the weekend I was surprised to learn that even calculating the elliptical orbit a single planet over time requires you to solve something called Kepler's Equation. This isn't a simple plug in the numbers formula. Evidently you need to use one of several algorithms to solve it. Fortunately they seem to be freely available on the internet; however it did open my eyes to the fact that predicting courses though a solar system is probably a non-trivial task.
Posted 31 August 2009 - 09:54 PM
Giving the Wikipedia article on it a once over, it looks like the problem is just that there isn't an elementary formula solving for E in the equation M = E - epsilon * sin(E). Yeah, it's a little inconvenient, but there's no elementary formula for sqrt either. The function seems well behaved, at least for reasonable eccentricities; surely you can approximate it with a polynomial, or precompute lookup tables for the regime you're interested in, and maybe use Newton's method to increase precision - in short, evaluate that function the same way things like sqrt, sin, exp and so on are usually evaluated by computers.
Posted 01 September 2009 - 06:17 PM
I'm not the best math wiz but after doing a bit of wiking myself I do follow you. I was able to get the basic planet orbit class working with no apparent issue. I'm still thinking that pre-plotting a spacecraft course is no small task. When you think about it there are a huge number of solutions. If you just look at the simple case with no planets you can get from A to B with a short burn to get you going and another short burn to stop you. You can also use longer burns that will get you there faster but use more fuel. Now add in the moving planets and you see all the possibilities. If memory servers me one NASA probe actually used Venus and Earth as slingshots to get to Saturn. I guess that's where you get the phrase "It ain't rocket science", except in this case "it is rocket science" :) I think I'll just have to bang on this some more over time. I have so many things to work on so I can do some research in parallel.
Posted 01 September 2009 - 06:52 PM
It seems to me you might use some sort of A* algorithm to try out possible slingshot paths.
Anyway, it's an interesting problem...now that you've gotten me thinking about it, I may try a few experiments myself!
Posted 07 September 2009 - 11:37 AM
If you did it without thrusts, it seems like a problem more suited to global optimization techniques than graph algorithms.
With thrusts, it seems more like a combination of many techniques. You'd probably quantize the time and thrusts so that you can generate some nodes for A*, then use a combination of math and global optimization as vertex evaluators.
Could be fun though. The problem I find with games involving gravity like that is that they're too damn hard. It's nearly impossible to stop yourself crashing into a planet. :)
Posted 08 September 2009 - 05:49 AM
Yes, good point. If you have a realistic space flight simulation you need a complex autopilot too to make it at least possible to control for the pilot.
Cool idea to make realistic space flight btw. There are too many unrealistic space games out there.
Posted 08 September 2009 - 02:40 PM
Yes something like that. However I'm not sure there is a single optimal path. You could probably optimize for fuel consumption, speed or some combination of the two.
I'm not sure what you mean. If you use no trusts you would end up where gravity wants to take you. Perhaps you meant an initial burn and then no thrusts after? However I'm guessing you would need to apply thrusters at the end to at least put you in orbit assuming you weren't using the atmosphere slow you down.
Yes that's kind of my motivation. Apollo 11 landing aside, in real life I'm sure computers are used for space navigation. I want to simplify it to where the player just tells the game where he wants to go, and maybe selects from a few possible routs, like a low fuel rout or fast route.
Posted 08 September 2009 - 03:24 PM
Ah sorry. I meant with an initial velocity e.g. firing a bullet.
If you wanted to end up in orbit then that would be difficult.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users