1998Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: DevMUD module configuration -->
<!--X-From-R13: Xnzrf Ivyfba <wjvyfbaNebpurfgre.ee.pbz> -->
<!--X-Date: Mon, 26 Oct 1998 18:32:38 &#45;0800 -->
<!--X-Message-Id: 9810262121360C.22929@d185d1e96 -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 19981026170208.B23823#divcom,slimy.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: DevMUD module configuration</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jwilson#rochester,rr.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00530.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00532.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00527.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00541.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00531">Author</A>
&nbsp;|&nbsp;<A HREF="#00531">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00531">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: DevMUD module configuration</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: DevMUD module configuration</LI>
<LI><em>From</em>: James Wilson &lt;<A HREF="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</A>&gt;</LI>
<LI><em>Date</em>: Mon, 26 Oct 1998 20:30:04 -0500</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>

On Mon, 26 Oct 1998, Jon Leonard wrote:
&gt;As I was putting together a prototype this weekend, I realized that we
&gt;don't yet have a sufficiently flexible scheme for configuring modules
&gt;when we assemble them into a server.

the way this was done in linux is instructive. modules are initialized
much like executables, i.e.

/sbin/insmod 3c509.o io=0x300

(I'm sure you know this, I'm just being rhetorical.) this seems a useful
paradigm (modules in Perl are also amenable to this sort of treatment). As I
mentioned, the system I built a couple years ago used a text config file
for just this purpose. I like your proposal much better though for runtime
configuration.

&gt;The most sophisticated system I've seen described involves having each
&gt;module have a list of dependencies and other requirements, along with
&gt;a list of features that it provides.  The loader would then be
&gt;responsible for picking out modules to load when some feature is required,
&gt;pointing out conflicts, and so on.
&gt;
&gt;The problem with this is that there are quite a few collections of modules
&gt;(that I'd like to see, anyway) which are ambiguous or otherwise fail to
&gt;correctly initialize in such a scheme.
&gt;
&gt;For example, suppose I have three modules:
&gt;
&gt;1) Socket, which provides network communication privliges
&gt;
&gt;2) Telnet, which sits on top of Socket to provide Telnet protocol
&gt;    features and RFC compliance.  It has the same interface (or
&gt;    a superset), for mix-and-match capability.
&gt;
&gt;3) World, which provides all of the non-transport functionality of a MUD.
&gt;
&gt;When loading World, how does the driver know whether to load telnet or not?
&gt;Similarly, if Socket, Telnet and World are loaded, how does the loader
&gt;know to connect World to Telnet instead of to Socket?

World could specify, "load me a telnet" or "load me a socket". Or it could
refer to something which telnet uniquely provided, e.g. "load me something
that provides RFC xyz compliance" and (assumimg Telnet claims to 
provide said compliance) all would be well. Or World could be invoked with

insmod World.o input=rawsocket.o
or
insmod World.o input=telnetd.o

[another example snipped]

&gt;As a result, I have a new proposal.
&gt;
&gt;In addition to the special Bootstrap module (the only module known to always
&gt;be part of the server), there is a special Config module.  The Config module
&gt;is like any other module, except:
&gt;
&gt;1) There can only be one Config module in a server.
&gt;
&gt;2) The Bootstrap module automatically loads Config on startup, and passes
&gt;   control to it.
&gt;
&gt;3) The config module is responsible for requesting modules to be loaded and
&gt;   telling loaded modules which other modules to use in which ways.  It may
&gt;   delegate this responsibility. 
&gt;
&gt;I expect most Config modules will immediately load a game language module
&gt;and delegate responsibility to a program in that language.  This allows
&gt;great flexibility including command-driven reconfiguration during run time,
&gt;while allowing minimal Config modules for simpler MUDs.


indeed. /etc/rc.d, anyone?

&gt;More details about the prototype mentioned above:
&gt;
&gt;In order to get a different perspective on how modules might fit together
&gt;to make a MUD, I threw together a prototype.  (There's nothing quite like
&gt;a segmentation fault to tell you that there's something wrong with a
&gt;design.)
&gt;
&gt;It's missing some important abstractions, and I don't expect any of the
&gt;code to survive into a distributable DevMUD.  Much like my IPC example,
&gt;it only has two commands, "say" and "quit".  It does, however, use
&gt;dynamic linking and separately compiled modules to build a runnable mud.

bravo.

&gt;It's running at mud.slimy.com on port 2121, and the source can be found
&gt;from <A  HREF="http://mud.slimy.com/devmud/">http://mud.slimy.com/devmud/</A> by following the proto_1 link.
&gt;(The name mud.slimy.com isn't very special: Mud.slimy.com = frost.slimy.com
&gt;= devmud.slimy.com, etc.)

