25 September 2007

Ode To Excel

You Are
Near My Heart
Saving Life From Time Lost
Pivot Tables Turn Data Into Paychecks For Me

23 September 2007

Exploration of the Digital Image

A couple of days ago I was thinking about photos and their properties when existing in the digital domain. A frame of life is captured and stored as a series of pixels, each pixel a set of numbers defining color. A random number generator could provide data to create a series of pixels and would result in an image. That got me thinking... if I were to have a file for each set of possible pixels, wouldn't I have the set of all images? Yes!

This excited me greatly.

So, how do we define the set of all images? First, we must decide on a resolution, or, the number of pixels in width and height. Then, we must define how specific to get when defining the set of colors. That's it. Our formula for the set of all images becomes:

(number of possible colors a pixel can be) ^ (width * height of the image)

Simple formula, huh? Let's start defining a sample resolution and color depth. What is a common image size found on computers? How about the icon? Icons are 10 pixels wide, 10 pixels high, and can have 256 colors. So how many possible icons could we ever see?

(256) ^ (10*10) = 6.67 * 10 ^ 240



Holy mackeral! It would take an astronomical amount of time and disk space to generate the set of all icons. On the bright side, we won't be running out of unique program icons for awhile...

Let's make a huge jump to photographs. A common format for photos stored and viewed on the web is 800x600, 24-bit color. 24-bit color refers to the number of bits needed to represent possible colors. A pixel has three primary colors: red, blue, and green. Each color has a range of values from 0 to 255. Each color range can be represented by a hexadecimal digit. For example, a pure red pixel has values of R=255, B=0, G=0, which in hex is R=FF, B=00, G=00. Each of those hex digits is four bits in size (2^4 in binary), so one pixel uses 24 bits (four bits per digit, two digits per color, three colors per pixel) to store it's color value. This provides for 16,777,216 (16^6) possible colors; a decent range for representing real life images. Good grief, what does this look like in our formula?

(16^6) ^ (800*600) = (My calculator commits suicide)

Yep, should have seen that one coming. What if we mix and match the icon properties and the photo properties?

Icon size with photo color range:
(16^6) ^ (10*10) = 2.96 * 10 ^ 722

Photo size with icon color range:
(256) ^ (800*600) = (Calculator chokes on itself again)

Raising the color depth of an icon to photo quality keeps us in the land of reality, but even with a drastically reduced color depth, we still aren't anywhere near fathoming the set of all photos at 800x600. Let's continue reducing the size and color depth until we can at least computet a number my computer will understand. How about 200x150 (a quarter of the resolution) at 16-color greyscale?
(16) ^ (200*150) = 3.98 * 10 ^ 36123

Hooray! Finally, a number my computer can display without imploding.

Moving along, let's think about why the numbers are so massive. There are so many fricken images in the set of all images that are very nearly the same image. Can you really tell the difference between these two images?

All I did was modify the value of a single pixel!

How many images look nearly exactly like this one with variation in a single pixel? Well, there are sixteen million values for a pixel and 480,000 different pixels that could be different by a single value. What does this mean for the set of all images? Just looking at one example, there are (16^6)*(800*600), or 8 trillion images that basically look exactly the same. If from the set of all images, we threw out 8 trillion entries for every good entry we wanted to keep, we reduce the number of images we care about. However, dividing an incalculably large number by a "measly" 8.00 * 10 ^ 12 is relatively insignificant. After all, in a much smaller set of 200x150, 16-color images, the magnitude of the total set is still in the range of 10 ^ 36123.

Why stop at discarding images with a single pixel difference? If ten pixels were different, would I still consider this an interesting image? Of course! Determining how many relatively similar images we could throw out of our random image generator is one path of a possible research project. In terms of "duplicate" images, what else can we throw out? Is there another factor for deciding whether a set of images are similar enough that we can keep one and discard the rest? Are there other factors for determining garbage images that we don't care about? It was here that I arrived at a very interesting question. What determines whether a set of 480,000 pixels is "worthwhile"?

This is where the fun starts. I can imagine this being a great research project. Creating a set of algorithms that define an image as either "interesting" or garbage pixels. Once enough algorithms are in place, how long would it take a random image generator to produce an interesting image? How long to produce two? This stuff fascinates me and is what computer science is all about: translating real life into mathematics executed on a computer.

16 September 2007

BioShock Review

