Category Archives: Programming

Building software.

FxCop Still Wants To Shoot Me

Last time I ran FxCop two and a half months ago I had 10,850 issues from 778,249 checks for a ratio of 13.94 issues per 1000 checks.  That was just on the core MUD engine without the utilities included (screen editor, zone editor, etc.)

Today I ran FxCop against the entire codebase.  The ratio has improved thanks to the code changes over the past couple months.  It’s still not great, and it still whines too much about the way constant variables and flags are named.  It’s now 10568 issues from 920,226 checks for a ratio of 11.48 issues per 1000 checks.

Not much of an issue decrease in total, but the overall issue “density” has improved by 17.65%.

ReSharper 4.5: It’s Finally Awesome

The two of you who have been following this blog regularly probably know that I’ve tried demos of JetBrains ReSharper versions 3 and 4 in the past.  The verdict was that they were pretty neat, but far too slow to be of any practical use.

Today I downloaded the trial version of ReSharper 4.5.  The big improvement they claim to have made is a significant speed increase.  After trying it out, I believe it.  They claim speed increases of about 25-40% depending on the type of project you’re working on, but that’s an understatement.  I’m using the same hardware I used for the previous test a year ago (yeah I need an upgrade, but that’s not something I care to address right now).   I haven’t used stopwatch tests, but it feels like ReSharper 4.5 is easily two to three times faster than ReSharper 4.0.

It’s now totally worth using — it has all of the benefits without any of the drawbacks the previous versions had.  Good work, JetBrains.

Magma MUD Codebase: Generally Quite Stable

The Magma MUD test site has been running for over a month now without any administrative intervention.  I have it set to automatically reboot the MUD after it’s been up a week.  That has happened 4 times now.  The fifth reboot was due to a segmentation fault (null reference exception) on June 10.  This means that in a month there has only been one unexpected reboot.

Any number more than zero isn’t particularly good, but it seems to be pretty stable under miniscule load (there isn’t really a playerbase, just people wandering in and out infrequently).

Telnet:  basternae.org port 4001.

Almost Working on Mono

There’s apparently a strange quirk to the XmlElementAttribute where you have to specify the data type for any type that isn’t a string (you’d think it would auto-detect an int property!)

So, with this:

///
/// The id number of the race.
///
[XmlElement("_number", typeof(int))]
public int Number
{
get { return _number; }
set { _number = value; }
}

Everything now loads, boots up, and characters can log in. However, when entering the game, there’s a NullReferenceException that happens on Mono (but not on the Windows version):

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at BasternaeMud.CharData.ResetStats () [0x00000]
at BasternaeMud.SocketConnection.ProcessMenuSelection (System.String argument) [0x00000]
at BasternaeMud.SocketConnection.ConnectionStateManager (System.String argument) [0x00000]
at BasternaeMud.SocketConnection.ProcessPlayerActions () [0x00000]
at BasternaeMud.SocketConnection.MainGameLoop (System.Net.Sockets.Socket control) [0x00000]
at BasternaeMud.Program.Main (System.String[] args) [0x00000]

So far it seems that this only happens for existing players. Creating a new player doesn’t cause this to happen. Might take quite a bit of effort to track down.

Technorati, Eh?

I finally went and set up a Technorati profile for the first time and claimed the Basternae blog.

I’m still not quite sure what you can really accomplish with Technorati. I guess I’ll find out. In the meantime, you can “favorite” this blog if you use Technorati:

Add to Technorati Favorites

Not Working on Mono

I tried firing up the current Basternae 3 codebase using Mono on my Ubuntu server. It crashed. So, here are the errors I have to sort out before I can get to the next errors:

14:30:34 Trace: Loading spells.
System.InvalidOperationException: Standard output has not been redirected or pro cess has not been started.
at System.Diagnostics.Process.CancelErrorRead () [0x00000]
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:CancelError Read ()
at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compile r.CompilerParameters options, System.String[] fileNames) [0x00000]
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom .Compiler.CompilerParameters options, System.String[] fileNames) [0x00000]
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFile (System.CodeDom.Comp iler.CompilerParameters options, System.String fileName) [0x00000]
at System.Xml.Serialization.XmlSerializer.GenerateSerializers (System.Xml.Seri alization.GenerationBatch batch, System.CodeDom.Compiler.CompilerParameters cp) [0x00000]
at System.Xml.Serialization.XmlSerializer.RunSerializerGeneration (System.Obje ct obj) [0x00000]
14:30:36 Trace: Loaded 421 spells.
14:30:36 Trace: Loading skills.
System.InvalidOperationException: Standard output has not been redirected or pro cess has not been started.
at System.Diagnostics.Process.CancelErrorRead () [0x00000]
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:CancelError Read ()
at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compile r.CompilerParameters options, System.String[] fileNames) [0x00000]
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom .Compiler.CompilerParameters options, System.String[] fileNames) [0x00000]
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFile (System.CodeDom.Comp iler.CompilerParameters options, System.String fileName) [0x00000]
at System.Xml.Serialization.XmlSerializer.GenerateSerializers (System.Xml.Seri alization.GenerationBatch batch, System.CodeDom.Compiler.CompilerParameters cp) [0x00000]
at System.Xml.Serialization.XmlSerializer.RunSerializerGeneration (System.Obje ct obj) [0x00000]
14:30:36 Trace: Loaded 95 skills.
14:30:36 Trace: Loading races.
Unhandled Exception: System.Exception: Error loading races in Race.LoadRaces(): System.Exception: Error loading race in Race.Load(): ../races/Barbarian.raceSyst em.Exception: Race.Load(): Race number 0 already taken by Human. Can't load Bar barian
at BasternaeMud.Race.Load (System.String filename) [0x00000]
at BasternaeMud.Race.Load (System.String filename) [0x00000]
at BasternaeMud.Race.LoadRaces () [0x00000]
at BasternaeMud.Race.LoadRaces () [0x00000]
at BasternaeMud.Database.LoadDatabase () [0x00000]
at BasternaeMud.Program.Main (System.String[] args) [0x00000]

