Hello and welcome back to my weekly devlog series. Let's get to it.
With a lot of engine groundwork done the previous week, I spent the first part of week 2 working on sprites. I'm very much not an artist, and my first attempts were your fairly typical programmer art. By the end of Tuesday though, I'd produced (what I think) is a pretty decent sprite for an AI core. Another thing I learned through this process was that I really, really suck at colour choices, and so Gamma Hollow has obtained a monochrome colour palette as a sort of side effect. To outline just how bad my colour choice was, and how much better it looks as monochrome, here's a side-by-side comparison of the AI core sprite:
Maybe it's just me, but I think that the monochrome version is a huge improvement. Getting used to using a monochrome palette made me consider a different but related idea: Since I've now decided to use monochrome sprites, I could simply convert the spritesheet to grayscale, which would save disk space, and give me the opportunity to "swizzle" the sprites in-game, potentially even with a user-configurable setting, either to allow the user to indulge in their aesthetic choices, or to allow the user to adjust colour and contrast for accessiblity reasons. It's a very enticing thought, but I think I'll have to come back to it later, as there's still lots of basic work that needs to get done first.
The next issue was getting the fancy new AI core (and some wall and ore sprites I made) into the game world. Although I got a good chunk of the rendering stuff done last week, there's still a lot more helper functions I need to write, so I wrote up some of those and set up the world generator to place an AI core in a room at the center of the world. This presented some problems I hadn't thought of. The AI core is internally represented as just one tile, but the sprite is three tiles wide. This was intentional, and the code would overwrite the other 8 tiles the AI core occupies with "empty" tiles. The issue is, empty tiles have a texture too, which gets drawn over the AI core if any adjacent tiles are updated.
My initial solution was to add a new "null" tile, which doesn't render anything, but that uncovered a new issue: The AI core sprite also includes transparency, so that you could see the floor underneath it, but the problem is that the game doesn't clear tiles before it redraws them, so the transparent portions were instead showing the previous texture that had been there. I wrote some code to do that, but it isn't pretty and it causes a massive drop in performance. Alright, this approach needs some rethinking. My first thought was, I don't need floors, they don't add that much to the gameplay, and if they come with such a large performance cost, it would be better to do away with them, in which case I won't need transparency in (most) of the textures.
This is how the code is working as I'm writing this, but since writing it I've changed my mind; although it technically works, I feel the proper solution in this case would be to simply 1) draw all the floor sprites in the same texture buffer as the tiles, which fixes the transparency issue but of course comes at the cost of having to redraw floor sprites with every tile update, and 2) instead of having a "null" tile type that tries to skip rendering, try to find the actual root tile (the AI core) for that tile, and then render it appropriately. This has the advantage of allowing multi-tile sprites to be redrawn with tile updates like everything else, but finding the root tile might have a performance cost, so I may keep it the way it is now.
It was a relatively slow week, but at least I have next week's work cut out for me.