Floors are back. In the last post I said I removed them, and then immediately reconsidered, and indeed right after that post I added them back in. In the week following that post I was busy with some other things, but I did manage to implement a bunch of other floor-related code, and by the end of the week I had a set of helper functions for placing floors, and floor rendering was working nicely as well.
Adding back floors brought with it a new problem, similar to an old one: When replacing the floor underneath a multi-tile sprite, choosing to just not render it no longer works as it *needs* to be re-rendered to display the new floor. So, I bit the bullet and wrote some code to automatically find and re-render the entire multi-tile sprite whenever one of its sub-tiles are updated. The current implementation is less than ideal, as it results in a whole bunch of extraneous updates; an easy optimization I could make is to skip it if it's only being rendered due to being adjacent to an updating tile, and hasn't actually been updated itself, but for now I'll leave it as it is for the sake of keeping the code more robust. If (or, rather, when) performance issues begin to become problematic, I'll go back and revisit old code like this to make additional optimizations then. As the saying goes, "premature optimization is the root of all evil".
The other thing done this week was revamping the procedural generation code. The game now uses multiple layers of Open Simplex Noise to generate caves, as well as three different types of ore: "Cubite", "Pentite", and "Hexite". Each ore has its own generation pattern, with Cubite being pretty much everywhere, Pentite being in very large but sparse clumps, and Hexite being in only a handful of small pockets around the map. I might change how generation works later to make it slightly more interesting; in particular, I'm thinking about changing Cubite to behave how Pentite does right now, and changing Pentite to surround the edges of caves. For now though, this is more than sufficient. I also had to change the sprites for the different ore types to make them more visible, as previously the sprites all looked the same from the distance (because they were the same colour), so it was pretty much impossible to tell them apart without zooming all the way in.
That's all for this week; nothing particularly exciting. So instead, enjoy this short video of the current prototype: