AssetCache Library

Hello All

I just pushed up AssetCache to github. This is a utility lib I’ve been using with three.js for asset loading and caching. AssetCache helps you load all your assets at once, cache them, and then retrieve them individually when needed.

You can check it out in the link below

Comments, suggestions and recommendations are highly welcomed


Hey @Blue_Magnificent, I understand what it is that you are sharing, and I have something similar in my own game engine, but for others out there - would you mind explaining why they might want to use it? Maybe offer some example that would demonstrate usefulness of your library?


Oh cool.

One reason for AssetCache is to ensure all assets are loaded successfully and cached before the application begins. If there is going to be any failure, it occurs right at the beginning and is handled.

A second reason is to tackle the issue of delay due to network latency. Loading assets the normal way when the render/game loop is already running can introduce a noticeable lag especially when the assets are heavy/large in size. For example textures of material take time to show. However loading assets at the beginning of the program ensures that all delay due to latency are incurred once before the render/game loop is entered.

An additional reason is to eliminate the callbacks and asynchronous program flow associated with loading assets the normal way. Sure we could wrap-up the loading processes in a Promise and either use it as is or with async-await but that would leave our code a bit messy visually. With this lib it’s just a straight synchronous call to get asset, keeping your code simple.

All these could still be achieved using regular variables but AssetCache gives a consistent and clean means of getting it done.

1 Like