Skip to main content
GameDev.net gamedev.net
🔒 Locked

Navigating in space

Started by Stephen R Jun 16, 2005 at 2:12 PM 5 replies 3.4k views
Original Post
Stephen R
Stephen R
Hi, I have quite a question on my hands and very little experience with either AI or pathfinding outside of A*. I have an artibtrary 2d universe where space ships fly around objects like moons and planets under the influence of gravity. What I need is some way of letting the computer controlled ships make a path to their next waypoint, taking the effects of gravity into account (hopefully even using them to its advantage) and avoiding any obsticales that might be in their way. I'm quite lost as to where to start writing this. If anyone could recommend any techniques, or if there are any sites which would be usefull, I'd be really appreciative. Thanks.
xEricx
xEricx
Hi,

I've never worked on such a project, so this is just a wild guess, but eh, it might help you :)

I guess if each "big objects" have a gravity that affects entities around them, A* won't be useful as you scene will change quite often... (I might not be visualizing your problem correctly though)

Since its in space, I guess you wont have any "dead ends", so having a pathfinder might not be necessary. You might want to try to write a custom steering behavior that uses gravity as an input, and have all your entities purely move with steering behaviors, avoiding other objects and using gravity as a "boost".

Craig W Reynolds has an example of following a flow field... this might be a starting point?

Hope this helps

Eric
Stephen R
Stephen R
Thanks, I kind of figured that A* would be of little use to me in this situation, but the flow field is very interesting. A kind of flow field created from the gravity info would mean that the ships could move around, taking gravity into account. Then all I have to do is make a way of plotting a course between two points and the ships should be able to follow it relatively easilly. Take into account collision avoision and that should be most of their functionallity in place.

Thanks a million, thats just what I needed.
WeirdoFu
WeirdoFu
Well, you could do what NASA does with their mission planning....

Basically, do gravity slingshots from one gravity point (planet) to another, until you get to the planet closest to your target. Of course, this is not considering that there may be obstacles in between planets, but its a start. Also, slingshoting from one planet to another in a greedy fashion may actually be more energy efficient in the long run, maybe.

If only I could do free hand drawinggs here, I'd draw you a picture, but basically, it involves alot of tangents and orbits.
Dobbs
Dobbs
This is not quite a pathfinding problem in the traditional sense. Navigation in a solar system with real gravity is annoying. Google for "spacecraft launch windows", "transfer orbits", "Hohmann transfer orbit" and similar terms to get an idea of how it works in real life. Basically there's a strategy for minimizing the amount of energy used (by using "transfer orbits", but the tradeoff is that you can only launch during relatively short time periods (the "launch windows") that don't occur very often (they depend on the relative phases and periods of the planets involved).
Dobbs
Dobbs
And if you're going to use real gravity, here's a system that isn't completely realistic but will probably make life simpler: when travelling within the immediate vicinity of one planet (ie between it and its moons), treat the planet as the only significant source of gravity (ignore its moons). When travelling between planets treat the central star as the the only signficant source (ignore the planets).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.