I’m building a text based, online TUI-RPG in Rust

For the past while, I’ve been diving deep into a passion project: a classic, client-server, text-based RPG that runs entirely in the terminal (a TUI). It’s built in Rust, using QUIC for fast and secure networking.

We’ve just finished implementing a bunch of core features that are really starting to make it feel like a living game, and I wanted to share a recap of what’s under the hood!

Here’s a quick rundown of the features:

  • Fully Data-Driven World: Every single thing—items, NPCs, skills, quests, and even branching conversations—is loaded from simple JSON files. This makes creating new content incredibly fast and opens the door for future modding.

  • Robust FSM-based Dialog System: Conversations aren’t just linear text. The system is a true finite state machine where player choices can trigger:

    • Skill & Attribute Checks: (e.g., [Strength Check: 15] Intimidate the guard.)
    • Transactions: Pay an NPC, bribe a guard, or buy an item directly in dialogue.
    • Branching Narratives: The conversation flows based on the success or failure of your actions.
  • Centralized “Effect Applicator” & System Narrator: This is the architectural core. Any action in the game (eating an apple, choosing a dialog option, equipping a sword) generates a list of “Game Effects.” A single, central system processes these effects, which means:

    • It handles all state changes: Modifying stats, adding/removing items, changing money, equipping gear.
    • It auto-generates clear player feedback. This creates a “System Narrator” that tells you exactly what happened in a clean, consistent format, just like in classic RPGs:
      • You feel more energetic. [+2 Endurance added]
      • Dull Knife [-1 Atk] removed from inventory.
      • 10 coins removed from your purse.
  • Dynamic ASCII/Braille Art Rendering: This is my favorite feature. The game can take any image file (for NPC portraits, area maps, or the world map) and render it as high-quality Braille art directly in the terminal. The world map even supports panning and zooming!

  • Intelligent Client-Side UI:

    • Smart Command Parser: Uses fuzzy matching to correct typos and understands a wide range of aliases (l for look, inv for inventory, etc.).
    • Context-Aware Actions: The use and unequip commands are tied to the UI. You just navigate your inventory with the arrow keys, type use, and the game knows exactly which item you mean.
    • Full Equipment & Stat System: Players can equip/unequip items into specific slots (Weapon, Armor). Stats update in real-time, and equipped items are clearly marked in the UI. Stats like Endurance can even be “overcharged” above their maximum.
  • Live World Ticker: The game world has its own clock. NPCs will eventually move, and timed events (like traveling between locations) are handled with progress bars, making the world feel persistent.

It’s been a massive learning experience, especially getting the client-server architecture right and ensuring the game state is always consistent. The focus has been on building a solid, scalable foundation before piling on tons of content.

TL;DR: Building a multiplayer TUI-RPG in Rust with a data-driven world, a proper FSM dialog system with skill checks, and dynamic maps that are rendered from images as ASCII art in the terminal.

Similar Posts