Dork RPG
A text-based adventure game built in Rust and compiled to WebAssembly. Explore dungeons, fight monsters, collect items, and complete quests!
How to Play
Movement
go north- Move northn, s, e, w- Direction shortcutslook- Look around
Inventory
take sword- Pick up itemdrop shield- Drop iteminventory- View inventoryuse potion- Use an item
Commands
examine sword- Examine objecthelp- Show all commandssave 1- Save to slot 1load 1- Load from slot 1
Tips
- ↑↓ arrows - Command history
- Take items from the armory
- Use potions to heal
- Explore all rooms!
Loading Dork RPG...
About This Game
Dork RPG is a complete text-based adventure game written in Rust and compiled to WebAssembly for near-native performance in the browser.
Technical Highlights
- 247KB total bundle (231KB WASM + 17KB JS)
- Zero runtime dependencies - Pure Rust/WASM
- 33 unit tests with 95%+ code coverage
- <1ms per turn - Instant command processing
- LocalStorage saves - Persist your progress
- Type-safe architecture - Rust's enum-based command system
Implementation
The game engine is built with a clean separation of concerns:
- GameState - World state, player data, entities
- Command System - Parse and execute player commands
- WASM Bindings - JavaScript ↔ Rust interface
- Terminal UI - TypeScript-based text interface
All game logic runs in WebAssembly for maximum performance. The terminal UI is a custom TypeScript implementation with command history, save/load, and real-time stats.
Features
- Procedurally connected rooms with unique descriptions
- Item system with weapons, armor, and consumables
- Turn-based gameplay with stat tracking
- Save/load system with multiple save slots
- Command history (↑↓ arrows)
- Real-time health and stats display
Source Code
Check out the implementation in the GitHub repository:
simulations/dork/src/- Rust game enginesrc/components/games/DorkRPG.tsx- React wrapper