feat: use the AssetBundle
API to provide more familiar ways to load assets
#3252
Labels
AssetBundle
API to provide more familiar ways to load assets
#3252
What could be improved
The way Flame handles assets is currently a bit ambiguous, images go through the
Images
class while other type of files (for instance tiled maps) have their own parsers in the bridge packages. This is also not the common way most Flutter developers are used to handling assets.Why should this be improved
Flutter already provides a way to load assets, that we internally already use, namely the
AssetBundle
class. This class however still does not provide direct ways to load asset types like images, tiled map and others. But we can extend it, and it even has aCachedAssetBundle
variant that does caching for us.My suggestion is to create a
FlameAssetBundle
that can load different kinds of types like images and tiled map (through extensions provided in the bridge package). This allows us to make it more user-friendly, flutter developers know aboutrootBundle
andAssetBundle
and allows our bridge packages to make loading assets for their implementation much easier.Risks
None to my knowledge, the
Images
can still exist for backwards compatibilty but under the hood it can use the Flame bundle system.More information
I already have been using this idea for my own games and would love to provide my implementation as a PR if we all agree on this idea.
Other
The text was updated successfully, but these errors were encountered: