Welcome to Arkanis Development

Asteroids

Published

This is (or was) one of the projects, that consumed my time for several weeks now.

A small screenshot of Asteroids. Starships shooting asteroids… and sometimes crashing on them.

Download: Linux with i368 and amd64 binaries, Windows 32bit.

On Ubuntu Linux you need a newer libsdl-image1.2 package than the one in the repository. Installing the newer Debian package does the trick.

When you start the game you can find an overview of the basic controls in the lower right corner. The normal cannon (space key or left mouse button) is a fast firing projectile weapon. However you'll need multiple hits with it before an asteroid finally breaks apart. The secondary weapon (called "sweeper") fires 10 projectiles at once with a small spread, making it effective at close range. However has a cooldown of 5 seconds so it can not be used that often.

As with every game there are some small bugs:

  • The player collision is not really exact. It does not consider the players rotation (always checks as if the player would be looking up).
  • If you hit an asteroid with the sweeper weapon at close range it might happen that more than two small asteroids are spawned.

Background and development

This game mainly was a playground to get a better feeling for the D programming language and to explore how a game could be programmed. It all stared with a course (development of computer games) Thomas Fuchsmann gave at the university. Since then I was somehow hooked up by this topic and so Asteroids became my official project for this course (due tomorrow).

However the game is not "just" an usual Asteroids remake. I guess when making a game every developer mixes in some other influences. Here are the specials:

  • An "ingame" menu. That does't only mean the menu is part of the game, but that your are flying around in the menu. You can land in different docks to trigger several actions (e.g. start a new game, continue a game or exit).
  • Particle effects. I don't actually know if the original Asteroids game had particle effects. Anyway, this game has particles with color. Thanks to Daniel Klier for inspiring me to write a basic particle system.
  • Real thrusters. Well, as real as virtual thrusters can be. The players ship is equipped with 7 thrusters. Depending on your controls different thrusters fire and this causes the ship to move or rotate. Of course each thruster has particle effects corresponding to its strength. Just try to rotate the ship with the arrow keys and with the mouse. You'll see the difference if you look closely.
  • Modern controls. Sort of. You can move your ship with the keyboard (basic WASD controls known from ego shooters) and rotate it and fire with the mouse (this makes crazy flying quite funny). You can also rotate the ship with the arrow keys. More or less the standard controls for PC games today, but now you can play Asteroids in this style, too.

I also worked on a way to really shatter the asteroids instead of just replacing them by smaller ones. However this didn't really worked as I wanted (concave polygons can be troublesome fellows) and it was to unreliable to give a good gameplay experience, so I removed it again.

Another drawback: The game can only be played on a fixed 800x800 pixel window right now. It would not be much effort to allow different sizes or a full screen mode but I simply didn't considered it important enough to devote time to it.

Technically I've learned quite a lot during this project. Several ways to structure your game with all sorts of pros and cons, architecture of an engine and even some details about math and algorithms. I only used OpenGL, SDL and SDL_Image as a basis, the rest was all done from scratch (starting from an N-Tree for the scene graph up to collision detection).

Turned out that D was quite a nice language to work with. Even if it's not really at home on 64 bit Linux yet (the game was developed with the GDC compiler on Ubuntu 64 bit). You also need wrappers for some stuff but it's still the most productive compiled language I've worked with so far. I'll definitely use this language more often now. However I might try to rewrite the game with some nice libraries and might take a look at Tango. Doing it all from scratch produced a lot of really ugly code that would need ages to clean up.

Anyway, enough talk, get shooting some asteroids… just not get crashed by one: Linux version, Windows version.

Please let me know what you think about the game (e.g. post a comment or drop me a mail). Much fun. :)

2 comments for this post

leave a new one

#1 by
Jona
,

I love it! :) It has a nice feel, just from the beginning. Though it's sometimes hard to manouver around the asteroids, flying this little ship makes me do some noises :) piiuuuh. Poow. tsch, tsch ,stch.. paoh.!

#2 by
Stephan Soller
,

I thought so. :) I was really tempted to write this into the readme file: Thanks to Jona for the special live sounds of the game.

Leave a new comment

Having thoughts on your mind about this stuff here? Want to tell me and the rest of the world your opinion? Write and post it right here. Be sure to check out the format help (focus the large text field) and give the preview button a try.

Format help

Please us the following stuff to spice up your comment.

An empty line starts a new paragraph. ---- print "---- lines start/end code" ---- * List items start with a * or -

or