emerald icon indicating copy to clipboard operation
emerald copied to clipboard

World/Ent caching system

Open Bombfuse opened this issue 1 year ago • 0 comments

I often need to spawn entities from .wrld or .ent files, for example, when spawning a Projectile from a weapon.

The engine shouldn't need to load the .ent file every time you spawn it, we should have some sort of caching system that keeps the .ent file data in memory until we no longer need it.

Maybe a world resource where the user can cache files?

Proposal

ex.

world.cache(&mut emd, "my_most_used.ent");

The world will then hold an AssetKey for the file data, and the data will be freed from the Asset Engine/memory when the world is dropped or has its cache cleared.

This should also work for any file, as the bytes of the file will be the data cached

Bombfuse avatar Jun 04 '23 20:06 Bombfuse