Light and Darkness
A kitchen sink of updates this week, including visuals, gameplay, "UI" and some refactoring.
Light and darkness. While I'm currently supporting dynamic lighting and light sources, the only light sources that I had so far were torches/braziers (on walls or floor), so no light spell or other item effects. Obviously this needed fixing, as I've put a bit of work on the lighting system, so it can't be a one-trick-pony. What I've done now is:
- Added support for a "touch of light" spell. With this placeholder spell, any item or creature within melee distance of the caster can be temporarily be converted into a light source (caster included). Light does not penetrate walls (so it's not euclidean distance to source)
- Added support for a "touch of darkness" spell. This is very similar, but the target becomes a beacon of darkness, reducing light at a maximum at the target, and the effect gradually reduces using euclidean distance (so, it does penetrate walls)
At the moment, what I dislike is that the unexplored fog of war and maximum darkness look exactly the same, and while that's acceptable in ASCII due to inherent constraints, here it's just my creativity (and my shader's complexity) that are currently limiting me from a better solution.
Level messages. When the player enters a level for the first time, they make a comment (for flavour), like "this place reeks of death and decay", which appears like a text bubble. I have a bunch of these messages, and each is associated with certain requirements (level type, climate, level tags), so only a relevant message will get selected.
Adventure location status icons. I wanted to generalize the mini-UI that is shown when hovering over creatures, that shows health, awareness state, disposition to player etc. I want something similar for non-creatures as well, for example adventure locations in the overworld, which could show the danger level (easy, normal, hard), if we've ever visited the location, and if there's some active quest in there, so I added support for that by refactoring a bit. Next support would be a similar UI for level objects (e.g. graves, fountains, bookshelves), but because the code is now generalized, the hardest part is to just find some nice icons and decide what info I want to show.
Dungeon feature placement database refactor. This was some semi-major internal refactor work, that thankfully resulted in easier-to-use dungeon feature specification. So now instead of creating presets for each dungeon type of which features they support and with what distribution (which is very tedious), I instead have the features specify requirements, for when they should spawn. The requirements can also specify some weighting adjustments based on tags, so we can apply tags to boost or reduce the chances of a feature appearing. This works now and resulted in overall code reduction, but I have to explore some more edge cases to ensure it's flexible enough as-is.
Also, very minor fix, torches don't spawn next to each other, as the specification for this feature type now includes "don't place a feature on a tile that's adjacent to another such feature"