Author Archives: xangis

Removing Hard-Coded Rooms, Objects, and Mobs

The old codebase had plenty of references to hard-coded room numbers. For instance, “Limbo” and the “default start room” for races without hometowns were set to room number 200.

Well, having those etched permanently into code is a bad idea, since it ties you inextricably to certain specific area files, and more importantly, it forces “zone gods” to dig into code if they want to change some things with how rooms are used. Bad idea.

The interim solution I’ve come up with isn’t great, but it does at least take the specific numbers out of code. I’ve created some XML files that load at boot time: StaticRooms.xml, StaticObjects.xml, and StaticMobs.xml. They contains a list of room, object, or mob names and their numbers, storing them in a Dictionary type. This makes it easy to refer to “ROOM_NUMBER_START” or “ROOM_NUMBER_LIMBO” in code and not worry too much about where it actually points. Of course, those names are still hard-coded, but at least they can be administered by non-programmers now.

I’d like to have them load dynamically as part of the zones, but there’s a bit of a problem there — some bits are just far too tightly integrated, especially things that revolve around locations, such as shifting to the astral or prime material plane. Those problems are better tackled in a future design change. This incremental improvement is good enough for now.

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.

InnoSetup Is Most Excellent

For a couple months back in 2003 I had a full-time job doing nothing but building InstallShield installers.  It was a pretty arduous process even for simple applications.

I wanted to build an installer for the Basternae Editor, which is a very simple program in that it doesn’t need any registry entries, license keys, services, or database objects.  It’s just data files and an executable.

This means that I really didn’t want to fire up my ancient (2003) copy of InstallShield to build an installer.  Instead I decided to give InnoSetup another chance.  I had tried it back when it was “brand spankin’ new” and didn’t really care for it, but that was a very very long time ago (before 2003).

I downloaded Inno Setup 5 and within minutes I was building an installer for the Basternae Editor.  I just ran through the wizard, added my files and executables, and fired it up.

Well, things were a little off on the first try — I wanted to run my app from the /bin directory and not the root program install directory.  Easy enough, the paths were right in front of me and I changed “{app}” to “{app}\bin” where it needed to be changed.

Next I found that it wasn’t using the executable’s directory as the working directory.  Yet again this was easy — I just added WorkingDir: “{app}\bin” to the icon setting and I’m good to go.  Total time spent building the installer, including Google searches and test install/uninstalls was about half an hour.  Nice.

The true test is whether it’s easy to maintain an install script.  I made a new build of the Basternae Editor today and wanted to update the installer.  The editor had no functional changes, just icons added to the menu so it’s a little clearer what button does what.

So I fire up InnoSetup, change the version at the top of the script from 0.39 to 0.40, hit “compile” and let it do its magic.  Seconds later I have a working install.  The best part is that this install cleanly installs over the top of an existing install, updates the listing in add/remove programs, and is COMPLETELY HASSLE FREE, a concept that was pretty alien to me given my InstallShield and WISE Installer experience.

So, here’s the new build of the Basternae Editor:  http://www.basternae.org/Basternae3EditorSetup_v0.40.exe

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.

I Can’t Run Windows

I have two computers at home — a cheapie $400 Gateway T-8635u laptop I bought on sale at Newegg a couple months ago and a homebuilt desktop based on a Gigabyte P43-ES3G motherboard, E8200 CPU, 4GB of RAM, Nvidia 7600GT and FX5500 GTS video cards, 2 Envy24-based sound cards, two Samsung DVD-RW drives, and 320, 500, and 640 GB SATA drives.  Pretty standard, mainstream hardware.

Well, strangely enough I’m completely incapable of running Windows natively on either one.

The laptop has a “restore partition” that you have to use to install Windows.  When I first got the thing, I set it up as a dual-boot Ubuntu and Vista machine.  Well, the Vista partition somehow got corrupted and attempts to restore from the “restore partition” always fail.

No problem, I can just boot to a “real” Windows OS disk.  No luck.  If I boot to WinXP, the machine bluescreens and reboots after I hit the “F8 – I Agree” after the license.

