• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
ChristerSwahn

Computing space travel

9 posts in this topic

[color=#333333][font=Georgia, Utopia,]How can a 3D-autopilot be implemented in a space opera game? In other words, how do you compute the optimal trajectory from A to B in a solar system using classical mechanics?[/font][/color]

[color=#333333][font=Georgia, Utopia,][background=rgb(254, 253, 250)]I solved this problem for the game I'm working on. I haven't found any other solution descriptions to this problem so I wrote an article about it in case others might find it of interest.[/background][/font][/color]

[color=#333333][font=Georgia, Utopia,][background=rgb(254, 253, 250)]Also, there are posters here with deep knowledge in physics simulations and it would be very interesting to hear any comments.[/background][/font][/color]

[color=#333333][font=Georgia, Utopia,][background=rgb(254, 253, 250)]Here's the link:[/background][/font][/color]

[url="http://mmoarch.blogspot.se/2012/05/computing-space-travel.html"][color=#333333][font=Georgia, Utopia,][background=rgb(254, 253, 250)]http://mmoarch.blogspot.se/2012/05/computing-space-travel.html[/background][/font][/color][/url]
0

Share this post


Link to post
Share on other sites
The "in a solar system" part threw me off, and I thought you were going to have gravitational effects into account (e.g., potential wells and [url="http://en.wikipedia.org/wiki/Gravity_assist"]slingshot[/url]), which sounds like a really cool problem, but I wouldn't know where to begin. I was a bit disappointed that you don't deal with that at all. :(
1

Share this post


Link to post
Share on other sites
[quote name='ChristerSwahn' timestamp='1336594347' post='4938755']
[color=#333333][font=Georgia, Utopia,]How can a 3D-autopilot be implemented in a space opera game?[/font][/color]
[/quote]

I didn't go too in-depth with your solution, but if your aim is to simplify it to the point where it's an analytic solution, then you can just use a Hohmann interplanetary transfer orbit, right? Is this not similar to what you did? This paper explains it better than I ever could: [url="http://ocw.mit.edu/courses/aeronautics-and-astronautics/16-07-dynamics-fall-2009/lecture-notes/MIT16_07F09_Lec17.pdf"]http://ocw.mit.edu/c...07F09_Lec17.pdf[/url]

And yeah, like alvaro is implying, and as I'm sure you already know, it's a bit more complicated if you want to take a whole lot of bodies into consideration. It's no longer just "a couple of two-body problems stitched together". At best, it would likely mean having to correct your course due to the many minor perturbations that you undergo as you travel from one planet to the other. At worst, it would mean having to postpone launch or taking a highly inoptimal course to ensure that your ship won't run smack dab into some other planet halfway through the journey. Have fun with that. If you succeed, you should probably be working at NASA. ;) Edited by taby
0

Share this post


Link to post
Share on other sites
[quote name='alvaro' timestamp='1336596654' post='4938775']
The "in a solar system" part threw me off, and I thought you were going to have gravitational effects into account (e.g., potential wells and [url="http://en.wikipedia.org/wiki/Gravity_assist"]slingshot[/url]), which sounds like a really cool problem, but I wouldn't know where to begin. I was a bit disappointed that you don't deal with that at all. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]
[/quote]

Yes that would be a cool problem! It also sounds like it would be a "complete" solution to projecting trajectories for celestial travel, taking all bodies, their orbits and gravity effects into account. That however would require sophisticated numerical analysis algorithms and is far beyond what's "practical" for my game! That's a "NASA problem" as taby mentions. :-)

Note that the solution is about planning a trajectory in advance; the actual space travel simulation in the game [i]does[/i] take gravitational effects into account. But in the game universe the spaceships have strong thrusters, usually providing between 1 and 10 g. That makes the planets' gravity effect almost negligable in practice. (At the altitude of geostationary satellites for example, the earth's gravity is only about 1/36 g.)

As I mention in the article, the trajectory needs to be recomputed regularly to take the destination's velocity changes into account. This also compensates for any gravitational perturbations the travelling spaceship undergoes, as long as it doesn't directly collide with something!


[quote name='taby' timestamp='1336596762' post='4938776']
I didn't go too in-depth with your solution, but if your aim is to simplify it to the point where it's an analytic solution, then you can just use a Hohmann interplanetary transfer orbit, right? Is this not similar to what you did? This paper explains it better than I ever could: [url="http://ocw.mit.edu/courses/aeronautics-and-astronautics/16-07-dynamics-fall-2009/lecture-notes/MIT16_07F09_Lec17.pdf"]http://ocw.mit.edu/c...07F09_Lec17.pdf[/url]

And yeah, like alvaro is implying, and as I'm sure you already know, it's a bit more complicated if you want to take a whole lot of bodies into consideration. It's no longer just "a couple of two-body problems stitched together". At best, it would likely mean having to correct your course due to the many minor perturbations that you undergo as you travel from one planet to the other. At worst, it would mean having to postpone launch or taking a highly inoptimal course to ensure that your ship won't run smack dab into some other planet halfway through the journey. Have fun with that. If you succeed, you should probably be working at NASA. ;)
[/quote]

Thanks for the link, it's an interesting article! However it seems to deal with the specific case of orbit transfer and has energy conservation as an aim. I needed to develop a solution for the general case, including being able to chase other ships! ;-)
0

Share this post


Link to post
Share on other sites
This book looks like the cutting edge of interplanetary travel, but it involves optimal orbit transfers of minimal energy, so it might not appeal to you:
http://press.princeton.edu/titles/7687.html
http://en.wikipedia.org/wiki/Interplanetary_Transport_Network
1

Share this post


Link to post
Share on other sites
[quote name='taby' timestamp='1336596762' post='4938776']
If you succeed, you should probably be working at NASA. ;)
[/quote]

They were launching craft 50 years ago and doing the math. The computing power I have in my toaster is probably 1000 times what NASA had then. It'd still be a bit of a project to read up the academic papers and figure out how to approach the problem. But even a completely naive implementation would probably run more than fast enough. Especially if it's an autopilot feature for a proper simulation type game, there's nothing wrong with a "plotting autopilot course" wait dialog of a second or two.
1

Share this post


Link to post
Share on other sites
[quote name='Numsgil' timestamp='1336775241' post='4939436']
[quote name='taby' timestamp='1336596762' post='4938776']
If you succeed, you should probably be working at NASA. ;)
[/quote]

