Image Caching Hell, but Progress

Hey Folks! Been a bit of a rough day, as I wrestle with Asset caching in the engine in order to load assets.

Pretty much most of the day was spent trying and failing to get the game loading bitmaps into mod containers. In the PC version, the engine loads each mod into a separate data container, so when the game requests an asset by ID, it first checks which mod to get it from, then loads it from there.

However, the mobile version defers a lot of its asset loading until the last possible moment before an asset is displayed. As such, it loads things using different methods, and those bypass mod containers.

Also, they seem to use OpenFL/Haxe/Flixel's built-in Asset caching, which is intended to only keep stuff in memory when needed, and remove it when done. Again, great in a performance-limited environment like mobile. However, it plays havoc with trying to load bitmaps in advance, since they almost all get dumped immediately when the cache sees they're not used yet.

And annoyingly, no amount of my trying to turn caching off, or bypassing it, seems to help. I always get a hodge-podge of missing images when I try to load things my way. Even if I create byte-copies of bitmaps after loading them, storing the copies, they get wiped. I can't see to get direct access to a bitmap that the cache can't touch, and my loaded bitmaps all disappear.

Anyway, today's screenshot is what I see now that I'm back to using the built-in cache loading that ignores mod paths. Just about everything loads now, except hex maps. I did manage to fix the explosive memory leak, which turned out to be the hex map trying to load new copies of each hex art each frame. So that's good. But I'm still not sure why I have blank hexes.

And once that's fixed, I'll have to return to the modding path issue. How can I intercept asset loads to ensure the game looks at the right mod? We'll see.

So far, I still think this is doable. But there's a lot to be done!

Comments

Asthepanda2iscool2's picture
Asthepanda2iscool2

Yeah, that hex problem will probably be more convoluted than when I messed up the transparency for the hex sheet I was working on (that's fixed now, actually, I should probably release that now that it's done).

Hmm, I have a question. I have a big NS mod project that I'm working on, and was wondering if I should do a release now (without the new story), or later once I wrap my head around encounters. Thankfully, someone made a map editor a while ago, so the map isn't an issue.

Rar! Rar rar rar! Thanks for reading :)

dcfedor's picture
dcfedor

90% of the time, bugs are actually really easy to fix once you figure out what's wrong. It's the "figure out what's wrong" part that takes all the time. So it could be something as simple as a bad transparency in my case, too!

Regarding releasing the mod, it's hard to say. And there may be no right or wrong answer. I'd say that if you can have fun in the mod without story, it's probably worth releasing now. But if you need the story to be fun, better to wait.

Dan Fedor - Founder, Blue Bottle Games