Developing StoryFork's Treeview
July 15, 2026 | 5m
StoryFork is a really cool app, in my humble opinion. It provides a standard format for writing CYOA stories in text files, as well as an interface for displaying and navigating through them in all sorts of fun and useful ways.
Ever since I first came up with the idea for it (long before I had any experience using a graphical toolkit like PyQt), I knew I wanted there to be a way to visualize a gamebook's branching paths, some kind of tree-shaped graph that shows the whole story at once. Something kind of like this:
That image is a screenshot (slightly modified for legibility) taken from the output of a prototype graph generation script. Pay close attention to the left-to-right layout, the sharp 90° turns at the corners, the way each node's path splits vertically before resuming its horizontal direction, and the arbitrary number of relatives a node can have. That's all part of my original vision for the graph - which has been an absolute pain to code.
I originally wanted to use a library like Graphviz to handle all the annoying low-level stuff I don't care about so I could focus on adding the actual feature to my app. But the orthogonal edges (the sharp 90° turns and path splitting) did not play nicely with the left-to-right layout, resulting in a visually broken mess that I couldn't ship. According to a forum post on the matter (I lost the link, sorry), fixing that particular issue would require a lot of work for such a volunteer-driven project and most likely won't happen without corporate incentive.
Since regular internet searches and forum posts of my own weren't helping me solve the issue, I ended up consulting an LLM. After a lot of back and forth, it gave me a usable demo using PyQt's QGraphicsScene and QPainter classes. It's a mess of spaghetti code that I only understand a little of, especially since there's so much complicated (and poorly commented) math involved, but it almost exactly meets my visual requirements for this feature.
But I still can't ship it.
As I mentioned, it's AI generated, a near-unreadable mess, and has quite a few bugs. All of which is to say that I'll be using it to learn how to make what I want rather than as the end product itself. Plus, I still need to couple it with a second script for transforming the page links of a gamebook into input for this graph's generation.
Developing this thing has been an exercise in patience right from the start. But I'm starting to see the rewards that will come out of it. Plus, I'm gaining a lot more experience with parts of my toolbox that I never had any reason to look at before. So it's not all bad. Just really, really time consuming. Which is why this feature hasn't landed yet, despite version 3.0.0 of StoryFork already in active development - and very close to finished otherwise.