(If you're in an RSS reader there's a YouTube video here)

I saw three things recently (well, saw two, heard about the third) that made me want to have a quick mess around with effecting the atmosphere around me while playing a game. They were in turn...

  1. Microsoft's IllimiRoom demo, projecting images beyond the boundaries of the gaming screen.
  2. Jim's Minecraft Day/Night cycle demo, where the hue lights are in sync with minecraft.
  3. Nick Ludlam talking about porting Proteus to the Oculus Rift.
 

Proteus is a nice "art" indy game, which deals with good solid blocks of colour, the audio part of it is pretty immersive in itself and I knew Nick had access to the source code for his Oculus hacking. It also has day/night cycle and a few other bits and bobs that makes it a pretty good candidate for some ambient colour hacking.

I didn't however want to get my hands to dirty with source code for what was supposed to just be a simple quick test of what synced ambient lighting could be.

Instead I figured I could just point a cheap webcam at the sky area of the game and feed those results to the Philips hue bulbs via the API. The video above shows the results, which are much better in person when you're in the lights rather than trying to catch them on camera.

The whole thing was really easy to setup, I grabbed a starter set of hue bulbs from the Apple store. Knocked up some javascript to read a webcam and fire off the colour values to the bulbs, you can see the code here...

https://github.com/revdancatt/CAT832-webcamtest-lights

...it's as easy as:

var url = 'http://' + control.ip + '/api/' +
 control.username + '/lights/' + lightNo + '/state';
 var params = {on: true, sat: sat, bri: bri, hue: hue};

$.ajax({ type: "PUT", url: url, contentType: "application/json", data: JSON.stringify(params) });

 

...and then hung the webcam over the front of the monitor, waited until it was dark, fired up Proteus and enjoyed sitting in the lightbath.

There's a few problems, all of which would be solved by actually hacking on the source code. The main one is the calibration of the webcam, anything even slightly close to red or magenta basically became red or magenta, while it had trouble dealing with greens and blues. I'm guessing that has more to do with science and wavelengths than anything else though.

The webcam also had trouble with deep colours as it would automatically adjust the brightness to compensate, making it really hard to cope with deep dark nighttime blues. But if the code that rendered the sky was talking directly to the bulbs that wouldn't be a problem, the bulbs can hit green and blue just fine from the iPhone app.

But the test was enough for me to figure that going further is probably worth the effort, as it really did add to the whole immersive feeling of the game. The lights flickering light and dark as you moved through trees did extend it beyond the edge of the screen, abet in a very hacky kind of way.

I like this because it's a bit more general than Jim's hack, in that you could pick a webcam looking out over some distant location and have that change your lights, or point it directly at some indicator light or some such.

But I'd also like to see it built into games like Thief 4, where the in-game 'am I hidden or not' stealth light meter was connected to your lights, so you'd really feel when you were hidden in the shadows or exposed.