Getting Started
Welcome to Encounters! This guide will help you create your first interactive messaging-based story.
What is Encounters?
Encounters is a platform for creating immersive, interactive stories that unfold through realistic messaging conversations. Players receive messages from characters, make choices, and influence the narrative in real-time.
Prerequisites
Before you begin, make sure you have:
- Node.js (v16 or higher) installed - Download here
- A code editor - We recommend Visual Studio Code (free)
- Basic understanding of JSON
- Familiarity with narrative writing
- (Optional) Knowledge of the Ink scripting language
Recommended Setup
Visual Studio Code with the Ink extension provides:
- Syntax highlighting for
.inkfiles - Auto-completion
- Error detection while you write
- Easy file navigation
To install:
- Download VS Code
- Open VS Code
- Click the Extensions icon (or press
Ctrl+Shift+X/Cmd+Shift+X) - Search for "Ink" by inkle
- Click Install
Quick Start
1. Create Your Project from Template
The easiest way to start is by using the GitHub template:
- Go to the Encounters Story Example Repository
- Click the green "Use this template" button (top right)
- Click "Create a new repository"
- Give your repository a name (e.g.,
my-encounters-story) - Choose if you want it public or private
- Click "Create repository"
Now clone your new repository to your computer:
git clone https://github.com/YOUR-USERNAME/your-repository-name.git
cd your-repository-name(Replace YOUR-USERNAME and your-repository-name with your actual GitHub username and repository name)
2. Configure npm for GitHub Packages
Before installing dependencies, you need to set up authentication for GitHub Packages. Create a .npmrc file in your project root:
touch .npmrcOpen .npmrc in a text editor and add the following:
@andy3471:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR AUTH TOKENReplace YOUR AUTH TOKEN with your GitHub Personal Access Token (PAT). You can create a PAT at https://github.com/settings/tokens. Make sure it has the read:packages permission.
Security Note
Never commit your .npmrc file with your actual token to Git! The .npmrc file should be in your .gitignore. Consider using environment variables or npm config commands instead if you're working in a team.
3. Install Dependencies
npm install4. Explore the Project Structure
Your project should look like this:
encounters-story-example/
├── src/
│ ├── assets/ # Images and media files
│ ├── contacts/ # Contact definitions (JSON)
│ ├── conversations/ # Conversation configurations (JSON)
│ └── ink/ # Ink script files (.ink)
├── scripts/
│ ├── build-story.cjs # Build script
│ └── publish-story.cjs # Publish script
├── .env.example # Environment variables template
└── package.json5. Build Your Story
Compile your Ink scripts and package your story:
npm run build:storyThis will:
- Compile all
.inkfiles to JSON - Copy assets to the build directory
- Generate a manifest
- Create a
dist/story-build.zipfile
6. Test Your Story Locally (Optional)
You can run your story in a browser for local testing:
npm run run:storyThis will:
- Start a local development server
- Open your story in your browser at
https://localhost:3000 - Automatically deploy changes when you save files
- Allow you to test your story interactively
Testing Workflow
- Edit your story files (
src/ink/*.ink,src/contacts/*.json, etc.) - Save your changes
- Refresh your browser or restart the story to see updates
- Test the conversation flow and player choices
- When satisfied, build and publish with
npm run build:storyandnpm run publish:story
::: note Restart Required After making changes to your story, you'll need to restart the story in the browser to see updates. The changes are deployed automatically, but the story session needs to be restarted. :::
7. Configure Publishing (Optional)
To publish your story to the Encounters server, you'll need to set up your credentials.
Step 1: Create Your Story
- Go to the Stories Management Page
- Click "Create New Story" or similar button
- Fill in your story details (name, description, etc.)
- After creation, copy the UUID from the URL in your browser's address bar
- Example:
https://encounters.andyh.app/authors/test/stories/abc123-def456-... - The UUID is the long string of letters and numbers at the end
- This is your
STORY_ID
- Example:
Step 2: Get Your API Key
- Go to the Manage Passport Tokens Page
- Create a new API token (or use an existing one)
- Copy the API key - you won't be able to see it again!
- This is your
API_KEY
Step 3: Configure Your Environment
In your project folder, copy
.env.exampleto.env:bashcp .env.example .envOpen
.envin a text editor and fill in your details:envBASE_URL=https://encounters.andyh.app STORY_ID=your-uuid-from-step-1 API_KEY=your-api-key-from-step-2Save the file
Step 4: Publish Your Story
Now you can publish:
npm run publish:storyFor Non-Technical Users
Don't worry if this seems complicated! Here's the simple version:
- Create your story on the website and copy the ID from the URL
- Get an API key from the tokens page
- Put both into the
.envfile - Run the publish command
Understanding the Template Story
The template includes "The Missing Friend" - a mystery story where the player helps find a missing person named Sarah. This serves as a complete working example you can learn from and modify.
Key Components
Contacts (src/contacts/*.json):
- Character profiles with names, avatars, and phone numbers
Conversations (src/conversations/*.json):
- Conversation configurations linking contacts to Ink scripts
- Defines conversation types (individual or group)
Ink Scripts (src/ink/*.ink):
- The actual narrative content and branching logic
- Player choices and character responses
Assets (src/assets/):
- Character avatars and images used in the story
Next Steps
Now that you have the basics:
- Understand the Project Structure - Learn about each file and folder
- Learn Ink Scripting - Master the narrative scripting language
- Build and Publish - Deploy your story to production
Tips for Beginners
Start Small
Begin with a simple conversation between two characters before creating complex branching narratives.
Test Frequently
Build and test your story often to catch errors early. The build script will show compilation errors.
Study the Example
The example story demonstrates many features - read through the Ink files to see how they work.
Getting Help
- Check the Ink documentation
- Review the example project files
- Look at the API reference for advanced features