Jump to content

Craft menu GUI slowdowns + solution


CarlZalph
  • Version: PC/MAC/Linux Pending

When someone scrolls quickly along the craft menu it's slowed down due to the assets continually trying to research for filepaths with the filepath resolver.

 

This can be fixed by caching the results in the base game's util.lua:

RENAME:
function softresolvefilepath(filepath)
TO:
function softresolvefilepath_nocache(filepath)

ADD:
local cached_paths = {}
function softresolvefilepath(filepath)
    if cached_paths[filepath]
    then
        return cached_paths[filepath]
    end
    cached_paths[filepath] = softresolvefilepath_nocache(filepath)
    return cached_paths[filepath]
end

Doesn't have to be a local cache, could be a global variable for mods to access it or something if desired.

 

As a global wrapper for the function it will also 'fix' any other filepath resolver issue elsewhere, instead of just the crafting area.


Steps to Reproduce
Load in a game. Console: `GetPlayer().components.builder:GiveAllRecipes()`. Open up the fighting tab and scroll wheel quickly through the options. See: Performance loss. Optionally see that the tabs are all accessing the filepath resolver many many times when it should cache these or store them internally.
  • Thanks 1



User Feedback



×
  • Create New...