[1.1.6] High UPS drop with forest fires

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
blargh2015
Inserter
Inserter
Posts: 28
Joined: Sun Jun 03, 2018 3:47 pm
Contact:

[1.1.6] High UPS drop with forest fires

Post by blargh2015 »

Disclaimer: This is a modded game.

We are experiencing VERY high UPS performance hits with even small forest fires after upgrading from 1.0 to 1.1.6, to the point that I'm having to almost constantly do a "for k,v in pairs(game.player.surface.find_entities_filtered{type="fire"}) do v.destroy() end" console command, which immediately brings the UPS back up to 60. Debug blames Entity updates during this time.

This is made worse by the Rampant mod having fire-spitting biters and map settings that had relatively dense forests, so the little buggers are always setting off forest fires.
Attachments
factorio-current.log
(208.6 KiB) Downloaded 84 times
OMGfire.jpg
OMGfire.jpg (1.87 MiB) Viewed 3023 times
FireOMG.zip
(17.49 MiB) Downloaded 84 times

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by Klonan »

I don't see anything that looks like a bug

probably some mod is changing the fire entities to do some crazy large area of effect damage or something

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by ptx0 »

i have a mod called wildfire season and you could i guess, use it to reduce the fire hop limit so the fires are less intense. or try disabling smoke.

User avatar
blargh2015
Inserter
Inserter
Posts: 28
Joined: Sun Jun 03, 2018 3:47 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by blargh2015 »

After binary-tree-searching through our mods, it turned out Water Turret was the culprit here, which I suppose makes sense. Just weird it didn't show as the culprit on the detailed time listing.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by Pi-C »

blargh2015 wrote:
Tue Jan 19, 2021 3:44 pm
After binary-tree-searching through our mods, it turned out Water Turret was the culprit here, which I suppose makes sense. Just weird it didn't show as the culprit on the detailed time listing.
Oh, geez! I thought I'd improved performance somewhat, and I've honestly no idea what more I could do. But it's true, whenever a fire is created it will spawn a dummy (which will be removed again together with the fire). Currently, I use combat bots (if I remember correctly, they are made inactive on being created) because I need an entity-with-force so the turrets can target it, but it may not be a simple-entity-with-force because that's attacked by artillery. If only we had target_masks for some more prototypes! :mrgreen:
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
blargh2015
Inserter
Inserter
Posts: 28
Joined: Sun Jun 03, 2018 3:47 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by blargh2015 »

Pi-C wrote:
Tue Jan 19, 2021 4:02 pm
Oh, geez! I thought I'd improved performance somewhat, and I've honestly no idea what more I could do. But it's true, whenever a fire is created it will spawn a dummy (which will be removed again together with the fire). Currently, I use combat bots (if I remember correctly, they are made inactive on being created) because I need an entity-with-force so the turrets can target it, but it may not be a simple-entity-with-force because that's attacked by artillery. If only we had target_masks for some more prototypes! :mrgreen:
A mitigating issue is probably that I got sick of people I'm playing with complaining "there aren't enough trees" so increased the tree density to its absolute maximum. It is SERIOUSLY a ridiculous amount of woodland. Then add in the Rampant mod that has biters that spit fire and the buggers just start forest fires all over the place, and having thousands of trees on fire happened pretty regularly.

However, we were getting the UPS slowdowns even when the fires were very far away from our water turrets - I don't know if there can be a range limit or somesuch put on finding fires and the dummy units? Would help a lot, at least in this case.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by ptx0 »

Pi-C wrote:
Tue Jan 19, 2021 4:02 pm
blargh2015 wrote:
Tue Jan 19, 2021 3:44 pm
After binary-tree-searching through our mods, it turned out Water Turret was the culprit here, which I suppose makes sense. Just weird it didn't show as the culprit on the detailed time listing.
Oh, geez! I thought I'd improved performance somewhat, and I've honestly no idea what more I could do. But it's true, whenever a fire is created it will spawn a dummy (which will be removed again together with the fire). Currently, I use combat bots (if I remember correctly, they are made inactive on being created) because I need an entity-with-force so the turrets can target it, but it may not be a simple-entity-with-force because that's attacked by artillery. If only we had target_masks for some more prototypes! :mrgreen:
what if you change the tree force to enemy (once it's on fire)?

User avatar
blargh2015
Inserter
Inserter
Posts: 28
Joined: Sun Jun 03, 2018 3:47 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by blargh2015 »

ptx0 wrote:
Tue Jan 19, 2021 5:17 pm
what if you change the tree force to enemy (once it's on fire)?
I think that would cause every turret type to target them? So flamethrower turrrets ("YOU'RE NOT HELPING!!!"), snipers, artillery, etc...

The idea of flamethrower turrets attacking forest fires is unreasonably hilarious to me for some reason :)

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by Pi-C »

ptx0 wrote:
Tue Jan 19, 2021 5:17 pm
Pi-C wrote:
Tue Jan 19, 2021 4:02 pm
blargh2015 wrote:
Tue Jan 19, 2021 3:44 pm
After binary-tree-searching through our mods, it turned out Water Turret was the culprit here, which I suppose makes sense. Just weird it didn't show as the culprit on the detailed time listing.
Oh, geez! I thought I'd improved performance somewhat, and I've honestly no idea what more I could do. But it's true, whenever a fire is created it will spawn a dummy (which will be removed again together with the fire). Currently, I use combat bots (if I remember correctly, they are made inactive on being created) because I need an entity-with-force so the turrets can target it, but it may not be a simple-entity-with-force because that's attacked by artillery. If only we had target_masks for some more prototypes! :mrgreen:
what if you change the tree force to enemy (once it's on fire)?
It's not the trees or the fires that get attacked, but the dummies. They are on their own force (which is hostile towards any force with players, and on ceasefire with all other forces, so that biters won't take out the fires for you), and unless another mod that's loaded after Water Turrets changes things again, they have a trigger_target_mask that will be ignored by all other turrets (except for artillery turrets, because these don't support target masks for whatever reason).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by Pi-C »

