The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Remote administration of in-memory content

I have a hobby project ( ) that I use to tinker with new .NET technologies. This is basically a telnet server that has a lot of objects loaded in memory. This is usually known as a Multi-User Dimension/Dungeon (MUD). My current quest is to create an admin console to deal with these in-memory objects.

The content is stored to the database when not in use. I have no problem getting to the off-line content. I just use the regular CRUD stuff with web services or any other RPC-style technologies. What I'm having a hard time with is getting to the content once it's loaded into memory. I just haven't found any sort of mechanism/design pattern for what I'm trying to do.

The current architecture looks like this:

In-Memory Objects (World)

The off line stuff is easily accessible through the BLL. I'm sure this is not a new problem, and I'd be thankful for anybody that could point me to literature about mechanisms/design patterns to do this.

slartibartfast Send private email
Saturday, December 29, 2007
I imagine your online users would be run in separate thread(s) from the admin 'user', so I think it'd just be a matter of using correct multi-threading locks inside the code.

A larger part of the problem is if some part of the game's state is distributed between the server & the clients.  You'd then have to have a way to push down relevant state changes in an atomic manner to the clients.  Not easy.
xampl Send private email
Saturday, December 29, 2007
If you're using .Net 3.5 then Linq to Objects will let you query your in memory object sets.
Wayne Bloss Send private email
Sunday, December 30, 2007
You may want to look at the model and underlying objects and interfaces created by Microsoft for PowerShell. At the very least this will enable you to use PowerShell as a management interface for your system.
Dan Shappir Send private email
Sunday, December 30, 2007
Thanks for all the responses so far.

My current design looks like this:

Telnet Server | Command Parser | World
  (IServer)  |  (ISystem)    | (IPlace)

This text diagram is read from left to right. Telnet clients talk to the server. The second line is for the interfaces that these systems implement. I'm thinking that what I might need to do is the following:

Admin Server  | Command Parser | World
  (IServer)  | (ISystem)      | (IPlace)

As you see (or maybe not) the Command Parser already has a copy of the World. The World object has the majority of the objects that I'm already interested in.

The only thing being multi-threaded is the server part. That's so that the server can serve many clients. The rest of the system runs in the same thread. There is also a single AppDomain.

The idea about looking at PowerShell looks intriguing. I'll have to read up on this.

slartibartfast Send private email
Monday, December 31, 2007
In my MUD code I have a separate telnet port for administration.  This port is set up to communicate with a WinForms client and uses BinaryReader/BinaryWriter rather than the TextReader/TextWriter that the standard port uses.  I don't actually use the BinaryWriter's ability to serialize objects, I just serialize my world objects to a JSON string and send them over.  The BinaryReader/BinaryWriter frees me from having to parse the text and figure out where messages start and stop, etc.

There's a few caveats with this:
1) The Client needs the dll's that contain the world class definitions and needs to be in sync with the server.  (I haven't tackled the syncing part yet)
2) If you want to edit the objects on the client, you have to figure out a way to update the changes on the server.  Either replace the server object with the one sent back from the client, or update the server object with the properties of the client object.

Have a look at my code on google code projects if you want some examples. MirageMUD.Core.IO.GuiClient and MirageGUIClient.Code.IOHandler are good places to start.
Ted Send private email
Thursday, January 03, 2008

That's interesting that you are using JSON for serialization. I was using XML-RPC when the codebase was VB6.

I'll take a look at your code. Thanks!
Slartibartfast Send private email
Friday, January 04, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz