Skip to main content

Improving the Engine

· 6 min read
Stefan Prelle
GraphicMUD creator

Improving the Engine - that's what happened the last 3 months. Let me elaborate ...

Improved Graphic Engine

A lot of work has been invested into making the map engine more powerful. Not only can you now configure the tile size and map size for the engine - the first version was hardcoded to 16x16 tiles in a 11x11 tile mapview - but I managed to add two important features:

Layering

The previous version could only draw one tile at a given coordinate - e.g. when you dropped a sword on the floor, you would see the sword, but not the ground below. If you wanted to be able to have the sword on grass, on wooden and on stone floor, you would have to draw multiple versions of the sword.

In the new version we have four layers:

  1. Terrain - The lowest layer is used to draw different floor or wall types.
  2. Immobiles - This layer is used to either modify the Terrain layer (e.g. adding a window in a wall) or adding elements that are part of the scenery (like a tree or a table)
  3. Assets - Basically everything you want to be pickable, like gear lying on the floor
  4. Mobiles - Everything that moves on its own. Since this is the highest layer, so a mobile entity may block view to assets below.

Not only the tiles are layered, but maps itself may have different floor levels as well. Map layers have a Z value, where Z=0 is the ground level, meaning negative values are below the surface, while positive values mark the height above ground. This is great for authoring zone maps and might lead to cool features like flying to enter buildings above the ground or falling, but it also lead to questions on how to indicate that parts of the map exist on a lower level

The feedback on our Discord server decided in favor of blurring without desaturation of the colors. There are more questions (like what to draw exactly or what about lower level light sources) not explored yet, which I will tackle in future versions.

Dynamic Views

In the previous version you would only get a fresh map view, when you move, e.g. walk from room to room or use cursor keys. If in the meantime other mobiles moved, you would get text messages but no map update - that has been changed. Now if some mobile in your view moves, you will get a map refresh, assuming you are using a suitable client - for non VT100 enabled clients like Mudlet I decided against potentially sending several new maps in the scrolling text window, since this would be quite irritating.

Base everything on tile-based movement

We do have two kinds of movement in the MUD: room-based and tile-based. In version 0.0.1 we based everything on room-based movement and added ways to move tile-based to it. When you moved room-based from A to B, there is no in-between - you simply appear in the center of room B - this felt normal for classic MUDs, but from a tilemap oberserver it looks a lot like teleporting. When you wanted to search a wardrobe in your current room and you type "examine wardrobe", it did not matter where in the room you are - it worked. While this was all fine for text-based clients, it felt weird when watching your character in a tilemap and seeing no interaction with the environment. So we changed it.

Now you need to go to the tile of the item you want to interact with. If you want to search a wardrobe in the room, but you are not standing next to it and you type "examine wardrobe", your character moves next to the wardrobe. If you want to walk into the neighboring room in the east and you type "east", your character walks to the eastern exit and passes through it - or it walks to the ladder to change to the upper floor.

For a player using a client that supports a dedicated map area, it drastically changes the experience, because suddenly you can see your character speedwalk to a different room. You also see other mobiles moving. For a player seeing only a static map, like you would in Mudlet or other non VT100 clients, nothing changes except a slight delay in the result. They only get an updated map at the end of the movement, when they entered the new room.

Switching that paradigma required a lot of work, since it basically invalidated all existing commands for interacting with the world, but it was so worth the effort.

New text engine and help text

The game engine uses XML files to describe zones, which includes room descriptions. To be able to add markup into the XML room description (that should not be parsed on serialization, but later), we made the XML parser namespace aware.

We also started working on help texts - at least as a proof of concept. For help text we considered writing in Markdown easier. Both - XML and Markdown - needed options to express text styling, as well as clickable anchors (using MXP <send>) or hyperlinks (using OSC 8) that open web pages. To make stuff more complicated, we not only had our classic telnet connection in mind, but possible connections to Discord or messengers.

To be flexible enough to fulfill all requirements we wrote a new intermediate format that can be created from XML or Markdown (Commonmark, to be precise) and exported to ANSI or yet to define export formats.

BeipMu Webview

The Windows based client BeipMu has a nice feature, which allows a server to open a web browser window on the client and interact with it using GMCP. This way GraphicMUD is able to bring not only ASCII maps, but real dynamic graphics maps to the client.

The same should be possible to Mudlet with Lua scripting, but I've never touched Lua before, so I hope someone is willing to make a contribution to this project by writing it.

Custom Graphics

Not really part of the MUD engine, but something we did for our example MUD: Start working on a tileset (size 32x32) that is not Ultima V. Digging deeper into the tiles, I admire how masterfully the U5 tileset was designed.

Startzone with Ultima 5 tileset Startzone in Ultima 5 tileset

Startzone with custom tileset Startzone with custom tileset (Work in progress)

Test it out!

Check out our info page for "Tech Demo 2"

Get in touch

We do have a dedicated Discord server for this project