COM Programming in zMUD

Updated: January 31, 2002 by Mike Potter (Zugg)

Related Articles:

Introduction to COM

(This is a simplified and abstract discussion of COM.)

COM stands for "Component Object Model."  So what is it?  It is a standard way for Microsoft Window's applications to communicate with each other.  Simple as that.  It allows one application (the client) to access another application (the server).  In fact, the COM Server can even be on a different machine (that's called DCOM, or Distributed COM).  It's important to remember that the client and server are "applications", not computers.  You should already be used to this kind of thing.  For example, zMUD is a "MUD Client" which can talk with "MUD Server" programs running on a remote machine.

What is special about COM is that it provides a standard programming interface for this client and server communication.  The Client can request data from the server, send data back to the server, or tell the server to execute some particular "method" or procedure.  COM provides the low level guts for sharing this data and information back and forth.  And what's even more special is that COM does this using "objects."  Objects are a big deal in programming today.  Objects combine data with the "methods" that act upon the data.  Thus, objects are not just collections of database fields, but also have all of the smarts to understand how to manipulate it's own data.

To dispel some myths, here are some facts about COM:

  1. COM is easy.  It really is.  But because most people focus on the gory details, some people think it's hard.  Try to look at this fresh, and ignore what you already think you know about COM and maybe then something will click and you will see how easy this can be.
  2. COM is fast.  Windows uses COM all over the place.  So does Internet Explorer.  While COM can be slower than traditional DLL library calls (such as in scripting, described below), it can also be just as fast.
  3. COM is incredibly powerful.  It allows you to do things that we very tricky in the past (such as calling different DLLs from different programming languages from different vendors...sound familiar, plugin developers?)

This document will focus on three specific COM topics.  First, is how to access COM from a zMUD script.  When performing COM Scripting in zMUD, zMUD is acting as the COM Client, enabling you access to a COM Server.  The COM Server can be any other application that supports COM, such as Microsoft Office, Internet Explorer, or Windows itself.  The second topic concerns zMUD as a COM Server.  This allows you to access and control zMUD from any other COM Client.  This will interest programmers who want to write applications that control zMUD.  The final topic discusses the COM interface defined by zMUD for zMUD Plugins.  With the plugin interface, zMUD and the plugin application are both clients and servers.  The plugins can control zMUD, and zMUD can control the plugin.  Any language that supports COM (such as Visual Basic) can be used to create a COM plugin for zMUD.

Next Chapter: COM Scripting in zMUD