Category Archives: Issues and Bugfixes

Issues and bugfixes for the Basternae/ModernMUD code.

Test Connection Up Again (Temporarily)

I put up the MUD server so I could do some development.  Telnet basternae.org port 4502 and feel free to report anything you find.   I haven’t fixed everything since the last test run, but did fix a handful of things.

I don’t have a restart script running, so if it crashes, that means it’s going to stay down until I check it again.

For those of you who want to use the old version of DikuEdit, I added a link to it on the sidebar.  I would like to get a bit of feedback on the new editor, so feel free to try that and let me know what you think of it so far.

A Solid Batch of Fixes

Thanks to reports from the pre-testing test and from actually trying to use the MUD as a player, I’ve taken care of a bunch of things.  Here’s the list:

— Fixed “look in object” command.
— Fixes to damage messages.  Sometimes they wouldn’t print thanks to a stray ‘\0’ (null) character.
— Kill message now shows properly.  Yet again, caused by a stray null character.  A remnant from the old C days.
— Improvements to name capitalization in prompts, descriptions, and room entry/exit messages.  Some things will still need adjustments, but it’s better.
— Fixed “no help on Grey Elf” during character creation.
— Fixed display of spell schools when using the “spells” command.
— Fixed a nasty bug that would cause a newly-killed player to become unplayable.
— Picking up items should work now.  Zone files weren’t synchronized with code (zone files were a version behind in the zone format).  That can cause all manner of weirdness, but the fix is simple — run the zone converter to build a new set of zones.  In this case, flags that included “takeable” settings were missing.
— Corpse creation should be less broken.  Can’t promise it’s perfect, but it’s better.  At the very least, I can kill things and loot coins from corpses.

Those are some pretty significant fixes, but I’m still no more than 45% through the things mentioned during the test.  Add to that the fact that I found a few other things that need to be looked at.  Actually PLAYING a game you’re working on does wonders for figuring out whether it works as intended.

Test Port Turned Off Now

The experiment is over for now. I more-or-less have the data I was looking for — what the most major issues are, where the crashes happen, what’s super-broken, and what needs a lot of work.  If you have any other results from your experimentation, feel free to send them to xangis at the yahoo email service.  Thank you for what you’ve sent in so far.

The main crashy issues have to do with object deletion and some odd who list thing.  I’ll have to get those sorted out before the next test, whenever that is, but it shouldn’t be too tough.

After this batch of issues is worked out I’ll have to think about finding someone to be zone chief, and/or someone to be the highfalutin’ potentate of overlorditude.

A Batch of Fixes

Between tester reports and the logs I’ve managed to track down and fix a handful of issues, some of which were so nasty as to make things untestable.  Here’s the list:

1 – Fix for removing an object from a room when that object points to a room but the room does not have the object in its content list.
2 – MUD now automatically creates player directories on boot if they don’t exist.  There was a problem with saving players when that dir didn’t exist yet that caused at least one crash.
3 – Changed “_name” to “name” at the login prompt.
4 – Fixed a crash bug that caused the world to explode when some spellcasting classes (i.e. Psionicist) entered the game for the first time.  It was a problem with setting initial spell proficiency values.
5 – Fixed a problem with the way age and total playing time was calculated.
6 – Fixed a problem where the petition command would make the MUD explode by calling itself.
7 – Fixed a problem with “get all”.
8 – Fixed a problem with clearing a mob’s hate list when it is killed.
9 – Fixed a glitch that would occasionally come up when taking an object out of another object.

Please try again and keep the observations coming.

Basternae 3 Test Port Currently Running

I have a test port of Basternae 3 running on basternae.org port 4502.  This is only temporary for the purpose of testing.

Here’s a list of things that need to be tested.  Feel free to spend as little as 1 minute testing, or as long as the server is up.  I only plan to have it up for a few days or less.  Please report any results to xangis at the yahoo dot com email service.  One big email is far better than lots of little emails.  Also let me know the name you’d like to be listed in the credits as (up to you whether you want to use your handle/nickname or your real name).  As I receive testing reports I’ll post what sections of this list have been covered so there’s not too much overlap of effort between testers.

1. Tester: Create one character of each race and one of each class to make sure that:

