Page 1 of 1

Weird FPS/UPS decrease during item craft lookup

Posted: Sun Aug 02, 2020 7:09 am
by Biker
Posting in behalf of infantryman4life.

Seemed like he had a slowdown while hovering over an item in the crafting window for the player. The drop seemed to be about 5-8 UPS, much less so on a seemingly light item such as iron pipe.

Notice the drop while hovers on the item to craft - https://clips.twitch.tv/SuaveSuaveDoveMcaT

The same thing was tested with an assembler instead of the player to craft the item and the UPS drop was barely noticeable.
Here's a snippet of it - https://clips.twitch.tv/BlueCarelessOkapiDogFace

Modlist - https://pastebin.com/k7m0eGD7

Any clue what's causing this?

Re: Weird FPS/UPS decrease during item craft lookup

Posted: Sun Aug 02, 2020 8:46 am
by mrvn
It's breaks down the item into raw materials, which means going though the recipes recursively till it reaches something that is flagged as raw material. It then shows which of those and the actual ingredients you have, which you can craft and which you lack.

The problem is iirc that it does this over and over to update in case you got some new materials from logistic bots or hand crafting. With the complex weave of recipes added by mods this becomes a performance drain.

The reason why an assembler doesn't have this problem is because you set the recipe and it doesn't go searching for what you have in you inventory. With furnaces you get a drop when it has to pick a recipe but that also is less of a problem because it isn't recursive. But it's noticeable for large recipe lists.

Re: Weird FPS/UPS decrease during item craft lookup

Posted: Mon Aug 10, 2020 11:33 am
by Sopel
That's why this mod exists. Even the in-game option to remove the raw ingredients display doesn't prevent this slowdown in many cases.

Re: Weird FPS/UPS decrease during item craft lookup

Posted: Mon Aug 10, 2020 12:20 pm
by Bilka
Sopel wrote:
Mon Aug 10, 2020 11:33 am
That's why this mod exists. Even the in-game option to remove the raw ingredients display doesn't prevent this slowdown in many cases.
I'd recommend to use the recipe_step_limit utility constant to decrease the maximum amount of recursive steps that Factorio does to calculate raw recipe ingredients instead of setting allow_decomposition to false on all recipes. The default limit is 50k, you could reduce it to 10k or even lower. Recipes that do not resolve into raw ingredients within that step limit will display "too expensive to calculate" as the total raw.

The reason the in-game option doesn't work is that the calculation is also done to display "how many times can this be crafted from what you have in your inventory currently", which is not disabled by the option to hide the total raw.

Re: Weird FPS/UPS decrease during item craft lookup

Posted: Mon Aug 10, 2020 2:08 pm
by infantryman4life
Bilka wrote:
Mon Aug 10, 2020 12:20 pm
Sopel wrote:
Mon Aug 10, 2020 11:33 am
That's why this mod exists. Even the in-game option to remove the raw ingredients display doesn't prevent this slowdown in many cases.
I'd recommend to use the recipe_step_limit utility constant to decrease the maximum amount of recursive steps that Factorio does to calculate raw recipe ingredients instead of setting allow_decomposition to false on all recipes. The default limit is 50k, you could reduce it to 10k or even lower. Recipes that do not resolve into raw ingredients within that step limit will display "too expensive to calculate" as the total raw.

The reason the in-game option doesn't work is that the calculation is also done to display "how many times can this be crafted from what you have in your inventory currently", which is not disabled by the option to hide the total raw.
Where do I insert the recipe_step_limit at?

Re: Weird FPS/UPS decrease during item craft lookup

Posted: Mon Aug 10, 2020 3:02 pm
by Bilka

Code: Select all

data.raw["utility-constants"]["default"].recipe_step_limit = 10000
and pack it into a data.lua file and mod, or use the attached mod (licensed under Unlicense).

Re: Weird FPS/UPS decrease during item craft lookup

Posted: Mon Aug 10, 2020 3:36 pm
by infantryman4life
Bilka wrote:
Mon Aug 10, 2020 3:02 pm

Code: Select all

data.raw["utility-constants"]["default"].recipe_step_limit = 10000
and pack it into a data.lua file and mod, or use the attached mod (licensed under Unlicense).
thank you :)