This package is designed to help you build a text adventure game.
The package based on old “choose your own adventure” games and books. Unlike modern games, this genre gives you some text to read and some options for how to proceed. Your options you chose led you down different paths with different outcomes.
Basically, this package allows you to string together a bunch of “Steps” and then set “Options” that link you between the steps.
Steps are made up of a locator, a camera, and a script. The camera changes the view for the player and the locator (and the script on it) lets you define all the text, the options, and a bunch of other settings. Options are the buttons that appear at the bottom of each step. They represent the choices a player can make. Any step can have any number of options and they should each lead to another step. Below is an image of an example step view.
- Install the Text Adventure Package
- Add the User Text Adventure template to your User template (Entity > Add Child > Script Folder > User Text Adventure)
- Add at least one Text Adventure Step template to your world
- Most likely add a bunch more steps and string them all together
There are 2 configurable parts of this package: the userTextAdventureScript (on the User) and the textAdventureStepScript (on the Text Adventure Step).
On the User template, the userTextAdventureScript has 2 options:
- Start on Init - If true, this script will find a step marked as the first step and automatically show the step when a player joins the game.
- Initial Delay - Only applicable Start on Init is true. This is a delay before switching from the Player Camera to the camera set in the first step.
On each Text Adventure Step, there are properties that define sequence, camera, text, options, and player behavior.
- Step Camera - The camera to show the Player for this step.
- Camera Change Duration - The amount of time to pan between the previous camera and this step’s camera.
- Header Text - A title text for this step. Can be left blank.
- Body Text - An array of strings to use for the main text of the step. Each item in the array will display as a separate paragraph.
- Options Text - An array of strings to use for the buttons that will show at the bottom of the screen.
- Options Destinations - An array of entities. These should be set to other Text Adventure Steps in your world and each of the Options Text items should correspond to an Option Destination. Any unlinked Options Texts will do nothing when pressed.
- Is First Step - Only applicable if the Start on Init property (on the User Text Adventure) is set to true. If so, the userTextAdventureScript will search the world for a step with this property set to true and display it automatically.
- Is Last Step - If true, all options on this step will end the sequence and give the player control of their character again. If you want to implement a “Game Over” without releasing control of the character, you can make the last step direct back to the first one.
- Player is Visible - Sets the player visibility for this step.
- Move Player to Locator - If true, the player will be moved to this step’s main locator after the Camera Change Duration.
- On Step - Events to trigger on this step, after the Camera Change Duration. This can be helpful for triggering animations while a player is looking at a certain step, changing visibility of entities, triggering motion, adjusting lights, etc…
This package also comes with one helper script: the startTextAdventureScript. This is useful if you don’t want to start the sequence automatically when a player joins the game. Instead this script allows you to start the sequence manually, which allows you to have multiple sequences in your game. The startTextAdventureScript has properties to set the First Step and option for how to initiate the sequence – on collision, on interact, or on trigger enter. A practical example might be starting a sequence when a player enters a room (with a trigger) and a difference sequence when they interact with a phone mesh.
I’m working on a proper demo for this package but in the meantime, if you’re interested in the overall concept, here’s a gif of my initial test:
As always, find me on the discord if you have questions or suggestions