Instead I have Ubuntu with VirtualBox loaded on the laptop and Vista installed in that, which runs perfectly fine.  It just won’t run on the hardware without Linux in-between.

OK, now on to the desktop.  If I try to boot to Vista, it bluescreens before the splashscreen and instantly reboots.  If I try to boot to the install CD, I get as far as selecting the drive to install to before being told that there are no valid drives installed.  I can run Ubuntu fine, and have WinXP installed in a VirtualBox so I can run the essentials — Visual Studio, Netflix player, DVD player (still haven’t gotten DVD playback working in Linux.  How lame.)  The bad thing is that I can’t access my Mustek A3 scanner (but the Canon LiDE works great).

It’s a little sad that I *have* to run Windows to accomplish the things I want to do, but the market share of Linux sucks so bad that I couldn’t *buy* software if I wanted to.  And I do.  I’m not above paying for things that are useful.  I’d gladly shell out $3-600 for a native copy of Photoshop or VS2008 on Ubuntu.  After all, I make more than enough money from doing work on those apps to justify buying them.

It just sucks that I can’t run Windows natively on any of my systems.  If only they had decent hardware support, but Microsoft is trying really hard to fail at OSes.  Everyone says that Windows 7 will be the be-all-end-all operating system, but I’ve used it and just don’t see it.  It’s just Vista for people with touchscreens.

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.

A Little Overwhelmed Right Now

Progress will have to halt for a bit — started the new job and there’s a bunch of things I don’t know as well as I’d like to, so it’s reading tech books that’ll take up the spare time for the next few weeks.

Masquerades

I just finished reading Masquerades by Kate Novak and Jeff Grubb, tenth book in The Harpers series. I skipped over the ninth book, Crown of Fire, because I ordered it from Paperbackswap and it hadn’t arrived by the time I wanted to pick up another book.

I have mixed feelings on the book. Most of the main characters are from Novak and Grubb’s earlier book, Azure Bonds. The problem is, I didn’t actually like any of those characters. They’re entirely too lifeless and one-dimensional and it’s not really worth caring about what happens to them. Despite the characters, the book has a good plot and in defiance of the lack of character development and choppy dialogue, I had to keep reading just to find out what happened next and which factions were victorious and which were destroyed. It wasn’t as bad as a George R.R. Martin book where the plot is enthralling but the writing is about what you’d get from a 5th grader, but it was still fairly dissonant.

Overall I’d give the book 2.5 stars out of 5. If you actually like the characters from Azure Bonds, give it a read.  Otherwise it’s probably not worth it. As for Azure Bonds, the gold box game (Curse of the Azure Bonds) was better than the book.

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 some preliminary “how broken is it” testing so I know what needs to be fixed before the real work (building) can begin.

Goodbye, Pizdook

One of the things that I do for the FindMUD mud listings is check connections once in a while (approximately monthly) to see if a MUD server is running and then display a log of connection attempts on that MUD’s listing page.

When I was on shared hosting, that was a process that was far more involved than it should have been.

Step 1:  Get a list of currently active mud listings to query.  For that I created a custom hidden view in Drupal that I could copy and paste into my connection test app.

Step 2: Run the connection tests.  I wrote an app specifically to do this by checking telnet connections to each MUD on the list.  If would generate two sets of SQL queries.  The first contained the connection results, while the second contained any changes to IP addresses.  I called the executable file “Pizdook”, which is a scathing insult used in Orson Scott Card’s Homecoming series of novels.  It represented my annoyance at having a multi-step process due to the limitations of using shared hosting.  Here’s a screenshot:

Step 3: Log into PHPMyAdmin and paste the queries generated by Pizdook into the “execute SQL” window to update the database.

Thanks to some new-found knowledge of SQLAlchemy, I’ve rewritten the app as a Python script that I can run with a monthly cron job.  Suddenly it’s hands-off, a single-step automated process that I no longer have to spend any effort on.

Resource Usage For Basternae 3

Here’s the resource usage for Basternae running on Mono on Ubuntu with 1 active user and 6 zones loaded:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     24624  0.2  6.9  39284 25548 pts/0    SNl  21:40   0:08 mono Basternae.exe

I have to imagine with a full complement of zones and a few active players that the memory usage will reach 64MB VSZ and 48MB RSS with probably about 1.2% CPU usage.  This would be well within the abilities of the current hosting and would use about 15% of the overall available resources.

What I am a little afraid of is memory leakage.  Contrary to popular folklore, running C# does not completely eliminate memory leakage, it just makes it easier to avoid.  The nice thing is that I’ve designed all of the game objects with instance counters, so at any time I can get a count of how many rooms, objects, mobiles, etc. exist in memory at any given time, whether they’re actually active in the game or not.  This will make it easier to track down leaks if any happen.

Worst case is if resource usage expands drastically we may have to upgrade from the Linode 360 to the Linode 540.  In that case, running Basternae would cost a total of $120 per year.  I’ve been spending that much on lunch every two weeks (I really need to cut down, but I work next to all of the best restaurants in my city), so it’s not exactly a huge number in the grand scheme of things.

It should also be mentioned that on Windows, memory usage is only 14MB.  Running on Linux/Mono requires a lot more resources.  Part of this is because some of the things used by .NET are automatically loaded by the Windows OS so they don’t contribute to memory size, and part of it is because in a way Mono is actually a “Windows software emulator” and is less optimal than something like a C executable compiled to run natively.

A New Job

For the past two years I’ve been working for a home automation company, first as a developer and then as a development manager.  Unless you’re deaf, dumb, and blind you know that the real estate market has been far less than optimal for the past year or three.  That makes it pretty challenging to work in an industry driven primarily by new home sales and secondarily by stock and investment markets.

I’ve just been offered a development job with a glass company, one that’s not particularly affected by real estate market cycles.  I start in two weeks.  It’ll be great to have a change of technology/scenery/responsibilities.  I’ll miss the people where I am now — I worked with some pretty kickass programmers and great people — but I have hit something of a plateau by not being exposed to any new environments lately.

What’s that have to do with Basternae?  Pretty much nothing, other than the fact that your friendly neighborhood codemonkey might get smarter by being exposed to new things.

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.

Elfsong

I just finished reading Elfsong by Elaine Cunningham, book 9 of The Harpers and the sequel to Elfshadow.  It was a 3.5-star book.  It had decent characters, and was your typical sword-and-sorcery novel.  A tale well-told, but not a tale you can’t live without.  Read it if you like the other Harpers books.

A Better To-Do List: Got-It-Done.com

If you’ve explored this blog much in the past you would have noticed that I had a “to do list” published.  It wasn’t well-sorted, and not all that easy to edit.

Since much of what I do in life is todo-list-driven, I’ve always tended to fill post-its and notebook pages with lists of things I need to get done, lists of ideas, tasks, etc.  While I’m at work, I’ll think of things I need to do and jot them down on whatever scrap of paper is handy.  It helps me stay focused, but I tend to have quite a clutter of papers on my desk.

The perfect solution for me to get rid of some of the clutter and make these lists available to me in more places than just my desk is an online solution.  There are already a solid handful of sites you can use to do that, but I’m far too hardcore for my own good.

Instead, since I wanted to get more familiar with the Django web framework and the jQuery JavaScript library, I built my own online task management application.  It was fun, challenging, and immediately useful.  I’ve moved the Basternae to-do-list to it and make use of it for everyday organization.

It’s free to create an account, so feel free to try it if it’s something you might find useful.  Here’s a screenshot of it in action:

Got-It-Done Task List Screenshot

Check it out at http://got-it-done.com.  It’s pretty beta, so feel free to offer suggestions and/or let me know if you have any errors.

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.

Soldiers of Ice

I finished reading book 7 of The Harpers — Soldiers of Ice by David “Zeb” Cook. It was just as good as the previous book, but with a twist:  a plot that was pretty original for a sword-and-sorcery book. I won’t give away the details, but I will say that it’s a solid 4-star book worth reading if you like the genre.

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