Item Work, Spike in Usage, and the Next Update
First off I'm really glad to see that we've had more users signing up/logging into Revel lately. I hope everyone is enjoying what little content there currently is at this stage, and I just wanted to take a moment and say thanks for the support!
I have tentative plans to release the next alpha version of Revel sometime this evening 1/31 eastern-time US; probably late-night.
Last night It was time to implement what I'd termed 'dissolvables' in the past; which is a really horrible name; but the idea is, an item that when you pick it up, it has an effect immediately and dissolves the actual item (never hitting your inventory).
Some games might call these 'pickups'.
The implementation of this feature is very simple, first I had to denote that an item type would perform this kind of action; and then check for it when an item is picked up.
After being picked up, if this flag was set, I simply called 'use' on the item, to get the desired effect; but the only tricky part is that for things like currency (bits, in the case of Revel) you express the item as a single 'bit' with a stack amount.
Now, actually calling use for 1000 bits isn't efficent and would cause a whole lot of problems, so the solution was to introduce a multiplier concept.
When attempting to use an item, if it is specified to be a 'pickup' a multiplier variable is set to the amount (stack number) of the item; and the multiplier is used in normal calculations that would be '1' by default.
This way instead of getting one thousand "+1 bits" notifications, you get just one "+1000 bits" notification.
In addition to currency this concept will be used for enemy drops of health/mana bonuses that will suppliment normal item consumables you carry with you.
However, when implementing the above feature, it was the final straw in what had become a bit of a mess. During the early development phase it was a very smart move to leave a lot of item flags as induvidua flags; such as:
equipmentType //an int of eq type
The problem with this, as many of you know, is it can result in "can't happen states" where you have flag configurations that are contradictory or just plain incompatible; for instance an item can't be consumeable but not useable; and a wieldable can't be usable or consumable... you get the idea.
So it was time to clean some things up... instead we now use:
toolType -[none, wieldable, useable]
equipmentType - [none, skin, hair, head, chest, legs, accessory]
consumptionType - [none, onUse, onPickup]
maxStack -[1 to 999]
staining - true/false
This wrangles things a bit better, by introducing some mutual exclusion.
With these parameters you can have:
Items that are weieldable [selectable as weapons, select on hotkey]
Items that are usable [use on click or hotkey]
Items that are equipable [non-none equipment type, even tools can potentially be equipable if a design allows]
Items that don't consume [certain spells, notably the Retreat spell which teleports you back to spawn]
Items that consume on use [classic potions/scrolls, etc.]
Items that consume on pickup [currency, health/mana bonues, buffs etc.]
Items that do or don't stack with limits
Items that can be equiped as dyes [staining flag]