Files
storybook/docs/tutorial/01-welcome.md
Sienna Meridian Satterwhite 16deb5d237 release: Storybook v0.2.0 - Major syntax and features update
BREAKING CHANGES:
- Relationship syntax now requires blocks for all participants
- Removed self/other perspective blocks from relationships
- Replaced 'guard' keyword with 'if' for behavior tree decorators

Language Features:
- Add tree-sitter grammar with improved if/condition disambiguation
- Add comprehensive tutorial and reference documentation
- Add SBIR v0.2.0 binary format specification
- Add resource linking system for behaviors and schedules
- Add year-long schedule patterns (day, season, recurrence)
- Add behavior tree enhancements (named nodes, decorators)

Documentation:
- Complete tutorial series (9 chapters) with baker family examples
- Complete reference documentation for all language features
- SBIR v0.2.0 specification with binary format details
- Added locations and institutions documentation

Examples:
- Convert all examples to baker family scenario
- Add comprehensive working examples

Tooling:
- Zed extension with LSP integration
- Tree-sitter grammar for syntax highlighting
- Build scripts and development tools

Version Updates:
- Main package: 0.1.0 → 0.2.0
- Tree-sitter grammar: 0.1.0 → 0.2.0
- Zed extension: 0.1.0 → 0.2.0
- Storybook editor: 0.1.0 → 0.2.0
2026-02-13 21:52:03 +00:00

135 lines
4.2 KiB
Markdown

# Welcome to Storybook
> **Bring characters to life with code that reads like stories.**
Welcome! This tutorial will guide you through the Storybook language step by step. By the end, you will be able to create rich characters, define complex behaviors, build relationships, and model entire narrative worlds.
## What You Will Learn
In this tutorial, we follow Martha and her bakery family, using their daily lives to learn each concept:
1. **Creating Characters** - Define Martha with traits and descriptions
2. **Your First Behavior Tree** - Give characters decision-making abilities
3. **Making Characters Act** - Actions, conditions, and decorators
4. **Advanced Behaviors** - Subtrees, parameters, and complex patterns
5. **Character Relationships** - Model how characters interact
6. **Schedules and Time** - Give characters daily routines
7. **Life Arcs** - Track character development over time
## What is Storybook?
Storybook is a domain-specific language (DSL) for narrative simulation. It lets you describe:
- **Who** characters are (traits, backstory, species)
- **What** they do (behavior trees with decision logic)
- **How** they relate to others (relationships with perspectives)
- **When** they act (schedules and time-based routines)
- **How they change** (life arcs and state machines)
All of this in syntax designed to be readable and expressive.
## Your First Storybook File
Create a file called `hello.sb` and add this:
```storybook
character Martha {
age: 34
skill_level: 0.95
---description
A master baker who runs the most popular bakery in town,
known for her sourdough bread and apple pastries.
---
}
```
That is it. You have defined a character with two numeric fields and a prose description block. Let us break it down:
- `character Martha` declares a new character named Martha
- `{ ... }` contains her attributes
- `age: 34` is an integer field
- `skill_level: 0.95` is a floating-point field (0.0 to 1.0)
- `---description ... ---` is a prose block for narrative text
## Key Concepts
### Everything is a Declaration
Storybook files contain **declarations** -- named definitions of things in your world:
```storybook
character Martha { ... } // A person or creature
behavior BakeRoutine { ... } // Decision-making logic
relationship Family { ... } // A connection between entities
schedule DailyRoutine { ... } // Time-based activities
life_arc Career { ... } // How someone changes over time
```
### Fields Hold Data
Fields use a simple `name: value` format:
```storybook
age: 34 // Integer
skill_level: 0.95 // Float
name: "Martha Baker" // String
is_open: true // Boolean
wake_time: 04:30 // Time
bake_duration: 45m // Duration
```
### Prose Blocks Tell Stories
Prose blocks embed narrative text directly in your definitions:
```storybook
---backstory
Martha learned to bake from her grandmother, starting at age
twelve with simple bread recipes. Over the years she mastered
sourdough, pastries, and specialty cakes, eventually opening
her own bakery.
---
```
You can have multiple prose blocks with different tags (`backstory`, `appearance`, `personality`, etc.) in a single declaration.
## Project Structure
A typical Storybook project organizes files into directories:
```
my-world/
schema/
core_enums.sb // Enum definitions (skill levels, moods, etc.)
templates.sb // Reusable trait sets
beings.sb // Species definitions
world/
characters/
martha.sb // Character definitions
jane.sb
behaviors/
baking.sb // Behavior trees
relationships/
family.sb // Relationship definitions
```
Files reference each other using `use` statements:
```storybook
use schema::core_enums::SkillLevel;
use schema::beings::Human;
character Martha: Human {
skill_level: expert
}
```
## Next Steps
Ready to create your first character? Head to [Creating Characters](./02-creating-characters.md) to start building Martha in detail.
---
**Tip**: You do not need to memorize everything now. This tutorial builds concepts gradually, and you can always refer back to the [Reference Guide](../reference/09-overview.md) for precise syntax details.