A Programmer’s Look Inside BioShock

121 0

I’m Steve Sinclair and I work at Digital Extremes. I’m scrawny with dry skin and male pattern baldness. Despite all that – I’m still smiling because I got to peek up BioShock’s skirt!

By skirt I mean the source code. For a programmer there is great joy in understanding. Every time the Great Carmack open sources an id engine, I rush to the Interwebs and fill my brain with the glory. I remember being astonished that they were using Huffman compression on their network stream for Quake 3. If I recall correctly, they’d just capture a bunch of traffic and build the table out of it. It was like profile-guided optimization for packets. That’s sublime right there.

Well, it was a bit odd, being the way I am, that the first thing I did when we got the BioShock build was … check the other ending. Like a coward, I could never bring myself to harvest. What kind of demented person can do that? Sure, I laugh when I light a Splicer on fire and she runs away screaming and then I shoot her in the head and beat her corpse with a wrench … but in my mind the freak deserved it. The point I’ve failed to make is this: learning more about the world of BioShock overwhelmed that programmer’s impulse.

crashsite

How about I say something on topic? BioShock on the PlayStation 3! My first task was to optimize the character ‘skinning’. For Bioshock, a lot of resources go into the character animation – here ‘skinning’ refers to the process of taking the various animated joints (spine, elbows, knees, wrists, etc) and deforming the rendered character to match that animation.


Skinning was coded for PS3 in two phases: first I made it work on the main CPU (actually Sony calls their CPU a PPU) using their specialized math instruction set (much faster than straight up C/C++). That was about four times faster, but the PS3 still had more love. That love was the final step, take that code and run it entirely on a SPU, freeing up the PPU for other tasks. The SPU processors run along side the PPU, chewing data while the PPU worries about something else. The idea being, if you have spare SPU time, your skinning is essentially ‘free’ (done before the rendering system even asks for it).

After that was working, I helped out with profiling and memory optimization. Things you want to do when you change memory architectures, like adding a second straw to your milkshake. In this amazing analogy the two straws would be the collision system and the rendering system. The ‘milkshake’ (chocolate) would be the objects in the world that need to be drawn but, just as importantly, shot, knocked over and generally interacted with. By dividing the data describing the objects between the two dedicated areas of memory I eliminated the need to make a second copy of the object while giving both systems full-speed access to the parts they needed.

As we wrapped, I was slogging on TRC issues (not fun) and crashes (quite fun actually). Such are the tasks of taking it the last mile … as usual it comes down to some nuanced and hard to nail down issues.

Well, enough of my technical jargon for now – thanks for reading. I hope you enjoy BioShock on PlayStation 3. It was an honor to be able to contribute to it.

Comments are closed.

121 Comments


    Loading More Comments

    Please enter your date of birth.

    Date of birth fields