sturdykeep / backbone

Strong & flexible game library for Flutter, that drinks milk 🥛
Other
37 stars 1 forks source link

Notes on the Asset System #74

Open skyne98 opened 1 year ago

skyne98 commented 1 year ago

Sources of inspiration: Architecture of Bevy

Handle<T>

Handles are lightweight pointers to assets, such as textures, sounds or any other kind of heavy resource you need in your game. Handles can point to resources not yet loaded. This allows you to pass it, for example, to a sprite and have it "pop in" as soon as it is ready.

Assets

A resource, which represents the global asset server. The server manages asset providers and keeps track of the cache of loaded resources.

AssetProvider

An abstract class that represents a potential source of assets. You might implement, or use providers, which, for example, load resources from the file system, from the network server or get processed from a raw file. When you request an asset from the Assets resource, it sequentially requests that resource from each of the providers, until one returns a success. Optionally, you can provide a specific type of the provider you want to get that resource from.