Trudging through designing a MUD engine

Posted: 15 Jan 2021. Last modified on 04-Jun-22.

This article will take about 3 minutes to read.


See the code for this project here


B20Server is multiplayer game server as an engine. It is a ktor server which can communicate over telnet (a la MUDs), or serve a react client.

Since ktor is a multiplatform library, the ultimate goal for the game is to host the server within an Android app. When users would like to play, they will be able to start the server locally on their phone, and other players will be able to interact with it via the locally served react client.

There are a couple of different sources of inspiration for the game, such as:

MUDs

TTRPGs

Roguelikes

Interactive Fiction

These are some of the current features:


Look will scan the current room, and report on people or objects of interest. It gives the following information:

Map displays all of this above information in a graphical format!


Move works how you might expect in a text-based game. There are 6 directions: north, east, south, west, down and up. Some spaces (like walls) can’t be occupied.

There is a border around the edge of the room that lets you know there is no room in that direction. If you move off of the edge of a room, you will be placed on a tile in the next room.

Attack allows for combat! Using set, you can change whether you are making a melee,thrown, or ranged attack.

Once a character is out of health, they die, and drop their inventory on their current space. If the character is a player, they return to their spawn room.

Items can be found on the ground in most rooms. If you take an item, it will appear in your inventory.

Examine will give you more information about an item on the ground, a mob in the room, or an item in your inventory!

Status effects are core to the representation of entities in the game. Each entity has a list of effects that determine what it is, such as its Ancestry, any Level ups, or spells and any temporary statuses which are currently applied to it.Examining an entity will give you more information about any statuses may be affecting it at a given time.

Here, Bob is cursed, and he remains cursed for multiple rounds. If he takes any damage during this time, he will die!

Some actions take multiple rounds to complete. A game round occurs once all mobs in the game have taken 2 actions.

Depending on the type of action you are trying to do, you may need to give up your turn - but you will still have the option of dropping the multiround action to respond to changes in the situation.

Here, Alice walks into a dark room, and needs to cast a multiple round spell called nightsight in order to increase her visible range. This gives her the nightsight status effect, which lights up the rest of the room, only from her perspective.