Open dranorter opened 8 years ago
Well, I'm regretting my late start! One day to go. Side quests within side quests were harder than I anticipated because there's so much context to keep from colliding; I've got stories as a whole, locations, goals, and quest-givers characters, and situations where those change individually or together. (Well, new nested stories are wholly independent, for now.) All this would be easy except for the bug which necessitates I rename them. I admit I could have avoided a lot of debugging time if I stuck to renaming conventions instead of leaving symbols with their original name when I thought it would work.
Anyway, I've got everything I originally imagined; the only nice feature I've left out is generating names and other background details for the locations the hero visits. I even have the thing creating a PDF. At present, though, my longest run got me just sixteen thousand words! And they were a pretty repetitive sixteen thousand. I've got all the nested structure I want but little content. So my last day will be spent expanding the number of possibilities and the average run length.
I realize I'm not breaking any new ground with this project, but here are the tricks I've used since my last update.
The overall shortness of my story output is no longer due to a selection effect. My main source of near-infinite recursion was the nested stories themselves, and the nested storied don't share any information with the story they're nested in, so I've simply replaced recursive story calls with "STORYGOESHERE". I then generate a bunch of stories and cobble them together, filling the holes until I get something complete. (I have a script that tries to piece together the longest complete story it can from the incomplete ones.)
To get around some bugs and tough spots, I'm running Tracery twice. The first run leaves behind some tags that are enclosed in %percent signs% instead of #number signs#. I replace the percent signs with number signs and then do the second run.
Besides that, designing story elements in Tracery has been pretty fun, and I feel like I learned some useful tricks, or design patterns even. I'd certainly like to try a purely grammar-based approach again and put things together more logically. I based a lot of things around "random event" symbols which keep getting called again and again to keep the story going, but I ended up with several separate event lists; the events which can occur any time, the one which happen inside (nested) locations, and the ones which happen during side-quests (which always involve locations). There's not any sharing between these; an "any time" type event doesn't come up during a quest, even though it should be able to. This is partly because one of the "any time" events is the story itself coming to an end, which shouldn't happen during a quest. So, I'm happy with a lot of what I did, but not with the random encounters. Who knows, maybe I'll have time to rearrange them before the month is over. (But I'd be better off just writing more of them.)
Well, I might make some more changes but I have a final product for now.
Oh dear! The version I posted as final had some major problems. The book renamed the hero mid-journey, and seemed to be missing sections. I can't seem to figure out exactly what's wrong so I've replaced the final PDF with a PDF from 24 hours ago. There's a lot of little pieces of story content missing but the overall effect is more what I was aiming for.
A much better, more complete version has been uploaded, including both the pdf and code.
The book renamed the hero mid-journey
https://cloud.githubusercontent.com/assets/2607898/21650553/449c7dd2-d273-11e6-91c7-22b0e80bc6d5.png
(For those reading in the vast and inconsolate future, MichaelPaulukonis linked to an image which reads "honor your mistake as a hidden intention -Brian Eno".)
I was definitely tempted to do that at points.
I think the issue you have encountered is basically that current symbol evaluations are not part of Tracery's stack state (or else the current symbol states are not correctly popped off the stack when a level in the recursion ends).
I might keep improving this a bit, but for now I'm calling it good.
Repository: here PDF: here
Some example text:
Original post below.
The Tracery tutorial concludes with an example where one story is nested into another ad infinitum. I really liked that example, so I played around with it for a while, and then suddenly remembered that NaNoGenMo existed. That was on November 24th. I'm creating this issue now because I realized I want somewhere to post progress reports.
So, I started with GalaxyKate's code (MIT license btw):
What this does is start a bunch of stories, but it only actually puts an ending on one of them. And I immediately ran into a problem when I tried to fix that; I had to rename the symbol "hero" (to "hero2") each time I called a new story, so that I could avoid the symbol being overwritten or even deleted entirely.
With that taken care of, I added little event templates and a second type of recursion: the hero finds themselves travelling through various locations throughout the story, and nested locations within locations. I also want to add in fetch quests within fetch quests, so I've added a goal that the narrative makes reference to.
At this point, though, I seem to be running into a problem with narrative length. In principle, the things I've been doing make the output story longer. But it seems to me that everything I've added since the nested locations has actually made them shorter. How could this be? Basically, as layers of recursion get deeper, it gets less and less likely that a story will end, so that my stories are either 30 to 100 words, or they take off to hundreds of thousands of words. But I never see the long ones, because Tracery crashes before it shows them to me.
They must be really long though, because I've switched over to Node.js and increased the stack size until I start getting segfaults, and I still get basically the same ratio of short ones to long ones. I guess my expected length might be infinite; or it might be incoherent to even talk about expected length, since it could be that given enough resources, the current grammar has a nonzero chance of not halting at all.
So clearly I've gotta reduce the amount of recursion a bit. But for now, here's the longest sample text I could get out of it.