nanomud 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nanomud-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: nanomud
3
+ Version: 0.1.0
4
+ Summary: A super simple, no-coding builder-focused MUD engine in Python.
5
+ License: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # Nanomud
13
+
14
+ Nanomud is a super simple, **no-coding**, builder-focused MUD (Multi-User Dungeon) engine written in Python.
15
+
16
+ Unlike other MUD engines that require you to write Python scripts to expand the world or add objects, Nanomud lets you do **everything entirely in-game through commands** (Online Creation / OLC). The world, items, players, and NPCs are persisted automatically as human-readable JSON files.
17
+
18
+ ## Features
19
+
20
+ - **No Code Required**: Start a server and construct your entire game world, items, npcs, behaviors, and stats interactively while connected.
21
+ - **Modern CLI & Packaging**: Install via `pip` and run immediately.
22
+ - **Auto-Persistence**: Any modification you make (digging a room, changing descriptions, spawning items, editing stats) is autosaved in real-time to `./data/world.json`.
23
+ - **Property-Based RPG Engine**: Built-in combat, movement, vendor shops, and NPC behaviors (wandering, conversation, aggression) driven by simple object properties (e.g. `hp`, `damage`, `gold`) editable via builder commands.
24
+ - **Standard Telnet Protocol**: Connect with any client (standard telnet, PuTTY, Mudlet, etc.).
25
+ - **Zero Dependencies**: Built entirely using the Python standard library (`asyncio`).
26
+
27
+ ---
28
+
29
+ ## Quick Start
30
+
31
+ ### 1. Installation
32
+ Install Nanomud as a package:
33
+ ```bash
34
+ pip install .
35
+ ```
36
+
37
+ ### 2. Start the Server
38
+ Run the command in the directory where you want your database to reside:
39
+ ```bash
40
+ nanomud --port 4000
41
+ ```
42
+ This will automatically create a `./data/` directory containing your world configuration and player profiles.
43
+
44
+ ### 3. Connect to the MUD
45
+ Open a telnet client and connect to your server:
46
+ ```bash
47
+ telnet localhost 4000
48
+ ```
49
+ *(If you are on Windows, you can use PuTTY set to Connection Type: Telnet, Host: localhost, Port: 4000)*
50
+
51
+ The **first player to register** is automatically granted **builder admin status** and can run `@` builder commands.
52
+
53
+ ---
54
+
55
+ ## How to Build the World (OLC)
56
+
57
+ All builder commands start with `@`. Here is a step-by-step example of how to build a basic zone.
58
+
59
+ ### 1. Digging Rooms
60
+ When you log in, you start in `The Grand Lobby` (room ID `lobby`). Let's dig a dark dungeon to the north:
61
+ ```
62
+ @dig north A Dark Dungeon
63
+ ```
64
+ This creates a new room called `A Dark Dungeon` (with ID `a_dark_dungeon`), links it to your north exit, and automatically creates a return exit `south` from the dungeon to the lobby.
65
+
66
+ Let's go north to inspect it:
67
+ ```
68
+ north
69
+ ```
70
+
71
+ ### 2. Customizing Descriptions
72
+ Let's make the dungeon sound more atmospheric:
73
+ ```
74
+ @desc The stone walls are covered in damp moss, and you hear water dripping in the distance.
75
+ ```
76
+
77
+ ### 3. Creating Items
78
+ Let's summon a weapon:
79
+ ```
80
+ @create steel sword
81
+ ```
82
+ Let's describe it:
83
+ ```
84
+ @itemdesc steel sword A heavy sword forged from polished steel. It feels powerful in your hands.
85
+ ```
86
+ By default, items can be picked up. Let's make this sword a weapon by giving it a `damage` property:
87
+ ```
88
+ @setprop steel sword damage 15
89
+ ```
90
+ *(When a player attacks an NPC, the engine automatically checks their inventory for items with a `damage` property and uses the highest value as their weapon damage).*
91
+
92
+ ### 4. Spawning NPCs and Customizing Behaviors
93
+ Let's spawn a goblin to guard the dungeon:
94
+ ```
95
+ @spawn goblin
96
+ @npcdesc goblin A small, green, sneaky goblin looking for gold.
97
+ ```
98
+ Let's give the goblin some stats:
99
+ ```
100
+ @setprop goblin hp 35
101
+ @setprop goblin max_hp 35
102
+ @setprop goblin damage 6
103
+ @setprop goblin gold 12
104
+ ```
105
+ Now, let's configure the goblin's behavior:
106
+ - Make it wander between rooms: `@npcbehavior goblin wander true`
107
+ - Set a custom line of dialogue: `@npcbehavior goblin talk Hehehe, you won't get my gold, human!`
108
+ - Make it aggressive (attack players on sight): `@npcbehavior goblin aggressive true`
109
+
110
+ ### 5. Creating Shops
111
+ You can turn any NPC into a shopkeeper. Let's create a shopkeeper back in the lobby:
112
+ ```
113
+ south
114
+ @spawn merchant
115
+ @npcbehavior merchant talk Hello, traveler! Would you like to buy a potion?
116
+ @npcbehavior merchant shop potion:10,shield:50
117
+ ```
118
+ This configures the merchant to sell a `potion` for 10 gold and a `shield` for 50 gold. Players can buy items from them using the `buy` command.
119
+
120
+ ---
121
+
122
+ ## Standard Commands Reference
123
+
124
+ ### Player / Gameplay Commands
125
+ - `look` / `l` - Look around the current room.
126
+ - `look <target>` - Examine an item, NPC, or player.
127
+ - `north`, `south`, `east`, `west`, `up`, `down` (aliases: `n`, `s`, `e`, `w`, `u`, `d`) - Move in a direction.
128
+ - `say <message>` (or `"`) - Say something to everyone in the room.
129
+ - `tell <player> <message>` - Whisper a private message.
130
+ - `get <item>` / `drop <item>` - Interact with items.
131
+ - `inventory` / `i` - View your items, gold, base damage, and HP.
132
+ - `who` - See who is currently online.
133
+ - `kill <npc>` - Start round-based combat. Combats tick every 2 seconds.
134
+ - `buy <item>` - Purchase an item from a shop vendor.
135
+ - `quit` - Disconnect and save character state.
136
+ - `help` - Show command help.
137
+
138
+ ### Builder Commands
139
+ - `@dig <direction> <room_name>` - Dig a new room in that direction.
140
+ - `@link <direction> <existing_room_id>` - Link exit to an existing room ID.
141
+ - `@unlink <direction>` - Remove exit in that direction.
142
+ - `@roomname <name>` - Rename the current room.
143
+ - `@desc <description>` - Set room description.
144
+ - `@create <item_name>` - Spawn an item in the room.
145
+ - `@itemdesc <item> <desc>` - Set description of an item.
146
+ - `@itemgettable <item> <t/f>` - Set if an item can be picked up.
147
+ - `@spawn <npc_name>` - Spawn a new NPC in the room.
148
+ - `@npcdesc <npc> <desc>` - Set description of an NPC.
149
+ - `@npcbehavior <npc> <behavior> <value>` - Set behaviors: `wander` (t/f), `aggressive` (t/f), `talk` (msg), `shop` (item:cost,item:cost).
150
+ - `@setprop <target> <property> <value>` - Set arbitrary properties on rooms, items, NPCs, or players (e.g. stats like `hp`, `damage`, `gold`, `admin`).
151
+ - `@rooms` - List all room IDs in the world.
152
+ - `@teleport <room_id>` - Teleport to any room by its ID.
153
+
154
+ ---
155
+
156
+ ## JSON Persistence Files
157
+
158
+ Nanomud stores your world in a clean, human-readable format. This makes it trivial to version control your world map using git, or manually edit stats in an editor.
159
+
160
+ - **World Map**: Saved in `data/world.json`.
161
+ - **Player Accounts**: Saved in `data/players/<username>.json`.
@@ -0,0 +1,150 @@
1
+ # Nanomud
2
+
3
+ Nanomud is a super simple, **no-coding**, builder-focused MUD (Multi-User Dungeon) engine written in Python.
4
+
5
+ Unlike other MUD engines that require you to write Python scripts to expand the world or add objects, Nanomud lets you do **everything entirely in-game through commands** (Online Creation / OLC). The world, items, players, and NPCs are persisted automatically as human-readable JSON files.
6
+
7
+ ## Features
8
+
9
+ - **No Code Required**: Start a server and construct your entire game world, items, npcs, behaviors, and stats interactively while connected.
10
+ - **Modern CLI & Packaging**: Install via `pip` and run immediately.
11
+ - **Auto-Persistence**: Any modification you make (digging a room, changing descriptions, spawning items, editing stats) is autosaved in real-time to `./data/world.json`.
12
+ - **Property-Based RPG Engine**: Built-in combat, movement, vendor shops, and NPC behaviors (wandering, conversation, aggression) driven by simple object properties (e.g. `hp`, `damage`, `gold`) editable via builder commands.
13
+ - **Standard Telnet Protocol**: Connect with any client (standard telnet, PuTTY, Mudlet, etc.).
14
+ - **Zero Dependencies**: Built entirely using the Python standard library (`asyncio`).
15
+
16
+ ---
17
+
18
+ ## Quick Start
19
+
20
+ ### 1. Installation
21
+ Install Nanomud as a package:
22
+ ```bash
23
+ pip install .
24
+ ```
25
+
26
+ ### 2. Start the Server
27
+ Run the command in the directory where you want your database to reside:
28
+ ```bash
29
+ nanomud --port 4000
30
+ ```
31
+ This will automatically create a `./data/` directory containing your world configuration and player profiles.
32
+
33
+ ### 3. Connect to the MUD
34
+ Open a telnet client and connect to your server:
35
+ ```bash
36
+ telnet localhost 4000
37
+ ```
38
+ *(If you are on Windows, you can use PuTTY set to Connection Type: Telnet, Host: localhost, Port: 4000)*
39
+
40
+ The **first player to register** is automatically granted **builder admin status** and can run `@` builder commands.
41
+
42
+ ---
43
+
44
+ ## How to Build the World (OLC)
45
+
46
+ All builder commands start with `@`. Here is a step-by-step example of how to build a basic zone.
47
+
48
+ ### 1. Digging Rooms
49
+ When you log in, you start in `The Grand Lobby` (room ID `lobby`). Let's dig a dark dungeon to the north:
50
+ ```
51
+ @dig north A Dark Dungeon
52
+ ```
53
+ This creates a new room called `A Dark Dungeon` (with ID `a_dark_dungeon`), links it to your north exit, and automatically creates a return exit `south` from the dungeon to the lobby.
54
+
55
+ Let's go north to inspect it:
56
+ ```
57
+ north
58
+ ```
59
+
60
+ ### 2. Customizing Descriptions
61
+ Let's make the dungeon sound more atmospheric:
62
+ ```
63
+ @desc The stone walls are covered in damp moss, and you hear water dripping in the distance.
64
+ ```
65
+
66
+ ### 3. Creating Items
67
+ Let's summon a weapon:
68
+ ```
69
+ @create steel sword
70
+ ```
71
+ Let's describe it:
72
+ ```
73
+ @itemdesc steel sword A heavy sword forged from polished steel. It feels powerful in your hands.
74
+ ```
75
+ By default, items can be picked up. Let's make this sword a weapon by giving it a `damage` property:
76
+ ```
77
+ @setprop steel sword damage 15
78
+ ```
79
+ *(When a player attacks an NPC, the engine automatically checks their inventory for items with a `damage` property and uses the highest value as their weapon damage).*
80
+
81
+ ### 4. Spawning NPCs and Customizing Behaviors
82
+ Let's spawn a goblin to guard the dungeon:
83
+ ```
84
+ @spawn goblin
85
+ @npcdesc goblin A small, green, sneaky goblin looking for gold.
86
+ ```
87
+ Let's give the goblin some stats:
88
+ ```
89
+ @setprop goblin hp 35
90
+ @setprop goblin max_hp 35
91
+ @setprop goblin damage 6
92
+ @setprop goblin gold 12
93
+ ```
94
+ Now, let's configure the goblin's behavior:
95
+ - Make it wander between rooms: `@npcbehavior goblin wander true`
96
+ - Set a custom line of dialogue: `@npcbehavior goblin talk Hehehe, you won't get my gold, human!`
97
+ - Make it aggressive (attack players on sight): `@npcbehavior goblin aggressive true`
98
+
99
+ ### 5. Creating Shops
100
+ You can turn any NPC into a shopkeeper. Let's create a shopkeeper back in the lobby:
101
+ ```
102
+ south
103
+ @spawn merchant
104
+ @npcbehavior merchant talk Hello, traveler! Would you like to buy a potion?
105
+ @npcbehavior merchant shop potion:10,shield:50
106
+ ```
107
+ This configures the merchant to sell a `potion` for 10 gold and a `shield` for 50 gold. Players can buy items from them using the `buy` command.
108
+
109
+ ---
110
+
111
+ ## Standard Commands Reference
112
+
113
+ ### Player / Gameplay Commands
114
+ - `look` / `l` - Look around the current room.
115
+ - `look <target>` - Examine an item, NPC, or player.
116
+ - `north`, `south`, `east`, `west`, `up`, `down` (aliases: `n`, `s`, `e`, `w`, `u`, `d`) - Move in a direction.
117
+ - `say <message>` (or `"`) - Say something to everyone in the room.
118
+ - `tell <player> <message>` - Whisper a private message.
119
+ - `get <item>` / `drop <item>` - Interact with items.
120
+ - `inventory` / `i` - View your items, gold, base damage, and HP.
121
+ - `who` - See who is currently online.
122
+ - `kill <npc>` - Start round-based combat. Combats tick every 2 seconds.
123
+ - `buy <item>` - Purchase an item from a shop vendor.
124
+ - `quit` - Disconnect and save character state.
125
+ - `help` - Show command help.
126
+
127
+ ### Builder Commands
128
+ - `@dig <direction> <room_name>` - Dig a new room in that direction.
129
+ - `@link <direction> <existing_room_id>` - Link exit to an existing room ID.
130
+ - `@unlink <direction>` - Remove exit in that direction.
131
+ - `@roomname <name>` - Rename the current room.
132
+ - `@desc <description>` - Set room description.
133
+ - `@create <item_name>` - Spawn an item in the room.
134
+ - `@itemdesc <item> <desc>` - Set description of an item.
135
+ - `@itemgettable <item> <t/f>` - Set if an item can be picked up.
136
+ - `@spawn <npc_name>` - Spawn a new NPC in the room.
137
+ - `@npcdesc <npc> <desc>` - Set description of an NPC.
138
+ - `@npcbehavior <npc> <behavior> <value>` - Set behaviors: `wander` (t/f), `aggressive` (t/f), `talk` (msg), `shop` (item:cost,item:cost).
139
+ - `@setprop <target> <property> <value>` - Set arbitrary properties on rooms, items, NPCs, or players (e.g. stats like `hp`, `damage`, `gold`, `admin`).
140
+ - `@rooms` - List all room IDs in the world.
141
+ - `@teleport <room_id>` - Teleport to any room by its ID.
142
+
143
+ ---
144
+
145
+ ## JSON Persistence Files
146
+
147
+ Nanomud stores your world in a clean, human-readable format. This makes it trivial to version control your world map using git, or manually edit stats in an editor.
148
+
149
+ - **World Map**: Saved in `data/world.json`.
150
+ - **Player Accounts**: Saved in `data/players/<username>.json`.
@@ -0,0 +1,3 @@
1
+ from .server import TelnetServer as NanoMUD
2
+
3
+ __all__ = ["NanoMUD"]
@@ -0,0 +1,16 @@
1
+ import argparse
2
+ from .server import TelnetServer
3
+
4
+ def main():
5
+ parser = argparse.ArgumentParser(description="Nanomud: A super simple no-coding builder MUD engine.")
6
+ parser.add_argument("--host", default="0.0.0.0", help="Host address to bind to (default: 0.0.0.0)")
7
+ parser.add_argument("--port", type=int, default=4000, help="Port to listen on (default: 4000)")
8
+ parser.add_argument("--data", default="./data", help="Directory for world and player JSON files (default: ./data)")
9
+
10
+ args = parser.parse_args()
11
+
12
+ server = TelnetServer(host=args.host, port=args.port, data_dir=args.data)
13
+ server.run()
14
+
15
+ if __name__ == "__main__":
16
+ main()