Home - ByteSower/qnce-engine GitHub Wiki
Notice (Feb 2026): The QNCE Engine is currently undergoing major reconstruction. Many features, including narrative rules and story flow, may not behave as expected. The engine is transitioning toward broader quantum modeling principles and improved performance. If you require stability, consider waiting for a future release. See GitHub and npm for updates.
Quantum Narrative Convergence Engine - Framework-agnostic interactive storytelling with quantum-inspired mechanics
The Quantum Narrative Convergence Engine (QNCE) is a powerful TypeScript library that enables developers to create sophisticated interactive narrative experiences. Drawing inspiration from quantum mechanics, QNCE provides unique storytelling capabilities through superposition, collapse, and entanglement mechanics.
- Multi-path narratives with conditional logic and flag-based branching
- AI-driven content generation for dynamic story expansion
- Real-time branch insertion/removal for live content updates
- Dynamic branch evaluation with custom condition evaluators
- Object Pooling: 90%+ allocation reduction
- Background Processing: Non-blocking cache preloading
- Hot-Reload: Sub-3.5ms live story updates
- Real-time Profiling: Comprehensive performance analysis
- Framework-agnostic - Works with React, Vue, Node.js, vanilla JS
- TypeScript-first with comprehensive type definitions
- Modular architecture allowing selective feature imports
- CLI tools for project scaffolding and performance monitoring
- Full state persistence with compression and validation
- Automatic save/restore with configurable intervals
- Checkpoint system for implementing undo/redo functionality
- Cross-session persistence with localStorage and custom storage adapters
-
React integration with
useQNCEhook for reactive state management - Pre-built components - UndoRedoControls, AutosaveIndicator
- Keyboard shortcuts for common actions and accessibility
- Customizable theming and responsive design support
| Concept | Description | Example |
|---|---|---|
| Superposition | Multiple narrative outcomes exist simultaneously | Player facing multiple potential story paths |
| Collapse | Choices "collapse" the narrative to a specific path | Making a decision that locks in story direction |
| Entanglement | Early decisions affect later outcomes | A kindness in chapter 1 affecting chapter 5 |
# Install QNCE Engine
npm install qnce-engine
# Create a new project
npx qnce-init my-story
# Run performance monitoring
npx qnce-perf --watchimport { createQNCEEngine, DEMO_STORY } from 'qnce-engine';
// Create engine instance
const engine = createQNCEEngine(DEMO_STORY);
// Get current narrative state
console.log(engine.getCurrentNode().text);
// Display available choices
const choices = engine.getAvailableChoices();
choices.forEach((choice, i) => {
console.log(`${i + 1}. ${choice.text}`);
});
// Make a choice and advance the story
engine.makeChoice(0);| Page | Description | Quick Link |
|---|---|---|
| Getting Started | Installation, basic usage, first steps | 🏁 Start here! |
| Branching Guide | Advanced branching system and AI integration | 🌿 Power features |
| Performance Tuning | Optimization, monitoring, and profiling | ⚡ Speed it up |
| CLI Usage | Command-line tools and automation | 🛠️ Developer tools |
| API Reference | Complete API documentation | 📖 Technical specs |
| Persistence Adapters | How to save/load engine state across backends | 💾 Persistence |
| Contributing | How to contribute to the project | 🤝 Join us! |
| Release Notes | Version history and migration guides | 📋 What's new |
Create branching narratives with complex storylines and character development.
Power RPG dialogue systems, quest lines, and story-driven gameplay.
Build interactive learning experiences with adaptive pathways.
Create guided user experiences, onboarding flows, and decision trees.
| Metric | Target | Current | Status |
|---|---|---|---|
| State Transitions | ≤5ms | ~3ms | ✅ Exceeds |
| Flow Switches | ≤20ms | ~12ms | ✅ Exceeds |
| Hot-reload Updates | <2ms | ~1.8ms | ✅ Meets |
| Memory Usage | ≤50MB | ~35MB | ✅ Exceeds |
| Cache Hit Rate | ≥95% | ~98% | ✅ Exceeds |
QNCE Engine works seamlessly with popular frameworks:
| Framework | Support Level | Integration Guide |
|---|---|---|
| React | ✅ Full | React Integration |
| Vue 3 | ✅ Full | Vue Integration |
| Node.js | ✅ Full | Server Integration |
| Vanilla JS | ✅ Full | Vanilla JS Guide |
| TypeScript | ✅ Native | TypeScript Examples |
-
NPM Package - Install via
npm install qnce-engine - GitHub Repository - Source code and issues
- Release Page - Download releases
- Examples Directory - Working code examples
- Performance Guide - Optimization strategies
- Contributing Guidelines - How to contribute
- GitHub Discussions - Ask questions and share ideas
- GitHub Issues - Report bugs and request features
- Visual story editor with drag-and-drop interface
- Advanced AI integration with GPT and Claude support
- Multiplayer narratives with real-time synchronization
- Visual novel renderer for rich media stories
QNCE Engine is released under the MIT License.
Ready to build your next interactive narrative?
Get Started → | View Examples → | Join Community →
Built with ❤️ by the QNCE development team
You are here: Home
Next: Getting Started →
All Pages: Getting Started • Branching Guide • Performance Tuning • CLI Usage • API Reference • Persistence Adapters • Contributing • Release Notes
This documentation is maintained for QNCE Engine v1.3.0 with advanced feature set including Choice Validation, State Persistence, Conditional Choices, Autosave & Undo/Redo, and UI Components.