Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt Asset Preload and Persistence (aka "Error 404: Asset Load Hiccup Not Found") #4652

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

Malkierian
Copy link
Contributor

@Malkierian Malkierian commented Dec 8, 2024

This adds alt asset preloading to the flow, as well as some common-sense alt asset persistence (menus, effects, audio, skyboxes). This altogether eliminates the asset load hitch that alt asset mods commonly suffer from except in a very few specific circumstances.

This all now runs in the background, whether alt assets are enabled or not, with no adverse effects on performance aside from the continued higher memory usage.

This does make it load a lot more assets in the persistent manner, so when using the 4K pack, usage can be 8GB+ on a continual basis, but I'm sure the 4K users would prefer to have that with virtually no hiccups rather than lower memory usage. Obviously, the usage will be significantly lower with standard HD packs.

This has the following effects (demonstrated with OoT Reloaded 4K to properly showcase the capabilities): audio on!

Startup is significantly faster when loading with alt assets enabled, and the logo, transitions, and sound effects all load without issues.

Before:

D1bH8KI.mp4

After:

D08Qoms.mp4

Loading directly into a save file is also still significantly smoother:

Before:

Q2n1SOs.mp4

After:

haZQNZk.mp4

Loading into file select is faster and smoother, and there are no skybox load hiccups

Before:

0nEHNKn.mp4

After:

JFJWmiu.mp4

The pause menu, and visual effects, give no hitches on first load, even across transitions

Before:

5FUaPaj.mp4

After:

JY0XLJJ.mp4

Reset loads are blazing fast

Before:

HNgH4DP.mp4

After:

zGaGtIY.mp4

And finally, the transition hitches are virtually eliminated, only being noticeable when loading areas like Hyrule Field, and toggling alt assets on in new areas takes almost no time at all:

Before:

d7NYTVO.mp4

After:

3YREvQj.mp4

Build Artifacts

Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haven't done any playtesting but overall the code and comparison videos look great! left a few comments/questions/suggestions

soh/soh/ResourceManagerHelpers.cpp Outdated Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Outdated Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Outdated Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Outdated Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i still haven't playtested this but all my code comments have been addressed!

@Malkierian Malkierian added the do not merge Not ready or not valid changes label Dec 11, 2024
@Malkierian
Copy link
Contributor Author

Fixed an issue that was causing the game to unload the scene it was going into if it was a back and forth (otherwise just lagging behind by a scene), but I'm marking this as do not merge as I want to try to refine the persistence to cut down on memory usage.

@Malkierian
Copy link
Contributor Author

Now requires Kenix3/libultraship#752 before I can remove do not merge, but dynamic skybox loading and unloading is done. Reloaded 4K is now buttery smooth, and for me never got above 6GB of RAM usage thanks to the skybox tweaks.

@Malkierian Malkierian force-pushed the alt-asset-bulk-preload branch from f6c8afa to a8ca475 Compare December 13, 2024 18:25
@Malkierian
Copy link
Contributor Author

Of course, ymmv, since the preload time might not be enough on lower-end machines, but should still improve things quite a bit.

soh/soh/OTRGlobals.cpp Outdated Show resolved Hide resolved
soh/soh/z_play_otr.cpp Outdated Show resolved Hide resolved
soh/soh/z_play_otr.cpp Outdated Show resolved Hide resolved
soh/src/code/game.c Outdated Show resolved Hide resolved
soh/soh/ResourceManagerHelpers.cpp Outdated Show resolved Hide resolved
@briaguya-ai briaguya-ai mentioned this pull request Jan 3, 2025
soh/src/code/game.c Outdated Show resolved Hide resolved
soh/soh/OTRGlobals.cpp Outdated Show resolved Hide resolved
… some persistent alt asset loading. Utilizes threading to handle LUS directory load and unload filtering.
Add comment documentation.
Refine a little persistent preload.
Un-persist skybox textures, add dynamic skybox loading instead.
Update for related LUS PR changes, which includes removing the threading (will be re-implemented when LUS Context thread pool access is added).
… functions to prevent debug stutter on transition.
@Malkierian Malkierian force-pushed the alt-asset-bulk-preload branch from 6d8ff03 to fec6765 Compare January 3, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants