Data-driven item generation for Equipment Explained

Equipment Explained is mostly practice for clear, accessible UI, but I still made an overly-complicated system to generate items.

The parts of an item

  • base item
    • item quality
    • (optional) prefix
      • prefix quality
    • (optional) suffix
      • suffix quality
    • (optional) requirements

The base item is either armor or a weapon.

  • weapon
    • type (axe, sword, hammer, etc.)
      • which stats the item boosts
    • slot (main hand, off hand)
      • where the item can be equipped
    • tier (0-3)
      • magnitude of bonuses
  • armor
    • slot (feet, body, head, etc.)
      • where the item can be equipped
      • magnitude of bonuses (a breastplate provides more armor than gloves)
    • tier (cloth, leather, plate, etc)
      • which stats the item boosts (leather boosts DEX, plate boosts HP)
  • item quality
    • probability of prefix
    • probability of rare prefix
    • probability of suffix
    • probability of rare suffix
    • probability of requirements
    • multiplier for magnitude of
      • item bonuses
      • prefix bonuses
      • suffix bonuses
      • requirements

Common affixes only boost a single stat, but rare affixes boost several stats

  • prefix
      • quality
        • multiplier for bonuses of prefix only
      • stat bonus
  • sufffix
    • quality
      • multiplier for bonuses of suffix only
    • stat bonus
  • requirements
    • lower limits for a set of thematically linked stats that must be met for an item to be equipped.

Simplifications

Because I’m not making a whole game, I was able to skip some constraints that most RPGs use.

Thematic Affixes

Some games limit certain affixes to certain types of items, such as

  • “of Fleeted-footedness” only appears on boots
  • there are no poison resistance rings
  • helmets tend to boost INT.

The base items in Equipment Explained specialize with only a few stats, but affixes can affect any stat, and any item can have any affix. So a sword is sure to boost Slashing Damage, but sometimes cloth gloves will boost Slashing Damage even more!

Balanced Requirements

Most RPGs will give more powerful items higher requirements, and thematically appropriate ones. So a magic staff may require a lot of INT or MP to equip, while a small hammer would instead require a bit of Strength. In Equipment Explained, higher quality items are more likely to have requirements, but those requirements are chosen randomly and aren’t associated with the bonuses the item provides.

Playtesting/Balance

Equipment Explained doesn’t have combat, experience, loot drops, or an economy.  I don’t have to worry about items being fair. Is it reasonable to scale Health from a base value of 100 to 2700, or to 125? I don’t care. I do care that it’s very obvious how much those boots will increase your Health, how much you need to increase your Magic Resistance to equip those boots, and which items will help you reach that goal.

Implementation

I created an LibreOffice spreadsheet with a sheet for each type of data. The first row in each sheet is human-readable labels for each column, which the game engine has no use for, so I don’t use LibreOffice’s built-in CSV exporter, which will export every cell in a sheet.  Instead I drag-select the sheet (except for the header row) copy and paste into a text document.

So the 10 sheets of one LibreOffice spreadsheet become 10 .txt files, which I place in the resource directory of my Godot project.  I write a custom function to read each file, and save all the information about items, affixes, requirements, probabilities, etc. into data structures.    affix.txt contains information for both prefixes and suffixes, since they are so similar. The function that reads affixes.txt can also read affixes_rare.txt, which uses a similar format. Weapons are armor are defined by a two-dimensional array of type and tier, and CSV files are good for one-dimensional lists, so armor and weapons need two CSV files each to completely define the space.

When I create an item, I pick from the list of items & the list of qualities. The quality specifies the probability of requirements, prefix, and suffix, so based on those odds I may pick from those lists as well. Pretty basic stuff once all the data is loaded from the files.

Manually copying data from spreadsheet to text file is error-prone busywork, so if I continue developing this, I’ll need to automate that step.