it has a certain Zen appeal, don't you think? heh.

looking through your source code, I immediately began thinking that the
inter-module protocol, so to speak, is going to have to be done quite
carefully so modules can really interoperate with a maximum of safety,
especially since the modules they'll be communicating with will ideally
be written by a heterogenous group of people. I get scared when I see 
function pointers being cast to void * and  back. Chris and Nick have
mentioned a couple of times the idea of defining interface types for 
modules, which makes me wonder

1. how are interfaces defined? ideally the mud-lang would be able to 
extend the set of interfaces at runtime.
and 
2. how are external interface implementations obtained in a type-safe way?

1. is a language issue I'm not brave enough to tackle at the moment. However,
a thought occurs to me as to how to do #2 in C++:

Every module defines a list of named objects which it exports. Each such
object  has some set of interfaces which it implements. There are no raw
function pointers; function objects or namespace-like objects with lots of
virtual methods are used instead. Every interface maintains a symbol table
listing all of the symbols which implement it (and perhaps, if a certain
symbol is  not currently in memory, the module exporting it is pointed to).
This would look something like

struct some_interface
{
	// normal functions
	virtual int foo (...) = 0;
	virtual int bar (...) = 0;

	// factory function
	virtual socket *hotline_to_jesus (void) = 0;
	
	/* these could go here or in a global table, or some tricks could be
	 * done with name mangling */
 	static some_interface *lookup_symbol (const string &amp;name);

	/* for auto-install of the name in the symbol table. could also have a
	 * no-parameters constructor for anonymous objects. */
 	some_interface (const string &amp;name)
	{ some_interface::install_symbol (name, this); }
private:
	static void install_symbol (const string &amp;name, some_interface *i);
};

SO, a number of symbols could implement 'some_interface' and be
accessible in a type-safe manner via their names. Name conflicts would
be an error, of course, but since the names are just strings they could
be qualified, and the linker could do a scoped search for the most
appropriate match.

A similar thing could be done in other languages, of course, and name 
mangling is an obvious alternative to using per-type tables. I like this
approach  because it suits my design aesthetics (interfaces, factory 
classes and so on).

James


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00527" HREF="msg00527.html">[MUD-Dev] DevMUD module configuration</A></STRONG>
<UL><LI><EM>From:</EM> Jon Leonard &lt;jleonard#divcom,slimy.com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00530.html">[MUD-Dev] Re: openmud or pdmud or devmud</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00532.html">[MUD-Dev] Re: Inheritance model (was Re: PDMud thread summary)</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00527.html">[MUD-Dev] DevMUD module configuration</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00541.html">[MUD-Dev] Re: DevMUD module configuration</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00531"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00531"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] Re: DevMUD module configuration</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00542" HREF="msg00542.html">[MUD-Dev] Re: DevMUD module configuration</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 27 Oct 1998, 06:47 GMT
</LI>
</ul>
</LI>
<LI><strong><A NAME="00529" HREF="msg00529.html">[MUD-Dev] Re: Inheritance model (was Re: PDMud thread summary)</A></strong>, 
Bruce Mitchener, Jr. <a href="mailto:bruce#puremagic,com">bruce#puremagic,com</a>, Tue 27 Oct 1998, 01:56 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00532" HREF="msg00532.html">[MUD-Dev] Re: Inheritance model (was Re: PDMud thread summary)</A></strong>, 
Cynbe ru Taren <a href="mailto:cynbe#muq,org">cynbe#muq,org</a>, Tue 27 Oct 1998, 03:08 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00527" HREF="msg00527.html">[MUD-Dev] DevMUD module configuration</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Tue 27 Oct 1998, 01:07 GMT
<UL>
<LI><strong><A NAME="00531" HREF="msg00531.html">[MUD-Dev] Re: DevMUD module configuration</A></strong>, 
James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Tue 27 Oct 1998, 02:32 GMT
</LI>
<LI><strong><A NAME="00541" HREF="msg00541.html">[MUD-Dev] Re: DevMUD module configuration</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Tue 27 Oct 1998, 06:44 GMT
</LI>
<LI><strong><A NAME="00612" HREF="msg00612.html">[MUD-Dev] Re: DevMUD module configuration</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Sat 31 Oct 1998, 03:09 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00523" HREF="msg00523.html">[MUD-Dev] Re: Missing the point:  OpenMUD, Gamora, Casbah, etc.</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 26 Oct 1998, 21:27 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00536" HREF="msg00536.html">[MUD-Dev] Re: Missing the point:  OpenMUD, Gamora, Casbah, etc.</A></strong>, 
Bruce Mitchener, Jr. <a href="mailto:bruce#puremagic,com">bruce#puremagic,com</a>, Tue 27 Oct 1998, 04:30 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>