Cube Slam is powered by WebRTC, the web video chat technology

Jun 13, 2013 11:48 GMT  ·  By

Google isn't done showing off what the modern web and Chrome can do. It showcased two games at I/O, both requiring multiple devices. Now, it's unveiling Cube Slam, an even more interesting game.

Interesting, generally with these games, refers to the technology behind them, not necessarily the games themselves. But this time around it refers to both.

Cube Slam looks like a simple pong game, but it gets harder through the levels. The different powerups and obstacles add to the challenge and the fun, and this is probably the first Chrome experiment game that's worth playing just for the sake of it.

But it's even more interesting underneath. In what is probably the first use of this nature, Google relies on WebRTC to power much of the game.

WebRTC has been in active and heavy development for the past year or so, and it has finally gotten to the point where it can be properly used in the wild.

The three main components of WebRTC are all used by Cube Slam. getUserMedia handles the webcam and the mic, PeerConnection handles the video and audio chat between players, and DataChannel handles the actual game data sent between browsers.

Of these, DataChannel is the most interesting, and it's the latest addition to WebRTC. Browsers are only now adding support for it, but it has a lot of potential.

DataChannel, as its name implies, can handle any type of data. Its intended use is to create and maintain a pure peer-2-peer connection between browsers. In a chat app, it would be used to send text messages, share files and photos, and so on.

In the game, it's used to handle all the data communication between the players. Until DataChannel came about, WebSockets was the only way to handle this type of problem.

While WebRTC is the star of the show, Cube Slam uses a wide range of web technologies. WebGL and the three.js JavaScript library are used for the graphics, but if your browser or computer doesn't support WebGL, Cube Slam falls back on CSS3D.

The sound is handled by Web Audio API, and all the server stuff runs on Google cloud technologies, of course. Technically, Cube should run on Firefox 23 Aurora, which supports Web Audio out of the box, as well as most WebRTC components, but you'll get a better experience in Chrome.

Google even put together a really cool page to describe all of the technologies inside, which is almost as fun as the game. Everything is open source and you can probably expect an article on HTML5Rocks delving deeper into the tech soon.

A bear explains how Cube Slam works: