Weird FPS/UPS decrease during item craft lookup

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
User avatar
Biker
Inserter
Inserter
Posts: 24
Joined: Fri Apr 28, 2017 10:01 pm
Contact:

Weird FPS/UPS decrease during item craft lookup

Post 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?
mrvn
Smart Inserter
Smart Inserter
Posts: 5853
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Weird FPS/UPS decrease during item craft lookup

Post 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.
Sopel
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Mon Sep 24, 2018 8:30 pm
Contact:

Re: Weird FPS/UPS decrease during item craft lookup

Post 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.
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Weird FPS/UPS decrease during item craft lookup

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
infantryman4life
Inserter
Inserter
Posts: 46
Joined: Thu May 09, 2019 1:19 am
Contact:

Re: Weird FPS/UPS decrease during item craft lookup

Post 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?
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Weird FPS/UPS decrease during item craft lookup

Post 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).
Attachments
foo_0.0.1.zip
(610 Bytes) Downloaded 95 times
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
infantryman4life
Inserter
Inserter
Posts: 46
Joined: Thu May 09, 2019 1:19 am
Contact:

Re: Weird FPS/UPS decrease during item craft lookup

Post 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 :)
Post Reply

Return to “Technical Help”