Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 201

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/tinyogre/rumsey.org/blog/wp-includes/class-wp.php on line 202
Ogre » Blog Archive » I Made Asteroids

I Made Asteroids

AsteroidI stayed home sick today, and made a little browser asteroids game on my laptop.  The cool part is, it doesn’t need Flash or any other plugin.  It’s all JavaScript.  The even cooler part is, I am still blissfully ignorant about JavaScript, I wrote the whole thing in Python, using Pyjamas.  I’ve tested it on Firefox and Safari, works great on both, and runs super smooth even with lots of asteroids.

It’s not much of a game, really, just classic Asteroids without even scores or keeping track of ships or much of anything but the basics.  But it’s only about 300 lines of Python, and it runs in any off the shelf browser.

I’ll try to add some polish to it and get the source up somewhere soon for anyone interested.  I’m pretty happy I managed to do all that in a day, plus a few hours on previous days getting Pyjamas set up.

Update (11/19): I uploaded the source code. It’s not the best code I’ve ever written, and it’s not commented at all, but now it’s a real project!  Sort of.

Update (11/20): Version 0.2 is now live, with sound effects, a score, and a different Canvas object that allows it to run in IE6.  It’s too slow to be playable in IE6, but at least it runs.

Tags: , , ,

7 Comments

  • Wes says:

    Nice..it’s always fun to have those days when you’re knocking problems down left and right.

  • Michael says:

    Compiles fine for me, but when i try to open it locally i get a popup that reads: “Space ImportError: undefined”.

  • tom says:

    This is so fun, I sent it to Shan for
    trial. Happy Turkey Day! Get well soooon!

  • Ogre says:

    Glad you liked it. From my server logs, I think you’re using Internet Explorer 8, is that right? It doesn’t run full speed in that browser, at least not when I tried it. Anything else, like Firefox or Google Chrome, works much better.

  • Michael says:

    actually, im running in firefox 3.5.2 on Ubuntu 9.10.

    I also tried on my home laptop, running the same FF and Ubuntu, same results.

  • wgw says:

    Great demo of pyjamas! I compiled it on my machine and ran it on a localhost apache server. I got one error:

    Module random at line 47 :
    /dev/urandom (or equivalent) not found
    random.py, line 789:
    _inst = Random()
    random.py, line 35:
    self.seed(x)
    random.py, line 47:
    a = long(_hexlify(_urandom(16)), 16)
    os.py, line 17:
    raise NotImplementedError(“/dev/urandom (or equivalent) not found”)

    This is no doubt a problem with my configuration of Apache (random.py runs fine under python).

    Othewise the sound code does not work under pyjd (predictably), but works directly as an html page –with same problem, plus no sound.

    Great lesson for me about how to use the canvas in pyjamas. Thanks!

  • Paul says:

    Cool! Sounds a little delayed on Chrome but playable.

    Try adding some gravity between the ship and the big asteroids, or maybe the UFOs that come out
    and shoot up the place like in the arcade version.

Leave a Reply