Hover Info And Names
This week was the last productive week before the holidays, and it's going to get mental for a while after that, so there's that.
Hover over enemies - info
I read in some reddit post some mention of Brogue's hover-over-enemies display of hit info and things like that. I played Brogue a long time ago, but I'm not a fan (I know, heretic extraordinaire) so I wasn't aware of that. I also support hover information, but it would just say "Rat" rather than giving you a blurb regarding hitting who can hit whom and how hard. So I thought "that sounds pretty useful!". It wasn't actually very complicated to implement, but now I've got my overkill version of hover-over-info. This version shows:
- From the point of view of the enemy
- If it can perform a melee attack, show stats ( chance to hit, chance to crit, damage per type, crit damage per type)
- If it can perform a ranged attack, show stats
- If it can perform a thrown attack, show stats
- show defender stats, at the moment just resistances (flat and percentage based)
- From the point of view of the sensor (I don't say player because if you're possessing some other creature, that's the perspective), show the same data
Damages are shown as ranges where applicable, due to some RNG values. Also for damage types I dug the game icon database for some relevant ones, so that when displaying damage per type, I'm showing icons rather than writing e.g. "slashing: 14-56". So, that works well, look at the relevant video for an example of this. It's not as nice and natural text as Brogue's, but I'd rather have pure stats -- they are easier to translate too. Also, to note for the future: Depending on the familiarity with the target creature, not all stats will be shown. For unfamiliar creatures you won't know anything, for a bit more familiar you might know the chance to hit, and so on. This might be an incentive to invest in some particular skills, plus the familiarity will increase the more you encounter such creatures. But this is just theory for now.
Naming enchanted items
That's an ongoing, gruelling bit of work. I want to scale up equipment enchantments, as I'm back on that subsystem now, and it's of course more complicated the more I look at it. The simplest bit of related work: I've added a sprite glow in the inventory for enchanted items. At the moment it's just a blue colours, but later on, according to various item properties, this can be changed. The glow is some very cheap, cheaty bit of shader code that works well with low-pixel-resolution sprites.
The more complicated part is architectural (my usual pain!): where do I store relationships of enchantments -> names. My so-far approach has been to store any such name modifications directly in enchantment information, but that quickly gets out of hand. For example, for the purposes of a Damage Percent Increase enchantment (parameter 1), for slashing damage type (parameter 2), for a grade 3 enchantment (parameter 3) that actually causes inverse effect -- reducing your damage -- (parameter 4), store a suffix (parameter 5): in this case the word might be "Dullness", e.g. you create a longsword of dullness. After some contemplation I decided that I need some global storage for all these versions, and maybe the approach becomes obvious when phrased as above: a single flat dictionary. The dictionary itself stores a key that combines all parameters and matches that to a word. Some examples in this screenshot: https://i.imgur.com/ZRfGGJF.png
The other woe is finding a way to create all these words without having to do it ultra manually! Oh the joys. I've tried ChatGPT, and it came up with a bunch of stuff, but it needed a lot of iterations to remotely attempt to obey some rules, and even then, it's frankly not great at it. Maybe it's better if I reduce the scope, rather than "generate 15 variations for each of those 50 parameters". My newer approach, which is currently failing, is to use some NLP library in python to get synonyms. Now that's easier said than done. WordNet can do it but it only accepts single words, e.g. can't handle "very small". For more advanced NLP supposedly there are libraries like spaCy. I tried using that, and failed, as apparently there must have been a library change lately (?) that renders example code online unusable. ChatGPT and the likes of course can't help with that as they're just stealthy old-data-processors. So, this is still work in progress, but I'm probably going to use a combination of everything above except spaCy -- in their documentation website"synonym" did not appear anywhere relevant, so I don't know what to say besides "let's skip that one".