Implementing classic video games in the browser using JavaScript and SVG.

We often hear about how JavaScript-based Web applications will be the wave of the future. Some people have gone so far as to say that these applications will completely replace the traditional, desktop-based applications we use today. The advocates will list off supposed benefits, but will rarely listen when serious problems are shown with their favourite technology. Take, for instance, the major problems I noticed with a JavaScript-based Breakout clone.

What I found was that the Web browser is apparently an unsuitable environment for cloning a 30-year-old game that ran on systems with a small fraction of the power of a low-end desktop system today. Well, I’ve had a very similar experience yet again. This time it involves a Space Invaders clone based around SVG and JavaScript. You can try this one out for yourself by visiting this page of SVG samples, and finding the “Invaders” game about half-way down the page.

The description says, “only currently works perfectly in gran paradiso alpha2.” I tried it with Gran Paradiso Alpha 7, thinking it would be compatible. But it did not want to start. So next I tried with Seamonkey 1.1.2, and it did actually start. However, it is horribly slow.

I will give the author credit. He does clearly admit that the game is, “very slow, at the moment.” But that’s putting it mildly. It’s essentially unusable. I could see each individual invader being drawn, one after the other, over the course of about 25 seconds. Moving your cannon takes forever. During all of this inaction, 100% of the CPU is being used. In short, it’s just not a playable game.

Now, I’d like to put this into perspective. Space Invaders was initially released in Japan in 1978. That’s nearly 30 years ago. It used an 2 MHz Intel 8080 processor. Today, I’m using a system with a Pentium 4 CPU running at 2800 MHz. That’s a pretty major difference in processing power. So there’s no excuse why a 30-year-old game can’t be easily reimplemented via the facilities offered by a modern Web browser. This is especially true when the Web browser is being hyped as an environment suitable for application development.

I know people will come up with excuses, perhaps saying something like, “JavaScript is NOT for games or animation.” If the Web browser is being touted as a suitable environment for developing applications that rival the desktop software we use on a daily basis today, then it damn well ought to be suitable for creating playable reimplementations of 30-year-old arcade games.

Out of curiosity, I also tried the game in Opera 9.20 and Konqueror 3.5.6. The game would work in neither browser. Now, I realize that the degree of SVG support varies between browsers. Regardless, this really puts a dent in the arguments from Web application advocates who say that Web browsers are mature enough to be used as an environment for running applications. What works in one browser will completely fail in a different browser. That’s clear a step backwards, not a step forwards.

I think it would be unreasonable for me to expect that a high-end, 3D game released a month ago could be effectively cloned using JavaScript, SVG and a modern Web browser. But the games I’m talking about were first developed 30 years ago! And they’re very simple games. They shouldn’t require much processing power. But apparently it’s quite difficult to implement usable clones using the environment presented by today’s Web browsers. That makes me really doubt the appropriateness and suitability of the Web browser as a platform for applications.

Leave a Reply

*
To protect against spam, please type the word in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word