<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Understanding_the_Architecture_of_DikuMUD_at_runtime</id>
	<title>Understanding the Architecture of DikuMUD at runtime - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Understanding_the_Architecture_of_DikuMUD_at_runtime"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Understanding_the_Architecture_of_DikuMUD_at_runtime&amp;action=history"/>
	<updated>2026-11-22T19:15:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Understanding_the_Architecture_of_DikuMUD_at_runtime&amp;diff=3181&amp;oldid=prev</id>
		<title>Agent-mud: checked against the current code (wiki review 2026-11-15)</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Understanding_the_Architecture_of_DikuMUD_at_runtime&amp;diff=3181&amp;oldid=prev"/>
		<updated>2026-11-15T06:14:38Z</updated>

		<summary type="html">&lt;p&gt;checked against the current code (wiki review 2026-11-15)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A running DikuMUD III game is a few separate programs. This page explains what each one does, how they connect, and what they keep on disk. For building and starting them, see [[Manual:Installation]].&lt;br /&gt;
&lt;br /&gt;
== The picture ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Browser                       Telnet / MUD client&lt;br /&gt;
  (vme/www/client)              (telnet, TinTin++, Mudlet ...)&lt;br /&gt;
      |                               |                |&lt;br /&gt;
      | ws:// or wss://               | telnet         | telnets (TLS)&lt;br /&gt;
      | port 4280                     | port 4242      | e.g. port 4243&lt;br /&gt;
      v                               v                v&lt;br /&gt;
  +-------------+              +-------------+   +-------------+&lt;br /&gt;
  | mplex -w    |              | mplex       |   | mplex -z    |&lt;br /&gt;
  | (websocket) |              | (telnet)    |   | (telnet+TLS)|&lt;br /&gt;
  +-------------+              +-------------+   +-------------+&lt;br /&gt;
         \                            |                 /&lt;br /&gt;
          \_____ one TCP connection per mplex _________/&lt;br /&gt;
                 to the mother port (4999)&lt;br /&gt;
                              |&lt;br /&gt;
                              v&lt;br /&gt;
                 +--------------------------+       named pipes&lt;br /&gt;
                 |  vme  (the game server)  | &amp;lt;-----------------&amp;gt; dispatcher.py &amp;lt;-&amp;gt; muddiscord.py &amp;lt;-&amp;gt; Discord&lt;br /&gt;
                 +--------------------------+       (optional)&lt;br /&gt;
                   |      |       |       |&lt;br /&gt;
                 etc/   zone/    lib/    log/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The web client ==&lt;br /&gt;
