Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

World/Ent caching system #247

Open
Bombfuse opened this issue Jun 4, 2023 · 0 comments
Open

World/Ent caching system #247

Bombfuse opened this issue Jun 4, 2023 · 0 comments

Comments

@Bombfuse
Copy link
Owner

Bombfuse commented Jun 4, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant