August 15, 2007

We're in Seattle now! We spent the last two days in a Motel 6 out by Sea-Tac, and now we're in a different Motel 6 out by Sea-Tac, but this one has wifi. The next week will probably be an endless parade of apartment hunting and phone interviews. We stumbled across GameFest at a mall downtown, and it finally dawned on me that in a week or two I could be living my dream of working in the games industry. That thought has made the exhausting move a little easier.

August 2, 2007

It's hard to believe we are just a few days away from moving to Washington! We will probably set off on Sunday or Monday. Thank god Popcorn doesn't realize he's going to be trapped in the car for a week.

Silent Hill-esque Demo

Orion hadn't ever seen Silent Hill (the movie), so we watched it night before last. The effects during the transition to the otherworld were so incredible they inspired me to whip up a tiny Silent Hill-esque demo. The room gradually transitions from creepy to hellish thanks to a simple alpha-testing trick.

The basic idea is this: I have an alpha-map with darker regions representing the earlier parts of the wall to peel away. Then I just gradually increase the alpha-test threshold. This makes it easy to draw vines that slowly creep up the wall, or spiral towards the center. The shader has a few other tricks to improve the quality. I manually bi-lerp the alpha-test results to smooth out the edges, and add a red tinge to the border. This gives the wall the effect of bleeding while it's being torn into by the otherworld.

The demo is pretty simple aside from the transition effect. There are some re-skinned ghost models from Prayer, and a blood pool that gets fed by drips from above.

I'll post it for download when I improve the blood rain(it's currently just ugly lines!). I think it would make a nice screensaver for Silent Hill fans.

July 29, 2007

Our trip to Anchorage was lovely. Hotel prices are completely outrageous due to tourist season, with rat-infested hovels going for $100+ a night, so we slept in a tent. Harry Potter 5 was fun as always. Transformers was pretty uneven, although better than your typical Bay film. I was expecting to be blown away by the transforming scenes, but they were rendered unwatchable by the frenetic camerawork. Just as a car would start to transform, the camera would swing underneath it to give the audience a nice shot of robot crotch and then twirl around to show the completed transformation. It was like playing a third person video game in the late 90's.

We have begun packing for the great trek to Seattle, which will likely begin next weekend. I haven't had much time for programming lately, but I've started ironing out some of the more noticeable bugs in Prayer. If any potential employer wants to see it during an interview, it needs to be as perfect as possible. It's running steady at about 25fps with bloom and shadows on now that I optimized some of the fill-rate chewing shaders.

I picked up Donald Menzel's Mathematical Physics at Tidal Wave on a whim. This book is small, cheap, and a brilliant short-form introduction to a wide range of math and physics topics. It's just verbose enough to give you a basic understanding of new topics, and compact enough to make a great reference. I'm looking forward to digesting it on our trip. I also caved and purchased Harry Potter 6, which I had expected to read on the trip but I doubt it will survive that long. I suspect after I devour the sixth and seventh books I will have to go back and read the first five.

July 23, 2007

We're back in Glennallen after a nice vacation in Cordova. We wound up staying a whole two weeks, hanging out with mutual friends and Dana's family. I didn't get much programming done, but I'm catching up now. We're heading into Anchorage soon to see a friend and catch up on some movies. I hear Transformers is not your typical Michael Bay movie, so I'm going to drag Dana to it. Definitely going to see Harry Potter. I haven't read the books, despite the chiding of pretty much everyone I know, but I am desperate to find out how the story ends. It's tempting to see the 5th movie, and then just read the 6th and 7th books. Would that be cheating?

Writing for the Wiimote, Part 2

I'm still working on some Wiimote mini-games. In addition to the photo booth mentioned in the last entry, I have two new mini-games in the oven.

The first is based on Witches in a Castle, an old Doom clone/parody I was working on a few years ago. I reused a bunch of the code and art assets with new wiimote controls, just like every other developer, harr harr. You are standing in the middle of the desert, and monsters are streaming in from all sides. The wiimote gets held on its side NES style and rotated left and right to turn the camera. The 2 button shoots, and pressing left and right on the d-pad switches weapons. Since the minigame just uses the orientation and buttons of the wiimote, the wiimote-specific code was wonderfully easy to write and works brilliantly. Dana was kind enough to model the game in the pictures below.

