BrianPeek.com
A Compendium of Random Uselessness

May 2007 - Brian Peek's Blog

  • Microsoft Surface Computing


    I'm typically not one to link to other sites in my blog, but if you haven't watched the Microsoft Surface Computing video at on10.net, please go watch it now.  Absolutely incredible.  I want a coffee table like this.

    Update: The official Microsoft Surface website.

    Update 2: Popular Mechanics video 

    Filed under:

  • XNA Timing Bug


    Update - 12/24/07: This issue has been fixed in XNA Game Studio 2.0.  Woo hoo!

    While working on my game for Maker Faire (which you'll be able to download in about a month), I came across a timing bug on the Xbox 360 using XNA.  For an application that requires very accurate timing (millisecond precision), one can use the StopWatch object in .NET 2.0.  This was working quite well in my PC build, but on the Xbox 360 build, I would notice that time would drift with no explanation.  After digging around for a couple days and writing a simple sample to prove the point, I determined that the time value returned by the StopWatch object would drift by about 150ms/minute, which is considerable when precision within a few milliseconds is required (and considerable when it should be accurate to begin with).

    I eventually found a workaround:  DateTime.UtcNow.Ticks is perfectly accurate on both platforms.  So a quick rewrite to use this property in all locations requiring accurate timing fixed everything quite nicely.

    The item is bugged and confirmed as such by the XNA folks, sample code is sent to the XNA team and it will hopefully be fixed in a future version.  But, for now, if you're looking for accurate timing on the 360, DateTime.UtcNow.Ticks is your friend.

    Update: After Chad's comment on CodeBetter.com, just wanted to clarify a few things...

    1. DateTime.UtcNow.Ticks may in fact not be precise on any given platform.  As stated below, sitting in a tight loop may not see the Ticks value increase for several milliseconds.
    2. StopWatch internally actually uses DateTime.UtcNow.Ticks if the QueryPerformanceCounter doesn't give back the results the StopWatch wants (precision information).  On the 360 side of things, QPC does return the valid information to the StopWatch so QPC is what gets used.
    3. The issue above is not one of precision, it's one of accuracy.  The length of a millisecond on the 360 according to StopWatch/QPC is just plain wrong.  Updates to the StopWatch value are certainly quite fast (millisecond precision) yet over time, comparing the time to "wall time" or DateTime.UtcNow.Ticks shows that the StopWatch runs slower than real-world time by about 150ms per minute.  It never catches up and in fact, just drifts further and further behind.  After about 10 minutes, StopWatch is one second in the past.  But again, only on the 360.  On the tested PCs, there was a drift of only 2 or 3 milliseconds in that same ten minute timeframe.
    Filed under: ,

  • Wiimote Applications


    I've received a couple emails in the past week of people using my Managed Wiimote Library to do some spiffy things.

    Brent Rossen's project allows one to interact with a virtual patient and is described as:

    This project was primarily created to allow the Wiimote to be used as a novel interface for a virtual environment. The goals were to create a Wiimote server, allow interaction with a virtual environment, and provide haptic as well as audio feedback. Six degrees of viewing freedom and stereo vision are provided via a Head Mounted Display and optical tracking system. Sound is provided through FMOD. Much of this project is built on top of code from the Virtual Patient Project.

    Evan Merz has created a virtual drum kit available at his site along with a video showing its operation.

    Great stuff, guys.  Anyone else using my library for a project?  I'd love to hear about it!

    Filed under: , ,

  • Maker Faire 2007


    I will be attending this year's Maker Faire with the Coding4Fun gang.  We will have a variety of spiffy projects to play around with, including two I have done:  several "Wiimote-controlled" cars using my Managed Wiimote Library and Microsoft Robotics Studio, and a game written with my Ganksoft Entertainment cronies using Microsoft's XNA Game Studio Express.  So if you're in the San Mateo area, stop by May 19th and 20th and have a gander.  At only $15 for admission, there's plenty to see and do...

    More details at (also linked above):