How do you identify an adventurer? They’re the ones carrying their own weight in weapons, armor, and dungeoneering paraphernalia. Cool equipment and treasures are essential to the CRPG experience.
Last night I sat down to sketch out the first draft of an equipment system for the engine so I can start buying and selling things. There’s not much to it yet – I haven’t added any support for equipping or using items – but it’s a place to start from.
Each piece of equipment in the game will have three pieces of data associated with it (so far):
- A name (“club”, “leather armor”, “priceless diamond”, etc.).
- One byte of data that’s fixed for every instance of an item. So far I’ve defined two flags that an item can have – STACKABLE (for items that the user might have many of, like arrows or torches), and HAS_CHARGES (for items that have a limited number of uses, like a magic wand).
- One byte of data that’s specific to a particular instance of an item. What I mean by this is that while every arrow should have the STACKABLE property, the arrows in the player’s inventory need to know how many arrows are in the stack. So far I’m using this byte for the number of items in a stack or the number of charges in a charged item. I could also use it for weapon and armor durability, but I’m usually not a big fan of durability systems.
I added a simple character statistics screen to display the inventory – you can see it at the top of this post. For now the player can have 20 items in their inventory. I picked that number for no better reason than that it seemed like a number that would fit conveniently on a single screen, so it’s subject to change. At some point when there’s a real game here we’ll need to sit down and make real decisions about that sort of thing based on game balance, but for now it’s just a matter of making something work.