How I Built a Chat Simulation in 2 Hours

Using Twine and the Trialogue story format, you can build a simple chat simulation in a few hours. I built the sample below in a little less than 2 hours, almost all of which was actually writing the conversation and choices. The story format controls all of the formatting and technical features. Try it yourself to get an idea of what’s possible.

Screenshot of a chat simulation with a customer service conversation. Select the image to try the simulation.

Forced choices, not a true chatbot

If you try the simulation, you’ll see that this isn’t a true chatbot. In a real chatbot, you would type open-ended responses, which would be analyzed by AI. That’s a different level of complexity than this. Instead of programming a true chatbot, this is a chat simulation. Users make choices from a few options. It’s sort of a chatbot, but much easier to build.

Screenshot of forced choices in the chat simulation

Branching scenario structure

Because users make forced choices, this chat is a branching scenario. I have written before about how to use Twine to create a branching structure like this. In total, this scenario has 50 passages in Twine. That took almost 90 minutes to write.

Branching structure of a chat simulation in Twine

This is just a sample so I could see what was possible in a chat simulation, rather than a real project with a client. That means I didn’t have the usual upfront analysis with a SME or planning the scenario I usually do. Some of the choices may not be quite realistic, which I decided was fine for this proof of concept.

Trialogue format

The heavy lifting of making this look like a chat is done via the Trialogue story format. That page includes instructions for installing and using the format. The big difference is that you need to tag each passage with “speaker-NAME.” In this simulation, I tagged most passages “speaker-Anna” (with a few for “speaker-Chat-Info” and the manager, Tom). The choices automatically appear with the name “You.”

Screenshot of a Twine passage with the tag "speaker-Anna"

Updated version

I revisited this chat simulation and made some improvements to the styling. Check out the updated version of this chatbot simulation.

Your ideas?

Now that you have seen it in action, what ideas do you have for using a chat simulation like this? How could you use this in your own work?