This is my first article here, thank you kindly for stopping by! Editor tools are all the rage, and XML-driven data is one of our core design goals for the modification and extendibility by our players. In that spirit, my latest goal was to overhaul the existing corpse harvesting system and replace it with a loot-drop driven system. To the un-initiated, the system involved opening up a corpses’ inventory after you had killed it and using weapons or tools to harvest resources from it. This proved to be cumbersome, as it required going into a menu screen and inventory management and forced you to stay in the menu until the harvesting process was over. We still want the player to be occupied while harvesting a corpse, as you are hacking apart a beast you just killed for it’s innards. That’s not the kind of thing that lends itself well to multi-tasking. The tools are also able to be equipped by the player. Is there a way we can do this, that is less disengaging for the player, and ties in to the existing systems?
Well yes, this article would be a bit anti-climactic if there wasn’t. When you abstract it, the corpse harvesting process goes like this: Kill a creature, interact with the creature, use a tool/weapon on the creature, wait, get the creatures resources. We can make this better. What if we combine the middle 3 steps into one? We end up with: Kill a creature, attack it with weapon/tool until the corpse is damaged enough, get the creatures resource. The systems already exist in the game for dropping items on the ground when dirt/grass/rocks are destroyed, so we can leverage that for use here. So, what’s good about this? The way that the player interacts with the world is consistent. When harvesting resources from a dirt block or grass blade, the player does not enter a menu and input a tool. The player attacks the target, and when it is destroyed, it drops the resources. This added consistency to corpse harvesting reduces the need to teach the player and is likely something a player will try without prompting once they understand that attacking things yields resources. This method also reduces player down-time staring at a menu screen, as they have to be actively engaged during the process. That’s the player experience of the new method, but we have additional complexity going on under the hood that is going to affect the balancing and make the experience more interesting for the player.
I’m going to give you a hypothetical. You’re a hunter. You’ve just downed a deer or similar big game with bullet or arrow to the neck. You go to claim it’s pelt to make a shawl to keep warm on the cold winter nights that are to come. Are you more likely to get a nice, clean, intact pelt by using a knife to cut around the sinew, or by using a hammer and pulverizing the creature until the fur is flung haphazardly from it’s frame? Right, it’s a dumb question, but I think you see my point. We have weapon types in the game, stabbing weapons, bashing weapon, slashing weapons. It would be interesting if the tool that the player chooses to attack the corpse with would yield different resources, or different chances of resources. This idea forms the basis for the loot table. We need a way to input a damage type into a loot table and get back a set of loot to drop for that creature. We also need to store and manipulate this data both while developing the game, and for players to modify once the game is in their hands. Are you thinking what I’m thinking? That’s right, an editor tool for an XML document.
There are several editor tools linked to XML documents already in the game, so we can crib the framework from these and modify to meet our needs. We need individual loot tables in a list, with the whole list stored inside a larger object. Each loot table is linked to a creature id, when the creature is spawned, it stores a reference to the loot table in the creature, to look up the items to drop when it is harvested. Some games just store what will be dropped by a creature when it is spawned. We are unable to do this, as we do not know which tool the player will use to harvest the creature. In each loot table is a list of loot drop items, which contain a reference to the item which they are associated with, and a set of percentage chances for each damage type that dictates their drop rate. We have also modified weapon items to have a harvest chance modifier, which is passed in when the loot is generated, which allows certain weapons to be better than other weapons at harvesting in the same class (sharp stone vs stone axe). This all works great, but one thing I found while testing was that I needed to see how loot was being generated in the editor. For this I just hacked in a button to generate a loot drop from the given input and show the output.
This works just fine for our needs. Right now, the loot generated is based upon the weapon that last hit the corpse as it ran out of health. In a future pass, I would like to keep a ratio of the damage done by each weapon type with each harvest modifier and have this play into the drop rates. But at this point, this is functional and gives us a lot of room to make things more interesting for the player.
Thanks for joining me on this little foray into loot tables! This stat driven stuff really gets me going, and I’m looking forward to doing some severe balancing with all the editor tools we have at this point. Look forward to a decent shakeup to existing experience coming soon!