The product of a web developer with a little too much caffeine

Teaching Software Development With Games

with 6 comments

Since an early age I was always interested in doing game development. I’ve made several efforts at developing games doing both the art and the code. I can honestly say that it was my interest in games that led me to become a software developer as a career.

Games have always been a great way to teach. You can see it applied to many different topics and to many different age groups.

So this last week I started on a project to do just that using Canvas and Javascript. The general idea behind the game is to build a better ‘bot’ to pilot your ship. The ships fight it out and the last one standing is the winner.

The logic for the ships, how they move, when they shoot, are all actually written by developers and then plug into the game.

Sounds complicated? Well that is up to the developer. In order to create a ship you only need to create a simple Javascript class.

var yourBotName = function() {
    //a visual name for your bot = "Display name";

    //the preferred weapons for your bot
    this.weapons = ["lazer", "burst", "tracker"];

    // a method to update your bot
    this.update = function(gameState, botState) {
        //do something here

And there you have it! Your bot is ready to go!

The developer is passed game and bot state information that they can use to determine how to behave. This means a developer can write their code to behave anyway they like. That means if you write good code then your bot will do great – if you write bad code (the kind that causes exceptions or tries to cheat) then your bot is penalized.

I have some more work to do to get the game in a web ready format (meaning people can upload their own bots, challenge others, etc…). But so far the game is coming along great.

Below is a quick video showing how the game works and what you can expect. Enjoy!

[Watch the preview video]


Written by hugoware

October 31, 2010 at 11:23 pm

6 Responses

Subscribe to comments with RSS.

  1. Great idea for the game. It would be nice if the player has access to the coordinates of an enemy ship(may be implement another gadget for that purpose, “radar” for example?). In this case, he could plan a shot or maneuver. It would be funny if the ships can exchange text messages, may be player can use ‘throw’ for that purpose?


    November 6, 2010 at 6:39 pm

    • Yes, the bot will receive game information which includes the coordinates of the projectiles and the enemy player.

      But in regards to sending messages from the other ship…

      My friend, that is an excellent idea – I’ll definitely be implementing a .taunt(msg) command because of you. Expect your name to be in the credits!


      November 6, 2010 at 7:52 pm

      • I am glad that my idea like you. I’m curious to know about a weapon of spaceships. Is there recharge time for weapon? How many damage weapon can deal? Also i am interested in amount of HP of spaceships? If this information is not a big secret could you reveal it please :)).


        November 7, 2010 at 10:20 am

  2. Hi..I would like to ask..May I know what ide u using for teaching?


    November 12, 2010 at 1:51 am

  3. Hi man!
    This would be fun to play with!
    Just some random ideas from top of my head:
    – Basic enemy state info (movement vector) would allow implementing some clever bot tactics, perhaps an attempt for dodging the bullets.
    – player can control speed/acceleration of the ship, is that correct? Perhaps players would not set concrete x coordinate, but feed a vector and a scale 0 – 100% (100% = max allowed speed/thrust)? 🙂
    – maybe we could balance out the seemingly always-hitting seeker missle (looked like a killer in the vid ;)) by replacing it with a coordinate missle, which can bee shot at a chosen coordinate on the field [speed of the particle is documented ;)].
    – there could be some kind of defensive function a player can activate, could be a radar jam / evasive movement for several frames, that denies our new position to the opposing force [they see the old position for a while] 😉
    – Automated nightly simulation match-ups to generate a general ranking table?

    will meet you the battlefield, bye 😉


    February 4, 2011 at 8:27 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: