AJAX + Canvas = Awesome + Games

You may recall a previous blog post I made about games using AJAX. Web pages with the ability to read and write to databases via XML and update the display without reloading allow for the possibility of games that work in any web browser without plug-ins or large bandwidth consumption. But the games would still be limited to what you can draw using CSS and HTML. Thanks to the new canvas element in the newest versions of Firefox and Safari this is no longer a limitation.

When I saw this fps implemented using the canvas element last week I knew gold had been struck. With the canvas you have the ability to create a real-time drawing surface with JavaScript. With the XMLHttpRequest you have the ability to get and send data to a web application which can read and write to a database. If you add these two things together you can make a massive multiplayer online game in a web browser that requires very little loading time, no installation and no plugins. This is the hotness. If games like Kingdom of Loathing pick up on this technology they can do some really revolutionary stuff.

As a proof of concept for this idea I have created a terrible terrible demo. It’s really simple and almost embarassing, but that’s what you get with less than an hour of work. I only tested it in Firefox 1.5, but it should theoretically work in any browser that supports XMLHttpRequest and canvas. There are two links and a canvas. If you click a link, the square with the coordinates it represents will turn black. This isn’t anything new, except that behind the scenes those coordinates are being read from XML data. If you replace that static XML data with a web application and a relational database then you’re playing with power.

Maybe the demo will be better by the time you read this. I’m going to keep working on it as a platform for creating games that utilize grids. Tile-laying games like Tigris and Euphrates and strategy games like Dungeons and Dragons combat are top contenders. All that we have to do now is expand the canvas to have real 3d drawing power with the help of the GPU.

What are the long term implications of this technology? The most obvious thing I see is another nail in the coffin of Microsoft. Looking for the reason? PC Gaming is one of the main reasons pepople still run Windows. If all the software is web-based then Firefox becomes the OS and Linux/OSX/Windows doesn’t matter. If we can make a 3d, or even a 2d MMO that works in Firefox regardless of platform we can make a killing. Even people running old versions of BSD would be able to play the game just fine. There are more PCs than consoles out there. Firefox’s popularity is growing daily. A quality game built on this platform could easily overtake the great World of Warcraft because the barrier to entry is so small. To get into most MMOs you have to install software and have sufficient 3d hardware. Signing up for this MMO would be no harder than registering for a forum on the web.

I’m going to talk about this tonight on GeekNights.

This entry was posted in Technology, Video Games and tagged , , , . Bookmark the permalink.

3 Responses to AJAX + Canvas = Awesome + Games

  1. James says:

    I seriously doubt Kingdom of Loathing will start using dynamic AJAX interfaces anytime soon. It’s kinda the point that everything looks like it was whipped up in 5 minutes.
    (Btw, do you play KoL? My s/n is “Jerred”)

  2. Apreche says:

    Nah, I haven’t played KoL in many months. In fact I only played it for a few weeks. It got really old really fast. I agree that part of the point of KoL is that it looks like MS Paint. But there’s no reason that style could be lost if they started using the canvas and AJAX a bit. It would just open the door to have some animated interactive stick figures and such.

    And even if you disagree that this technology would be good for KoL you can’t disagree that it has amazing possibilities for web gaming in general.

  3. Jacob says:

    Do you think something like this could be used for getting the venerable old NetHack into an MMO form?

Leave a Reply

Your email address will not be published. Required fields are marked *