Quickslots
Ok full speed development (well, part-time anyway) for this week, and the focus was belts and quickslots.
Quickslots
This was the bulk of work for the week, and it happened in the latter part, but I have to start with this.
In the game I have a lot of "usable" items: potions, scrolls, etc. So far you can open the inventory, select one such item and click "Use" from a context menu. Now this has two problems:
- In the heat of battle (ok it's turn-based, but still) you don't want to open menus and scroll over pages of items. You want something quicker and more streamlined
- Ok you might say "use the hotbar at the bottom of the screen, duh" (that's the area where we have ability shortcuts, for those who don't know, which is probably 99% of you). Sure but there's another problem.
- It's a bit nonsensical game-wise to have quick access to anything you might be carrying, for instant use, without penalties.
So, the answer is obvious - use "quickslots"! These are a few slots where we can place items we can use or throw, and we can execute that command quickly. You can still use/throw items straight from the inventory, but it costs more time (actually the time to transfer an item from backpack to quickslot: 1 turn) and is less desirable. Now for this I had to make some GUI like the ability hotbar, but to support game sprites rather than icons (sounds the same to you but there be dragons under the hood), and some other paraphernalia that needs to be implemented for "proper support", like being able to clear a slot, updating the slots when using items, and so on and so forth.
After some sweat and tears, this works pretty well it seems. And there's more! AI can use quickslots too. How?
- Adding an item to a quickslot is an innate ability. The "utility" value of this action is high if we have empty quickslots and usable items. Basically this means that it will be prioritised if quickslots can be filled.
- Using an item can prioritise quickslot items. Actually we can ignore other items if we have items in the quickslots. Additional benefit: AI is ever slightly faster.
- As above with throwing items, although some AI for that is yet to be implemented
Overall I'm pretty happy with this choice, as it adds another strategic layer in the game, as clearly I'm going for the "depth by a million features" approach. I'm also happy that it didn't really take that long to implement.
But now you're left with the burning question: "How many quickslots does a creature have?" And the answer, as always, is ... it depends! To have some flexibility for builds/strategies, the number of quickslots is dependent, among other factors by ...
Belts
This is a new item type, and a new equipment slot type. It doesn't affect the in-game character sprite (yet). The reason for adding yet another equipment slot was purely for supporting quickslots in a sensible way. You can't have "potion belt" without a belt, can you? So, different belts can provide different number of quickslots, and we can support quickslots as an enchantment type (e.g. "belt of carrying" could boost quickslots even more, at some reasonable max of currently 10).
Now there were two challenges for this:
- Finding sprites: I didn't think twice about this, just got an asset pack with 50 belts and just used a few as variants. Done.
- In-game support for a new equipment slot type: that was barely any work really, just a couple of enums and edits in a json file, it was extremely easy. Belts are armor, so they get spawned wherever armor spawns, and get armor-like enchantments. At some point I need to add some clause to increase their chances of getting a ...
- Quickslot enchantment: Still not complicated, slightly longer than adding the new slot type (go figure)
And that's about it with the belts!
Misc
Some other work that was done: above the spot that I wanted to place the quickslots (middle-right) there was this half-baked display of what you're carrying in main/off-hand. I thought that was pretty useless, so I changed that. Now it says what types of default melee/ranged attacks you have available based on equipment; iterative improvement, but still.
That's it for this week, have a nice weekend!