Jump to content

Craft menu GUI slowdowns + solution

  • 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:

function softresolvefilepath(filepath)
function softresolvefilepath_nocache(filepath)

local cached_paths = {}
function softresolvefilepath(filepath)
    if cached_paths[filepath]
        return cached_paths[filepath]
    cached_paths[filepath] = softresolvefilepath_nocache(filepath)
    return cached_paths[filepath]

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...