Fellow scholars,
I stand before you, half alive, half dead, almost as if I have a lifecycle challenge ![:wink: :wink:](https://emoji.discourse-cdn.com/win10/wink.png?v=12)
Background:
I had this idea of moving between scenes, originally I manually cleaned up all my mess in the same scene, but I found that I would miss things and performance would still dial down over time, so I figured an entire scene disposal and rebuild would be the right way to handle things.
I guess Iām struggling with the idea of the asset manager being tied to a specific scene. I know what I need to load in the background, and a lot of assets are shared between scenes, so it feels ā¦not so optimal to keep creating new asset managers with largely the same assets in.
I might have missed this topic on the form somewhere, I did have a good scan, the lifecycle looks like:
Load what you know you need for the initial scene
Async load anything you donāt know or that is dynamically added to the scene
Async load assets for the next scene that you Might need.
I feel like Iām good on the first two, but the last one I canāt do, or I need to create a whole new scene and asset manager in the background to pull it off.
Have I got that right, and I think about things wrong? I did try creating an asset manager with a dummy scene, and that didnāt work out when it came to doing a instantiateModelsToScene.
Thank you, fellow scholars, for your wisdom
The AssetContainer is still tied to the idea of a scene through, so it wouldnāt enable sharing assets between scenes
Hmmmm I wonder what would be the best solution for this, maybe @PatrickRyan has an idea?
1 Like
Thats exactly it, @carolhmj , and thank you, @sebavan good suggestion; already using AssetContainers and thatās probably the challenge being tied back to a specific scene.
A totally fair answer would be, āyouāre being lazy, write better code so you donāt need to tear down the entire scene and build a new oneā.
1 Like
Eh, your dedication to knowledge can never be classified as ālazyā, I think āhow to manage shared assets between scenesā is a totally fair question.
I donāt think there is a single answer to this, but studying the different approaches is always a good exercise.
You might get some scene management ideas from @jelster amazing Space Truckers repo jelster/space-truckers: A game of getting stuff from Point A to Point Bā¦ IN SPAAAACCE! (github.com) and the accompanying book too ![:smiley: :smiley:](https://emoji.discourse-cdn.com/win10/smiley.png?v=12)
3 Likes
All over it! thanks @carolhmj
1 Like
@potato_noob, I donāt have a great answer for you here either because I feel the most seamless experience for the user is to maintain your asset container between sections/levels/areas of your game (I hesitate to use the word scene here because itās a loaded term). If you dispose the scene to clear out all the garbage, you will need to load all your original assets into the asset container again which means the user is paying a load tax every time you need to refresh. This isnāt the best experience from the userās standpoint and depending on their internet connection, you could be using up vital bandwidth for them which can leave a bad impression of the experience.
I would do everything possible not to reload any asset youāve already loaded once if for no other reason than many people around the world have very poor internet speeds which creates a non-inclusive experience. In my area, fiber internet is common, but in my siblingās area they need to rely on a 5G mobile hotspot for the house which is a simple illustration of why you donāt want to download any more than necessary.
In addition to the Space Truckerās repo that @carolhmj mentioned, I would also suggest looking at the Dev Stories in our docs to see how they are handling any level change as well as The Space Pirates demo which is a far more complex version of loading assets and managing game state. There isnāt a lot of documentation around the Space Pirates demo, but all of the code and assets are there for you to play with. And if you have questions specifically around that demo, I am sure than @Cedric and @DarraghBurke can answer them as they wrote and/or optimized the code. Hope this helps.
1 Like
browser cache? Any model you loaded once already is not loaded again in the same manner , the browser fetches it from the cache. ? am i missing something here.
Im also not convinced that you can infatically state doing a full reload is not a option and should be avoided like a plague. It honestly depends.
Engineering a battle tested system that hot reloads only essential code , data or assets can take magnitudes more time than simply building something that just reloads the lot and is only ever so slightly less ideal.
we talking small and medium applications hereā¦ If you building the worlds next greatest MMO game , yeah maybe then it makes sense , and even then , maybe not.
2 Likes