Ok, so my post that you linked to dealt with multithreaded loading. I did mention a cache near the end.
Sheado's code is a relatively simplified version of what I do in my engine. You ask the cache for the filename and it returns a preloaded file or hot loads it.
I would suggest that if you intend on having a game with levels and different assets/animations you might want to try a Library 'chain' approach. The program would have a global asset Library, whatever screen you were on would have a local 'screen' Library and any level you were on would have a 'level' Library.
Each Library is created with a pointer to a parent Library (or nullptr if none exists). The Level is hitting it's local Library, but when the cache misses, it traverses up the parent Library chain.
If all the chains miss, then you can hot load and cache locally. Personally though, I'm against hot loading assets. They should be preloaded before the screen or level begins. It creates a better user experience. For debugging purposes you can have a 'missing' texture and LOG your cache misses.
When you change levels, it's easier to drop those assets. Keep memory usage low!
This setup also makes skinning easier, so if you want you can add a 'Holiday' pack at the bottom of the chain. Or language ports.
However, if you're not using a game with a lot of different assets or levels, I'd suggest a global cache. Heck, even with Library loading I still have a global cache. It just deletes the resource when the reference counter hits zero. My global cache will hotload, my Library will not.
As for my engine? Lots of games use it or a variation of it, here are a few:
The games I'm credited on:
http://www.mobygames.com/developer/james-poag/credits/developerId,359318/
Basically everything from this site:
http://rumbic.com/
And a dozen others.
framusrock ha scrittoHey Jim,
Sure thing, here's your post:
Skeleton Animation performance
Here's my post:
Cocos2d-x - Batch all Skeletons / Sprites from one atlas
I got a bit confused, somebody else referenced our posts, having a similar issue here:
Cocos2d-x Spine Atlas and Skeleton Caching
I'm actually looking for a way to cache Spine atlasses / create Skeleton Animation easily while being able to batch draw from the same atlas. I'm also looking for a way to create cocos2d-x sprites from these atlasses. I'm currently on the fence of just writing such a cache / factory singleton myself, but as you also had a similar request, I thought I'd ask you first, how you handle these things ๐
So you wrote your own C/C++ engine? That sounds cool! Can the engine or a game with the engine be seen somewhere?
Cheers,
Max