Yearly Archives: 2008

Magma MUD 3.04 Released!

I’ve made a minor update to the Magma codebase.  Here’s what’s changed:

1. Added support for loading 4 of the 5 remaining Envy 2.2 zones that wouldn’t load.
2. Bundled the MakeZonesFast32 and DikuEdit 3.10 zone editors in the MUD package.
3. Added DOS conversion utilities for assembling DikuEdit zones (makezone.bat).

MagmaMUD 3.04 is available for download at FindMUD.

Resharper 4.0

Last year I tried the Resharper 3 plugin for Visual Studio, and posted my thoughts on it:

http://basternae.org/blog/2007/07/26/jetbrains-resharper/

It was OK, but not all that special. It had potential, but wasn’t quite “there” yet.

I just finished trying out Resharper 4.0 and you could paste the Resharper 3.0 review in its place. It’s neat, but not so neat that it’s a ‘must have’ utility. The features added in the latest version really aren’t anything I find useful — I don’t refactor Visual Basic, don’t use LINQ, etc.

It does, however, appear to run a little faster than version 3.  That might just be the system I’m using it with, but the slowness is no longer an annoyance.

I’ll keep my eye on it. Maybe they’ll add something I can’t live without in a later version.

First Zone Editor Preview Version

Here’s the first view of the Basternae Zone Editor available for download:

BasternaeEditorPreview1.zip (download removed, see the post about preview version 2)

Some warnings:

1. This is a pre-release version and it’s entirely likely that it will be unstable and lacking in features.
2. It has no help files.
3. It has no icons for the edit window buttons — just colors.  You have to guess what they do.
4. The map edit and walkthrough edit modes are not done yet (and haven’t been started yet either).
5. Save your work often and keep backup copies.

This is just to download, play around with a bit, and get a feel for.  I don’t expect that the area file format will change in a way that will break zones created with this editor, so you can actually start trying to use it to build something.

Check it out, see if it’s usable, and feel free to make requests, bug reports, or just say what would make you more likely to want to use the tool to create a zone for the new Basternae.

Rewiring The Core

In the process or getting an alpha version of the editor ready I’ve found that I had to separate the game code, a.k.a. “business logic” from the data, a.k.a. “object model”.  Otherwise I’d have to include the entire MUD engine in the editor download.  Since that’s not something I want to do I’ve had to pull them apart.  It’s a lot like pulling apart a cold grilled cheese sandwich, and as expected, the bread did tear a little.

The “core rewire” still needs some work, but I should have an “alpha”, a.k.a. “try it and see how broken it is or isn’t” version of the zone editor out sometime this month.

A Review of Duris

The MUD Connector has an interesting review of Duris posted:

http://www.mudconnect.com/mud-bin/new_prev/review.cgi?rid=25705

I’ve always enjoyed Duris and still play it off and on (maybe half a dozen weeks a year), but it has always had so many flaws that I end up getting fed up and walking away after a while. Part of it is administrative, sure, but a lot of the problems are core game design — at the core it’s an excellent MUD, but so much of it is an unnecessarily frustrating mess that it doesn’t really have much longevity for me. I think it comes from the original philosophy of the design — the creators really didn’t differentiate between “difficult” and “irritating”.

For example (and I’m mainly referring to Duris from a few years ago because that’s what I know best):

Randomly killed by random-spawn unpredictable scan-track mobs in the underdark for no logical reason, or = annoying.

Instantly killed because you were attacked by a drunk orc when you try to leave the inn in your hometown and since you’re level 1, assisting guards one-shot you (and your class doesn’t have sneak) = annoying.

Getting killed in artifact-wielding players in low-level zones and having your corpse looted of spellbooks/totems that you are too poor to replace because you’rer a newbie = annoying.

Player-wiping because you want to refresh the player base, purge an overabundance of equipment, or replace the world maps, or cover up the fact that the game mechanics still need some work = annoying.

Needing to use your head to come up with a strategy to defeat mobs, complete a zone, or accomplish a task = difficult.

Being forced to rely on your wits and diligently reading room descriptions to solve quests or puzzles = difficult.

Optimizing your equipment and stat bonuses based on how you want to perform in combat and doing so by real combat experience rather than reading the source code = difficult.

Somehow they seem to think that and difficult are both beneficial. Difficult makes players keep playing because things aren’t too easy. Annoying makes them log in to WoW.

I still find it incredibly amusing that I was more-or-less programming for Duris during the 2000-2001 “arms race” with Basternae 2 — every time I added a feature or convenience command that was neat but didn’t affect game balance it would show up on Duris a week later.

Even so, I can’t really say I have anything against any of the admins of Duris. After all, I’ve never even met any of them (except Xyzom from old Duris, who I actually lived with for a while and worked on Illustrium Arcana with — nice enough fella but we haven’t kept in touch). All I can do is judge by their product, Duris: Land of Bloodlust, which needs some work.

Serious Shrinkage

The connection state management code in the socket layer of Basternae has always been what I call “spaghetti code”.  It was a single method containing a huge switch statement with pretty sizable blocks of code for each case.  Tracing program flow for characters that were not actively playing was always difficult due to the complexity and verbosity of this 1600-line function.

Today I refactored it into a bunch of more sensible pieces that go together a lot more smoothly.  The 1600-line function is now 80 lines, I can actually tell what’s going on during program execution, and a handful of confusing and unused variables have been eliminated.  Huzzah!

Unit Testing With MbUnit

In general either code works or it doesn’t and it’s easy to tell whether it does or doesn’t work. At least until you reach a certain level of complexity. At some point a project gets large enough that you can’t tell which project/dll your error is coming from, let alone which of the 100K or even 50M lines of code is doing naughty things.

Today I had a problem that was easier to solve by creating unit tests to point out where the flaw was. The tool uset? MbUnit.

Here’s an example of an MbUnit test I wrote in order to find a string processing bug:


using System;
using System.Collections.Generic;
using System.Text;
using MbUnit.Framework;
namespace UnitTests
{
[TestFixture]
public class MUDStringTests
{
[RowTest]
[Row(12, "12.box", "box")]
[Row(1, "cheese", "cheese")]
[Row(1, "1.pie", "pie")]
[Row(1, ".chicken", "chicken")]
public void NumberArgument(int expectedValue, string inputString, string expectedOutput)
{
string str = String.Empty;
Assert.AreEqual(expectedValue, BasternaeMud.MUDString.NumberArgument(inputString, ref str));
Assert.AreEqual(expectedOutput, str);
}
}
}

What this does is check whether we’re getting the expected output when we give a certain piece of input. It’s handy for detecting anomalies without having to boot up the server and/or mess with production code. Mind you, there’s no such thing as ‘production code’ since we don’t have a server up yet, but this sort of thing is likely to be handy in the future.

I’m not the type that has any chance of turning into a ‘write the unit tests first’ and ‘unit tests are more important than code’ evangelistic freak, but in most cases it is far easier than using trial-and-error to track down a bug.

I still hate the way WordPress formats my code.

Miscellaneous Fixes

I made a few changes to character creation today.  There were a few places where it was case-sensitive — you could create a “Troll” but not a “troll” and there were a few weird state changes.  For instance, when creating a character you would see the menu twice the first time it was displayed.

I also fixed a few immortal commands that will make it easier to create immortals and set command permissions for their abilities.

The say, emote, whisper, yell, shout, ask, and immtalk commands were broken (all messages came across blank), and are now fixed.

Issue Code Is Working

I finished testing the issue code today.  We now have a functional ‘help desk database’ for the MUD.  It’s primitive, but it should do the trick and can be expanded/changed as necessary.  At least we’ve eliminated the bug, idea, typo, and ‘helps needed’ files that admins would rarely, if ever, look at.  Here’s an example of usage:

< > issue update 2 This is a test issue.
Issue 2 updated with text This is a test issue.

< > issue close 2 Testing the issue entry system.
Issue 2 closed with resolution Testing the issue entry system.

< > issue show 2
Issue Number: 2   Priority: high   Type: helpentryrequest
Is Closed: True   Opened by Imm: True   In Room: 0
Created by: Xangis   Time: 7/6/2008 11:14 AM   Text:
disarm
Entered by: Xangis   Time: 7/6/2008 11:32 AM   Text:
this
Entered by: Xangis   Time: 7/6/2008 11:36 AM   Text:
This is a test issue.
Closed by: Xangis   Time: 7/6/2008 11:37 AM   Text:
Testing the issue entry system.

< > requesthelp disarm
Help entry request recorded.  Thank you.

< > issue list
Issues:
[3] (lowest) Help Request: disarm
[4] (lowest) Help Request: issue
[5] (lowest) Help Request: ignore

< > Issue Number: 3   Priority: lowest   Type: helpentryrequest
Is Closed: False   Opened by Imm: True   In Room: 0
Created by: Xangis   Time: 7/6/2008 11:25 AM   Text:
Help Request: disarm

