python mudlib using telnetlib3
Find a file
Jared Miller 0f7404cb12
Fix prefix matching for combat move variants
The variant handler now supports prefix matching for directional variants.
This allows 'pa hi' to match 'parry high', 'pa lo' to match 'parry low', etc.

Implementation:
- First tries exact match on variant key
- Falls back to prefix matching if no exact match
- Returns unique match if exactly one variant starts with the prefix
- Shows disambiguation message if multiple variants match
- Shows error with valid options if no variants match

Tests cover exact match, prefix match, ambiguous prefix, no match,
single-char prefix, case-insensitivity, and preservation of target args.
2026-02-08 14:41:40 -05:00
.claude Restructure combat moves: single-word commands with variant args 2026-02-08 00:20:52 -05:00
content Add descriptions to all combat move TOMLs 2026-02-08 14:32:51 -05:00
docs Add dbzfe notes 2026-02-08 10:45:25 -05:00
scripts Add a map renderer 2026-02-07 13:38:32 -05:00
src/mudlib Fix prefix matching for combat move variants 2026-02-08 14:41:40 -05:00
tests Fix prefix matching for combat move variants 2026-02-08 14:41:40 -05:00
worlds/earth Add seed-based terrain world with movement and viewport 2026-02-07 13:27:44 -05:00
.gitignore Add fast and parallel testing 2026-02-07 22:03:00 -05:00
demo_terrain.py Add seed-based terrain world with movement and viewport 2026-02-07 13:27:44 -05:00
DREAMBOOK.md Add a dreambook 2026-02-07 12:19:49 -05:00
justfile Simplify test recipe 2026-02-07 22:49:01 -05:00
mud.tin Restructure combat moves: single-word commands with variant args 2026-02-08 00:20:52 -05:00
pyproject.toml Wire client capabilities into Player & terrain 2026-02-07 22:44:45 -05:00
README.md Add a simple README 2026-02-07 15:42:07 -05:00
uv.lock Wire client capabilities into Player & terrain 2026-02-07 22:44:45 -05:00

mudlib

A telnet MUD engine. No client needed — just telnet and you're in.

Built on telnetlib3, Python 3.12+, managed with uv.

Quickstart

uv sync
just run

Then connect: telnet localhost 6789

Commands

just check   # lint + typecheck + test
just run     # start the server
just debug   # start with debug logging
just render  # generate world map HTML

What's in here

  • src/mudlib/ — the engine (commands, world, combat, rendering, storage)
  • tests/ — pytest tests
  • worlds/ — world definitions (yaml/toml)
  • docs/ — internal knowledge base
  • DREAMBOOK.md — vision and wild ideas

How it works

The world is a toroidal 2D grid of terrain tiles, not discrete rooms. Players see a viewport centered on their position. Terrain types have mechanics — shallow water slows you, mountains block you, forests hide you.

Combat is timing-based with telegraphed moves and cooldown management, not turn-based.

The server runs a tick-based async game loop alongside the telnet server. SQLite handles persistence. Session mode stacks filter what reaches the player depending on context (exploring, fighting, composing, solving puzzles).