Ministry of Innovation —

HTML5 and WebGL bring Quake to the browser

GWT developers have ported Quake 2 to run entirely in the browser using WebGL …

The developers behind the GWT Java framework have implemented a port of Quake 2 that runs natively in modern Web browsers. It takes advantage of recent innovations in emerging standards-based Web technologies such as WebGL and WebSockets.

GWT is designed to enable Web application development with Java. Developers can benefit from Java's static typing and more rigidly structured architecture. It generates the requisite JavaScript code that is needed for the application's client-side components. GWT powers several high-profile Google Web applications, including Google Wave. The GWT developers implemented browser-based Quake by using a Java port of the Quake 2 engine on top of GWT.

GWT and the Java-based Quake engine both had to be extended and modified extensively in order for the pairing to work, but the effort paid off. It serves as a compelling example of how emerging standards are becoming increasingly capable of delivering all of the necessary functionality for interactive 3D network gaming.

As some readers might remember, Google released a Quake demo for Native Client (NaCl) when the plug-in was first announced in 2008. The state of open Web technologies has clearly advanced since that time. It's no longer necessary to rely on plugins to deliver this kind of functionality.

You mean there can be games online without having to have Flash? Blasphemy!! Flash is THE standard for all things video and games and interactive on the web. Nothing else can do what Flash does! You heretics who claim otherwise will pay.

Or maybe Flash isn't necessary for all of the games online or the video.

The reality is that most people who sing the praises of Flash are singing the praises of the development environment, not the underlying technology. So, the biggest thing that Flash really has going for it is a great development environment.

Why would I wan't a browser with a built-in gaming platform? I don't need this for browsing the web so it shouldn't be built into every browser. Isn't Ghrome supposed to be lightwheight? The world needs good web browsers and a good portable platform which developers can target, not a compromise between the two.

Why can't something like this be built on top of Parrot or JVM or .NET even? Why do you need to make everything a webapp? The Web isn't a platform.

You mean there can be games online without having to have Flash? Blasphemy!! Flash is THE standard for all things video and games and interactive on the web. Nothing else can do what Flash does! You heretics who claim otherwise will pay.

Or maybe Flash isn't necessary for all of the games online or the video.

The reality is that most people who sing the praises of Flash are singing the praises of the development environment, not the underlying technology. So, the biggest thing that Flash really has going for it is a great development environment.

for one argument is that there is nothing out right now that could replace it and no a 3 to 4 month old first working draft does not count as being out now.

Why would I wan't a browser with a built-in gaming platform? I don't need this for browsing the web so it shouldn't be built into every browser. Isn't Ghrome supposed to be lightwheight? The world needs good web browsers and a good portable platform which developers can target, not a compromise between the two. Why can't something like this be built on top of Parrot or JVM or .NET even? Why do you need to make everything a webapp? The Web isn't a platform.

Why would I wan't a browser with a built-in gaming platform? I don't need this for browsing the web so it shouldn't be built into every browser. Isn't Ghrome supposed to be lightwheight? The world needs good web browsers and a good portable platform which developers can target, not a compromise between the two. Why can't something like this be built on top of Parrot or JVM or .NET even? Why do you need to make everything a webapp? The Web isn't a platform.

So you can have more holes in your browser, of course!

Maybe i'm missing the argument. All that's being added to browsers is a canvas binding for opengl. Not exactly what you could call bloat or a huge attack surface, especially since browsers are already moving to an accelerated backend. This isn't a gaming platform...this is just one example of what's possible today (in still to be released browsers, for that matter).

Second, its hard to see how you could argue that the web isn't a platform, even if you accept only the most basic of in-browser scripting (or even just server round-trips). If you're just worried about some slippery slope somewhere, that's why god invented noscript.

