When Slashdot reader magenta was invited to participate in the Loki Hack Contest attached to Atlanta Linux Showcase, his first thought was, "There must be someone more deserving of this high honor; after all, I'd never even seen Civ:CTP. But after a few exchanged emails and a bit of chatting with various friends who all told me it would be a good idea (thanks, Ross and Joel), I reluctantly decided to accept the invitation, and booked myself a cheap flight to Atlanta." (More below)
The Hacking Contest Nobody Tried to Win-by magenta
I am very glad that I decided to enter.
First off, nobody there, including myself, cared about the potential for prizes. There was a great feeling of camaraderie, of friendship. Thirty people (including Loki Entertainment's representatives; very few people, as it turns out, actually signed up, probably due to some of the FUD spread on Slashdot regarding Loki's intentions) talked to each other as though they were old friends even though we'd never met each other online, much less in real life. We all exchanged ideas for hacks, bounced ideas off each other, and discussed means of implementation. The attitude was the opensource mentality at its best.
And then we saw the source.
The official Loki Hack '99 t-shirt has a slogan on the back. The slogan is "I saw the source and lived." This slogan is incredibly apt. At the risk of offending Activision (which I certainly don't intend to do), Civ:CTP isn't exactly the best-engineered program around. Imagine the original release of Mozilla, put into a blender on frappé, shoved into a toaster oven and let to sit on medium heat for a few days. And then microwave it. The individual pieces of code weren't too bad (if not inelegant), but the entire package wasn't arranged in any semblance of order. The first hack I wanted to perform was XaoS-like smooth zooming on the map, so that when someone clicked on a zoom button, it would do it smoothly. I couldn't find, nor could the Loki people tell me, where any sort of useful callback would be. After tracing through about 10 levels of indirection, going past hard-coded constants and multiple redundant and nonsensical calls to seemingly-random parts of the source, I gave up and decided to work on other things.
But I saw the source, and I lived.
That is such a cool concept. Namely that I saw the source. The source to a very commercial, very proprietary program, from a very un-opensource company. Activision put a lot of faith and trust into this experiment, and hopefully they will find that it was well worth it. In just 48 hours, a couple dozen programmers who had never seen the source before added in some incredible changes. I rewrote the map generator to generate quasi-fractal terrains with randomly-combined algorithms. The person sitting next to me changed the game logic so that different civilizations would have different abilities (rather than just being different in name, one tribe could run faster but be weaker, while another one could produce technology more quickly but not generate wealth, or whatever), which was no mean feat considering the network-play mechanism. Various people ported SDL (the low-level graphics API written by Loki for the purpose of having DirectDraw-esque functionality in Linux) to varying other APIs, such as Clanlib and GGI. One person, whom I now consider myself friends with thanks to this experience, added in hooks so that during a network game, you could launch an arbitrary program (such as tetris) while waiting for other people to finish their turns, and also added in hooks for publishing the gamestate to an external server, so that people can watch the game from the outside, getting a play-by-play summary for example.
I saw some very cool things. One of the reasons I chose to work on the map generator was that unlike the main program, which took several hours to build fresh and 10 minutes to link (on a quad Xeon-600 with a gigabyte of RAM), the map generator was implemented originally by Activision as a COM object. Sam of Loki decided to take the next logical step when porting this code to Linux by making it a separately-linked set of shared libraries to be linked at runtime. Of course, Linux doesn't have any good COM implementations, certainly none which are readily-available and behave the same way as MSVC's, so what did he do? He basically reimplemented the most important functionality (QueryInterface, AddRef, and DelRef) in about 10 lines of C++, confirming my suspicions that without DCOM, COM is just a C++ refcount garbage collector.
The competition (or lack thereof) was basically the embodiment of open source. Twenty or so talented hackers teamed up to make sweeping improvements on someone else's code, without any real desire for glory or money. Most of the Slashdot naysayers were saying that Loki was obviously trying to take advantage of talented programmers by conning them into giving up quite a bit of labor for free. Well, Loki certainly didn't get it "for free," as they went out of their way to be as helpful and giving to the "competitors" as they could. They provided everything, short of travel; they even rented a hotel room that people could take turns crashing and showering in, and when the hotel-catered meals weren't enough, they happily went and got food for us as needed. And of course, the best thing that Loki did was deciding to do this to begin with. That and coming up with a very flexible NDA which only restricts our usage of the physical code for the next five years, which of course, we weren't allowed to leave with anyway.
I can't properly describe how incredible this competition was to anyone who wasn't there. Particularly I know I can't describe it to people who are driven by money and recognition, rather than the love of simply coding. Again, there was no feeling of competition there. Nor did there need to be. As bad as Activision's code was, it wasn't bad enough to stop people from simply having fun and doing very cool things. It surprised everyone there how productive they could be under the circumstances. It certainly surprised me.
Hopefully this experiment will be a positive lesson to Activision and other companies that opening the source can lead to wonderful consequences.
In any case, I would definitely like to thank the wonderful people at Loki Entertainment for enabling this to happen, especially Sam, who tried his best to help me whenever I was stuck on a piece of code, and Scott, who stroked everyone's ego in nice ways. I would like to thank the people I met there, especially Chris and Ryan, for being so cool to work with and knowing what this contest was really all about. I would definitely like to thank Activision, who made this possible to begin with; I look forward to seeing the results of this experiment, on every scale.
People who don't know any better sometimes think magenta's real name is Joshua Shagam.