/demo-extension

A demo extension to try out developing extensions for TwilioQuest

Primary LanguageJavaScriptMIT LicenseMIT

TwilioQuest Extension Template

Interested in creating an extension for TwilioQuest? You've come to the right place! Using this repository as a template, you can create new levels, objectives, characters, and items in TwilioQuest.

Getting Started

TwilioQuest Extensions enable developers to create new content for TwilioQuest, and allow players to experience community-created content. If you are interested in either using or creating TwilioQuest extensions, the first step is to enable extensions in the TQ game client.

NOTE: TwilioQuest Extensions are only available in the 3.2 version of the game. As of spring 2021, the current stable version of the game is 3.1.x. You may need to use the launcher to select the "3.2 Preview" release channel to use a version of the game that supports extensions.

Launcher for 3.2

Enabling extensions

In the Settings UI (press the 3 key in-game), navigate to the Extensions submenu. Click the button there labeled Enable Extensions.

Enable Extensions in the Settings UI

IMPORTANT NOTE: As indicated in the UI, make sure to only use extensions from trusted sources. Like "mods" from other games you may have played before (Minecraft, Skyrim, etc.), a TwilioQuest extension will be able to execute code on your computer. Exercise caution when installing an extension, just as you would using any third-party code on your computer.

Once you have enabled extensions, specify a folder on your computer where you will download and manage extensions. This should be the full path to an empty folder on your computer (you should create such a folder first, if you haven't already).

Specify a folder path for extensions

Once you have enabled extensions, you should see a listing of automatically-installed "base extensions", and a list of any extensions you have installed yourself. Now you are ready to create your own extension!

Creating an Extension

To create your own content for TwilioQuest, you will need to create an extension project. For that purpose, we recommend using this repository as a template, and creating your own copy of it to host on GitHub.

To create your own copy of this repository, click the green "Use This Template" button on the top right of the repository home page.

Use this extension template

Follow the prompts to create your own project based on our template repo.

Working on your extension locally

When you've created your own copy of this template repo, clone your new repository into the extensions folder you specified in the game client (see "Getting Started" above).

cd /path/to/extensions/folder
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name

Creating a TwilioQuest extension will require that you have Node.js and npm installed. Once you have installed Node.js, you can install the template extension's dependencies with:

npm install

After cloning your extension in the extensions folder, you should be able to see it in the Extensions submenu under Settings in the game client.

Extension template is loaded

The template extension has a simple VR training level created for you to reference and start hacking on. Interact with the VR Training computer aboard the Fog Owl to load up this sample mission!

VR training sim mission

Extension development topics

Level configuation.json file options

Configuration properties for your level are editable in levels/<level_name>.json. Here is a breakdown of all the components of <level_name>.json:

  • title (String): displayed title for the level (used in Mission Computer)
  • description (String): text description of the level (used in Mission Computer)
  • is_mission (Boolean): Set to true if this level should appear in the Mission Computer
  • prereqs (Array<String>): A list of objectives from other missions that must be completed before this mission is playable. Each string in this list contains a mission folder name concatenated with an objective folder name. Example: ["basic_training.basic3", "basic_training.basic4"] - this means that in order to play this mission, you need to complete the objectives in basic3 and basic4 in the basic_training mission.
  • flavorTextOverrides (Object<String>): set flavor text overrides for this level. If an in Tiled TileObject has the corresponding flavorText property string as a key in this object, the HTML text specified here will override the interaction text pop up.
  • backgroundMusic (String): the key of the background music track to play for this mission. It should be the basename of a track found in public/levels/common/music.
  • backgroundEffect (Object): specify the background effect of this level that will be shown behind transparent tiles left open in Tiled.
    • key (String): the name of the effect to be used. e.g. "starfield" or "vr"
    • options (Object): some effects have options that allow them to be customized
Background Effects
  • key: starfield

    options:

    option type values default notes
    ySpeed Array[Numbers] <[ConstantSpeed] | [MinSpeed, MaxSpeed]> [4, 8] An array specifying the min and max y speed of the stars in the field. If only one value is provided, all stars are the same speed
    rotationSpeed Number (-Infinity, Infinity) 0 Speed of starfield rotation in radians per frame. Small numbers are appropriate (e.g. 0.0001)!
    starCount Number (0, Infinity) 400 Quantity of stars in the field. Increasing this number will increase the visual density of the stars on screen.
  • key: vr

Example Gists

Objective Validator.js Examples

UNDER CONSTRUCTION

During the early development phase of our content authoring tools, our documentation won't be as robust as it could (and will) be. Until then, we encourage you to install this template extension and explore the features that it adds to the game. Over time, we will update the template repo with more documentation on topics such as the following.

  • Extension architecture overview
  • package.json and extension global configuration
  • Creating new levels & level configuration
  • Editing maps and working with Tiled
  • In-game entities and objects
  • NPCs and conversations
  • Creating objectives and validators
  • Scripting and event handling
  • Managing game world state
  • Adding custom tile maps
  • Music and sound effects
  • Distributing your extension to players

<< TO TABLE OF CONTENTS


Extension Development Help

The TwilioQuest extension authoring tools are under active development, and we welcome your feedback! Join us on Discord in the #extension-dev channel.

<< TO TABLE OF CONTENTS

License

This template is open source under the MIT license.