Posts Tagged ‘Asteroids’

Coding Challenge: Write Asteroids in 10 hours or less

June 13, 2012 18 comments

Update 17-Jun-2012: Fixed some typos, the broken formatting in some of the code and the missing types after static_cast and dynamic_cast operators, and updated the code snippets to reflect two bug fixes.

Update 18-Jun-2012: Wrote the final section regarding the implementation of shields and waves.

The sun is shining brightly, it’s nice and warm outside and unbearably hot in the office, I didn’t manage to fall asleep til 7 this morning and people are asking me to go to the beach. This, of course, can only mean one thing: it’s time for another coding challenge!

Last time we managed to rattle through Tetris in a smooth 7 hours 59 minutes. Reader Jez Ward has upped the ante by issuing a challenge to write Asteroids in 10 hours or less. This is significantly more complex than Tetris for a few reasons:

  1. It’s a free-form game world and not a grid, which requires the use of per-pixel collision detection
  2. The ship has to accelerate and move in a way that roughly resembles basic physics
  3. The ship and asteroids do not have rectangular shapes but are irregular geometric constructions

…all of which basically means that significant portions of the game have to be engineered using different techniques to Tetris, which I thought made it a good 2nd-stage challenge for beginning game programmers to follow along with. Read more…

%d bloggers like this: