Tuesday, October 2, 2007

When I was a contractor at The Coca-Cola Company back in 1994, during a seasonal lull, I was tasked with creating a "consumer presence" screen-saver for the company, and SkiBear was the result. I wrote it in C, targeting Windows 3.1, and used a cutting-edge (at the time) technique called 256-color palette "black-mask" animation.

You can still, 13 years later, find SkiBear at various freeware sites around the web; Googling for "skibear screen saver" led me to http://tinyurl.com/3xe5ay . The download is just 64 KB, and that includes a help file, a read me file, and several images! Those were simpler times.

The thing I'm quite proud of (and a little amazed, to be honest) is that it runs on every version of Windows starting at Windows 3.1all the way up to Windows Vista. This is a testimony to something, but I'm pretty sure it's not the programming skills I had in 1994. Probably has more to do with being written in C, directly against the Win16 API: no MFC, no OLE, no .NET. May be a lesson in there somewhere.

One interesting experience was trying to get the stars in the night sky to look realistic. My first thought was that they should simply be spread out randomly: that turned out to look very, very fake, which puzzled me. Are stars not spread out randomly from any vantage point? So, I began experimenting with various simple algorithms, and after a few days (hey, I was a contractor, during the holiday season), I finally came up with a scheme that worked pretty well. I would randomly place a star, and then position four or five stars near it, at increasing and random distances and directions. After that, I simply randomized the brightness of the stars (which did work well), and threw in the occasional red, blue, and yellow stars.

I still don't understand why a random dispersal didn't look realistic; anyone have any ideas? (I'm familiar with the plane of the Milky Way galaxy, Olber's Paradox, gravitational lenses, etc., but would love to hear a definitive answer.)

Due to the highly graphical nature of this screen saver, your PC's 'System Resources' must have at least 25 per cent free for the skiing bears to be displayed; otherwise, a minimal, 'StandBy' screen saver will appear. This 'StandBy' saver simply blacks the screen and scrolls a multi-color message across the screen (it also provides the standard password protection). You can check how much free System Resources you have by clicking the 'Help, About Program Manager...' menu item in the Windows Program Manager.

Before making the move to SQL Server, Larry specialized in Windows programming in C/Win32, C++/MFC, and C#/.NET. His blog focuses on query tuning, database optimization, and system performance, and features handy scripts, practical tips, and occasional dispatches from the many dark corners of SQL Server.