What I'd like to do:
At each story node, I'd like to have links pointing "up the tree" of story nodes back to the start node. Since twine is fundamentally a tree structure, my thought is that there should be some way to traverse that tree "backwards" up to the root node.
My original thought was that I could use the "back"/"history" functionality, but because there might be internal loops within the structure, going "back" isn't always equivalent to going "up" towards the "start" node.
Is there some way to traverse the tree of story nodes vertically?
I'm formatting a story that's less of a story and more of an investigation into a topic/book. This makes the structure more hierarchical: I start with a linear background/overview, then separate out into parts, and each part has multiple chapters, and each chapter has sub-sections (which may have sub-subsections). But because I'm not telling a chronological story, you could go to the different parts/chapters/sub-headings in any order, and may want to jump around: each section more or less stands independently but still may have links to other sections. After you've explored any given section sufficiently, I'd like to be able to go "up a level" back from sub-heading to chapter to part to index, or up multiple levels at once. Hard-coding these links for each node would be really obnoxious. I started on sugarcube, but would be perfectly willing to switch formats if that adds ease of use.
A) If there's a way to access the connectivity map of the nodes, it wouldn't be that hard to search the tree from the root node down to the current node and use that path to make the links. But I don't know if there's a way to get at that node structure.
B) Alternatively, if there's a way to "post-process" your story, node-by-node, you could also implement some sort of "breadth-first" search over the nodes of the story, and mark mark which branch each story point lies on. This branch-marking could be used to generate the links needed to point back to the root node.
C) A completely different solution is if you can force links to be run multiple at a time, or if you can mess with the story history. Since the "back" button/history solution works fine to go up the tree unless you have created loops in the tree, I could eliminate loops by changing links that don't point "down" one level of the tree to act as if the user clicked "back" the appropriate amount of times and then re-entered the tree to go down to that other node. This would mean that I could always use the "back" button to go "up" the tree, level by level. This still comes back around to the connectivity question because I'd have to know how to traverse "down" to these other nodes, and would significantly change the behavior of links, so may be super-complicated to implement.
D) I could code the story to not have any loops and be structured exactly as a tree, so using "back" and "history", I should be able to make what I want work. This kind of destroys a bunch of the utility of using twine, but would still be a workable option and should be simplest to implement.
If there's an easier way, I'd love to hear feedback. Or if you think I shouldn't be using twine for this, it'd be good to know I'm barking up the wrong tree. I hope someone has some thoughts - would appreciate any insight/help!