They were launching craft 50 years ago and doing the math. The computing power I have in my toaster is probably 1000 times what NASA had then. It'd still be a bit of a project to read up the academic papers and figure out how to approach the problem. But even a completely naive implementation would probably run more than fast enough. Especially if it's an autopilot feature for a proper simulation type game, there's nothing wrong with a "plotting autopilot course" wait dialog of a second or two.
[/quote]

It was a bit of a joke. I honestly believed him when he said that he already had a working solution, and I honestly didn't bother reading his web site beyond the first two paragraphs, and perhaps that was my problem. My first reply assumed he was doing something simple, like a Hohmann transfer. After alvaro posted a more realistic answer, I realized otherwise. Still, I didn't bother to read the guy's web site, and perhaps that was my problem yet again. Anyway, please consider that it took me more than 2 minutes to write my first reply, and even longer to edit it to reflect the new knowledge.

The key word that I was going on was optimal, and the link to the book that I posted seems to be for fairly new theory (~20 years ago, for JAXA and NASA missions). Perhaps I made a mistake when I assumed -- using my new knowledge -- that what he meant by optimal was optimal fuel usage in a chaotic environment, perhaps not. In any case, plotting a course with optimal fuel usage in a chaotic environment requires a bit more than just naivety, as the 220 page count of that book goes to show. Outside of the bounds of chaos (ie. a couple of two-body problems stitched together, such as the Hohmann transfer) where things are reasonably predictable in the long term, yes, calculating ahead to see where the target will be at later is not exactly rocket surgery. Outside of the bounds of optimality and determinism/chaos, where fuel is infinite and/or enemies are unpredictable even in the short term, yes, AI for chasing and evading is most definitely nothing remotely close to rocket surgery. ;)

Thanks for the input either way. I really did learn a ton of stuff from you, and I rated you up for it (yeah, thanks for those Intel fluid simulation links too). ;) Edited by taby
0

Share this post


Link to post
Share on other sites
Is it possible to phrase the problem in a way so that we can find the solution numerically, using only some sort of an error function?
0

Share this post


Link to post
Share on other sites
[quote name='jameszhao00' timestamp='1336790648' post='4939482']
Is it possible to phrase the problem in a way so that we can find the solution numerically, using only some sort of an error function?
[/quote]
Yes. You can solve the problem numerically by value iteration, if you describe it as the optimization of the sum of future values of a utility function, with some exponential discount as you go further into the future. You will also need to quantize the space of states somehow to make this work.

I've thought of trying to write precisely what I just described, but I never found the time.

I don't have a good reference to value iteration. It is described on the second volume of [url="http://www.amazon.com/Dynamic-Programming-Optimal-Control-Vol/dp/1886529086"]this book[/url], but the book is expensive and not particularly readable, so I won't recommend it. If anyone finds a good online reference, please post it. Edited by alvaro
0

Share this post


Link to post
Share on other sites
The working Java implementation of my solution is now on github:

[url="https://gist.github.com/2708736"]https://gist.github.com/2708736[/url]

[url="http://mmoarch.blogspot.se/2012/05/computing-space-travel-implementation.html"]http://mmoarch.blogs...ementation.html[/url]

Input:
- delta position
- delta velocity
- max force (vessel's max thrust)
- mass (vessel's mass)

Output:
An array of trajectory legs, each containing:
- thrust vector
- time to apply the thrust
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0