I finished playing Bioshock today. It took me about 12 hours, spread over three sessions. Irrational Games has created a terrific and terrifying experience that raises the bar for games in many areas, yet falls short in a few areas that prevent it from earning the fabled Perfect 10.

*spoiler alert*

Very solid FPS gameplay here. Perfect FPS controls on a console controller. I prefer my FPS titles with keyboard & mouse, however, the PC demo only ran at 20fps on my laptop. Gunfire and weapon switching are done on the right trigger and shoulder, plasmids (spells) and plasmid selection done on the left trigger and shoulder; simple, elegant, and functional. The brief pause that occurs when weapon switching served a welcome reprieve from frantic combat. Acquisition of new weapons and plasmids is done at a steady pace, I think I had all of them two-thirds through the game. The combat is great. The nature of the game encourages players to attack an enemy not with their strongest weapon, but their smartest weapon. This is what excited me most about the game leading up to it's release. Weapons have three different kinds of ammunition, plasmids can be used in combinations to achieve clever results, enemies have strengths and weaknesses to certain elements, and the environment itself can be turned to your favor. All of these factors are present in every fight in the game. There's no way two people play through Bioshock the same. I actually wonder how much of the game could be completed without firing your guns.

Bioshock doesn't just raise the aesthetic bar. It pulls it out of the ground and beats down competitors ala the Burly Brawl in The Matrix Reloaded. The city's architecture, set pieces, voice acting, environmental audio, visual effects, et cetera are all superb! Developers must look to this game for how a big budget video game stimulates the senses. These are all things I can't convey too well with words, they must be experienced. I highly recommend playing this game in a low-light environment with surround sound. More than once did I actually yell out loud.

As a whole, the game's story was good, but this is one of the first elements the game falls short on. The way the story is told is excellent. Playback of recorded audio, radio messages, flashbacks; all of these were top notch. However, the story itself was only good for two-thirds of the game. The "ha-HA, **I** am the true bad guy" mechanic did not belong here. I condemn Irrational's efforts to have me hunt down Andrew Ryan, only to have me wish he was still alive after I killed him. He was a superior villain compared to Fontaine. In the end, I don't even understand why he insisted on dying at my hands. It was a good twist, but unsatisfying to kill a "mastermind villain" via cutscene and unnecessary to throw in an overly typical "video game boss" in a game that was clearly above such commonplace standards. I was really hoping for a meaningful ending that perhaps played on the game's sophisticated narrative. Instead, I got a generic three-staged, fire boss, ice boss, lightning boss, congrats-you-win conclusion. This really hurts the game for me because Bioshock was setup to break current video game conventions.

A couple other notes-
- Despite solid architecture, the level design in terms of games was lacking. The game was entirely too linear with not enough path diversion. I was under the impression the city was falling apart, so where were my "Oh shit, this building is collapsing, get out before you drown" events?
- Not enough first person cutscene events. For example, when you get the first plasmid, fall off the balcony, and see the Little Sister evaluate you for the first time, or the cutscene where you kill Andrew Ryan. Each of these cutscenes were excellent, I would have liked to see more.
- TOO. MUCH. SEARCHING. Good god, there are 1000 objects to search for loot in this game and only half even have any.
- I'm torn on hacking. I enjoy mini-puzzles, but there are so many hackable objects that I felt an hour of my game time was spent hacking.
- Speaking of puzzles, where are my damn puzzles? I would gladly have given up the crafting and photography elements for some environmental puzzles.
- I can't stress how awesome the Little Sister character design is. The way she moves, how she speaks ("C'mon Mr. B! Angels don't wait for slowpokes!"), and how you interact with them throughout the game will be memorable for the rest of gaming.

Given the length of the game, all of my minor gripes can be forgiven. The only real reason this isn't a 10 for me is how it falls flat and sells itself short in the final chapter of the game. Had the game ended after the encounter with Andrew Ryan, I probably would have given Bioshock a 10.

Some possible alternate endings I would have preferred include eventually gaining all of Andrew Ryan's memories by using more and more ADAM, essentially resurrecting him in his son as his master plan; becoming a Big Daddy permanently (they said over and over again that the process was a one-way trip) and being enslaved to the torment of Rapture; and learning that Andrew Ryan IS Atlus and was using you to eliminate the Splicers so he could reset the population of Rapture with nothing but his own offspring.

Share your thoughts on BioShock in the comments!