1 (edited by chrisnorman7 2017-05-04 22:14:05)

Hi all,
I recently found myself writing lots of text-based game-type stuff, some of it MUD-like, and some intended to be played with a custom client. Either way, I found myself re-using a lot of the same code, so I made me a package!

The package is creatively called gsb (Game Server Base), and it's reminiscent of Flask or Klein.

There's a more complete example in the repo's examples folder, but here's a basic idea:

from gsb import Server  # like flask.Flask.

s = Server()  # This holds commands ETC.


@s.command('^quit$')
def do_quit(caller):
    """Disconnect from the game."""
    s.disconnect(caller.connection)


s.run()

This will run a very minimalist game on port 4000.

Clearly it's not very interesting having only one command, but you can create as many as you like, making yourself a fully-functioning MUD-type server, or (I used it for) an RTS-type thingy. I was using Telnet to test, so I thought I may as well make it MUD like.

Anyways, there's full documentation (for once). If anyone's got any suggestions or whatever, please let me know either by email or Github or something.

Visit the repo.

To install with pip do:

pip install git+https://github.com/chrisnorman7/game-server-base

Happy hacking.

Thumbs up

Thank you, this gives me an idea on coding muds.

Thumbs up

Well if there's anything I can help with please let me know.

I've started making my own MUD using this module, and it's helping me realise where things need changing ETC.

There's already a bunch of new events and the banned hosts api is more configurable.

Thumbs up

Hi.
I get an error when trying to run your minimal example.
the error is as following:

  File

Thumbs up

5 (edited by chrisnorman7 2017-05-17 10:52:52)

Hi,
I can't actually see the error other than the word File, but I suspect you haven't installed the package.

First run

python setup.py install

Or

pip install git+https://github.com/chrisnorman7/game-server-base.git#egg=gsb

hTH.

Thumbs up