NOTE these instructions are out of date, new ones to follow.
Theyr provides a development environment that allows anyone to create multiplayer Twine applications using the SugarCube story format.
Note: This project is still actively being developed. If any features are buggy feel free to let us know!Theyr was created in response to a Stony Brook University professor's need for a real-time updating multiplayer Twine game. Standalone Twine only provides support for single player stories, but through the SugarCube story format, JavaScript, and Socket.IO, multiplayer Twine becomes possible. This project utilizes Lando, which sets up your development environment instantly so that you don't have to manually install all of the dependencies yourself. This includes linking the application to your Heroku account, so once you've written your Twine story, all you have to do is follow the instructions below to deploy the application to Heroku and make your game available to play over the web!
If you're familiar with SugarCube, you'll know that the variables for a Twine story are stored within the SugarCube State. In order to provide a multiplayer experience, Theyr uses sockets to ensure that each player's SugarCube State is synchronized with every other player in the game. This happens in realtime, so when one player does something that changes the state of the game, a socket event is sent to all of the other clients to reflect these new changes.
That's it! You don't need to do anything extra to your Twine- the multiplayer features will come automatically from Theyr.
-
Install Lando at https://lando.dev/download/
-
Create a MongoDB Atlas account and follow this tutorial to create a cluster for your application: https://www.freecodecamp.org/news/get-started-with-mongodb-atlas/
-
Create a Heroku account at https://id.heroku.com/login
-
Install Twine at https://twinery.org/ and create your own story
- Clone this repository:
git clone https://github.com/timothyhsu8/THEIR-multiplayer-twine.git
- Go into the 'THEIR-multiplayer-twine' directory and run Lando to install all of the necessary dependencies:
lando start
After 'lando start' has completed, some green links will appear in your console. You can click on 'lando-heroku-sockets.lndo.site' to see your Twine story.
- Replace the CONNECTION_URL in server.js with the MongoDB Atlas URI obtained from the tutorial
const CONNECTION_URL = 'YOUR_MONGO_URI_HERE'
- Open MultiplayerTemplate.html in Twine and use it to create your story.
- Log in to your Heroku account:
lando heroku auth:login
- Create a new Heroku project with a Node buildpack:
lando heroku apps:create app-name-here --buildpack heroku/nodejs
- Initialize a git repository and set your Heroku application as a remote:
git init
git add -A
git commit -m "Initial commit."
git remote add heroku https://git.heroku.com/app-name-here.git
- Deploy to Heroku
git push heroku master
