python mudlib using telnetlib3
New opcodes: op_call_vn, op_call_vn2, op_call_vs2, op_catch, op_check_arg_count. All call variants delegate to existing _call(). ZRoutine now tracks arg_count for check_arg_count. Fixed zopdecoder double-byte operand parsing for call_vs2/call_vn2: the old code called _parse_operands_byte() twice, but this method reads both type byte AND operands together. The second call would read operand data as a type byte. Refactored into _read_type_byte() + _parse_operand_list() so both type bytes are read before any operand data. Also fixed the double-byte detection: was checking opcode[0:7] (7 bits = 0x7A for call_vn2) instead of opcode_num (5 bits = 0x1A). The check never matched, so double-byte opcodes were always mis-parsed. |
||
|---|---|---|
| .claude | ||
| content | ||
| docs | ||
| scripts | ||
| src/mudlib | ||
| tests | ||
| worlds/earth | ||
| .dockerignore | ||
| .gitignore | ||
| compose.yml | ||
| demo_terrain.py | ||
| Dockerfile | ||
| DREAMBOOK.md | ||
| justfile | ||
| mud.tin | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
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 testsworlds/— world definitions (yaml/toml)docs/— internal knowledge baseDREAMBOOK.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).