Jump to content
  • Advertisement
  • entries
  • comments
  • views

Some work on my space engine, yeah!

Sign in to follow this  


Lots of things have been happening, recently. So this is gonna be a pretty long and technical post (with a screenie for your patience if you read everything!).

I've added a generic interface for physics, and made an implementation of it by using ODE. Since i already had some experience with ODE, everything went quite smoothly. The next step was to simulate a small spaceship with it.

My goal is to keep everything as realistic as possible - but without sacrificing playability. One of the main problems is related to speeds. The limit of light speed is approximately 300,000 km/s. If i want to stay coherent with that limit, playing in real-time, it would take 8 minutes to travel 1 AU (the distance between the sun and the Earth). If you were to start from one side of the solar system and travel on a planet of the other side, you could easily have to wait for one hour.

In addition, in real-time, many events which could be exciting become boring, because you'd have to wait from minutes to hours in order to see them. Sunrise, sunset, moonrise, eclipses, moving bodies in the sky.. are almost unnoticeable because happening very slowly. For this reason, i decided to keep the distances/speeds realistic, but to run the simulation a lot faster than in real-time: approximately 50x faster.

With that new time scale, travelling from the sun to the Earth is taking 10 seconds, which is much better for the player. In practise it is taking longer, because the ship has to accelerate/deccelerate.

Accelerations are another problem i had, and are more related to the ship's physics. Let's assume the ship is motionless in space near a station, and wants to accelerate until reaching up to light speed. The natural idea is to bind the keys to a constant acceleration force: pressing the "forward" key makes your ship accelerate in the forward direction (which increases the velocity, which in turn makes the ship advance faster and faster). Unfortunately we've got a major problem with this idea.

You see, if you use a small acceleration, it will take forever to reach light speed. If you use a high acceleration (so that you reach light speed in, say, 20 seconds), you will no longer be able to move precisely at small scales. In particular, you can forget any idea of navigating near the space station or at ground level on a planet.

My solution to this problem is to use a non-constant acceleration; in particular, an acceleration that is dependant on the velocity: the higher the velocity, the higher the acceleration. Reminds me of differencial equations, i don't know why..

Another problem is inertia. In space, there is no friction - so if you want to be realistic, if no force is applied, you should keep moving in the direction you were moving before, ad infinitum. In practise, if you start motionless on a planet and want to travel to another planet, you need to accelerate until light speed, then deccelerate. Because of inertia, this is extremely tricky. If you tried a realistic space simulator, you'll understand what i mean.

To counter inertia, i decided to change a bit the way the ship is controlled. The keys 1 to 9 are used to set a "target velocity". Your ship will keep going at that speed in whatever direction it is moving. After testing, i realized this is surprizingly easy to use and seems to be a good compromise between realism and playability. I also added some automatic friction to the mouse movement (controlling the ship's orientation) so that you do not spin forever.

The result is quite nice and easy to use: the player controls the ship orientation via the mouse (right mouse button is used to roll), while the only keys used to fly are the 1 to 9 keys to set the velocity. I think i'll post a video of that some day.

In other news, i've added a space station taken from the net. It's around 550k triangles, but the 3D engine handles it pretty well (100 fps on a geforce 6800, 200 fps on an ati X850). I haven't focused on the graphics yet, so no coherent lighting or advanced effect, but i thought it was looking quite nice (click for full screen image):

Sign in to follow this  


Recommended Comments

That model looks really nice. Did you buy it or get it for free?

Some interesting notes about physics as well! Reminds me of my astronomy class. Really cool stuff!

Share this comment

Link to comment
I found the model on the web, it's from Deep Space 9. It is actually quite detailed on the geometry side, but the textures are pretty ugly IMO, and it is split in hundred of objects (so i had to merge everything together). I think that model would look awesome with some per-pixel lighting, window glows and shadowing.. but i must resist working on the graphics engine.. again. I *must* advance a bit on the "gameplay" side (eg. physics, controls, autopilot, planets generation, etc.. ).

Share this comment

Link to comment
Wow, that looks amazing. Any change that there might be a release sometime soon? [grin]

Share this comment

Link to comment
Depends on what you mean by "soon". In the next 2 years, there's a small chance, yes :)

Seriously, the list of features to implement is so long.. don't expect anything public in the next months.

Share this comment

Link to comment

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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!