Chord: A Declarative Approach to Browser-Based Interactive Fiction
... (markdown formatted)
When Less Code Means More Possibility: Meet Chord
The interactive fiction landscape has a new player worth watching. Chord, a declarative pseudo-code styled modeling language, just hit version 1.0—and it brings a philosophy that might surprise you.
Rather than adding another programming language to the mix, Chord takes a fundamentally different approach: it's designed as a modeling language. No if-then-else blocks. No boolean flags. Just pure, readable declarations that compile down to intermediate representation and deploy directly to browser-based applications.
The Philosophy: Find the Meaning, Build the Model
What makes Chord interesting isn't just its technical implementation—it's the mindset shift it asks of authors. Instead of hacking together game logic with conditional statements, you're challenged to find the correct domain meaning and implement its parts accordingly.
This is a refreshing perspective in an era where we often duct-tape solutions together and call it "shipped." Chord demands clarity before code.
Technical Foundation
Under the hood, Chord maintains compatibility with the Sharpee ecosystem. It shares the same feature set as the Sharpee TypeScript API while adding its own wrinkles. Every piece of text lives within definitions or phrases, with phrases organized into named phrasebooks that use predicates to determine when they apply to the game world.
The output story can exist as a single .story file or leverage .chord imports for modular organization (though interestingly, .chord files cannot import other .chord files—a deliberate constraint for simplicity).
Web-Ready Out of the Box
Here's where Chord shines for modern developers: deployment is framework-less. The compiled output runs as a standard web application without dependencies on specific frameworks or runtime environments. Authors can replace the index.html template and inject custom components, provided they honor the contract for named styles and required elements like the command line interface.
The team has even built a live sandbox/playground where you can experiment with Chord in real-time. If you've ever been curious about interactive fiction authoring but intimidated by the technical barrier, this makes exploration frictionless.
A Glimpse at the Future
The inclusion of GenAI-generated sample stories hints at where this space is heading. When authoring tools can assist with boilerplate and authors can focus on narrative design rather than implementation details, we might see a renaissance in browser-based interactive fiction.
Chord won't be for everyone—and that's by design. Its constraints are features, not limitations. For developers tired of over-engineered solutions and authors seeking a cleaner mental model, it offers a compelling alternative.
If you're building anything that involves complex state and narrative branching, spending an afternoon with Chord might just change how you think about modeling problems. Sometimes the best tools are the ones that constrain you into clarity.
Read in other languages: