Category Archives: Data Saving and Loading

Getting data into and out of the MUD engine.

Preserving Newlines in XML Serialization

With .NET’s XML serialization, it kills newlines when you serialize XML to disk. More specifically, it converts a CR+LF into just an LF (\r\n becomes just \n). This was causing annoyances with the spell editor, since you can edit source code for spells with it, but the code would appear all on one line after […]

Starting on a Spell Editor

Since spells are stored in files and not directly in the code, it’ll be a whole lot easier to edit them with an editor than editing data files by hand.  Today I started building an editor.  It’s probably about 1/3 done so far.  Here’s a look-see:

More Fixes To File Loading

A week ago I wrote about Mono not being happy with XmlElementAttribute.  I had cleaned up loading/saving for players and zone files, but skill and spell data needed some work.  I took care of that today, so all of the xml serialization is happy now. I’ve hired the wife as a QA tester to do […]

Good News and Bad News

Good News:  The crash is fixed.  It happened because an object was being loaded from a zone that didn’t exist. Bad News:  The root cause of the crash was that zones don’t actually load — the files open, but data isn’t read.  They load fine on Windows, but Mono isn’t happy.

Visual Studio Refactoring And Encapsulation

I love the refactoring support in MS Visual Studio.  It makes certain things like field encapsulation incredibly easy. For instance, thanks to its origins in C, most of the Basternae 3 codebase doesn’t have encapsulation yet.  This means that there are tons of class member variables declared like this: public string _keyword; Setting the _keyword […]

Continuing Spell Migration

When we last saw our hero, he was working on migrating spells from being hard-coded in 15 different places to being individual XML data files that are loaded at boot time. While this makes it easy to modify, enable, disable, rename, or adjust spells without a recompile, the main reason I’m doing so is because […]

A Whole New Spell And Skill Engine

Well, maybe not a *whole* engine quite yet, but certainly two thirds of one. I’ve generated about 500 little XML files to hold all of the skill and spell data for dynamic runtime loading.  It’s all pretty neat — skills and spells can be tweaked by hand without having to compile any code (though the […]

Learned Something New Today

I came across this article on Scripting with C#. Quick summary: It tells how to load and compile C# code from within a running application so that you can dynamically load scripts. This is something I’ve been meaning to find out how to do for a while. I’ve always wanted to create a file-based spell […]

The Joy of the Flags Enumeration

In the old days of MUDs it became a rather common occurrence to use each bit of a 32-bit integer as a binary flag to set or unset a value. This was far more efficient than using an array of 32 boolean values because the integer consumed 4 bytes, while an array of 32 booleans […]

.Net XML Serialization

Most of the saving and loading of MUD data in Basterne 2 was handled by low-level C functions that used a custom text file format for each data type. That is just a bad idea. Save and load functions were typically dozens or hundreds of lines of code with lots of room for error and […]