r/MUD•
ThinkIn3D

Adding 100's of rooms to TinyMUSH

Building & Design

Just pondering this. The idea is to automatically add hundreds of rooms at once to a TinyMUSH.

Say there's a method to generate these rooms coherently, with descriptions, exits, etc. (There isn't in this case, but let's say there is.)

Once the content is created, what might be the best way to actually import or create these objects in the server?

  • A generator program could use tools like python and the "pexpect" library to interact with the server over a telnet session. This would enter dig, link, open, succ, fail, etc commands as if typed manually.
  • Could a generator create the flatfile DB that the server loads at next startup?
  • Is there some other mass import command I just haven't found yet?

Posted Dec 4, 2023, 2:48 AM UTC

50
ThinkIn3DOP•

Web searches didn't turn up anything, so I ran with my first idea of using python+pexpect to control things. This actually works pretty well, but there are some performance issues when doing something like this.

I changed the server's config to reserve room for 10,000 objects in the initial DB, and start a new player with 1,000,000 pennies.

My program runs telnet to the server, then writes commands and reads responses with pexpect. For those who may not know, the pexpect library allows a python program to control some other interactive command, like telnet.

Here's sample output from creating a 1000-room long hallway.

Dug room Longway-1:13
Teleported to room 13
Dug room Longway-2:16
Teleported to room 16
... 898 rooms later ...
Dug room Longway-900:2710
Teleported to room 2710

Connecting to localhost:6250...
Connected to localhost OK
Logged in to the mush
Teleported to 2710

Dug room Longway-901:2713
Teleported to room 2713
...
Dug room Longway-1000:3010
Teleported to room 3010
Dug room The End:3013
Mush DB written to autodig_db.json

The connection lines in the middle are due to how TinyMUSH slows down to about 1 command/second after the first 100. To avoid the slowdown, before every 100 rooms it logs out, then reconnects. This keeps it fast.

Memory-wise, the server starts with an empty DB and is using <1MB of RAM. After this runs, RAM usage is about 50MB, and the .db file is about 524K.

Of course, this is no way to create a world. I was curious about how this could be done as I was thinking about procedural generation (wave function collapse, L-systems, random creation, etc).

1