Boring Update About My Second Novel
First off, I assure you all that Book 2 of the Thaddeus Marcell chronicles is mostly written now. I’m nearly done with my first draft of “Rebellion at Ailon” and then comes the editing process. I feel much more experienced and confident this time around, and so I think that this first draft will be pretty close to the final published version, apart from some polishing, fixing up consistency issues, replacing some placeholder names with real character names, spending some serious time with a thesaurus, and so on. In any case, I’m feeling very comfortable with my self-imposed publishing deadline of January 2019.
But none of that is really the topic today. Instead, I want to talk about far more interesting things: word processors.
Now, if you’re done laughing and you’re still here, cool. If you didn’t know, I’m a software engineer at my day job. Writing is just a side hobby that I enjoy and sometimes it draws in a few extra bucks. But who says the two can’t be combined? (Yes, even my side projects have side projects…)
Are you nuts? Why In The World Would You Write Your Own Word Processor?!?!
When I started writing the Thaddeus Marcell Chronicles (probably around 2016-ish is when I got serious about the project, though it’s been on my radar since junior high school and I’ve probably had half a dozen aborted attempts since then) I switched back and forth between Microsoft Word and LibreOffice, depending on whether I was on a Windows or a Linux PC. Towards the end of 2017, I ran into some major annoyances while editing Rescue at Waverly. My biggest problem was how much I needed to move things around. Scenes and chapters got cut and pasted all over the place while smoothing out the story flow. But the document was difficult to navigate. Word and LibreOffice outlined inconsistently and didn’t always get along, and I found myself doing document-wide searches on a few remembered phrases just to get me close to the section I was trying to find.
But I’m a software engineer, right? I don’t have to put up with this! I’m gonna go make my own word processor! With blackjack and hookers! My main goal was to improve document organization so I could easily navigate it and move things around. Overall, it’s really basic and tailored specifically to my use. Sometimes it’s buggy, and it’s definitely not at all fit for public consumption. It saves everything to an XML document and I still sometimes have to hand-edit the XML to do a few things because sometimes that’s faster than adding the feature to the application itself.
The Amazing WpfApp1.exe
It’s written in C#, using WPF (Windows Presentation Foundation) for the user interface and targeting .NET Framework 4.5.something-or-other. Unfortunately, using WPF means it will not run on Linux even with Mono or Wine, but oh well. C# is my best programming language and I had to compromise somewhere in the interest of developing something quickly. In this case I lost the ability to write on over half of my personal PC’s.
Here’s a couple screenshots of the main window. Yes, it’s titled “MainWindow” and yes that’s because I never bothered setting window titles myself. (Such details weren’t important for a tool I wrote for myself.)
Here’s a top-down overview of the involved data structures necessary to understand the application, as illustrated above:
- Universe: A Universe is a single XML file containing a collection of related stories.
- Series: This is what you’d expect. A series is a collection of related books, usually with a common theme, characters, and plotline. As you can see above, I have plans for three series in the Thaddeus Marcell universe.
- Book: This is also what you’d expect. Rescue at Waverly is a book. Rebellion at Ailon is a book. I have many such book ideas outlined above. Have fun speculating. 🙂
- Chapter: Okay, I need to quit starting definitions this way, but this is what you’d expect. Here, a chapter is a collection of Scenes. Chapters are somewhat arbitrary. I’m sure there are rules out there somewhere, but I don’t know the rules and I don’t play by the rules.
- Scene: A scene is a single narrative section. In my writing, a change of scene usually involves a change in point of view or narrator, or a skip in time. You can see some scenes listed under the chapters above. Scene names are only for me, they are never included in the published work so sometimes I get pretty goofy with them just so I can remember it.
- Trash: You don’t delete stuff, at least not intentionally. If I delete something, it only gets hidden and moved into the Trash. It takes a conscious effort to “Show Trash” and then delete stuff later. I just clicked on “Show Trash” for this screenshot, and I couldn’t tell you what half the deleted things were supposed to be. Many of them are empty scenes. I guess I need to empty the trash sometime.
How I Organize Things
I quickly learned how to abuse chapters. Now, when setting up an outline I create a “chapter” for each subplot, and fill it with scenes. Later, during the editing process, I move the scenes out and interleave them into the real chapters that end up in the published version, and the subplot chapters get trashed.
I also have the ability to color the scene names in the main window. You can get a glimpse of that in the trash screenshot above, where some entries have red text and others are black. This is arbitrary. I use it to flag sections I know are done, or mark ones that really need some more work, or to mark scenes for possible deletion.
The Main Editor Window
Here’s a screenshot of the main editor that opens when I edit a scene. Each window only shows one scene at a time, but I can have several such windows open simultaneously when I need compare different scenes/chapters. I don’t think Word or LibreOffice really know how to do that.
My Dirty Little Secret
Okay, so I didn’t really write a word processor. Not like you’re probably thinking, if you aren’t a coder and you’ve somehow survived reading this far. Actually, most of the main editor window is just an out-of-the-box System.Windows.Controls.RichTextBox instance, which gave me just about everything I needed for a basic word processor without writing much code. Thanks, Microsoft! I simply dropped in a RichTextBox, hooked up some editing buttons (most of which I’ve never actually used or even tested, and I’m sure some of them will BSOD all PC’s within half a mile of me if I actually click on them), and a few extras like the bug-ridden-but-I-don’t-care zoom control and some basic document statistics.
Despite its importance, this really is the smallest part of the application. I spent at most an hour putting this editor window together, and the vast majority of that time was spent coding the search feature that I’ve only used maybe three times ever. Overall, this editor probably has 2% of the features of Word or LibreOffice, but it’s the 2% I care about so it works well for me.
To me, the real value is in the rest of the application, not in the editor itself. I spent most of my time elsewhere developing seemingly-trivial things like reordering scenes, renaming chapters, collecting statistics, and exporting portions to Word format using a template that’s close-ish to what I need to upload to the Kindle Direct Publishing website.
And context-menu handlers! So many context-menu handlers! Most of the application’s C# code (incorrectly) lives inside event handlers in MainWindow.xaml.cs. There are some 600-lines of context-menu and button handling here!
(Don’t critique my solution too harshly. This is an internal my-use-only tool I never intended to release. I didn’t quite follow things like “best practices” or MVC/MVVM/whatever the cool kids call it these days. It grew very organically and I’d be a bit embarrassed by it if I was releasing this as a product. It’s not even checked into source control! Yes my code is bad and I should feel bad.)
A Couple Other Interesting Tools
You’ve seen most of the application already. Most of what’s left is pretty boring, but I’m a bit proud of these two parts.
Here, I can see statistics on a selection. This can be for a single scene, a chapter, or an entire story. I realize this looks very boring and mundane at first, but Word/LibreOffice only gives you document-wide statistics. It wasn’t easy for me to figure out how long chapters or scenes were. Now, it’s trivial. It also works great with how I organize things while drafting. Since I (mis)use chapters to organize subplots during the initial writing phase, I can view statistics on the “Crew Mutiny” subplot and see how long it is. Then I can decide if I need to add to it, or trim it down because it’s taking up too much of the story.
Which leads to this bizarre and colorful thing that makes that even easier:
This window breaks up a selection and helps you compare lengths. There’s a thick black border around each chapter (in this case, each “chapter” is a subplot for Rebellion). Within that is a colorful box for each scene. And all the boxes are proportionally scaled, e.g. a box that is twice as big contains twice as many words. It’s far from perfect. The scaling means the text on smaller sections is cut off and can’t be seen. Oh well.
This is extremely useful for me to figure out pacing. For example, how far does the reader need to go until such-and-such event happens? Is it way too close to the beginning of the work even though in my mind it should be near the end? Or is a subplot involving minor characters growing too large and beginning to dominate the novel? (Not-quite-spoiler alert: Rebellion originally had an entire subplot following Commodore Wilcox’s Yellow Fleet that I decided to move into the third novel.)
This view isn’t quite as useful later on, but it’s been invaluable while outlining and writing out a first draft. Although it is a bit prettier on a finished work:
So, there’s a sneak peak into the mind of a software engineer who can’t even do non-software side projects without ending up writing software anyway. Maybe someday I’ll clean this up and release it under an MIT or BSD license. But no promises.