Potions, bottles and sprites
Ok, weekly update time! It's not super-expansive, but it will have to do, to get back at the weekly pace. So, the main theme for this week is items, and more specifically potions/bottles.
On potions and bottles
I've implemented a super-flexible enchantment system, and I want to use it! But, when reality kicks in (and basic design intelligence) I realise that it's not a good idea to have lots of item types that can do everything. So, let's see what's going on here - everything in the context of items that can be used. I've got:
- Flexibility in effects. Attribute boosts (temporary or permanent), skill boosts (temp/perm), status effect applications/removals, attack speed, attack/defense rating, resistances, etc. Granting skills, changing fov radius and so on. Most can be applied permanently or for a limited time. There's support for explicitly-coded effects as well, that might not fit into a neat category.
- Different item types: potions, bombs, oils (for equipment), scrolls, tomes, wands, etc
- Potions/oils/bombs come in "grades", to avoid having "level 22 healing potion" we have "supreme healing potion" (say 5 grades total)
So, what's the problem? I need to set constraints, for anything to make sense. E.g. I don't want a potion that increases your skill in archery - a tome should do that. So my current (WIP) allocation is as follows:
- potions: things that improve self (e.g. attributes/health/mana/resistances) permanently or temporarily
- bomb: typically negative area effects (e.g. stun/poison/fire)
- oil: effects applicable for equipment only (more temp than perm, to avoid cheesing)
- scroll: magic skills, one-off
- tome: improve skill or learn ability
- wand: magic, one-off (need to think it's differentiation with scroll - not happy about this)
- special: conjuring statuettes and the like
Alright! But potions is still a broad category. Also, since this is a graphical roguelike, I need flexible graphics. Questions that need to be answered, is: Can we easily differentiate between...
- a bomb, an oil and a potion bottle?
- a potion of increase intelligence vs a potion of status effect resistance? (different type)
- a potion of increase intelligence vs a potion of increase strength? ( same type different subtye)
- a minor potion of healing vs a major potion of healing? (same type/subtype, different grade)
Now one solution is to keep it lame and use some potion graphic from an AI pack of 10000 potion sprites, or find/make a procedural potion bottle generator. Guess what I chose :) WARNING: numbers follow
So, for the procgen potion generator, I've decided to pregenerate art rather than compose on the fly, but it's not huge effort to do the latter. My limitation is 2048 sprites because I keep my sprites in texture arrays, and it's the maximum array size. For 32x32 pixels of uncompressed RGBA sprites, this means 8MB of VRAM for our potions, plus 2MB for the distance field if needed. It's fine.
So, how do we generate combinations? A potion bottle sprite is a function of bottle shape, content color and grade:
- grade: My programmer-art self thought that I can represent the grades by different amounts of fill in a bottle. A minor healing potion would use the same bottle as a major healing potion, but the former will be 10% filled, while the latter would be 90% filled. It's far easier for me to create different fill versions rather than creating different shapes.
- color: this can be used to differentiate between different subtypes (e.g. potion of intelligence vs potion of strength), but also possibly differentiate between different types of the same category (e.g. a potion that permanently boosts something would use different color depend on the "something")
- shape: this can be used to differentiate between different types (e.g. potion that increases something permanently vs temporarily) and also would differentiate between bombs, oils and potions that are for player consumption.
At the moment I have 6 shapes, 3 of which are from DCSS and 3 are mine (altered DCSS versions really), which I call potion, phial, flask and flagon, bomb and oil. If we have 5 grades per bottle, this means that we're left with 2048/30 colours, which is 68. I've decided to use a palette for the colours, more specifically the resurrect64 one from lospec, which means I get a total of 1920 sprites and I have 128 to spare, for example these could be unique bottles for unique items. This leads to a nicely packed 10MB texture atlas for just bottles.
Gold stacks
I've been debugging gold and stacks, as different gold stack sizes have different sprite. All works fine now, so, video below!
Some unfoggy overworld to close off the weekly update: walking around with fog of war turned off, just to enjoy nature a bit :)
Have a nice weekend and see you next time!