python mudlib using telnetlib3
Find a file
Jared Miller 8a5ef7b1f6
Implement V5+ opcodes: aread, save_undo, shifts, scan_table, and more
Implements the opcode set needed for Lost Pig (V8):
- op_aread: V5+ input with text at byte 2, char count at byte 1,
  stores terminating character
- op_save_undo/op_restore_undo: stub returning -1/0 (undo not yet
  available, game continues without it)
- op_log_shift/op_art_shift: logical and arithmetic bit shifts
- op_scan_table: table search with configurable entry size and
  word/byte comparison
- op_tokenize: re-tokenize text buffer against dictionary
- op_copy_table: memory copy/zero with forward/backward support
- op_set_font: returns 1 for font 1, 0 for others
- op_print_unicode/op_check_unicode: basic Unicode output support

Lost Pig now runs to completion: 101K steps, 61 unique opcodes,
3 full input cycles with room descriptions rendering correctly.
2026-02-10 13:51:28 -05:00
.claude Re-copy fixed repos/zvm source into src/mudlib/zmachine 2026-02-09 20:44:21 -05:00
content Add mob templates, registry, and spawn/despawn/query 2026-02-09 11:54:29 -05:00
docs Update if-journey.rst with save/restore bug fix details 2026-02-10 13:15:16 -05:00
scripts Add z-machine save file inspection script 2026-02-10 11:51:55 -05:00
src/mudlib Implement V5+ opcodes: aread, save_undo, shifts, scan_table, and more 2026-02-10 13:51:28 -05:00
tests Relax version gates to accept V8 story files 2026-02-10 13:37:22 -05:00
worlds/earth Add seed-based terrain world with movement and viewport 2026-02-07 13:27:44 -05:00
.dockerignore Add a docker container solution 2026-02-09 12:34:56 -05:00
.gitignore Re-copy fixed repos/zvm source into src/mudlib/zmachine 2026-02-09 20:44:21 -05:00
compose.yml Add a docker container solution 2026-02-09 12:34:56 -05:00
demo_terrain.py Add seed-based terrain world with movement and viewport 2026-02-07 13:27:44 -05:00
Dockerfile Add a docker container solution 2026-02-09 12:34:56 -05:00
DREAMBOOK.md Add a dreambook 2026-02-07 12:19:49 -05:00
justfile Strip dfrotz prompt even without preceding newline 2026-02-09 17:55:14 -05:00
mud.tin Add reconnect tintin command 2026-02-10 11:26:41 -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).