Category Archives: C# Conversion

Converting C++ code to C# code.

I Am Addicted To Github

Until recently, the only code I’ve released as open source has been the Magma MUD codebase. In the process of posting the Magma source on Github, I kind of got hooked on posting code online. Since then I’ve posted the source for a handful of applications, a mix of Linux and Windows desktop apps. A […]

Back to WPF

A while back I made a start on building the client using WPF, the Windows Presentation Foundation. It only made sense to give it a shot since the whole MUD is based on C# and .NET. That effort stalled due to a roadblock or two, probably because I didn’t know about routed events and partly […]

Zone Data Encapsulation Complete

Zone data encapsulation is complete now.  It was a long, tedious process, but it’s all for the greater good. Last time the code was Fx-Copped, It ran 778,249 checks and found 10,850 issues.  This time, it ran 865,441 checks and found 10,370 issues.  It’s an improvement, but not a huge one. We now have the […]

Encapsulation of Zone Data 80% Complete

Just a progress report — things are moving along slowly but steadily and it shouldn’t take all that much longer to finish data encapsulation for the zone data classes.

Pulled Over by FxCop

I ran FxCop against the Basternae source for the first time today. It ran 778,249 checks and found 10,850 issues. While some of these really are design flaws, some minor and some serious, many of them are not applicable to this project, such as the security declarations and assembly signing. Here’s how I break down […]

Halfway Through Encapsulation

You have passed the halfway point and are nearing your next codebase. There’s a lot to do, but I’m halfway through encapsulating all of the data for the zone classes.  This will give us the power to validate data before assigning it to a variable and will help us reduce the number of boundary checks […]

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 […]

C++ Is a Pain in the Arse (New Client)

Yesterday I opened up the source code for the Basternae Client in order to make a few changes, fixes, and updates.  What I had forgotten in the two years since I had been programming C++ actively is what a pain in the behind it is to get anything done in C++. Sure, you can do […]

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 […]

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 […]

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 […]

Command Processing Engine Complete

I completed the last of the code for the command processing engine today. Not much detail to report — it’s done and seems to work well enough.

A New Command Processing Engine

Command processing in the old Basternae was pretty klunky. The command interpreter would just pass on any text that was entered and each command function would have to do a lot of parsing to split up the command strings and figure out what the user actually intended. About half of each command would be devoted […]

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 […]

Writing A MUD Engine Is Hard

Seriously. I don’t mean just writing a basic telnet chat server with a few objects and commands you can interact with.  Any amateur programmer can do that. No, I mean writing a full-featured MUD engine that supports all of the features MUDders have come to expect from a game like Basternae 3.  It’s really dang […]

Humpy Dumpty It Ain’t

A little less than a week ago I mentioned that I had broken the heck out of the codebase. Well, it’s all back together again.  The MUD engine and the zone converter are as healthy or healthier than they were before, the weather’s nice, and all is well with the world.

Mass Refactoring

In the interest of making sure the MUD can be modified easily well into the future I’ve broken the heck out of the codebase. Yep. I’ve been refactoring, rearranging, renaming, and restructuring things so they make a lot more sense. That has inevitably broken a few things, but it will be far easier to add […]

Smashin’ More Bugs

Now that the communication routines are a lot smoother I’ve been able to test and debug more of the rewritten code.  I fixed a bug in the new command interpreter and one in the string builder today.  I also came up with a better way of handling per-area repop points so it’ll be a lot […]

A Self-Populating .NET About Box

One thing that has always been a little annoying is updating/changing the about box every time the program version or date changes. Here’s a neat little way to make it pull the values from the assembly info: private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { Assembly assembly = Assembly.GetExecutingAssembly(); AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute( assembly, typeof( AssemblyCopyrightAttribute […]

Converting Races by Hand

I spent quite a lot of time manually converting the race files to XML.  The file format didn’t lend itself well to automatic conversion, nor was much of it an easy search-and-replace setup.  Some of the values were strings of flags, some integers, some full sentences, without much consistency. It wasn’t fast and it wasn’t […]