&amp;lt;code&amp;gt;vme/www/client/&amp;lt;/code&amp;gt; is a plain HTML and JavaScript client; there is nothing to build. &amp;lt;code&amp;gt;index.html&amp;lt;/code&amp;gt; is the normal client and &amp;lt;code&amp;gt;client-a.html&amp;lt;/code&amp;gt; is a simpler one made for screen readers. You can open the files straight from disk or put them on any web server.&lt;br /&gt;
&lt;br /&gt;
The client opens one websocket per player to a websocket mplex. The connect form asks for protocol (&amp;lt;code&amp;gt;ws&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wss&amp;lt;/code&amp;gt;), host, port and path (&amp;lt;code&amp;gt;/echo&amp;lt;/code&amp;gt; by default; mplex ignores the path). When the client is served from a web server, it suggests that server's host name and port 4280. The same settings can be given in the address, for example &amp;lt;code&amp;gt;index.html?protocol=ws&amp;amp;host=localhost&amp;amp;port=4280&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The server sends HTML, and the client shows it. It also understands a few extra containers (who is online, aliases, combat status). The format is described in [https://github.com/Seifert69/DikuMUD3/blob/master/vme/www/client/PROTOCOL.md vme/www/client/PROTOCOL.md].&lt;br /&gt;
&lt;br /&gt;
== mplex, the network front end ==&lt;br /&gt;
mplex (source in &amp;lt;code&amp;gt;vme/src/mplex/&amp;lt;/code&amp;gt;) is what players connect to. Each mplex listens on one port and handles one kind of connection:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Started as !! Players connect with&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mplex -p 4242&amp;lt;/code&amp;gt; || telnet or a MUD client. mplex handles the telnet negotiation and turns the server's HTML into ANSI colour text.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mplex -z -p 4243&amp;lt;/code&amp;gt; || telnet inside TLS (&amp;quot;telnets&amp;quot;), for clients that support it. Needs &amp;lt;code&amp;gt;server.pem&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mplex -w -p 4280&amp;lt;/code&amp;gt; || the web client over plain &amp;lt;code&amp;gt;ws://&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mplex -w -t -p 4280&amp;lt;/code&amp;gt; || the web client over &amp;lt;code&amp;gt;wss://&amp;lt;/code&amp;gt; (TLS). Needs &amp;lt;code&amp;gt;server.pem&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;dh.pem&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You can run as many mplexers as you like against one game, for example one for telnet and one for the web client. Each one opens a single TCP connection to vme and sends all its players' traffic over it, using a small protocol of its own (&amp;lt;code&amp;gt;vme/src/protocol.h&amp;lt;/code&amp;gt;): new connection, text, prompt, close, the player's address, and so on.&lt;br /&gt;
&lt;br /&gt;
mplex does not need to restart when the game does. When vme goes away, mplex tells its players &amp;quot;The connection to ... was broken. Please be patient...&amp;quot;, keeps their connections open, and connects to vme again as soon as it is back. The players then log in again.&lt;br /&gt;
&lt;br /&gt;
The certificate files are read from the directory mplex is started in. The details are in [https://github.com/Seifert69/DikuMUD3/blob/master/vme/src/mplex/mplex.md vme/src/mplex/mplex.md].&lt;br /&gt;
&lt;br /&gt;
== vme, the game server ==&lt;br /&gt;
vme (source in &amp;lt;code&amp;gt;vme/src/&amp;lt;/code&amp;gt;) is the game. It runs the whole game in one loop that makes four passes a second: commands, combat, NPCs, zone resets and all DIL programs (DIL is the scripting language of the zones, run by the interpreter in &amp;lt;code&amp;gt;vme/src/dil*.cpp&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
vme does not talk to players directly. It listens on the '''mother port''' (&amp;lt;code&amp;gt;Port&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;vme/etc/server.cfg&amp;lt;/code&amp;gt;, 4999 by default) for mplexers. It accepts a connection there only from an address listed under &amp;lt;code&amp;gt;mplex hosts&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;server.cfg&amp;lt;/code&amp;gt;; any other is logged as &amp;quot;Mplex not from trusted host&amp;quot; and closed. vme listens on all network interfaces, so keep the mother port closed to the outside in your firewall. Only the mplex ports need to be open to players.&lt;br /&gt;
&lt;br /&gt;
The name &amp;quot;mother connection&amp;quot; is used on both sides: in vme it is the port the mplexers connect to, and in mplex it is the port the players connect to.&lt;br /&gt;
&lt;br /&gt;
== What is on disk ==&lt;br /&gt;
vme finds its directories through &amp;lt;code&amp;gt;server.cfg&amp;lt;/code&amp;gt;. The paths there are relative to the directory vme is started in, which is why it is started from &amp;lt;code&amp;gt;vme/bin/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Directory !! What vme does with it&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vme/etc/&amp;lt;/code&amp;gt; || Read at boot: &amp;lt;code&amp;gt;server.cfg&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;zonelist&amp;lt;/code&amp;gt; (which zones to load), the compiled definition files (&amp;lt;code&amp;gt;commands.dat&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;spells.dat&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;races.dat&amp;lt;/code&amp;gt; and others, built from the &amp;lt;code&amp;gt;.def&amp;lt;/code&amp;gt; files), &amp;lt;code&amp;gt;color.dat&amp;lt;/code&amp;gt;, the money definitions, login texts in &amp;lt;code&amp;gt;etc/strings/&amp;lt;/code&amp;gt; and the help files in &amp;lt;code&amp;gt;etc/help/&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vme/zone/&amp;lt;/code&amp;gt; || The compiled zones: one &amp;lt;code&amp;gt;.data&amp;lt;/code&amp;gt; and one &amp;lt;code&amp;gt;.reset&amp;lt;/code&amp;gt; file per zone, made by vmc from the &amp;lt;code&amp;gt;.zon&amp;lt;/code&amp;gt; source. They are read only at boot, so a recompiled zone takes effect after a restart.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vme/lib/&amp;lt;/code&amp;gt; || Everything the game saves while it runs. &amp;lt;code&amp;gt;lib/ply/&amp;amp;lt;first letter&amp;amp;gt;/&amp;amp;lt;name&amp;amp;gt;&amp;lt;/code&amp;gt; is a player, and &amp;lt;code&amp;gt;&amp;amp;lt;name&amp;amp;gt;.inv&amp;lt;/code&amp;gt; next to it is what the player carries. &amp;lt;code&amp;gt;lib/players.id&amp;lt;/code&amp;gt; holds the next player id. Boards, banned sites, slimed objects and the data that DIL programs save (under &amp;lt;code&amp;gt;lib/dilfiles/&amp;lt;/code&amp;gt; and the paths given in &amp;lt;code&amp;gt;zonelist&amp;lt;/code&amp;gt;) are kept here too. Back this directory up; it is the state of your game.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vme/log/&amp;lt;/code&amp;gt; || Statistics and account logs. When vme is started by &amp;lt;code&amp;gt;runvme.sh&amp;lt;/code&amp;gt;, its log is here too.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The server log is &amp;lt;code&amp;gt;vme.log&amp;lt;/code&amp;gt; in the directory vme was started in, unless &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt; names another file. vme empties it at every start, so copy it first if you need it. mplex writes &amp;lt;code&amp;gt;mplex.log&amp;lt;/code&amp;gt; in its own start directory, or the file given with &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The zone compiler, vmc, is not part of the running game. It turns &amp;lt;code&amp;gt;.zon&amp;lt;/code&amp;gt; files into &amp;lt;code&amp;gt;.data&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.reset&amp;lt;/code&amp;gt; files; see [[Manual:Zone Manual/General Compiler Information]].&lt;br /&gt;
&lt;br /&gt;
== Discord (optional) ==&lt;br /&gt;
vme can talk to a Discord server through two small Python programs in &amp;lt;code&amp;gt;vme/bin/&amp;lt;/code&amp;gt;. vme writes lines for Discord to the named pipe &amp;lt;code&amp;gt;pipeDispatcher&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;dispatcher.py&amp;lt;/code&amp;gt; passes them on to &amp;lt;code&amp;gt;muddiscord.py&amp;lt;/code&amp;gt;, which posts them on Discord. Messages from Discord go the other way, through the pipe &amp;lt;code&amp;gt;pipeMUD&amp;lt;/code&amp;gt;, and reach the players as channel messages. The pipes are files in &amp;lt;code&amp;gt;vme/bin/&amp;lt;/code&amp;gt;. See [[Manual:Discord]].&lt;br /&gt;
&lt;br /&gt;
== Keeping it running ==&lt;br /&gt;
&amp;lt;code&amp;gt;vme/bin/startvme.sh&amp;lt;/code&amp;gt; starts everything: vme through &amp;lt;code&amp;gt;runvme.sh&amp;lt;/code&amp;gt;, one &amp;lt;code&amp;gt;runmplex.sh&amp;lt;/code&amp;gt; for each &amp;lt;code&amp;gt;mplexer&amp;lt;/code&amp;gt; line in &amp;lt;code&amp;gt;server.cfg&amp;lt;/code&amp;gt;, and the Discord programs. Each &amp;lt;code&amp;gt;run*.sh&amp;lt;/code&amp;gt; script starts its program again when it exits. That is how the in-game &amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt; command works: vme saves the players and exits, and &amp;lt;code&amp;gt;runvme.sh&amp;lt;/code&amp;gt; starts it again. &amp;lt;code&amp;gt;stopvme.sh&amp;lt;/code&amp;gt; stops it all.&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>