Closed Helco closed 8 months ago
Okay, third (or fourth?) design:
Constraints:
Global
is shared across all game and editor instances
Context
is shared across a single game or editor instance
SingleUsage
assets are never shared. Examples for this are:
First measurable results: With only backdrops, models and FOModels migrated we have gone from loading 156 textures for sc_2411 to just 11. When transitioning to sc_2421 we only load 2 textures. Currently however none of this is async as seemingly textures are loaded too fast relative to the other stuff.
There is a new implementation of an
AssetRegistry
, but before merging I want to extensively test this. Therefore we have:Yes manage them entirely locally.
Or not. With
ActorMaterialAsset
there is enough reason to introduceAssetLocality
IAssetLoader
and allAResourceManager
Old comment
Another somewhat large rework, this time the way assets are loaded and kept alive, as the current way with mostly using `ManagedResource` except when not bothers me immensely. Other issues briefly written down in the issue were: - No deferred application of assets (meaning definitely no asynchronous loading) - No asynchronous or parallel loading - No model of asset dependencies - No checking that `TAsset` and `TInfo` (now `TQuery`) actually have a loader registered - No deferred unloading of assets - No statistics However I found that the general ECS memory model works well enough for my design, so it is used internally. This should also allow us to add it to `ECSExplorer` for further debugging purposes. However² the implementation sketches show a deeper problem which is OneToMany / ManyToMany relationships which are badly supported by DefaultEcs at this time. I might invest into a "RefittedEcs" to correct this and other shortcomings A quick alternative thought: Creating and disposing resources will inevitably allocate and deallocate memory, additional (relatively tiny) allocations regarding dependency management or even resource state management should be negligible. This is strengthen by the fact that this dynamic memory is probably not often accessed. Meaning: maybe we can use a more naive approach and concentrate on getting the API right.Fixes #180