Set up a solar system

Blitz3D Forums/Blitz3D Programming/Set up a solar system

Farflame(Posted 2003) [#1]
Does anyone know how I'd go about setting up a random solar system? I have my planets working and I know how to get them revolving around the sun properly, and how to get moons to orbit the planets, but my math seems wrong (I just did it by trial and error) because the planets are constantly coming into conjunction.

Does anyone know if planets all move at the same speed? I realise that the outer planets take alot longer to orbit the sun than the inner ones, but is this simply because they have further to travel, or do they also travel slower?

What I basically need to do is this. When I enter a solar system, it will be randomly created, based on it's number and the current date. The number is just used as a random seed which calculates which planets will exist, but then I need to locate them accurately based on the current date. The date could be used as the angle, but then obviously all the planets would be in permanent conjunction and the outer ones would fly around at huge speed. So I'm dividing the date by the orbit (e.g if it's in the orbit of the 10th planet, the angle would be date/10). As I say, this looks ok at first but the planets come into conjunction alot. I suppose it may be because the math is too basic.

Any suggestions?

By the way, this is just for a game, so it doesn't need to be highly accurate. For example, I'm quite happy for my planets to follow circular orbits, unlike real planets whose orbits are slightly eliptical. It just needs to look fairly realistic.


Floyd(Posted 2003) [#2]
Kepler's third law:

period^2 = distance^3.

So if Earth were moved to four times its current distance from the sun the new period would be eight years.


RexRhino(Posted 2003) [#3]
FarFlame:

Are you simply calculating position on a circle, or are you doing real calculations of gravity, mass, acceleration, etc?

If you are using real physics, check out this tutorial:
http://www.phy6.org/stargaze/Sintro.htm

It will provide you all you need to know about planetary motion, space travel, newtonian physics... in fact, it's only problem is that it might go into too much depth. It also includes tutorials on the algebra and trig used. So EVERYTHING you need to understand planetary motion and space travel is there. Even though in theory we all learned this stuff in Physics 101, it was nice to have a well-writen tutorial SPECIFICLY about space travel with all the information right there.


ragtag(Posted 2003) [#4]
You could also check out GURPS Space (a role-playing book from Steve Jackson Games ). I wrote a random galaxy generator from the data in that book ages ago. The nice thing about it is that it goes into just the amount of detail you would need for a game, and even includes a table for randomly generating planets.

Ragnar

p.s. Link to book http://www.sjgames.com/gurps/books/Space/ just noticed that there is a star generator at the bottom of that page.


Farflame(Posted 2003) [#5]
Thanks guys, that's exactly what I needed. Actually, I've made it a bit better by just adding a slight random number to each planet/moon, so they move at different speeds. It looks ok now anyway, but the links look even better, and you can never have something TOO good :)


Kuron(Posted 2003) [#6]
this sound really cool, farflame. just thinking about the math involved gives me a migraine, lol. be sure to show us a demo when you get to that stage. sounds really interesting.