2D Space Game

This was written in C++, SDL and OpenGL and is a hobbyist project.

In this game the player controls a ship which is strongly affected by gravity from nearby stars and planets. By design the ship’s velocity is not capped, and there is no friction. The ship can shoot asteroids and collect the resulting minerals. It has a limited amount of fuel; if it uses this up it will just start drifting through space. It can land on planets and moons to sell minerals and refuel, but will explode if it makes contact at too high a velocity or at the wrong angle. Enemies and objectives are yet to be added.

Navigation: Use the radar indicators to work out the direction of each planet. White indicators are usually just asteroids. Travel towards your target but be careful not to go too fast or you may easily crash into it, or fly right past (it takes a while to turn around). To land (this is hard for new players), match the velocity of the planet, face away from it and let its gravity pull you in. Check your speed by tapping the up key repeatedly.


  • Arrow keys or WSAD: Turn and move
  • Left ctrl: Shoot
  • Left shift: Shield
  • Left shift + up/down: Turbo
  • Z: Launch mine
  • P: Pause
  • D: Toggle trade interface (while docked at a planet)
  • I: Toggle inventory/cargo screen
  • F2: Respawn near the central star

Debug Keys

  • F4: Spawn 20 asteroids
  • F5: Generate a new random name for each planet

A series of indicators are displayed on the radar, showing the distance and direction to nearby asteroids (white indicators), the central star and planets. You can view planet and star names by mousing over these. A backdrop of moving stars helps to show the current velocity of the ship.

The game is a work in progress; there are missing and overlapping textures, and if you travel far enough you will eventually find odd movement errors due to floating point imprecision. But take a look anyway – I’d be interested in your feedback.

Download zip (extract before running)



Leave some feedback!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s