DailyJS

SceneVR: Node and WebGL 3D Scenes

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

books sponsored-content meteor react WebComponent

SceneVR: Node and WebGL 3D Scenes

Posted by Alex R. Young on .
Featured

books sponsored-content meteor react WebComponent

SceneVR: Node and WebGL 3D Scenes

Posted by Alex R. Young on .

SceneVR

For years I've wanted to make a WebGL version of Elite (or maybe Elite II). The technical trick to making it really compelling and native to the web would be if it streamed data with WebSocket to the client... maybe huge persistent galaxies could live on clusters of Node/io.js servers!

I'm never going to have the time to make anything like that, but Ben Nolan's SceneVR project (GitHub: bnolan/scenevr, License: BSD, npm: scenevr) seems like a fun way of experimenting with interconnected virtual reality worlds. The demo allows you to walk around a 3D world with links to various games. There's a Pac-Man game, a chess game, and some other cool stuff as well.

It works by streaming XML data to the browser from a Node server. The server uses Express, and the scenes rendered on the client use HTML-like markup with CSS:

<scene>  
  <box id="mycube" position="1 2 3" scale="1 1 1" style="color: #f07" />
</scene>  

The scenes can then be scripted with JavaScript, so you can add rules to create games:

document.getElementById("mycube").addEventListener("click", function(e){  
  document.scene.removeChild(document.getElementById("mycube"));
});

It even supports multiplayer games by streaming player events to each client. Editing scenes also pushes data to the client, so you can live edit and quickly preview the results.

Ben has added WebVR browser support, so if you've got an Oculus Rift you can actually view scenes in VR.