< > issue priority 3 lowest
Issue 3 priority set to lowest.

Basternae Zone Contract

I’ve put together a simple “zone permission contract” here:
http://www.basternae.org/BasternaeZoneContract.pdf

It’s probably not necessary, but while I was publishing my science fiction magazine I found it to be a good idea to get everything in “official” writing.

If you have written any zones you’d like to let us use or know someone who has, this can be sent either to my xangis at yahoo mail account or to the following mailing address:

Jason Champion
Zeta Centauri, Inc.
1388 Clydesdale Ave.
Columbus, OH 43229

TODO List Added

I’ve added a to-do list under the ‘Pages’ section. It’s not quite complete and the formatting isn’t all that great, but it might be a useful way to keep track of what needs to be done. At the very least it’ll give readers some idea what I’m working on.

So far I’ve been using simple “todo.txt” files in each of my Visual Studio projects, but that keeps them from being all in one place and is a bit disorganized.

Back From Vacation

OK, so maybe I didn’t announce the vacation in the first place, but I took some time off from working on Bast to enjoy the summer.

I’ve been working on the client a bit, and I had almost forgotten how much I dislike C++.  It’s just so messy and inefficient to work with.  You have to spend about 30% more time to get anything done and then once you’re done you have a pretty good chance of having to do some memory-based debugging.

Enough of the whining (because that’s what it is).  Just posting a note to let folks know work is continuing.

An Upgrade (For Me)

It’s been a busy week at work — just got myself a promotion and haven’t had a chance to work on the MUD as much as I’d like (more tired in the evenings than out of time, really). Most of this week’s effort has been directed toward the editor.

I’m wondering whether it would be a better idea to release a prototype of the editor to get ideas and suggestions or wait until it’s pretty much useable before releasing it.  It’s probably a difference of about 4 weeks in time/effort.

Removing Items From A Container In A Foreach Loop

It wouldn’t have been unrealistic for the designers of .NET to find a way to make this work:

foreach( Item i in ItemList )
{
  if( i.ShouldBeRemoved )
  {
    ItemList.Remove(i);
  }
}

What happens is you get a ‘collection modified’ exception and you’re hosed. You can’t move to the next item in the list because removing the item broke the list. It wouldn’t have been that hard for the design of IEnumerable (the thingy that makes foreach possible) to keep track of where the next item was even after a removal.

Instead of being able to use the above code, something like this clunky bit is required:

for( int i = (ItemList.Count – 1); i >= 0; i– )
{
  if( i.ShouldBeRemoved )
  {
    ItemList.Remove(i);
  }
}

It’s like telling someone they can avoid head-on car collisions by always driving in reverse.

Anyhow, there was a bit of a problem with the Select() command and socket management, and this was the solution. The socket code is now functional and stable enough that I can log in and run around trying to play the game. It’s not terribly playable yet — I have a *LOT* more work to do, but it’s still theoretically possible that a development server could go up i mid-but-more-likely-late May.

Sorting The Easy Way in C#

If you have a list of objects, say List<Widget> it’s mighty easy to to sort them using .NET.

First, derive the Widget class from IComparable:

public class Widget : IComparable

Then create the CompareTo method. In this case, we’re sorting the list of Widgets by name:

public int CompareTo(object obj)
{
if( !(obj is SynthProfile ))
{
return 0; // We could throw an exception here if we wanted to.
}
return this.Name.CompareTo(((SynthProfile)obj).Name);
}

Once that’s done all you have to do is call:

WidgetList.Sort();

Easy.

Raph Koster Is Pretty Awesome

Some of you may remember Raph from Ultima Online, Star Wars Galaxies, or Everquest II. He also wrote a few articles for Imaginary Realities webzine (a webzine about MUDs for those of you who don’t know). The site was pretty active from 1998-2001, but at some point it vanished from the face of the Earth.

Well, Raph was nice enough to give permission to reprint his IR articles on FindMUD. They’re a good read, and still relevant today, so if you’re at all interested in MUD design you should read ’em over.

Raph’s blog is also pretty interesting and updated fairly regularly. It’s worth becoming a regular reader.

300 MUDs on FindMUD

Data entry is a lot of work and it takes a lot of time. Even so, I’ve been making steady progress on FindMUD. It’s up to 300 MUD listings now.

Our next goal is to pass MudMagic, which has just over 500 listings. It won’t be blazingly fast, but it will happen.