Downscaling and Refactoring
Ok so this week went a bit off the rails. I got a bit obsessed with an implementation of a paper on Content Adaptive Image Downscaling which I plan to add on Pixel Pal. The implementation was successful, even though I still get some problematic edge cases where I need to tweak parameters to make it work. But it's fast (for the work it's doing) and I strived to implement it in a very data-parallel way, and it's very very easy to map it to GPU. With OpenMP I'm getting a simple 3x performance increase (a medium sized image needs about 2 seconds to downscale to e.g. 64x64), but I expect the GPU version to be better. As it's going to be implemented through Pixel Pal, I'll use compute shaders, but writing the boilerplate to support them has put me off a bit. Examples below, also including some k-means for good measure. Back to Sigil of Kings!
More refactoring work it seems. First, the generic sparse element distributions were not working very well, so did some refactoring on that, I'll spare you the boring details. For the sparse element visualisation, which is an icon on a purple circle, I've tweaked it a bit for multi-element features, like a door-and-key, or a trap-and-mechanism. Instead of repeating the same sprite, I generate the same sphere sprite twice, where in both cases I'm showing both sprites, and they have a fat dot indicator (1,2 or more) to specify which element it is.
Back on the refactoring track, I've been cleaning up the sparse feature list by removing all too special elements, e.g. beds (we don't generally have beds in dungeons, we do have traps and treasure and encounters). A quality of life feature is to improve the hover element display to show not only layout data (wall, floor, connection) but any elements placed on top (encounter, door, crate). More data is always better.
The latest thing I'm working on resulting from trying to make a "Lean-to" prefab. I want the default floor of the parent zone (e.g. snow, grass, etc) but a custom wall (e.g. wood). I didn't have that support, and even if I hacked things together, it would not work on the C# side that I'll eventually fix. So, I'm on a refactoring track there to support that, and it's going well. By now, the C# code, in terms of dungeon generation glue, is very, very broken. Soon to be fixed, so I can show better screenshots as well!