The first error happens when the engine tries to compile custom code in a spell file.

The last error, “race number 0 already taken” is not correct — the ID for Barbarians is set to 1, so the files are obviously not being read correctly.

Integrating Python?

One of the things I’ve been worrying over is how to write a new scripting and artificial intelligence engine that integrates all the buttery goodness and capabilities of MobProgs and the homebrew probability-based AI system I wrote for Basternae II along with the only-used-once movement scripts I put together. They were all pretty powerful, but the bad things are/were:

1. Too many pieces of code to maintain.
2. Required a programmer’s full attention — far too complex for a zone writer or newbie-level web scripter to use.
3. Always required a recompile if changes were made.
4. Always required a reboot to load new changes. This made it un-tweakable. Want a mob to cast fireball half as often? Change it and reboot the MUD.
5. Extremely zone-dependent. If we unload the plane of fire, we still have all of the plane of fire scripts active, including hard-coded mob names and numbers.

It definitely shouldn’t require a restart of the game just to make a troll kick someone in the head more often. This naturally leads me to Python and/or IronPython, since it’s my current obsession. I have some reading to do, but don’t be surprised if I come up with a scripting engine of pure awesomeness.

22 Hours Uptime

Mind you, only about 5 players have logged into the Magma 3.04 demo site, but it’s been up 22 hours so far.

I remember back when Magma was first being developed. An hour of uptime was considered a good thing.

Funny how things progress. I remember my first MUD in 1999, Illustrium Arcana, running on a Cyrix 6×86-PR200 on a 32MB machine co-located on a friend’s ISP (stax.net, apparently shut down around the end of 2006). Having T1 access was so amazing ten years ago. Now I’d be angry if my cable modem slowed down to 1.5 MBPS.

The original Cyrix machine ran at about 200 BogoMIPS, which was screaming fast. Right now I have what is effectively 1/10 of a Xeon 2.5 GHz processor. That gives me 500 BogoMIPS and 320 MB of RAM. That’s more than enough to run a MUD and a few websites.

Accepted Into Microsoft BizSpark

Microsoft has this neat little program, BizSpark, that gives a company free access to pretty much all of their products for three years for a total of $100.  The idea is that if they can get startups hooked on Microsoft operating systems, databases, and development tools, then if the companies are still alive after three years they’ll become thriving, paying customers.

Seems like a smart idea to me.  After all, startups generally have to be run “on the cheap”, so most of them turn to Linux and open source solutions.  BizSpark is keeping Microsoft competitive, helping out startups, and is an all-around good thing.

So, my company, Zeta Centauri, Inc., was just accepted into the BizSpark program and I now have access to all these neat development tools, including Visual Studio 2008 Team Suite (which is $10k retail).  It’s still downloading, but I’m sure I’ll have to post about some of the bells and whistles that come with it.  I’ve never worked with anything above Visual Studio Professional.   With any luck these new and shiny tools will help me build something awesome.

Studying For The 70-503 Exam

On to the next one… this time it’s the .NET Framework 3.5 Windows Communication Foundation exam. The study guide for this one seems pretty dry and repetitive so far.

It might just be that I have less experience with WCF than I did with the other exam subjects, but so far this one is requiring a serious act of willpower to stay focused on reading.

I doubt I’ll be able to continue my one-exam-every-two-weeks pace, but we’ll see…

Passed The 70-561

I took and passed the Microsoft 70-561 exam today and how have the “MCTS: .NET Framework 3.5 ADO.NET Applications” certification.

This exam was incredibly hard, and I didn’t obliterate like I did to the previous two.  A score of 700 was required to pass and I picked up a 768.

The study book for the ADO exam wasn’t really all that good — it was far too sparse and left out too much information.  It was only about 450 pages or so and should have been around 700 to really cover the material.

Random Character Name Generator

I wrote a random character name generator in Python today. It’s HERE at Xangis.com.

The system used is:
1. Roll a d6. 1-3 = consonant (1d20). 4-5 = vowel (1d6 with ‘y’ counting as a vowel), 6 = end name.
2. Names must be at least 3 characters long, ignore a roll of 6 if the name is too short.
3. If you get three consonants in a row, end the name.

I used to use that method to generate horrible character names for AD&D a decade and a half ago.

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 power to enforce sanity.  For instance, when an object’s condition is set, we cap it at a max of 100% (perfect) and a minimum of 0% (destroyed).

Studying For The 70-561 Exam

Finished one exam, on to the next now.  The upcoming target is the Microsoft 70-561 exam, “Microsoft .NET Framework 3.5 ADO.NET Application Development”.

I’m already a fair way into the book, and it looks like I shouldn’t have too much trouble wrapping my head around the material.  There are a few things I haven’t really worked with, like the Entity Framework and LINQ to XML, but much of the material involves things I’ve been using a lot lately — datasets, LINQ to SQL, etc.

It should be a couple weeks before I’m ready to tackle the exam, but I can’t imagine that it will be all that hard.  It’s the WCF and ASP.NET ones I’m worried about (mainly due to lack of experience with the technologies).

Passed The 70-505 Exam

Over the weekend I took and passed the Microsoft 70-505 certification exam and now have the “MCTS: .NET 3.5 Windows Forms Application Development” certification.  It was far harder than I expected, but I still ended up with a score of 914 (passing score was 700).