How to merge stories?

I’m having students write their own games, all stemming from the same opening passage hook. I would like the end-product of the course to be a multifurcating, combined game merging all of their smaller games. I found this entwine repo, but it appears to be poorly documented and I’m wondering if there is another way that is more actively being developed.

Thanks in advance!

You probably want to look at Tweego or Extwee

I mean the docs are right there in the readme. Entwine is actively maintained, it’s even up to date to the latest Twee3 spec. Tweego may be easier for you though.

1 Like

It looks like the last activity for entwine was Dec 31, 2019, so I don’t think my question warranted such a snarky response. It’s also unclear how Tweego or Twee3 could solve my specific problem. Searching the Tweego documentation for “merge” found 0 results.

I don’t think it’ll solve your problem entirely because of your circumstances of wanting to combine multiple standalone projects into a single project. I think there might be some conflicts between files, for example their start passages.

The reason tweego and entwine (everyone just uses tweego) were suggested is that for a normal project, people would ask if they could combine multiple files into one (like chapter 1, chapter 2, etc). The easiest way to do this is to take tweego and convert the Twine HTML file into a twee source file. You can feed as many of those files into the tweego compiler as you want and it’ll merge them into one game.

That works great when you know that there won’t be any conflicts and the files are maintained by yourself. I think it won’t go as well if you’re trying to do it with HTML files from multiple people. It’ll be cumbersome and there might be conflicts. Unfortunately, I don’t know of a better alternative either because Twine/tweego wasn’t really designed with optimizing something like this in mind. It’s a bit of a rare use.

1 Like

Ah, sorry. From your question I thought that entwine did solve your problem, so I assumed you had that part handled and were just looking for a different Twee compiler that was more to your liking.

1 Like

Any compiler should be able to merge multiple source files into one compiled result.

Talking about Tweego here, as I’m the author. There’s no specific “merge” example, since (A) that’s not a common request and (B), as a basic case (possible troubles ahead, more on this later), it’s a simple operation. There are several ways to do this, here is one: Create a directory for the aggregate project and place your core file(s) into that directory, place each of the students projects into a subdirectory with that main directory, and finally compile the main directory.

A possible, perhaps likely, problem here, regardless of compiler, is that unless your students have used passage names that are unique to their projects, there are likely to be conflicts. You’ll have to resolve those conflicts before these projects will all work together as a whole.

1 Like

Thanks very much, Tayruh! I appreciate the details, as I’ve only worked within Twine using the twinery.org interface. I’ll look into using Tweego. I was considering writing a script to prefix each student’s links with a unique identifier (e.g. just iterating from 1…n) to avoid conflicts upon merge. One problem is if they use [[standard link format]], adding a prefix would affect the text, so I guess a first step would be changing them all to piped links and the passage titles they refer to say I could then add the prefix to the titles.

Basically, this seems pretty complicated and I wanted to make sure that somebody with real javascript skills hadn’t already solved this problem. It seems like they haven’t because this is not used very often in a collaborative classroom setting. I think I will put this down as a long term project, as I see a huge promise in students working together to build a complex project that showcases all their different storylines–starting from the same passage.

Thanks for your thoughts and suggestions. I look forward to checking out Tweego! As I mentioned in my response to Tayruh, I’m wondering how hard it would be to add in a preprocessing step that adds unique prefixes to all the links (and referent titles) for each passage. That way, there would be no conflicts during merge.

This is something I might want to work towards in the coming months, if you have any suggested programmatic approaches. (Even just generically how you might do this…not sure if this would be easier changing attributes in the HTML or if Tweego exposes story elements in a more accessible way for this kind of manipulation). Having just started teaching 5th and 6th graders how to write short stories and translate them into games, I can see a great appeal in having a collaborative semester/unit end product that includes all the class’s work as a complex game, starting from the same initial “hook” passage.

No worries. I hadn’t heard of Tweego, so this is all new, interesting territory for me. Thanks!

You said it was poorly documented, I was just pointing out that it did in fact have documentation, as I assumed you somehow missed it. Wasn’t intended to be snarky. Something doesn’t have to be constantly updated to be maintained, Entwine has still been updated more recently than the Twine 2 app I believe. And Entwine doesn’t need much in the way of frequent maintenance and it definitely hasn’t been abandoned.

Most people do use Tweego, and I think it’s probably the better bet overall, but if you wanted to use Entwine there’s no particular reason you can’t.

Sorry for sounding “snarky.”

1 Like

Thanks for clarifying, and no worries. Brevity and anonymity can lead to misunderstandings. I also didn’t mean to suggest that Entwine was not up-to-date, it’s just hard to assess what projects are being actively utilized and updated as an outsider. (I’m pretty new to the Twine ecosystem). I was really just seeking information about whether current solutions already exist to solve my problem of merging stories created by multiple student authors. I can see this is not a common use case at present, but I think there is huge promise in using this as a collaborative teaching tool, so I will try to find a way to achieve it. Definitely going to check out Tweego. Cheers.

Yeah, I don’t think you’ll find anything that does what you want. Things like twine-utils, Tweego, Extwee don’t look at the contents of the passages (mostly), they just let you put passages for a single story in multiple files and then stuff them all into a single HTML file.

It wouldn’t be too hard to parse the basic Twine link formats ([[passage name]], [[link text|passage name]] etc.) and prefix the passage names somehow, but beyond that…all the story formats have ways to programmatically create links, so in the general case it’s probably not practical.

Both Tweego (written in the Go language) and Extwee (JavaScript) can translate both ways between HTML and Twee-format text files, so if you’re comfortable with one of those languages you could possibly use their source as a starting point?

Or if not, there’s a set of Twine specifications available that describes the Twine HTML format and the Twee text format (as well as how story formats work). So you could just code it from scratch: it’s not that complicated.

Off the top of my head I can’t remember seeing any exceptionally readable code to parse Twine links, though both the Twine editor and any story format would have code for it…

1 Like

Hi Josh,

Thanks for the background! The link to the Twine specifications is helpful! I’m basically a n00b with JS, but I’ll see if I can cobble together a solution.

Thanks for the leads.