I have mentioned this a couple of times already but here it goes again: I started making games in 2007. Back then it was really, really hard to gain access to a Game Engine to handle content creation with. Unity was nowhere in sight, Unreal licensing costs was out of my reach and the only tools left for me to use were frameworks or rendering API’s (anyone remember OGRE? Irrlicht?). Level editors weren’t common and game system documentation was sparse so I had to learn to manage and design everything myself.
For Ebony Spire: Heresy I wanted items to play a central role in the game. I wanted them to be more than just stat boosters and behave like actual objects that you can interact with. They can be picked up, equipped, thrown, casted and used by both the player and the enemy entities/creatures that exist in the game. I also wanted to be able to add new items to the game on the fly without having to compile the game every single time. So how do I handle items in my game?
CSV files. Simple, text-based, readable and easily parsable files that act as a table in which I can add entries. It acts as a database containing a list of items governed by the following properties:
Name | Type | Asset | Color | Effect | In Game Description | Weight | Damage | Multiplier | Spell Damage | Defense | Arcane Defense | Value | Modifier Type | Modifier | Can Spawn | Chance to Spawn | Level List |
Seems like a long list of things to add but most entries are just flavor. The really interesting bits happen with the Type — Effect — Modifier categories.
Type is just that. It tells us what kind of a item it is. Is it a piece of armor that can be worn? Is it a weapon? A potion? A trinket, a ring maybe? Is it an artefact, a scroll, a book or a spell? Type dictates the behavior of the item when it’s put to use. Take the Weapon type for example: It increases the player’s damage when melee-ing enemies. However the weapon itself can have very low damage for melee but a high Damage Multiplier that increases damage done with another equipped weapon. A scroll however cannot be used in battle to deal melee damage but can be cast by selecting it in the inventory and pressing the <Use Key>. Or thrown at an enemy for close to no-damage.
Effect tells us what kind of a… well — effect — an item has when used. A dagger with a healing effect can heal the player when <Used> from the inventory but also the enemies when attacking with it. If an enemy creature uses the dagger on the player chances are it will only help the player. The effect is triggered every time the item on which it is applied is <activated>. This includes self-activation, when attacking with it in melee or when thrown. In-Game effect range from Teleportation, Healing, Summoning, Blinding, Damaging, AoE Damage, AoE Healing and Revealing the map just to name a few.
The Modifier Type field can cover specific needs such as only affecting items that are thrown. Or only performs the applied effect on creatures/the player with the hp_regen effect applied to them.
By combining this three categories we can create a huge amount of item combinations like a Dagger that teleports the enemy to a random location with each strike. Or a coin that blinds the target when thrown. Applying the Magic Missile effect on a piece of Armor effectively causes arcane bolts to fly towards the direction the player is facing every time a creature attacks the player. Fun fact: all spells in the game are items. Even a single Magic Missigle bolt is an item that can have another effect attached to it. This makes it possible to create a monster that has a 10% chance to catch a magic bolt if it hits him. And as such can throw it right back in your face on his turn. Kinda neat ha?
Going even further we can play with the weight parameter to make objects inside the game (like barrels, and chairs) pick-able by anyone. Their weight would not make it possible for the player (or any entity) to hoard 20 barrels in their pockets but the increased weight of the object makes it for a handsome amount of damage when it connects with it’s target’s face. Especially if we add an explosive effect (hi modern FPS’s). So throwing a scroll that only weights 0.01 kg wouldn’t do you much good but a chest? Worth carrying!
So we can make an extremely heavy earring that slows you down to a crawl but can decimate the end boss if it hits him. And the applied effect triggered on impact will summon three more bosses :)
It sounds simple and to be honest, it is. And it’s easy to use this method to create as many items with variations as possible. And spells. And the fact that all items can be used by enemy creatures the chances for wacky, fun and interesting things to happen is huge. Especially when Polymorph gets involved.