Tea is a free (gratis and libre) story format for Twine and Twee, forked from the widely-used SugarCube 2 engine. It gives interactive fiction authors a powerful macro language, robust state and save management, audio playback, and a JavaScript-based scripting layer — all in a single self-contained format file you can drop into any Twine project.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Add Tea to Twine 2, Tweego, or Twine 1/Twee in minutes
Quickstart
Write your first interactive story with Tea’s macro language
Macro Reference
Browse all 50+ built-in macros for display, control, audio, and more
API Reference
Explore the full JavaScript API for Config, State, Save, and more
Why Tea?
Tea builds on the rock-solid SugarCube 2 foundation and extends it for modern interactive fiction development:- Rich macro language — 50+ built-in macros covering variables, control flow, interactive UI, DOM manipulation, audio, and more
- TwineScript — full JavaScript-based scripting with story variables, temporary variables, and expression support
- State & history — configurable history depth, PRNG support, and per-save metadata
- Comprehensive saves — browser auto-saves, slot saves, disk export/import, and base64 encoded saves
- SimpleAudio — tracks, groups, and playlists for rich soundscapes
- Player settings — toggles, lists, ranges, and custom values surfaced through the built-in settings UI
- Custom macros — extend Tea with your own macros using the
MacroandMacroContextAPIs - Debug tools — interactive debug bar and test mode for rapid iteration
How it works
Tea compiles into a singleformat.js file that Twine uses as a story format. When a reader opens your story, Tea’s engine initializes the story, processes your passages through the wiki/markup parser, and manages the lifecycle of navigation, state, and UI.
Core Language
Learn Tea’s markup syntax and TwineScript expressions
Guides
Deep-dive guides on saving, audio, localization, and custom macros