The second game is a lot more exciting. It uses Prayer art assets. You hold the wiimote like a sword and orient it the way you want, and then sharply swing forward to attack. There's a lot of fudges and hacks to make the sword feel smooth and reduce jittering. The first time I compiled and ran my test sword minigame with the most obvious implementation, it felt just like the frustrating sword boss in Wario Ware: Smooth Moves. Nintendo must have spent all of fifteen minutes on it. This sword feels pretty good now, although it's still not perfect. You can also walk around with the nunchuck joystick and swing the nunchuck upward to block with your shield. The experience is pretty visceral after awhile. There is currently only one monster, a ghost. I'm having a lot of fun with this one, and I think anybody who plays it will be impressed.

Simple gestures are really easy to implement. If the player is supposed to be holding the wiimote in a certain orientation, gesturing can be as simple as detecting when the acceleration in one axis is above some threshold. Unfortunately players are not always so good at holding the wiimote the way you want them to. I noticed when some friends playtested the sword game, they naturally held the wiimote in one of two configurations. Determining the orientation and activating the gestures for the sword requires a different axis based on which way the wiimote is held. Surprisingly, this was pretty easy to account for. I wrote code to handle both cases and then lerped between them based on the roll of the wiimote. Now it doesn't matter how the player holds it, as long as it is held more or less like a sword. Hacks like this make all the difference when writing for the wiimote.

Machine Vision

Since I had the camera code up and running, I decided to play with some machine vision stuff. My first attempt isn't anything too spectacular, but it works pretty well. I look at pixels that have changed significantly, group them into blobs, and then group the blobs into what are believed to be moving objects. For fun I set the mouse position based on the largest moving object's position in the image. If you move your hand towards the bottom of the frame, the mouse moves towards the bottom of the screen. It tripped out a bunch of people to watch me move the cursor around with my index finger. I'll have to try some more sophisticated experiments later. I think a key ingredient will be converting to HSV to look at skin hues independent of luminosity(mostly to deal with shadows). It'll probably have to be done on the GPU though, because I've noticed it doesn't take much image processing on the CPU to bog things down.

July 12, 2007

Dana and I are staying with her parents in Cordova for a few days. It's her last chance to see them before we move, so we are enduring the terrible weather as best we can. We took a trip out to see Childs glacier this afternoon, which is always impressive. Of course, Popcorn was not impressed. His eyes were constantly glued to our hotdogs.

Writing for the Wiimote
We have been enjoying Brain Academy, WarioWare, and Mario Party for the Wii a lot lately, which has given me a hankering to write some mini-games for the wiimote. Luckily my MacBook Pro is blessed with bluetooth, and a bunch of other neat features I've never written anything for. As such, I've started piecing together a little party game that makes use of the iSight camera, microphone and wiimote.

I'm using the Darwiin Remote framework for the wiimote. It's written in pure cocoa, so I whipped up a platform agnostic C++ wrapper to make porting to Windows later a bit easier. I will be sure to post it when I get the Windows side up and running.

After playing around the wiimote accelerometer data for a few minutes, most of the Wii control issues in the current crop of games made sense. All you get is 8-bits from each of the wiimote's three accelerometers. The wiimote also gives you calibration data, which you can use to convert the acceleration vector into g's. When the wiimote is held still, you can determine the pitch and roll from the acceleration vector with a bit of trigonometry, but there's no good way to determine the yaw, at least without looking at previous acceleration data and guessing or cheating by using the IR position.

8 bits spread over the accelerometer's -3g's to +3g's range just isn't enough. If you just look at the orientation of the wiimote, there is noticable jittering as the wiimote flips back and forth between two values. If you filter the accelerometer data, you start to run into the 'floaty' feel present in a lot of Mario Party's driving minigames. Because of the puny 3g range and low accuracy, integrating the data to guess the approximate position of the wiimote doesn't work very well.

I have only been working with the orientation so far, which alone has tons of possibilities. I want to try recording some acceleration data and seeing how well a dumb fuzzy matcher will work.

The iSight camera is fairly cumbersome to get at. As far as I can tell, you're stuck using the antiquated QuickTime SequenceGrabber routines. It seems wrong to have to use ancient Mac programming tools like GWorlds on my shiny new Intel MacBook Pro.

I've started writing a few minigames. Right now I just have a Wii-esque photo booth where players take win/lose snapshots of themselves. Why use a Mii can when you can use a real picture?