Powered Entities


This mod will create power lines between most of the base game's entities that require power.

Content
3 years ago
0.13 - 1.1
1.95K
Power

g Extreme long lag while "wiring up powered entities"

3 years ago
(updated 3 years ago)

There are some recalculate every time I install or actualise mods (and when wiring technology is researched). But this "wiring up powered entities" seriously slows game (to just few ticks per sec) and can be very long. I have empty map (no factory build), just reveal very huge area (/c game.player.force.chart(game.player.surface, {{x = -6000, y = -6000}, {x = 6000, y = 6000}})) and lag is 52.000 ticks (900 - 1800 secons). When reveales map is small, lag is shorter, but still annoying. Mods needs actualise very often.

Why this recalculate depends on revealed map size and not only on size of factory itself? And why its run after every mods change? Can be this deep recalculate set to run manually, pls?

Thanks a lot.

3 years ago

There is no "size of the factory", you can build stuff anywhere, so the mod has the check the entire revealed map.

Now that I think about it, I guess it isn't necessarily needed when a new mod is added (since the new entities from that mod can't exist on the map yet), but it might still be needed on removal. Depends on if Factorio tells my mod that an entity was removed (I doubt it does).

I'll take a look at what can be done, in the meantime you can change the size of the recalculate batches to a large number, this will cause a single large freeze in the game instead of a drawn out lag.

3 years ago

I have created a new version that will not trigger a recalculate on adding/activating new mods. It is still needed when a mod is removed or changed though, since there is no reasonable way to make sure entities are the same.

3 years ago
(updated 3 years ago)

2 hours and still counting on empty map revealed 1200x1200 squares. I use extremly sparse RSO setting and modded radars. That means looong railways and resource finding. And after some mod actualised (almost every day) there will be recalculating?

What is happend when something is changes? Game crash? Or just unwired buildings? If just something unwired, then can you add option for recalculate only manually, please? (Or just after technology is researched - it is early and lag is not huge.)

Edit: It's done, after cca 2 hours. And map is 1600x1600 squares revealed (by console command). Yes, it is extreme, i know :)

3 years ago

What do you mean mod actualised? Enabling a mod (adding it to the save)? You change mods every day with this save?

The situation is that buildings could end up unwired or with the incorrect wiring (if the size were to change).

I can have the mod skip the check if the technology hasn't been researched by any force in the game. I guess the setting would be the same place in the code anyways. Just be warned that such a setting is going to be unsafe for your save if you play around with it.

3 years ago
(updated 3 years ago)

Oh, sorry. I mean Mods -> Upgrades.
Actually there is some for upgrade almost everytime I launch Factorio (just for 0.18.22 compatibility). And after some mod is upgraded, all saves needs recalculate.

3 years ago

Ok good point, the recent change did break a lot of mods, and stuff like that can definitely happen. I'm going to add a setting to turn it off, and just cover it in warnings that it could dirty up your map.

When you turn it off make sure that you manually hit the Recalculate button in the top left (after you research the technology) if you see wires going off to weird places around the map.

3 years ago

Thank you.
I think it is uncommon remove or change size of placeable "buildings" in middle of the game. It can lead to unpredictable bugs anyway.

3 years ago

I would hope it's uncommon, but it's still entirely possible to do, so I need to cover the off chance of it happening.

Either way, the new version is up with the setting added.

New response