blargh2015 wrote:
Tue Jan 19, 2021 5:16 pm
However, we were getting the UPS slowdowns even when the fires were very far away from our water turrets
Technically, the acid splashes made by spitters and worms are just fires as well (based on the fire prototype), so if the option to clean acid is on, that may be the reason.
blargh2015 wrote:
Tue Jan 19, 2021 5:16 pm
I don't know if there can be a range limit or somesuch put on finding fires and the dummy units? Would help a lot, at least in this case.
We've come a long way! In the first version of firefighting water turrets, I did indeed search in a radius around each turrets for fires, which was incredibly inefficient. Now I don't need to search for fires at all: they announce themselves because I've modified all fire prototypes to autospawn a dummy. When a dummy is spawned, I look for the fire on the dummy position and create a custom entity for it. When the dummy is killed, fires around it are destroyed (along with the respective dummies), and if a fire expires of its own before the dummy could be killed, the dummy will simply be removed. The dummies are hardcoded in the attack_target_masks of the water turrets. Whenever a fire is created in range of a water turret, it will be attacked automatically, so I leave searching for dummies to the game engine. There are options like "attack target with least/most health" that require intervention per script, but these should be off per default.

Perhaps I'm missing something, but I believe I've optimized pretty much everything that took a hefty bite out of UPS.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by Pi-C »

blargh2015 wrote:
Tue Jan 19, 2021 5:16 pm
… increased the tree density to its absolute maximum. …
You could edit settings.lua (lines 178--185):

Code: Select all

  {   -- Set radius in which fires are extinguished around a fire dummy
    type = "double-setting",
    name = "WT-fire-extinguish-radius",
    setting_type = "runtime-global",
    allowed_values = {1, 1.5, 2, 2.5, 3, 3.5, 4},
    default_value = 2.5,
    order = "WT-[misc]-[fire-extinguishing-radius]"
  },
You could add to or change "allowed_values", to extend the radius (no idea what a sane value would be: 6, 7, even more?). If one dummy is killed, all fires in this radius will be removed. It certainly will look ridiculous if a single turret can extinguish fires in a big area, but if there are so many trees that would take off some load. Turning up the damage should also help (turrets waste less time per fire, and the fires have less time to spread).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
blargh2015
Inserter
Inserter
Posts: 28
Joined: Sun Jun 03, 2018 3:47 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by blargh2015 »

Pi-C wrote:
Tue Jan 19, 2021 6:43 pm
blargh2015 wrote:
Tue Jan 19, 2021 5:16 pm
… increased the tree density to its absolute maximum. …
You could edit settings.lua (lines 178--185):

Code: Select all

  {   -- Set radius in which fires are extinguished around a fire dummy
    type = "double-setting",
    name = "WT-fire-extinguish-radius",
    setting_type = "runtime-global",
    allowed_values = {1, 1.5, 2, 2.5, 3, 3.5, 4},
    default_value = 2.5,
    order = "WT-[misc]-[fire-extinguishing-radius]"
  },
You could add to or change "allowed_values", to extend the radius (no idea what a sane value would be: 6, 7, even more?). If one dummy is killed, all fires in this radius will be removed. It certainly will look ridiculous if a single turret can extinguish fires in a big area, but if there are so many trees that would take off some load. Turning up the damage should also help (turrets waste less time per fire, and the fires have less time to spread).
I'll give it a look. Our main point of deploying the water turrets was to try and deal with the overwhelming forest fires, so our solution will PROBABLY be "Okay Blargh2015, you made your point, turn the tree density back down." :)

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by ptx0 »

blargh2015 wrote:
Tue Jan 19, 2021 8:27 pm
I'll give it a look. Our main point of deploying the water turrets was to try and deal with the overwhelming forest fires, so our solution will PROBABLY be "Okay Blargh2015, you made your point, turn the tree density back down." :)
this is what i was recommending my Wildfire Season mod for, to tune down the fire hop limit, which is how far a fire can spread from the first tree that burned. you can set it to 1 or 2, and that will make fires less devastating with high tree count.

User avatar
blargh2015
Inserter
Inserter
Posts: 28
Joined: Sun Jun 03, 2018 3:47 pm
Contact:

Re: [1.1.6] High UPS drop with forest fires

Post by blargh2015 »

ptx0 wrote:
Tue Jan 19, 2021 8:56 pm
blargh2015 wrote:
Tue Jan 19, 2021 8:27 pm
I'll give it a look. Our main point of deploying the water turrets was to try and deal with the overwhelming forest fires, so our solution will PROBABLY be "Okay Blargh2015, you made your point, turn the tree density back down." :)
this is what i was recommending my Wildfire Season mod for, to tune down the fire hop limit, which is how far a fire can spread from the first tree that burned. you can set it to 1 or 2, and that will make fires less devastating with high tree count.
We were having entire screen fulls of forest on fire at once. Did WONDERS for the pollution map, heh.

Post Reply

Return to “Modding discussion”