Testing, Lag Fix, and Software

Hey Folks! Slightly more productive today, as I started with a playtest, then moved on to fixing a few bugs.

My Release mode playtest went well for a little while, playing through some DMC encounters (complete with working map now!), then, moving back out into the wasteland for more scavenging. However, before too long, I started to notice that lag when opening any inventory screen again. And it was bad enough I don't think it can stand.

This was pretty discouraging, since my last attempt to fix this failed, and suggested I might need to rearchitect the entire image pipeline.

I took another look, though, and this time I might've found a fix. It seems the image loading code was skipping a caching step that was causing a lot of the lag. All attempts to load a cached image would fail, since it was storing the images under unique names each time (like "pixel2032"). So I was wasting a ton of time looking-up images each time I needed one, looking for a name like ItmDataTXT.png and searching 2000+ "pixel___" names in the cache. Plus, it would then load the image from disk again and store it in the cache. Under a new name, "pixel2033."

Needless to say, this was bad. Bad for performance, and if it weren't for garbage collection, bad for memory, too.

The good news is that this seems to have eliminated any lag when opening that screen. At least, beyond the first time it has to load everything. So I think that was a major success!

The next issue is a bit more minor, but still pretty tricky: software item rendering. As you know, software either shows the normal image (when in a powered hardware item), or a black box (when inaccessible). However, there were a number of issues with this in my testing.

For one thing, the "peek" tooltip was broken for software, showing a red X. Also, software was appearing accessible when it shouldn't, or vice versa.

It turns out there are a few things going on here. First, the peek view was relying on the sprite's "name" field, which wasn't being set on PC due to a different method of loading graphics. I setup som code to assign that field on PC, and it seems to work now.

The other issue I'm running into is that the image for software is calculated when it is loaded, instead of when it is added to a container. This means it always appears in whatever default state I set in the code, until the hardware container holding it is switched on or off. After the switch, it works fine.

I'm not really sure how this worked before on mobile. And maybe it didn't? Maybe save games always had this problem and I never noticed?

Anyway, I'll need to sort this out. Perhaps re-check the image when it changes containers or something.

Finally, there also appears to be a music issue that causes it to cut-off before finishing. And this is going to be a pain to debug, due to the long waiting times in testing full music tracks.

Even so, this isn't bad news, overall. The remaining issues are fairly minor. Definitely not game-breaking. And hopefully, some of the last issues I'll encounter!