Cube Slam – a Real-time WebRTC Chrome Game
An interesting Chrome experiment based on WebRTC, which incorporates webcam and microphone input, and the ability to play a 3d version of Pong, an arcade classic. It works around the firewall limitation of P2P by using a TURN relay server.
Cube Slam uses
getUserMediato access your webcam and microphone (with your permission, of course),
RTCPeerConnectionto stream your video to a friend, and
RTCDataChannelto transfer the bits that keep the gameplay in sync. If you and your friend are behind firewalls,
RTCPeerConnectionuses a TURN relay server (hosted on Google Compute Engine) to make the connection. However, when there are no firewalls in the way, the entire game happens directly peer-to-peer, reducing latency for players and server costs for developers. [more details on the Google Chrome blog]
Similar real-time communication has been possible for years with Flash Player, and it’s core technology RTMFP made it into the IETF. More details on WebRTC and the relationship to RTMFP in this interview.