If you missed the live blog then check out Coding Challenge: Write Asteroids in 10 hours or less for the background. Let us now take a retrospective look at the results.
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:
- It’s a free-form game world and not a grid, which requires the use of per-pixel collision detection
- The ship has to accelerate and move in a way that roughly resembles basic physics
- 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…
This is a follow-up from the 8-hour Tetris prototype article.
Now we have a working game prototype, I shall walk you through how to make a series of basic improvements. The full source code is available below (see the original article for other dependencies you need to install to compile the code; the game is based on my Simple2D graphics library).
Time spent: 2.5 hours. Read more…