28 Aug, 2009, Idealiad wrote in the 1st comment:
Votes: 0
So MB member exeter said a week or two ago he was working on a port of SocketMUD to Python. He's been away from the forums since then, and I'm starting to get more curious…is there a Python SocketMUD-kind-of-mud out there?

Now there are a lot of Python muds to look at. For example BogBoa has a socket module and a telnet module under the GPL. However you need to make sense of that within the structure of all the other BogBoa stuff. There is PunyMUD, but that uses multi-threading and I'm trying to avoid that. I've also looked at RocketMUD, thinking that might be more understandable than SocketMUD itself, and that does help. There is SimPY mud which has a clear implementation of socket and select, but that doesn't even implement telnet as far as I can tell.

It seems like a good way to bootstrap this thing would be to use BogBoa's socket and telnet modules, but in a framework that otherwise was very simple to understand. Does anyone have further suggestions for creating a Pythonic SocketMUD?
28 Aug, 2009, Chris Bailey wrote in the 2nd comment:
Votes: 0
If you have a hard time understand Socketmud just use Rocketmud as your base, as you mentioned, and port it over. It's pretty simple and straightforward.
28 Aug, 2009, Barm wrote in the 3rd comment:
Votes: 0
Idealiad said:
However you need to make sense of that within the structure of all the other BogBoa stuff.


It's not too deeply welded to the rest of the stuff. Basically my server loop looks like this:

while shared.SERVER_RUN == True:
THE_SCHEDULER.tick()
THE_PORT_AUTHORITY.poll()


Where THE_PORT_AUTHORITY (groan) is a 'global' instance of port manager class in async.py that does the select.select():
http://code.google.com/p/bogboa/source/b...

In the poll method (line 124) I take new socket connections and create a Telnet object from them. Then in line 130 I pass the Telnet object to the game's connect function that starts talking to the player. If you replace this with your own function, you have a Telnet object that you can send text to, Telnet.send(), and when Telnet.cmd_ready == True, you can grab the player's input already broken in lines with Telnet.get_command().
http://code.google.com/p/bogboa/source/b...

When I'm done, I set Telnet.active = False and THE_PORT_MANAGER drops it from the list of active connections (async.py line 73) and it gets garbage collected, which automatically calls socket.close(). You'll need to drop any reference to it on the game side as well or no gc.

You'll have to gut THE_LOG stuff and some references to xterm.py for ansi coloring. Where you see shared.THE_TIME, it's the same as time.time().
28 Aug, 2009, Idealiad wrote in the 4th comment:
Votes: 0
Thanks for posting Barm, and thanks for BogBoa, without those modules I'd have a ton more work.

I have another general question; in reading about socket I found socket.makefile(), which basically creates a file-like object out of socket so you can call readlines() and writelines() on it. Would there be any issues with using this instead of parsing the buffer for new lines?
28 Aug, 2009, Barm wrote in the 5th comment:
Votes: 0
Idealiad said:
Thanks for posting Barm, and thanks for BogBoa, without those modules I'd have a ton more work.


You're welcome. Happy to see anything that mixes Python with fun. That's like fun squared. :biggrin:

Edit: I think it's only fair to point out that BogBoa is a spaghetti mess of quarter-finished dubious ideas, before someone gets the false idea it's worth downloading.

Quote
I have another general question; in reading about socket I found socket.makefile(), which basically creates a file-like object out of socket so you can call readlines() and writelines() on it. Would there be any issues with using this instead of parsing the buffer for new lines?


Could be an issue if a Telnet command uses an ordinal byte value that happens equal '\r' or '\n' since they would probably be consumed. Say you resized your window to 265 columns. During NAWS the client would send a most-significant byte of 1 and a least-significant byte of 10 – where ASCII 10 is newline. Sounds like you'd be trading fine control for syntactical sugar.
02 Sep, 2009, Barm wrote in the 6th comment:
Votes: 0
I'd consider pruning down the socket and telnet code to stand-alone modules and releasing them under the something like the Apache 2.0 license. What else would a socketmud for Python need? Not being rhetorical – really asking.
03 Sep, 2009, Kelvin wrote in the 7th comment:
Votes: 0
You're welcome to look at Evennia, a Twisted+Django MUD server. http://evennia.com
03 Sep, 2009, Idealiad wrote in the 8th comment:
Votes: 0
Barm said:
I'd consider pruning down the socket and telnet code to stand-alone modules and releasing them under the something like the Apache 2.0 license. What else would a socketmud for Python need? Not being rhetorical – really asking.


My personal preference would be just to have the socket and telnet, and maybe a simple echo to all connected users for anything a user sends from their client?. Everything else – command parser, event model, world structures, I'd leave up to the developers who download that.

I confess I've had more difficulty than I thought in extricating BB's socket and telnet from the other modules, so if you do a release like that it'd be awesome!
03 Sep, 2009, Barm wrote in the 9th comment:
Votes: 0
Ok, you can find MiniBoa (the Socket & Telnet modules plus a demo chatroom server) here:

http://code.google.com/p/bogboa/download...

These files, in the spirit of most other little mud codebases, are licensed under the highly permissive Apache 2.0 License.
04 Sep, 2009, Idealiad wrote in the 10th comment:
Votes: 0
Excellent Barm!
04 Sep, 2009, Barm wrote in the 11th comment:
Votes: 0
Idealiad said:
I confess I've had more difficulty than I thought in extricating BB's socket and telnet from the other modules…


*cough* It turned out to be bigger pain in the neck than I expected too. :redface: I remember the code being so much cleaner – damn bit rot.
04 Sep, 2009, David Haley wrote in the 12th comment:
Votes: 0
Writing completely modular and independent code for stuff like this that tends to put its tendrils everywhere is always easier in principle than in practice. :thinking:
04 Dec, 2009, Barm wrote in the 13th comment:
Votes: 0
Please note that I've deprecated the download for Miniboa mentioned above and created a proper project page (with documentation!!) for it at:

http://code.google.com/p/miniboa/

I've made some changes in naming and structure which hopefully makes everything a bit more coherent. I'll probably start a dedicated thread with more detail.
04 Dec, 2009, Idealiad wrote in the 14th comment:
Votes: 0
Awesome!
0.0/14