Gates Christmas Decoration

Every year we decorate the gates comptuer science building in an attempt to outtech and outdo the previous years' decoration. Here's a link to previous years' decorations:
[2005] [2004] [2003]

Defcon Christmas Mod
Daniel, Nghia, Zhang

So what would be a better statement in the world than replacing the menacing threat of MAD in the game of DEFCON, where players nuke each other until they glow, with the promise of happy children all over the world receiving gifts. This website documents the creation

Defcon Official Website and demo
Download mod
YouTube Movie

Art Project
To give DEFCON a christmas feel, the art has to change completely. In fact the idea that made us think of it in the first place was the shape of a silo with respect to a christmas tree. So we crafted a stylized Christmas tree:

But what would actually fly out of the trees to hit other players? Why gifts of course!

So gifts are raining down on happy children...but what in the world would shoot down these gifts? What would replace the SAM sites...but abominable snowmen!

And lastly what flying object would rain presnents down on happy children? Well nothing other than a sleigh

And thus christmas DEFCON was born!

The game still sounded eerie and creepy with the bunker noises and funereal soundtrack. The first order of business was replacing the sound of a blast with happy cheering children. This wasn't hard to orchestrate, but it was nearly impossible to get working in game for reasons still unknown to us. Next we had to recruit a santa to yell "Ho Ho Ho" the minute gifts started launching from one country. Finally we were left with an eerie soundtrack and some happy sounds...we needed some public domain music.
Luckily for us most Christmas Carols have fallen into the public domain over the years, but unlucky for us most recordings of said public domain tracks are copyrighted for years (and perhaps forever depending on who bribes our congresspeople). So we were left with sheet music and some freely redistributable samples from Debian and the best midi synth out there: timidity. So it was down to picking instruments and tempos for the songs. Boy was that an adventure---you can hear them playing in the youtube video. It's too bad Weird Al never responded to my request to use his "Christmas at Ground Zero". It would have been deliciously ironic to be giving presents in a nuclear war simulator to that song.

Hacking Assembly
The game features a countdown from DEFCON 5 to DEFCON 1. For a christmas game this is completely inappropriate--but it would make sense if presents were only allowed to be given on at midnight on December 25th...
So it clearly became our mission to patch the assembly in DEFCON to make this a reality. Luckily the string constants were all padded to 4 byte boundaries, which gave us enough padding room to fill in the longer string "December 2" straight into the string pool.

This left us with some tricky math to hack at. We needed to perform 6-DEFCON. Since 1 was already subtracted from the DEFCON number, it was easy to subtract 6 more from it. However, the whole thing needed to be negated for it to count up, and that wouldn't fit into the code. Instead, 5 bytes of code to call a new function was inserted. Since all functions happened to be 16 byte aligned, this gave us the 13 bytes needed for the code to do the subtract, negate, and one additional instruction that the 5 byte sequence blasted. Thus the hack was complete and DEFCON now counts up from December 21 rather than counting down from DEFCON 5.
You can download the patched binary here (for defcon version 1.1). Note that the videos and screenshots were taken before the patch was in effect.

If you're interested in some of my 16-bit era ASM hacks visit my Begin2 webpage, where I hack multiplayer onto my favorite old skool tactical space simulator.

With the code all ready to go for multiplayer we realized there was something terribly missing from the final demoable package. The game needed to run in a screensaver-like mode all day, spouting pretty music and cheery children sounds while showing off what we'd done. Defcon doesn't like to loop itself, I suspect because the authors didn't want people to bore of the visuals. Thus we had 3 challenges.

a) Determine when the game was over
b) if the game was over restart it
c) Pan the camera while the game runs so that interesting areas may be observed by the casual viewer

None of these proved to be trivial. Though the gameplay freezes when time is up and the time stops ticking, the game has radiation that "pulses" when the game ends, so simply determining if there has been no change in the framebuffer was right out. The timer that stops is bright white, so looking for white seemed promising, but unforutuately it was antialiased and actually varied from frame to frame because it was semitransparent and often over some glowy radiation. The solution was to separate the image into color channels and pick the one that changed the least and make sure that no pixel exceeded a difference of 20/255 in the last 6 seconds. Not exactly what folks would have come up with on a first try, but it worked every time!.
Restarting was accomplished with the autoit tool--not too hard--but sometimes that tool doesn't actually deliver the click, just the motion, so we had to program double or even triple clicks lest it mess itself up--since game restart requires 3 separate individual clicks in different locations on the screen.
Lastly panning and scanning was another autoit script that hit the arrow keys for panning and scanning--though it can get irksome if someone is actually trying to play the game in earnest---

Polar Projection
What christmas game would be complete without something from the north pole. In this case we decided on a view from the north pole as our contribution from Santa's HQ. That way you are literally looking down upon the world from Santa's lair!
This required figuring out the formats in which introversion software put their line art as well as images. Most everything was text or bmp images, so it was really not a problem to parse them using python and some regexps. However the images and the lineart were actually skewed from each other with a number of weird constants that we just had to guess. A number of different angles for the polar projection were considered, but the one chosen was done so due to the curve of the gifts most mimicing shortest path routes across the sphere that is the earth. Since all missiles arc up in defcon, this meant putting the pole slightly higher in the image than it otherwise would have been. This also meant lopping off Australia (sorry, mate!).
Anyhow here is the code to convert the data
Python Code to Project from the Pole(BSD License)
And here is a link to the polar portion of the mod itself (also compatible with vanilla defcon--and standalone from the atwork):
Download Polar Projection


The Christmas mod also works on a flat map:

YouTube Movie

Physical Defcon
Daniel, Bjoern, Monzy, Mike, Jeff, 3rd Floor Artists

Well a computer game isn't enough to decorate a lobby--it has to have something physical, something active. And what better way to complement Christmas DEFCON than a actual gift giving challenge where people have to deliver physical gifts to "continents" drawn all around the room---specifically RFID readers at each corner of the room. So the game is simple: a player has 60 seconds to deliver certain gifts to each portion of the main lobby.
The game was mostly artistic in nature as the simple code to read signals from the RFID tags and the code to speak out the different presents and locations was actually only a couple of lines long. I decided to make a google code project out of it anyway.
Motivating all the CS grad students to decorate their presents was actually not as easy as it sounds ;-). But in the end we got a superb bunch of presents.

The game sounds so easy: just a permutation of presents and areas---how could it be hard? But it taxes both the short term memory and the physical exertion of the user who must run between various RFID sensors to scan each present. It's like a UPS job on government-grade crack---especially with the timer set to 45 seconds!

To my 16-bit era Begin2 webpage
To my main OSS project, Vega Strike
Back to my student webpage