Little MUD Engine

0 views
Skip to first unread message

Chris Norman

unread,
Dec 16, 2015, 9:05:36 AM12/16/15
to MOO Talk
Hi all,
I'm currently working on a MUD server written purely in Python.

Little MUD Engine is very much in it's infancy, doesn't even support
matching yet, but it is very fast, and already has some compelling features:

* Uses Twisted for a very robust network experience.

* Uses bcrypt for password storage.

* Dumps to a human-readable JSON file.

* Really easy to add new commands:
Just make a function, set a name and (optionally) a minimum access
level, then use add_command to add it to the commands list.

If the player calling the function does not have the minimum-required
access level, they won't be able to use the command, and they won't see
it in the commands (or @commands) listing.

For example:
def do_hello(obj):
"""
Say hello to yourself.

Synopsis:
hello
"""
obj.notify('Hello world.')
return True # If we'd not returned True the command parser would
continue trying to match commands.
do_hello.name = 'hello
add_command('^hello$', do_hello)

An example with arguments:
import db, objects.players as players

def do_shout(obj, text):
"""
Shout text to everyone in the game.

Synopsis:
shout <text>
!<text>

<text> will be announced to everyone currently connected.
"""
if text:
for p in db.get_players():
p.notify('%s shouts, "%s"' % (obj.title(), text))
else:
obj.notify('Shout what?')
return True
do_shout.name = 'shout !'
do_shout.access = players.PROGRAMMER # Don't let anyone who isn't a
programmer or a wizard use this command.
add_command('^(?:!|shout )([^$]*)$', do_shout)

* Easy to extend the object types by creating classes.

Currently there are mobs, rooms and players. Equipment will come, as
well as weapons and vehicles (horses, cars, whatever).

* Spells and skills will be easy to implement. I honestly have no idea
how yet, but they'll be objects like everything else.

* Colour support is already included.

For example:
obj.notify('This text should be {fg_blue}Blue{fg_default}. This text
should be {bold_on}bold{reset}.')

All text which is sent through PlayerObject.notify uses those colour codes.

I'm currently thinking of a fantacy style game for something to be
aiming towards, but there's no reason you couldn't use LME for pretty
much anything.

Any suggestions or fixes are welcome (especially test cases, since I'm
currently learning how to write them). The code can be found on:

https://github.com/chrisnorman7/lme.git

Please: checkout, test, criticise (constructively of course), request
features and hack away.

Cheers,

-- Chris.

Reply all
Reply to author
Forward
0 new messages