Saturday, July 30, 2005

My Summer of Code

No, I'm not talking about a Google-sponsored open-source Summer of Code. I should be so lucky!

But thanks to my wonderful wife, I've had the next best thing: 6 weeks of low-interruption, low-obligation crunch time. She took Jason down to Mexico while I cuddled up with my text editor.

As you may know, I'm trying hard to train myself for a career as a software architect, professional writer, or some combination of the two. As the primary caregiver of a now two-year-old, it has been a bit of a struggle. Last spring, I learned the high school math I never learned in high school. I had retained almost none of it, and from what I recall, the understanding I had back then wasn't worth retaining. I also learned some basic Python, an oh-so-nifty programming language I wish never to be parted from.

Summer, autumn and winter were difficult times of heavy parenting, in which, for the sake of my sanity, I had to content myself with daytime reading and late-night writing. Jason made it tough even for these, but at least I continued to learn and develop in areas important to me.

[At this point, I must ask forgiveness of my non-programming readers while I give a concise accounting of my summer exploits.]

I started to heat things back up this spring, as more time became available. I learned Linux well enough for it to become my primary OS. Getting MythTV running had a lot to do with this switch, although I haven't watched TV at all this summer. (It's mostly for the wife and kid, since I'm currently suffering from Simpsons fatigue.)

I actually said “free as in beer” the other day, too. My indoctrination is complete.

As spring moved into summer, I dusted off my Python and went on to become pretty fluent. Why Python? I doubt there's any faster way to gain exposure to the terms and metaphors of programming-in-general. This really helps me understand what the writers of programming books are saying. I'm drinking from a firehose, and need all the help I can get.

But I didn't become fluent by simply reading books and doing exercises – although I've done plenty of that.

I gained my fluency by plunging into what, to a beginner like me, is an ambitious project: A suite of dynamic mod-making utilities for Freelancer, the game of space combat and privateering my brother and I had been playing together on Saturdays.

We had first played Freelancer when it came out in 2003. It's a great game that leaves you wanting more content. So in a bit of hopeful nostalgia, we were trying the impressive FLRebalance mod for Freelancer.

FLRebalance combined new star systems, ships, and weapons from many different modders. Excellent! But among other things, this meant that there were now many hundreds of different items for sale, each apparently priced by their creators, who seemed to have very different ideas on what things should cost. Another side-effect of massive inclusion was inconsistent use of the new items, leaving many of them in relative obscurity. As a result, I felt that FLRebalance lacked, well, balance.

Apart from a couple of very minor and lucky bug fixes in years long past, I've never done any modding. (Well, I did play with the Unlimited Adventures build-your-own-gold-box-D&D-game kit back in the day, but I'm not sure that counts.)

Frankly, the kind of modding I wanted to see in Freelancer never held much appeal to me. Not only are there a gazillion little decisions to make, it's tedious, repetetive, and error-prone... the kind of activity computers were meant to do.

Aha!

After spending quality time with Google and Lancer's Reactor (the premier Freelancer modding site), I was satisfied that the tools I wanted did not exist. I had found my summer project. (Update: As of yesterday, someone else has made a basic version of one of my tools -- a ship shuffler. Guess I'd better hurry!)

My toolkit, FLModMonkey, makes the kinds of global alterations to large game variants like Rebalance that only the foolish or masochistic modder would want to try and do by hand. It currently does the following:

--Uses a complex and finely tuned scoring algorithm to set and integrate a fair price for every ship in the game variant being examined.
--Uses another complex and finely tuned scoring algorithm to set a fair price for every weapon.
--Uses yet another algorithm to determine the “level” of star systems based on the difficulty of the missions offered within them, and redistributes the ships being sold based on these scores, with some controlled noise thrown in to ensure a fresh shuffle every time.
--Generates as many as several thousand unique random weapons by applying clever Diablo-style modifiers to existing weapons (with excellent flavor text, I might add).

Before I'm finished with this version, it will also do this:

--Shuffle the weapons being sold similar to the redistribution of ships described above, except for weapons that will only drop from NPCs (see below.).
--Generate hundreds of variations on existing ships (i.e. 'used' or 'modded'), similar to the weapon generator.
--Generate thousands of new loadouts for NPC pilots, making use of all of the above.
--Combine all of the above into a simple super-utility that determines logical boundary prices and shuffling restrictions based on the data found in the game variant being modified.

Apart from all the programming essentials I've learned just in the course of learning Python, FLModMonkey has brought me excuses to play with unicode strings, XML, hexadecimal arithmetic, and more. But at it's heart, writing FLModMonkey is all about creating, weighting, curving and tweaking scoring algorithms, an area I find particularly interesting.

But now that I'm about midway through the project, with most of the research behind me, it's become more about code management. I'm taking pleasure in becoming more object oriented as I go along and grow more comfortable with this methodology.

But FLModMonkey does not own me, as hard as it tries. I've also done the following this summer:
  • Progressed from Vim newbie to actually feeling at home in the editor. A few stategic keymappings have allowed me to more than compensate for the inherent disadvantage I have with the defaults as a Dvorak typist.
  • Learned the basics of C with help from K&R, and wrote some very fast little utilities for converting things like Project Gutenberg .txt files and multiple decompressed .chm pages into a basic single-page HTML format that RBMAKE can easily use to make perfect .rb files to send to my REB1100 via REBCOMM. You catch all that?
  • Lost my Windows API virginity by using Mark Hammond's WinAPI extensions for Python – initially to open the .dll files Freelancer stores some of its text in and pull out the creamy goo inside. Yes, I put it back. And then some.
  • Began keeping a programming schedule (at the advice of Joel on Software), so as to learn the valuable art of estimating how long it will take me to code something.
  • Encountered Getting Things Done, as seen in Wired Magazine. Like many geeks, I was already pretty organized. I had the stereotypical todo.txt files lying around. GTD was just what I needed to close the remaining leaks in my personal management loops.
  • Wrote my own little keyboard-centric, cross-platform (GTD-flavored) organizer program (in Python) to bring unity to my to-do lists. Every hacker has done this at some point, right?
  • Discovered the work done by veteran game programmer Chris Crawford in the embryonic genre of Interactive Storytelling. You may be hearing a lot about interactive storytelling from me, because it's a topic I happen to be fascinated in.
My wife gets back in a couple days, and my parenting duties will return. I intend to see FLModMonkey through to completion, however, even if it takes me until Christmas. Hopefully it won't come to that: we've got more financial stability and babysitting options this year.

And Jason has finally started talking!

0 Comments:

Post a Comment

<< Home