A choose-your-own-adventure game with ELIZA-style NPC conversations, D20 combat, and equipment. Built with React 19 and Vite 8.
npm install
npm run devThe dev server starts at http://localhost:5173/crit-happens/.
| Command | Description |
|---|---|
npm run dev |
Start dev server with HMR |
npm run build |
Production build to dist/ |
npm run preview |
Preview production build |
npm run lint |
Run ESLint |
npm test |
Run tests once |
npm run test:watch |
Run tests in watch mode |
Players explore a village, a dark forest, underground dungeons, and an abandoned mine. Each location has NPCs to talk to, items to buy, and monsters to fight.
NPCs use an ELIZA-style pattern-matching engine. The player types freely and the NPC responds based on keyword rules. Some NPCs sell items (with confirmation), others steal your gold, and insulting certain NPCs triggers combat.
D20-based combat system. Roll a d20 each turn — critical hits on 20, fumbles on 1. Players can attack, flee, or use combat items (holy water, healing potions). Equipment (sword, shield, helmet, armor) affects attack and armor class.
Each NPC is built from 3 merged config layers:
- Generic — shared conversational rules
- Aggressivity — personality tone (friendly or hostile)
- Specific — character-unique topics, shops, and exit conditions
The game supports English and French. Language can be switched at any time via the settings gear (⚙) without losing progress.
Game progress is automatically saved to localStorage and restored on page reload.
CC BY-NC-SA 4.0 — See LICENSE for details.