Orbits
Posted: Fri Jul 26, 2013 9:20 am
How objects will orbit has been a frequent topic on the MC forum as of late, and I think it is worth it to review the current gameplan. I don't have a lot of time right now so I'll try to be brief and follow up a bit later.
The most prominent thing about the Futurecraft universe is there is no central coordinate system, and having one would be impractical if not impossible. Every object is bound to a frame of reference such as a ship or a planet or a fleet or some arbitrary point in space, and that frame of reference can be an offset to yet another frame and so on until all frames of reference share a common point, typically the center of the solar system. Finding relative coordinates is as simple as traversing the tree and applying transformations as you go. Since the frames are grouped by locality, you rarely need to look very far. Each frame of reference additionally might have a velocity, such as an orbit around a planet or a sun that can change over time depending on its nature.
That's all fine and good, but non-orbiting objects need a baseline velocity as well so that we can implement top speeds and slowing down the way a player would expect (instead of how it would work IRL). We can do that using a formula to work out what a reasonable baseline is for any point in the solar system. It is a similar concept to a gravitational field, in which the natural path of an object is curved by the presence of gravity wells. If we can mesh the two well, we can simulate orbits based on an object's local velocity.
This part needs some tweaking, because as it is, the local velocity zero relative to the nearest natural satellite and blends as you move towards others. This is fine if you want to move freely about the object, and you sometimes will, but if you need to orbit, such as around a planet, a velocity of 0 wont work, because you have an infinite number of vectors upon which you can be orbiting. So orbiting needs a velocity other than 0 to stay afloat, and not-orbiting should have a local velocity of 0. If we mix the force of gravity on planets and natural satellites, we may be able to resolve this conflict. If you were, say moving to dock with a space station, your velocity baseline would be the same as the station, which is stationary from that frame of reference. However, that frame of reference is orbiting the planet at a required velocity. As long as you are interracting in the vicinity of the station, your top speed is relative to the space station. When you break away and orbit the planet, your baseline speed is based on the altitude needed to maintain that orbit (I am assuming perfectly circular orbits to keep things simple). However, unlike before, your direction is ignored.
Because your baseline changes as you change your altitude, you never hit your top speed where you can't ascend any higher.
That's for natural orbits, though, meaning you will continue in this orbit if you cut the engines. You can travel faster along a natural orbit by accelerating into the curve, which produces a new velocity which is not 0m/s. That is the part where your top speed comes into play, and if you are flying around with other people, it should result in you being able to move freely around them almost like in deep space. The complex differences of handling the gravity well can be left up to the ship AI (or do it manually if you didn't include that module).
When I get a little bit of time, I want to try and work out the math on paper, at least in 2D.
The tl;dr thing to take away from this is that you should be able to move relatively freely regardless of where you are, and you should always have a stationary speed and a top speed which are relevant to wherever you are. If we can preserve these two things, we win.
P.S. One significant exception. When you hit atmosphere, air resistance becomes a major player and your top speed is sharply reduced and the frame of reference becomes the planet's surface. If the orbiting formula is correct, if you can't maintain your orbiting velocity (which drags more and more the closer to the surface you get), you will drop out of the sky unless you can counter with sufficient upward acceleration. If implemented properly, this will make it so that giant ships will naturally not be able to enter the atmosphere, and need to use other means to get to and from the surface.
The most prominent thing about the Futurecraft universe is there is no central coordinate system, and having one would be impractical if not impossible. Every object is bound to a frame of reference such as a ship or a planet or a fleet or some arbitrary point in space, and that frame of reference can be an offset to yet another frame and so on until all frames of reference share a common point, typically the center of the solar system. Finding relative coordinates is as simple as traversing the tree and applying transformations as you go. Since the frames are grouped by locality, you rarely need to look very far. Each frame of reference additionally might have a velocity, such as an orbit around a planet or a sun that can change over time depending on its nature.
That's all fine and good, but non-orbiting objects need a baseline velocity as well so that we can implement top speeds and slowing down the way a player would expect (instead of how it would work IRL). We can do that using a formula to work out what a reasonable baseline is for any point in the solar system. It is a similar concept to a gravitational field, in which the natural path of an object is curved by the presence of gravity wells. If we can mesh the two well, we can simulate orbits based on an object's local velocity.
This part needs some tweaking, because as it is, the local velocity zero relative to the nearest natural satellite and blends as you move towards others. This is fine if you want to move freely about the object, and you sometimes will, but if you need to orbit, such as around a planet, a velocity of 0 wont work, because you have an infinite number of vectors upon which you can be orbiting. So orbiting needs a velocity other than 0 to stay afloat, and not-orbiting should have a local velocity of 0. If we mix the force of gravity on planets and natural satellites, we may be able to resolve this conflict. If you were, say moving to dock with a space station, your velocity baseline would be the same as the station, which is stationary from that frame of reference. However, that frame of reference is orbiting the planet at a required velocity. As long as you are interracting in the vicinity of the station, your top speed is relative to the space station. When you break away and orbit the planet, your baseline speed is based on the altitude needed to maintain that orbit (I am assuming perfectly circular orbits to keep things simple). However, unlike before, your direction is ignored.
Because your baseline changes as you change your altitude, you never hit your top speed where you can't ascend any higher.
That's for natural orbits, though, meaning you will continue in this orbit if you cut the engines. You can travel faster along a natural orbit by accelerating into the curve, which produces a new velocity which is not 0m/s. That is the part where your top speed comes into play, and if you are flying around with other people, it should result in you being able to move freely around them almost like in deep space. The complex differences of handling the gravity well can be left up to the ship AI (or do it manually if you didn't include that module).
When I get a little bit of time, I want to try and work out the math on paper, at least in 2D.
The tl;dr thing to take away from this is that you should be able to move relatively freely regardless of where you are, and you should always have a stationary speed and a top speed which are relevant to wherever you are. If we can preserve these two things, we win.
P.S. One significant exception. When you hit atmosphere, air resistance becomes a major player and your top speed is sharply reduced and the frame of reference becomes the planet's surface. If the orbiting formula is correct, if you can't maintain your orbiting velocity (which drags more and more the closer to the surface you get), you will drop out of the sky unless you can counter with sufficient upward acceleration. If implemented properly, this will make it so that giant ships will naturally not be able to enter the atmosphere, and need to use other means to get to and from the surface.