by Ryan Walker

Town Defense Game

WARNING: If you're not interested in RPG games, or Ruby programming, ignore this blog post.

A few years ago, when I was learning Ruby, I had an idea for a game.

Here are my initial notes for the game that I jotted down before writing code:

  • You start out with a small team of heros.
  • Foes start streaming in.
  • You fight the foes.
  • Results: deaths/stats upgrade/skill acquirement.
  • Payment: you get paid for your hard work and effort by the town for your kills.
  • Shopping to upgrade equipment.
  • Cash in experience for stats upgrades.
  • Heros can permanently die.

The inspiration was the “Tower Defense” games that were hugely popular.

I considered basing the game engine on D&D, but instead chose Fudge game system.

I implemented a number of features, including:

  • Name generator
  • Creature library
  • Foe generator
  • Hero generator
  • Combat system
  • Items system
  • Skill system
  • Open ID

Why did I do all this? To amuse my son, Emerson. We played the game on my computer.

I have tossed it out onto the Internet (http://towndefensegame.com), so you can play the game too :) Source code (rough & unrefactored) has been posted to http://github.com/ryw/town-defense-game for your amusement. I decided to not try and quickly clean up the source code before posting, except what I had to to get it deployed.

The UI is ugly and layouts need fixed in certain browsers, sometimes a hero dies during battle then gets hit again and is somehow brought back to life (bug), there are no tests, there is no instruction on how to play the game.

But it’s out there now so Emerson can play whenever he wants, and now I’m motivated to clean it up.

Feel free to play it and see if you can get hero’s on the top 20 list. I’m warning you now, however, that Emerson is competitive.


Filed under Ruby Ruby on Rails