How is it a small attack surface (seriously I'd like to see your reasoning here)?

From what I understand, it's piping un-managed code out of the sandbox. Code that by necessity has tons of memory management, tons of buffers, and partially runs in kernel mode. Not to mention it's a huge standard (opengl) that has never been tested for the purposes of creating exploits like javascript, flash, or html.

I've had tons of buffer overflows when writing opengl code, probably more than any other kind of coding I've ever done. Is there some safeguard against this with webgl?

How is it a small attack surface (seriously I'd like to see your reasoning here)?

From what I understand, it's piping un-managed code out of the sandbox.

It's code running in a JIT VM environment that hooks up with system APIs for accelerating graphics. Think like C#/.NET or Java, except now it's ECMAscript.

Quote:

Code that by necessity has tons of memory management, tons of buffers, and partially runs in kernel mode. Not to mention it's a huge standard (opengl) that has never been tested for the purposes of creating exploits like javascript, flash, or html.

I've had tons of buffer overflows when writing opengl code, probably more than any other kind of coding I've ever done. Is there some safeguard against this with webgl?

*shrug*.

I know that Flash plugin uses at least OpenGL for accelerating compositing in Linux. Everything you said applies about just as much as WebGL as anything else that uses the GPU and touches the internet in some way. So that counts Silverlight, Adobe Flash, World of Warcraft, your web browser without plugins, etc etc.

Well looking up a bit I confused Tracemonkey with Chrome for the JIT/VM part. But in practice I doubt it's going to much different in terms of security, other then Chrome is designed for security from the ground up while Mozilla is dealing with a huge codebase dating back to early Netscape days.

I've recently become more concerned with the splintering platforms for gaming, whether it's online distribution services or hardware/os platforms. This has the potential of creating a single platform for a majority of games across any hardware with a modern browser. It offers increased interoperability, easily integrated community features, rapid deployment, nearly instant accessibility, as well as a catalyst for further browser innovation. I'm only a novice programmer, so I can't see the whole picture, but WebGL IS a big deal.

"It's no longer necessary to rely on plugins to deliver this kind of functionality."

If *this* is defined as a 15 year old game with a very low poly count, next to zero physics and no character animation then yes, you don't need plugins for that kind of functionality. If you want a modern game, you do need plugins.

Folks are missing the point. Quake 2 in JavaScript is kinda impressive. But this is Quake 2 in Java, cross-compiled to JavaScript using GWT. Which is freaking insane. I can't decide if GWT is genuinely a sensible and faster way to develop JavaScript applications or if it's a crutch letting Java coders avoid learning JavaScript. Either way it's an amazing piece of technology, particularly because it does stuff like breakpoints and debugging and I think even modifying "running" code all across the language gap. The whole thing makes more sense if you consider JavaScript as a browser assembly language -- a consideration that also tends to show the absurdity of itself.

Folks are missing the point. Quake 2 in JavaScript is kinda impressive. But this is Quake 2 in Java, cross-compiled to JavaScript using GWT. Which is freaking insane. I can't decide if GWT is genuinely a sensible and faster way to develop JavaScript applications or if it's a crutch letting Java coders avoid learning JavaScript. Either way it's an amazing piece of technology, particularly because it does stuff like breakpoints and debugging and I think even modifying "running" code all across the language gap. The whole thing makes more sense if you consider JavaScript as a browser assembly language -- a consideration that also tends to show the absurdity of itself.

Check out Safari's develop menu (Preferences > Advanced > Show Develop menu in menu bar). Yes the UI on the Windows version is clunky but the developer tools with it are excellent. Everything you can do with Firefox+Firebug and more.

It has a DOM inspector, javascript debugger that has breakpoints and can step through code. It has a decent profiler to help optimise your site. It also tracks resource loads and XMLHttpRequests. It can also display local database storage from HTML5.

Check out Safari's develop menu (Preferences > Advanced > Show Develop menu in menu bar). Yes the UI on the Windows version is clunky but the developer tools with it are excellent. Everything you can do with Firefox+Firebug and more.

It has a DOM inspector, javascript debugger that has breakpoints and can step through code. It has a decent profiler to help optimise your site. It also tracks resource loads and XMLHttpRequests. It can also display local database storage from HTML5.

All you need provide yourself is a decent text editor.

... huh? That's dynamite, but why bring it up? Of course there are capable JavaScript debuggers. It's still amazing that GWT allows you to step through Java code that is executing as JavaScript code in the browser.

I vote for GWT being "genuinely a sensible and faster way to develop JavaScript applications". I've used it in anger for three years now developing a commercial application and it's fantastic. Two points. Firstly, it's not about Java for the sake of the Java language but Java because Java currently has the best development toolset. All of the refactoring etc. operations that you can perform easily in a strongly typed language with a modern IDE are available to you, and single step debugging in multiple browsers is amazing. Secondly, the JavaScript that the compiler creates is faster than you could write by hand. No kidding. Here's Bruce talking about how it does this from Google I/O two years ago and it's only got better and faster since then http://sites.google.com/site/io/faster- ... g-with-gwt Seriously, it's well worth taking a look at it if you've not already.

To those who don't think this has any security risk, go check the game's "compatible browsers" section on google.code. In order to get it to work in Chrome you first need to enable WebGL (understandable) then you need to turn off sandboxing for your browser. The site then warms you that this removes some of the browser's security features and you should not surf like this normally.

Also note that despite Firefox supporting WebGL, it's not among the supported browsers, likely because WebGL is still changing.

Very cool bleeding edge stuff, but looking at the realistic side of things (when can developers use it), we are likely more than a decade more before this is implemented in 90% of all browsers (becomes mainstream and not a testbed).

Why would I wan't a browser with a built-in gaming platform? I don't need this for browsing the web so it shouldn't be built into every browser. Isn't Ghrome supposed to be lightwheight? The world needs good web browsers and a good portable platform which developers can target, not a compromise between the two. Why can't something like this be built on top of Parrot or JVM or .NET even? Why do you need to make everything a webapp? The Web isn't a platform.

So you can have more holes in your browser, of course!

Maybe i'm missing the argument. All that's being added to browsers is a canvas binding for opengl. Not exactly what you could call bloat or a huge attack surface, especially since browsers are already moving to an accelerated backend. This isn't a gaming platform...this is just one example of what's possible today (in still to be released browsers, for that matter).

I seem to have a different notation of bloat than you. In my opinion it's unnecassary for a web browser to be able to run JavaScript programs with 3D graphics. What could that be used for but gaming?

That's even worse than browsers themselfes taking care of media web pages link to with built-in decoders, video players, etc. My problem is with the canvas element itself and the forthcoming implementations of HTML5 and related technologies. The HTML rendering engines shouldn't need to take care of everything themselfes and thus force everyone who uses a browser based on a modern standards-compliant rendering engine to bundle OGG/MPEG unpackers, Vorbis decoders and media players and such. I dislike plugins, but simply building the plugins into the browser isn't better at all.

Quote:

I've recently become more concerned with the splintering platforms for gaming, whether it's online distribution services or hardware/os platforms. This has the potential of creating a single platform for a majority of games across any hardware with a modern browser. It offers increased interoperability, easily integrated community features, rapid deployment, nearly instant accessibility, as well as a catalyst for further browser innovation. I'm only a novice programmer, so I can't see the whole picture, but WebGL IS a big deal.

Why do you rather want to program games for "web browsers" rather than, let's say, a virtual machine? Isn't JavaVM widespread enough? Runs on everything but jailed iPhones.

Hey, I thought this article is pretty neat. I'd like to see other games ported to browser. Especially those classic games that won't run on anything past Win95, or Win98 (Original Doom, Heretic, etc.) I've tried using Dos Box and other simulated environments, but it's too much of a pain. It'd be great to just type a web address and be up and running.

PS: This is one of the first tech articles I've seen that didn't mention the iPad! Awesome!

So wait... the only difference between Quake 2 running out of a browser and Quake 3 running out of a browser is that 2 here requires no plugins? Sort of interesting, though I doubt I'll scramble to try it out. Personally I loved Quake 2 for some of it's mods, if they could be added in then that'd be interesting.

I seem to have a different notation of bloat than you. In my opinion it's unnecassary for a web browser to be able to run JavaScript programs with 3D graphics. What could that be used for but gaming?

That's even worse than browsers themselfes taking care of media web pages link to with built-in decoders, video players, etc. My problem is with the canvas element itself and the forthcoming implementations of HTML5 and related technologies. The HTML rendering engines shouldn't need to take care of everything themselfes and thus force everyone who uses a browser based on a modern standards-compliant rendering engine to bundle OGG/MPEG unpackers, Vorbis decoders and media players and such. I dislike plugins, but simply building the plugins into the browser isn't better at all.

So you'd rather have a plugin for every function that requires a web page to render anything other than text? A Java machine for images, a flash player for videos, another flash player for audio, another plugin that controls drop down navigation, another plugin that facilitates X-Y movement with your mouse in relation to an interactive web object on the screen...

If a browser handles everything natively and goes directly to the CPU/memory for processing that's much less bloat than going through a number of plugins to accomplish the same thing. Operating systems are much more robust today than they were 10 years ago, don't be afraid to let your browser handle multimedia.

Quote:

Why do you rather want to program games for "web browsers" rather than, let's say, a virtual machine? Isn't JavaVM widespread enough? Runs on everything but jailed iPhones.

Reason enough for me. The idea here is to make everything more open without being dependent on a private company's set of closed, proprietary standards.

Don't get me wrong, I'd much rather play a game like Quake in its own application vs a web browser. But this shows what can be done in terms of advanced user interfaces for the open web, and maybe even casual games for mobile phone users.

I seem to have a different notation of bloat than you. In my opinion it's unnecassary for a web browser to be able to run JavaScript programs with 3D graphics. What could that be used for but gaming?

Exactly right. The goal here is to expand the capability of the browser platform until it matches what the native platforms can do, including the ability to run modern games, while still using the traditional web-based distribution model (central hosting, distributed execution, cross-platform). The long-term roadmap for browsers is to become the VM in which all of your apps run.

If you think the current software distribution model (native windows, mac, ... apps) is just fine, you're obviously not looking forward to this. I am looking forward to it. I think the current way of building and distributing apps really sucks.

I seem to have a different notation of bloat than you. In my opinion it's unnecassary for a web browser to be able to run JavaScript programs with 3D graphics. What could that be used for but gaming?

Did you say the same thing about the powerful 3D graphics advancements in general when they were gaining speed and capability from the 80s onwards? Why do you think this is limited to just games when it leverages the power of OpenGL, which is not specifically a gaming API?