1998Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: PDMud thread summary -->
<!--X-From-R13: @vxynf Syzdivfg <q97ryzNqgrx.punyzref.fr> -->
<!--X-Date: Sun, 25 Oct 1998 11:45:46 &#45;0800 -->
<!--X-Message-Id: Pine.SOL.3.96.981025200201.11778A&#45;100000#licia,dtek.chalmers.se -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199810251726.KAA02859@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: PDMud thread summary</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:d97elm#dtek,chalmers.se">
</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="msg00494.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00496.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00492.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00498.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00495">Author</A>
&nbsp;|&nbsp;<A HREF="#00495">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00495">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: PDMud thread summary</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: PDMud thread summary</LI>
<LI><em>From</em>: Niklas Elmqvist &lt;<A HREF="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</A>&gt;</LI>
<LI><em>Date</em>: Sun, 25 Oct 1998 20:42:36 +0100 (MET)</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 Sun, 25 Oct 1998, Chris Gray wrote:

&gt; [Niklas Elmqvist:]
&gt;  &gt;This is also why I think some sort of bus-based message communication
&gt;  &gt;system is a Good Thing&lt;tm&gt;. It is a quite good abstraction in that it
&gt;  &gt;captures normal function calls, message queueing, RPC mechanisms and
&gt;  &gt;distributed proxy calls under one concept, while still not introducing too
&gt;  &gt;much inefficiency. It is much easier for a newbie developer to think of
&gt;  &gt;inter-module communication in terms of "here is a channel leading directly
&gt;  &gt;to this module you requested contact with" instead of having to learn the
&gt;  &gt;implementation details.
&gt; 
&gt; Call me dumb. Call me poor at abstraction. Please show me what you really
&gt; mean by this. Exactly *how* would it work? Go to as low a level as you
&gt; think I will need. Avoid assuming I'm good at C++, because I'm not.
&gt; Please?

I'll try :) However, I don't have any working source code and have not
really mapped this out in my head (since these are quite new versions of
old ideas), so I'll have to wing it. Semantics and syntax are, of course,
subject to flaws, as are the individual functions. You'll get the idea,
though.

If this is too low-level (or low-tech?) for this list, I apologize.

Participants:

class Core {
private:
	EventManager hEventManager;
	ModuleManager hModuleManager;
	CommManager hCommManager;
	..
public:
	// Event managing
	void ScheduleEvent(Event *hEvent);
	..	
	// Intermodule communication
	void Broadcast(Message *hMsg);
	Pipe GetPipe(ModuleID *hID);
	..
	// Module management
	void LoadModule(string sFilename, ..);
	void UnloadModule(ModuleID *hID);
	..
}

class Module {
	ModuleID mID;
	..
public:
	Module(Core *hCore); 	// Constructor
	~Module();
	..
	// The following are quite empty and to be overridden
	virtual void Init(..);
	virtual bool HandleEvent(..); 
	..
}

// Pipe abstract class: no functionality
class Pipe {
private:
	ModuleID *hNode1, *hNode2;
public:
	..
	virtual void Send(ModuleID hSrc, ModuleID hDst, Message *hMsg);
	virtual Msg *Recv(ModuleID hCurr); 
	..
}
(Not satisified about this, but am pressed for time.)

class CallPipe : public Pipe {
private:
	FunctionPtr *hFun1, *hFun2;
public:
	..
	virtual void Send(ModuleID hSrc, ModuleID hDst, Message *hMsg);
	virtual void Recv(..)
	..
}

class QueuePipe : Public Pipe {
private:
	FunctionPtr *hFun1, *hFun2;
	MessageList hMsgList;
..
}

class ProxyPipe : public Pipe { // CORBA-like stuff
..
}

class RPCPipe : public Pipe { // RPC or something :)
..
}

(And whatever additional intermodule communication ways we need.)

Okay. What I have in mind is this: Say we have a running system with one
module loaded, call it A. A belongs to the ParserModule class which has
been subclassed outside of the executable (external inheritance) and
dynamically loaded into the running MUD. 

Module B is loaded in some way (signal or command). B belongs to the
SocialModule class, also externally inherited from the core. What happens
is this:

