Progress!

Hey Folks! After nearly 2 days of banging my head against this map rendering issue, it appears to be fixed!

I think I basically had to try everything before I was able to get a hold of this bug. Rewriting image loaders, walking the code, debug output, wildly trying different inputs and outputs. Eventually, disabling huge swaths of the map renderer pointed me in the right direction. Because as it turned out, rendering one part of the map was short-circuiting the rendering of the rest.

When the hexmap is rendered, it creates batches for the camera to draw. A batch might be a plains hex at coordinates 100,64. Or it might be a magnifying glass just over that hex. Or maybe it'd be the blank, unvisited hexes using the blank hex art. Each of these batches needs info on where to grab graphics from.

As it turned out, the hexmap draw function was telling the camera to grab hex art from the hex spritesheet (so far, so good). But before it finished rendering those hexes, it changed the source image to the hex icon sprites, and later, the blank hex sprites. In effect, it was trying to draw the visible hexes using the blank hex as a source sprite. Which usually ended up being a smear of pixels because the blank hex was a different size than the hex spritesheet. (I think it was basically copying the pixels from that blank hex's right and bottom edges over and over.)

Anyway, transplanting these batch commands to a place preceding the draw commands that need them did the trick. We can now render the map again! What a huge relief. Not making progress here was really breaking my spirit.

I managed to fix a few more things after that, including a null item bug that was breaking save games. In retrospect, I don't think this was the elusive late crash bug people talk about on the forums. Especially given how consistently it appeared (like, crashing 25% of the time starting a new game, and close to 100% of the time loading a save). This appears to be a bug exclusive to running mobile engine on desktop right now.

I still have a bunch more to do, including the daunting task of restoring mods in the new engine. However, making progress like this before the weekend will surely help me sleep better :) Have a good one, all!