Skip to main content
  1. Posts/

Day 48 - Minimalism 2: Janitorial Supplies

OldDays seitan-spin csharp
Table of Contents

Seems legit.
Seems legit.

What do you want?
#

Ok, so we’ve got a minimal server database, and we’re getting some interesting errors:

6/3/2016 1:01:58 AM: {SystemFailure} Failure in JanitorEvent while pruning cells.
6/3/2016 1:02:08 AM: {SystemFailure} Failure in JanitorEvent while pruning cells.
6/3/2016 1:02:18 AM: {SystemFailure} Failure in JanitorEvent while pruning cells.
6/3/2016 1:02:28 AM: {SystemFailure} Failure in JanitorEvent while pruning cells.

And:

6/3/2016 1:01:48 AM: {SystemWarning} Item.CopyItemFromDictionary(24550) ITEM ID does not exist.
6/3/2016 1:01:48 AM: {SystemWarning} Item.CopyItemFromDictionary(100) ITEM ID does not exist.
6/3/2016 1:01:48 AM: {SystemWarning} Item.CopyItemFromDictionary(8010) ITEM ID does not exist.
6/3/2016 1:01:48 AM: {SystemWarning} Item.CopyItemFromDictionary(15010) ITEM ID does not exist.
6/3/2016 1:01:48 AM: {SystemWarning} Item.CopyItemFromDictionary(25020) ITEM ID does not exist.
6/3/2016 1:01:48 AM: {SystemWarning} Item.CopyItemFromDictionary(7206) ITEM ID does not exist.
6/3/2016 1:01:58 AM: {SystemWarning} Item.CopyItemFromDictionary(33020) ITEM ID does not exist.

Let’s find that SystemFailure message and look into the Janitor code:

DragonsSpine/DragonsSpineMain.cs
708
709
710
711
private static void JanitorEvent(object sender, ElapsedEventArgs eventArgs)
{
  try
  {
DragonsSpine/DragonsSpineMain.cs
829
830
831
832
833
834
835
836
837
  }
  catch (Exception e)
  {
    Utils.LogException(e);
    Utils.Log("Failure in JanitorEvent while pruning cells.", Utils.LogType.SystemFailure);
  }

  NPC.DoSpawn();
}

Looking at that piece of code, one thing immediately jumps out:

DragonsSpine/DragonsSpineMain.cs
795
//the janitor is also a gardener, and places berries where they should be
DragonsSpine/DragonsSpineMain.cs
815
816
817
818
819
  if (cell.balmBerry && !hasBalmBerries) { newBerries = Item.CopyItemFromDictionary(Item.ID_BALMBERRY); }
  else if (cell.poisonBerry && !hasPoisonBerries) { newBerries = Item.CopyItemFromDictionary(Item.ID_POISONBERRY); }
  else if (cell.manaBerry && !hasManaBerries) { newBerries = Item.CopyItemFromDictionary(Item.ID_MANABERRY); }
  else if (cell.stamBerry && !hasStamBerries) { newBerries = Item.CopyItemFromDictionary(Item.ID_STAMINABERRY); }
  cell.Add(newBerries);

I wonder what those Item IDs are?

DragonsSpine/GameObjects/Item/Item.cs
19
20
21
22
  public const int ID_BALMBERRY = 33020;
  public const int ID_POISONBERRY = 33021;
  public const int ID_MANABERRY = 33022;
  public const int ID_STAMINABERRY = 33023;

Well, that resolves at least one of my ITEM ID does not exist. What about the others?

  • 100. Wooden shield - according to our minimal CharGen table, should be in the left hand of any freshly-spawned Barbarian Fighter.
  • 7206. Dog fur - according to our mininal NPC table, should be the tanning result of the Kesmai dog.
  • 8010. Leather tunic - according to our minimal CharGen table, should be worn by any freshly-spawned Barbarian Fighter.
  • 15010. Leather leggings - according to our minimal CharGen table, should be worn by any freshly-spawned Barbarian Fighter.
  • 24550. Wooden spear - according to our minimal CharGen table, should be in the right hand of any freshly-spawned Barbarian Fighter.
  • 25020. Iron shortsword - according to our minimal CharGen table, should be on the belt of any freshly-spawned Barbarian Fighter.

So we minimized the character and NPC lists, but didn’t account for what they referenced as far as items. We can fix that; we’ll just put those items into the minimal DB.

Lonely Town
#

Booting up the server with the new minimal DB:

6/3/2016 3:09:02 PM: {SystemGo} Drag Spin Exp 2.0.99.5
> 6/3/2016 3:09:02 PM: {SystemGo} Compiling scripts.
> 6/3/2016 3:09:02 PM: {SystemGo} Compiled!
> 6/3/2016 3:09:03 PM: {SystemGo} Added Facet: Agate
> 6/3/2016 3:09:03 PM: {SystemGo} Added Land: Beginner's Game to Facet: Agate
> 6/3/2016 3:09:03 PM: {SystemGo} Loaded Map: Island of Kesmai
> 6/3/2016 3:09:03 PM: {SystemGo} Loaded Cell Info for Island of Kesmai...
> 6/3/2016 3:09:03 PM: {SystemGo} Loaded SpawnZones (1)...
> 6/3/2016 3:09:03 PM: {SystemGo} Clearing PC Location Data.
> 6/3/2016 3:09:04 PM: {SystemGo} Loaded Spells (0) ...
> 6/3/2016 3:09:04 PM: {SystemGo} Clearing NPC Location Data.
> 6/3/2016 3:09:04 PM: {SystemGo} Creating NPC Catalog.
> 6/3/2016 3:09:04 PM: {SystemGo} Loaded NPCs (1)...
> 6/3/2016 3:09:04 PM: {SystemGo} Spawning NPCs.
> 6/3/2016 3:09:04 PM: {SystemGo} Restocked 0 store records.
> 6/3/2016 3:09:04 PM: {SystemGo} Master round timer started.
> 6/3/2016 3:09:04 PM: {SystemGo} Save timer started.
> 6/3/2016 3:09:04 PM: {SystemGo} Janitor round timer started.
> 6/3/2016 3:09:04 PM: {SystemGo} Chronology timer started.
> 6/3/2016 3:09:04 PM: {SystemGo} Lunar cycle timer started.
> 6/3/2016 3:09:04 PM: {SystemGo} Inactivity timer started.
> 6/3/2016 3:09:04 PM: {SystemGo} Listening for connections on port 3000.
> Protocol Server listening to port 4000.
6/3/2016 3:09:04 PM: {SystemGo} Starting main game loop.
> 6/3/2016 3:09:34 PM: NPCs: [1] | Players: [0] | CPU: [??%] | Rnd: [5]

Wow, just a couple of seconds to start up. Checking the memory, the server executable settles down to about 140mb. Much better than the 14 seconds and 360mb we were seeing before. Let’s log in and take a look around.

Hello, dog.
Hello, dog.
Kind of spooky.
Kind of spooky.

Nice and quiet. But even just this map is still awfully big:

A whole lot of nothing.
A whole lot of nothing.

We can fix that, too. Tomorrow.


More to come
More to come

Day 48 code - tests (actually just SQL scripts)