1. The module manager takes charge of the situation. The shared lib is
	opened using dlopen() (depending on OS, of course).  
2. The executable extracts a pointer to the factory function in the lib
	(yes, it has to be there) using dlsym().
3. The executable calls the function, passing it a pointer to the Core
	class. This is the basic set of primitives the module may access.
	The pointer is passed to the constructor of module B (see class
	Module) and the function then returns with the new pointer to
	the module B object. 
4. The module manager adds the new module object to a list.
5. The executable calls B-&gt;Init() (that is SocialModule::Init()) and
	passes it its new ModuleID.
6. The Init function, which is written specifically for the SocialModule
	(it is virtual and overrides the original Module::Init()), does
	some initialization and then decides it needs to talk to a parser.
	It calls Core::Broadcast() along with a generic status message ("I
	am a CommandHandler")
7. Object A (the parser module) receives this message on the broadcast
	channel/pipe and decides that it is interested in CommandHandlers.
	It calls Core::GetPipe() with the ModuleID it received from the
	Message.
8. The intermodule communication manager (CommManager) receives the
	request and queries the module manager about the location of the
	two ModuleIDs. If on the same system, it creates a CallPipe
	(function pointers). If multi-threading is required, it creates a
	QueuePipe, and so on. It returns the pipe to the calling module
	(A).
9. Module A receives the pipe and immediately calls B on it, telling it
	that it is a parser and wants a command grammar and a way to
	package data for passing it.
10. Module B provides A with this and then sits idle until information
	from A comes through the pipe.

I haven't ironed out any details, as you can tell, and most of this I made
up as I went along. It may therefore be totally demented; I make no
guarantees. But hopefully, it will help in seeing what I envision.

&gt; Chris Gray     cg#ami-cg,GraySage.Edmonton.AB.CA

-- Niklas Elmqvist (d97elm#dtek,chalmers.se) ----------------------
  "The trouble with being a god is that you've got no one to 
   pray to."
		-- Terry Pratchett, Small Gods



</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00498" HREF="msg00498.html">[MUD-Dev] Re: PDMud thread summary</A></strong>
<ul compact><li><em>From:</em> James Wilson &lt;jwilson#rochester,rr.com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00492" HREF="msg00492.html">[MUD-Dev] Re: PDMud thread summary</A></STRONG>
<UL><LI><EM>From:</EM> Chris Gray &lt;cg#ami-cg,GraySage.Edmonton.AB.CA&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00494.html">[MUD-Dev] Re: openmud or pdmud or devmud</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00496.html">[MUD-Dev] Re: OpenMUD: bus-based communications</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00492.html">[MUD-Dev] Re: PDMud thread summary</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00498.html">[MUD-Dev] Re: PDMud thread summary</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00495"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00495"><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: PDMud thread summary</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<LI><strong><A NAME="00450" HREF="msg00450.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
Adam J. Thornton <a href="mailto:adam#phoenix,Princeton.EDU">adam#phoenix,Princeton.EDU</a>, Sat 24 Oct 1998, 04:16 GMT
</LI>
</ul>
<LI><strong><A NAME="00463" HREF="msg00463.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
ApplePiMan <a href="mailto:ApplePiMan#aol,com">ApplePiMan#aol,com</a>, Sat 24 Oct 1998, 23:29 GMT
<UL>
<LI><strong><A NAME="00470" HREF="msg00470.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Sun 25 Oct 1998, 02:02 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00492" HREF="msg00492.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 25 Oct 1998, 17:28 GMT
<UL>
<LI><strong><A NAME="00495" HREF="msg00495.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Sun 25 Oct 1998, 19:45 GMT
<UL>
<LI><strong><A NAME="00498" HREF="msg00498.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Sun 25 Oct 1998, 21:10 GMT
<UL>
<LI><strong><A NAME="00502" HREF="msg00502.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Mon 26 Oct 1998, 00:09 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="00499" HREF="msg00499.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 25 Oct 1998, 21:51 GMT
<UL>
<LI><strong><A NAME="00501" HREF="msg00501.html">[MUD-Dev] Re: PDMud thread summary</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Sun 25 Oct 1998, 23:08 GMT
</LI>
</UL>
</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>