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 north
  • n, s, e, w - Direction shortcuts
  • look - Look around

Inventory

  • take sword - Pick up item
  • drop shield - Drop item
  • inventory - View inventory
  • use potion - Use an item

Commands

  • examine sword - Examine object
  • help - Show all commands
  • save 1 - Save to slot 1
  • load 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 engine
  • src/components/games/DorkRPG.tsx - React wrapper