Rework asset system 2 : electric boogaloo #70
Labels
No labels
0. Imported
1. Bug
1. Clean-up
1. Feature
1. Improvement
2. Deliverable
2. Epic
3. Duplicate
3. Invalid
3. Need investigation
4. Assets
4. Birb Core
4. Debug
4. Dependencies
4. Inputs
4. Lang
4. Scenes
4. Screen
4. World
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: epervier/epervier-old#70
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The current asset system have several flaws:
In order to solve all that, we should:
assets.sounds
), to make most common case easier. Kill asset subtypes when possible.assets.get(type, name)
,assets.handler.get(name)
or stuff likeassets.sfx.play(name)
), if it's not in the cache, load it in local cache.assets.preload(name, type, isGlobal)
andassets.handler.preload(name, isGlobal)
functions.Assets folder file tree
Maybe handlers should handle everything
-> When started, they scann their directory and populate their list
-> Their load function add to the cache an asset if it's not already in it (and fail if it doesn't exists at all)
--> It can handle a string (load the asset) or a table (load all assets)
-> Their "get()" function load the asset if it's not in the cache
-> They have a purge function to purge their own cache
-> The "asset" object will just be a collection of handler
Each handler will be derived from a common AssetHandlerParent that'll manage the cache and give all the generic function
-> They'll give a list of extensions, and if it handle metadata (in a separate lua file) or not
-> They'll override a "newAsset" that create the actual asset
-> They'll have a few function to handle directly their assets
Questions:
-> Does font really need a specific object ?
-> How to handle font size ? (the first one could answer the second...)
-> Music maybe will work a bit different as they won't have strong caching ?
Add a global function to preload everything (except music ? Or maybe even music ?) and bypass lazy loading.