About Cube Slam

Scroll down to nerd out
Animals playing pong

WebRTC

Cube Slam is built using WebRTC, an open web technology that lets you video chat with your friends right in the browser, no plug-ins necessary. The getUserMedia API provides access to your webcam and microphone, RTCPeerConnection sends the audio and video to your friends, and RTCDataChannel exchanges all the bits and pieces that keep the game in sync. When there are no firewalls in the way, game data can be sent directly peer-to-peer, greatly reducing server costs.

Animals playing pong

Web Audio

The Cube Slam music-tracker and sound manager are built on the Web Audio API, allowing for a dynamic soundtrack that adapts in real-time to every level you reach and extra you unlock.

Animals playing pong

WebGL & CSS3

If you play Cube Slam on Chrome or Firefox, you’ll see real-time 3D rendering enabled by WebGL and three.js. If you don’t have WebGL, you can still play Cube Slam in 3D thanks to CSS3, with the same game engine running under the hood. All the graphics run on your GPU, freeing the CPU for other tasks.

Animals playing pong

Google Cloud Platform

Cube Slam is built entirely on Google Cloud Platform. The app is hosted on Google App Engine with a backend written in Go, and the Channel API is used to set up the connection with your opponent. If one of the players is behind a firewall, the game uses a STUN/TURN server hosted on Google Compute Engine to exchange data. PageSpeed helps things load quickly, and AppCache lets you play offline.

Animals playing pong

Open source

You can check out Cube Slam’s source on Google Code or in the Chrome Developer Tools (you’ll need to enable source maps). Also, as a reward for reading this far: you can add the ?⁠dev parameter to the URL to enable dat.gui and tweak all the levels, extras, and other attributes of the game. Have fun!