– The help file/info is displayed properly for each race and makes sense.
– The help file/info is displayed properly for each class and makes sense.
– The character creation process is logical, sensible, and user-frieldy enough that someone who has never played a MUD could make sense of it.
– Nothing weird happens.
– Nothing looks too un-customized.
– You actually start in the Kobold Village instead of a room with no exits.
– Text formatting glitches are under control.

Report any ideas/suggestions/observances during the process.

2. Tester: Check help entries for all commands and report any that don’t exist.

The “commands” command will give you a list of the commands available.  “help <command_name>” should display the help for that command.

3. Tester: Check help entries for all skills and report any that don’t exist.

Type “skills” to show the skills available for your character.  “help <skill_name>” should display the help for that skill.

4. Tester: Check help entries for all spells and report any that don’t exist.

Type “spells” to show the spells available for your character.  “help <spell_name>” should display the help for that spell.

5. Tester: Test all spells available to you and report any that don’t work.

Until I have the “auto advance to max level” stuff going there’s not a whole lot you can test with this.  In addition, spellbook/scribe classes will have trouble.  Just do what you can.

6. Tester: Try all commands without arguments and report any that malfunction, fail to give any feedback, give badly-formatted responses, or give responses that look like a stock codebase.

For instance, try “score”, “attributes”, “who”, and any other commands shown when you type “commands”.

7. Tester: Try all socials and report any that malfunction, print output that is garbled or nonsensical, or looks like a stock codebase.

Type “socials” to get a list of the available socials.  Then try these different combinations with each social:
<social_name>
<social_name> me
<social_name> <some_mobile_in_the_room>

8. Tester:  Try combat and see whether you’re able to successfully kill a mobile.  If anything strange happens, report it.  This includes messages that don’t make sense, like getting kicked by a creature with no legs, bitten by a creature without a head, etc.

During the history of Basternae (1 through 3) there have been issues with combat round timing, corpse creation, and deathblows.  I’d like to identify any of those as early as possible.

9. Tester:  Try combat and see whether you’re able to successfully get killed by a mobile.

During the history of Basternae (1 through 3) there have been issues with combat round timing, corpse creation, and deathblows.  I’d like to identify any of those as early as possible.

10. Tester: Log in with two characters and see whether you can successfully kill another player in PvP combat.  If anything strange happens or if you’re unable to fight another player, report it.  Try with characters on the same racewar side (i.e. Troll vs. Ogre) and with characters on opposite racewar sides (i.e. Dwarf vs. Orc)

There’s all kinds of extra logic involved in PvP combat and there’s plenty of room for weirdness.

11. Tester: Check help entries for all bard songs and report any that don’t exist.

This assumes you’ll be able to create a Bard and that they actually have songs defined..  I haven’t tried.

12. Tester: Walk through a zone looking at mobiles, objects, and rooms and report anything that is formatted weird or doesn’t display properly.

Although issues of that nature are usually zone file related, it’s entirely possible that with our entirely-new socket and text formatting code that something will look wrong.

13. Tester: Download the Basternae client and try using it with Basternae 3.

It’s available here:  http://www.basternae.org/BasternaeClientPreview_08-04-09.exe

I know it’s only barely functional (none of the extra windows do anything yet), but it’d be nice to get a little feedback, and to know what it would require before you’d consider using it as your main MUD client (if you’d consider using it).  And, of course, if it doesn’t run on your main OS that’d be nice to know too.  It’s probably worth running it side-by-side with another MUD/telnet client to make sure that text comes across OK (it’s entirely likely that the text parser isn’t 100% right).  If anything looks wonky, screenshots might be helpful.

14. Tester: Download and try to use the Basternae zone editor and take note of what parts of it are confusing and/or unclear.

The basternae editor can be downloaded here: http://www.basternae.org/Basternae3EditorSetup_v0.39.exe

There isn’t any documentation for the zone editor yet, so it might help to have some input as to what a new zone writer would want to know how to do and what guidelines should be made clear.  If you’re feeling really brave you could write a basic conceptual overview or intro tutorial.

The editor currently only runs on Windows and requires the .NET framework (you’ll already have it if you have Windows).

15: Tester:  Download the Basternae zone editor and try creating a 2-3 room zone with a mob, a quest, and an object.

