Editing Code and Editing Novels

I got to thinking about editing, mainly because of some conversations. Lately, I haven't been writing much, mainly because I have a packed schedule for the next three months and writing isn't for another two weeks. Mostly, I've been obsessing about CuteGod and getting it done before November 1st. Writing problems is like writing novels. The difference is that it is, in a way, more compact but more complicated. In a story or novel, you know how it ends, in a program, you have to plan for all the possibilities. You have to test data and, in most cases, let people do their own thing. In a way, running RPG games is the mid-point of writing and programming, at least for me. :)

A good example is CuteGod. I've been working on it for a few months, call it two, but if you look at the lines of code (LOC), it doesn't look like much. Yeah, a LOC is like a sentence in a story, but the language is richer in many ways.

  • MfGames.Sprite3: 8,515 LOC
  • MfGames Libraries: 13,868 LOC
  • BooGame: 5,529 LOC
  • Total: 27,912 LOC

Can you guess which library I've been working on for a few years? Put together, this pretty much comes up to the same amount of work as a novel. Now, I don't use everything for CuteGod, but a lot of the same things with editing are there. When I start, the code is clean and organized, I have everything thrown into its perfectly little bit, encapsulated like a proper object-oriented (OO) code should be. As I get further though, I start to throw in patches and fixes. Like adding descriptions or plot lines that weren't planned from the beginning, the patches start to wind their way into the program and soon I have layers on layers of code that is rather fragile. One change to the underlying system and it can bring things crumbling down. For example, in Sprite3, I have a small library to handle the blocks being dropped. They work for almost everything, except the bugs I wanted to add to CuteGod. Vibrating blocks simply didn't work with the pseudo-physics layer. I know how to fix it, but to do so would require me to rip out the entire library and rebuild the block management.

Mr. Birtolo came back with his opinions of Muddy Reflections a week or so ago and I've been mulling over them. Some of them are pretty simple, clean up the language, maybe rebuild the calendar to be less regular and a bit more... fantasy. Others are a bit more complicated. I write in layers, pretty much have for the last five years. At the bottom level, there are the nice clean plots of everyone involved. Everyone has their story, motivations, and personalities. Held alone, like a brand new source file, they are fairly simple. Its when they interact and start to mix that you get these little layers of plot. They are patches, fixes, in the individual plot lines as everyone tries to go back to their goals in life, but those patches are what creates the story. They weave into the tale creating the interaction and conflict that stories need. At the top, it ends up being a complicated mess because of those interactions. However, changing a character's motivation or purpose creates this ripple where you have to fix everything they impact and sometimes you have to rip out large hunks to make it work. I have three of those from Dylan's review. They are three important ones, ones that help fuel the story, but if I want to succeed I have to fix it.

In the case of CuteGod, I just took out the bugs. They were important to the story of the game and I can always fix it later. For Muddy Reflections, I decided to keep all three points in, but it means I have to debug my code and review almost everything to make sure they fit a bit smoother into the story. To me, there isn't much difference in writing programs or writing stories. There also isn't much difference in the ways you have to edit it, how you figure out what to cut and what to change. Sometimes you hate how it looks or sounds and go back and rewrite an entire chapter. I do the same with code, when I realize I did something really badly and it doesn't fit. Last night, I worked on rewriting the prayer complete, chest bonuses, and new stage screens because they really needed to be cleaned up. Too many patches.

Oh, since it is polite, the LOC program I use requests that I mention that it was generated using David A. Wheeler's 'SLOCCount'.

Summer Biking: (370.2 of 400.0 km)