Grizzen: A websocket-based MUD server

Grizzen is a small MUD-like game server that uses the websocket protocol instead of telnet for communications.

Besides using websockets, this project also differs from traditional MUDs in that the text is almost entirely generated on the client (i.e. in the browser). The server’s role is to maintain game state and pass messages between the appropriate clients. This will allow the server logic to remain relatively simple.

At this time, the game includes most of the basic commands one would expect from a MUD, as well as a rich set of social/roleplaing commands.

If you’re here to play the game, head on over to the Grizzen MUD site.

Goals and guiding principles

Most of the following are not yet implemented, but these are some of the goals and ideas guiding this project:

  • Maintain the text-based MUD experience while taking advantage of the modern web browser for layout and interaction.
  • Use browser accessibility features to make the game playable using a screenreader.
  • Develop a flexible system to specify the random story elements that can be generated. New games should be able to start with a base set of common story data and simply add new data specific to the game.
  • Move as much game data and logic as possible into the client. The server should simply handle the game world state and coordinate client messages.

Set up your own game server

You can get the server code from the Grizzen server project on GitHub.

The server is written in C# and uses the Fleck library for websockets.

For persistence, we use SQLite. Older MUD servers typically implement a custom flat file format for persistence, while newer projects use an RDBMS such as PostgreSQL or MySQL. Although powerful, these database systems take a lot of work to maintain and secure propertly. I would like to see how far we can go with SQLite and avoid enterprise-grade RDBMS servers if possible.

Set up the Client

The front-end client (maintained in a separate project) is just a static website. You will have to configure your web server to pass requests through to the websocket server on the host.

Example for Nginx with the websocket server listening on port 8888:

server {
    listen 80;
    server_name EXAMPLE.com www.EXAMPLE.com;

    location /ws/ {
        proxy_pass http://localhost:8888/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }

    location / {
        root /www/yoursites/EXAMPLE;
        index.html;
    }
}

Barring typos, the above example should tell Nginx to pass requests of the form EXAMPLE.com/ws/ to the Grizzen server instead of a static web page.


 MENU