2017-05-04 23:12:37 (edited by chrisnorman7 2017-05-04 23: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.

-----
I have code on GitHub

2017-05-12 16:15:50

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

2017-05-15 12:30:12

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.

-----
I have code on GitHub

2017-05-16 11:39:08

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

  File

If you like what I do, Feel free to check me out on GitHub, or follow me on Twitter

2017-05-17 11:52:14 (edited by chrisnorman7 2017-05-17 11: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.

-----
I have code on GitHub