Just try it out and see if it works, offer usability suggestions, and/or report anything weird.  Once you’re done, send me the test zone and I’ll see if it actually loads in the MUD engine.  Quality does not count — this is only a test.  You could create an entire zone if you want to, but I don’t recommend it until after these tests are done because there could be some breaking file format changes.

A few things to be aware of:

The code was written and compiled on Windows and is currently running on Linux under Mono.  Since Mono doesn’t have full support for everything in .NET there’s a chance something will go haywire at some point.  While doing some initial testing a few weeks ago I saw CPU usage on the server spike to 100% for no obvious reason.  If this happens, I’ll have to kill the process because I have about 15 or so other sites running on the server and I can’t let them be taken down.

I’m sure some of these tests will not really be able to be run effectively without some code changes/fixes.

THIS IS NOT A FULLY FUNCTIONAL MUD.  THIS IS JUST SO I CAN BUILD MY “TO DO” LIST OF THINGS THAT MUST BE FIXED OR REWRITTEN.

Ready For Some Preliminary Testing Soon

Some time in the next few days I hope to put up the Basternae 3 codebase in its current state temporarily in the hope that a few folks will be willing to help with some testing.

This isn’t a “beta” or anything like that.  It’s more of a “proof of concept” — to find out what’s completely broken and/or needs work next.  After the things in this test are fixed then I’ll be ready to start thinking about getting some help with zones.  For this test there will probably only be one or two zones attached – just enough to try out some combat, etc.

What I’ll be looking for in this test is just for someone (or multiple someones) to try all of the commands, skills, help file entries, socials, etc. and report any that are non-functional, fail to give any feedback, or that just behave weird.  I know that classes and their skills/abilities still need a fair amount of work, but this will also help me with getting everything else in working order.

So, check back later this week.  Next week at the latest.

Today’s Update

I spent a while working on the code today.  Nothing specific, just reorganizing some things, cleaning up some excessive logging, fixing a bug or three.

I ran FxCop again and it came up with 961,407 checks and 9,557 issues, a ratio of 9.94 issues per 1000 checks.  This is an improvement of 6.49% over last check.  I think I’m going to mothball FxCop for now since following its rules doesn’t actually result in better, more stable code.  All FxCop cares about is how “pretty” the code looks.

Mono 2.01 Doesn’t Like XmlElementAttribute

I have zone files loading on Mono now.

I had a sneaking suspicion that it had something to do with the XmlElementAttribute that I used to keep the XML tags in the zone files compatible with the encapsulated, property-based classes.  I spent a few hours updating the zone converter application so I could remove the XmlElement attributes.  After loading the MUD on Mono, all zone files magically loaded.  “All” being the ~6 that I’m officially authorized to use so far.

Since I’m running Ubuntu 9.04, the native version of Mono is 2.01, a bit behind the current version of 2.4 (which will ship with Ubuntu 9.10).  Installing Mono 2.4 on Ubuntu 9.04 is not as easy as one would hope, and I can’t say for sure that it would take care of the problem.  Mono has made great advances lately, so I’d be surprised if the latest version had the same problem.

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%.

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.

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.

No Null Checks

After running the automated tests generated by Pex, it’s amazing how many functions in the old codebase received various class or structure arguments and immediately started working with the data in them without ever checking for null. It was a paradigm followed by the old public code release of Diku, Envy, Merc, etc. and was unthinkingly carried on by the Basternae 2 programmers, myself included. This lack of data validation is being corrected.

It’s no surprise that the old codebase crashed a lot. After seeing the extent of the damage, I feel like I need to go back and revisit the Magma codebase and add a lot of stabilization.

In fact, one of the main things with Basternae 3 that will help stability is the fact that all player-entered commands are executed within a try-catch block. This means that typing in a broken or unsupported command should never crash the MUD, which was a huge problem in the “bad old days”. Instead it will log an error and appear to do absolutely nothing from the player’s viewpoint.

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.

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.

Fixes and More Fixes

I have the client and server running well enough that I’m able to create a character and log in to test all of the available commands. In the first pass, just logging in and typing the command name to see what happens, I’ve found a fixed quite a few glitches. I haven’t fixed all that I’ve found yet, but at least it’s progress.

It finally feels like this is turning into a game again.