Blog


Processing.js Tower Defense

I'm currently in the process of touring the globe (I've given four talks in two cities, have two talks in two cities left) but I dug up something that should prove to be a lot of fun.

Will Larson has gone about revising the classic Tower Defense genre, porting it to the open web using Processing.js. The port is pretty basic still - but it definitely offers a lot of promise (and is a ton of fun to play, to boot!).

» Play Processing.js Tower Defense

He's written a full post describing the construction of the game (which he did in JavaScript using the Processing API).

Will has been a machine - writing tons of demos and articles on Processing.js. Feel free to read through them to get a better feel for what you can do with the library.

Update: After a minor hiccup the game is working again (there was some problems with mouse input). Thanks Will!

Tags: games, javascript, processing

SXSW

This Friday I'll be flying down to Austin to attend SXSW. I'm really excited to be going, it looks like its going to be a lot of fun. There's going to be a ton of people that I know, there, and I'm looking forward to meeting them.

I won't be presenting this time around, I'm looking forward to just soaking in the area and talking with people. You'll most likely be able to find me at the Mozilla booth (in case, my cell # is 585-615-5287) and making at least one stop to the Apress booth. (I hear they'll have a bunch of my books on hand - let me know if you want one signed, ha!)

Side Events

Three events that I'm looking forward to (in addition to the main conference) are:

BarCamp Austin: I'll confess, I love BarCamps. Ever since attending the first BarCamp NYC, during January of last year, I've gone to all the camps that I've been able to make. This one is no exception. (I'm also looking forward to going to BarCamp Boston 2 later this month.)

Avalonstar Bowling: I'm part of Team JavaScript Ninjas, which includes: Andrew Dupont (Prototype Core), Aaron Gustafson (Co-Author of Web Design in a Nutshell, Speaker, A List Apart), and Dan Webb (Prototype Core, author of UJS for Rails). And no, we're not better at bowling than we are at JavaScript.

Breakfast with Dustin: Dustin Diaz is having a late night breakfast for all of those who've opted to fly out on the 14th (as opposed to taking a red-eye).

Games + Work = ?

One thing that you might notice from my itinerary: I'm currently planning on attending very few JavaScript-centric or Entrepreneurship-centric talks. I could say that I'm burnt out, but in reality I'm just much more interested in the number of game-centric talks. For example, these all sound very interesting to me:

I love the topic of integration of games and reality. Mixing user interfaces and games, work with games; treating real-life like a game. It fascinates me, I can't get enough. It definitely looks like SXSW will satiate that desire.

I'm sure I'll talk about it more at some point, but there's a fundamental core buried inside gaming. Work becomes enjoyable, interfaces and input become simple - I'm very interested in how those concepts can be extracted and applied to real-life applications and user interfaces.

Rough Itinerary

Note: If you're reading this in a feed reader, then you'll probably see no agenda below this line - please visit the blog post to view the full thing.

So yeah, if you're going to be at SXSW, let me know - I'd love to talk with you!

Update: I just signed up for Conferenceer, you can look at my full schedule (and connect with me) on my profile there.

Tags: games, conferences, mozilla, sxsw, sxsw2007

Playing With llor.nu

A fun online game that I've been playing, lately, is llor.nu (unroll, backwards). It's written using Ruby on Rails, has lots of nice Javscript/AJAXy things, and is Open Source.

The game, in and of itself, is rather simple - you roll the dice, collect money, pay rent, build buildings, and get more money. Which can be rather tedious - however, being a programmer, I saw an opprotunity to automate a bunch of the tedium and maximize my profits - and according to the discussion boards, I'm not alone. Recently, the game had an overhaul changing much of the dynamics, and much of my code. One of the things on the developer's 'to-do' list is to implement a public API, but until then, I've pulled together a number of commands (e.g. REST-like URL and parameter combos) that can get the job done. So, if you're interested in writing your own bot, it's definitely a good place to start.

Logging In

POST /login
user[login]=USERNAME&user[password]=PASSWORD

This is the essential first step of any bot - logging in to your account. The username and password are the ones that you signed up with originally.

Rolling The Dice

GET /js/take_turn/

The most simple of bots can do nothing but login and then roll the dice to kingdom come - under the current version of the game, it is very likely that you will become quite rich.

Buying A Building

GET /deeds/buy/NUM?levels=LEVELS

The next step, is to generate some form of perpetual income (from other hapless players, rolling their dice) - this can be done by buying an available plot and hoping that it'll be landed on. However, you must first know if you've landed on a plot that can be purchased - the easiest way to do this is to take the output from 'Rolling The Dice' and to check and see if it contains the text "buy and build". Some psuedo code:

login();
while( 1 ) {
  data = GET('http://llor.nu/js/take_turn/');
  if ( data.contains( 'buy and build' ) ) {
     GET('http://llor.nu/deeds/buy/2?levels=1');
  }
}

The next important step is to determine what type of building and how many levels to buy - There are four types of buildings numbered 2 (lowest worth), 3, 4, 5 (highest) - and multiple levels (1 to 30ish). You'll probably want to focus on buying on particular type of building, exclusively - it'll make your code, and management, much simpler.

That should be sufficient to get you started hacking around - just make sure that you don't call their poor server too frequently - leave a couple second delay it, to be nice. (Otherwise there may not be any more game to mess with.) If there's interest, I'll be happy to delve into the following:

  • Using ducks, Figuring out when to use a duck
  • Using hard hats, Figuring out when to use a hard hat
  • Figuring out how much money you have
  • Renaming Buildings
  • Upgrading Buildings
  • and Selling Buildings

At the very least, be sure to check out the game, it's very slick, to say the least (and look for me up on the high score board!).

Update: The 'can I buy' text has been changed to 'buy and build' (to work with today's update).

Tags: programming, api, rails, rubyonrails, games, ruby

Current Projects

jQuery JavaScript Library

jQuery

Comprehensive DOM, Event, Animation, and Ajax JavaScript Library.

Recent Projects

Pro JavaScript Techniques

JavaScript Book

The best techniques for professional JavaScript. Published by Apress.


Hosting provided by the cool dudes at Engine Yard.