Page 1 of 2
Efficiency of entities that have no power.
Posted: Thu Jan 19, 2017 12:48 pm
by Stevetrov
I have noticed that UPS doesn't change noticeably when nearly all of my factory is powered down.
Potentially this could be easy fix and this would help a lot building megabases as then I could power down some parts of my factory whilst working on other parts without massive slow down. Of course if it requires major reworking it probably not worth the effort.
Many thanks for the great game.
Re: Efficiency of entities that have no power.
Posted: Thu Jan 19, 2017 2:48 pm
by Deadly-Bagel
I don't think we need to tell the devs how to make the game more efficient... they've proven themselves more than capable =P besides 0.15 will bring a ton of optimisations to make the game even more ludicrously efficient.
And it's possible your performance is due to graphics processing or memory speed.
Re: Efficiency of entities that have no power.
Posted: Thu Jan 19, 2017 4:43 pm
by Stevetrov
I am not telling anyone what to do.
My point is that the game is very well optimised but it seems to spend a lot of CPU cycles on entities that are inactive because they don't have power. Of course this may have already been addressed, but I had the idea and so I suggested it, which is what this forum is for after all.
Re: Efficiency of entities that have no power.
Posted: Thu Jan 19, 2017 5:14 pm
by Deadly-Bagel
I didn't say you were telling them what to do, I meant it that they know what they're doing in terms of optimisation.
This forum is more for suggestions for the gameplay, as we don't know the inner workings we can't suggest improvements to them.
Just saying.
Re: Efficiency of entities that have no power.
Posted: Thu Jan 19, 2017 6:55 pm
by Rseding91
"Powering down" things is one of the worse ways you can stop a factory. Simply not giving it any resources to consume/use is the ideal way.
The problem is: "powering down" an entity means the normal update logic on the entity can't run because there's no power to do things like "move the inserter arm". The entity has no update notification when power is restored so it can't disable itself.
Adding such a notification would be a gigantic waste of CPU time because 99% + of the time the entity has power or will have power next tick.
Re: Efficiency of entities that have no power.
Posted: Fri Jan 20, 2017 9:16 am
by Stevetrov
Fair enough thanks for the reply. I will work out another way of doing this.
Re: Efficiency of entities that have no power.
Posted: Fri Jan 20, 2017 11:19 am
by hoho
Stevetrov wrote:My point is that the game is very well optimised but it seems to spend a lot of CPU cycles on entities that are inactive because they don't have power.
This is your gut feeling or did you test it somehow?
I don't really think that dealing with drain power usage is all that expensive in the big picture. I'd be surprised if it's more than a couple of percentages of total load in a megabase.
Re: Efficiency of entities that have no power.
Posted: Fri Jan 20, 2017 11:35 am
by Optera
Rseding91 wrote:"Powering down" things is one of the worse ways you can stop a factory. Simply not giving it any resources to consume/use is the ideal way.
The problem is: "powering down" an entity means the normal update logic on the entity can't run because there's no power to do things like "move the inserter arm". The entity has no update notification when power is restored so it can't disable itself.
Another reason for making beacons switch on/off on signals. Sadly switching beacons wasn't voted higher in circuit feature poll.
Currently you have to decide between draining power for more UPS or switch power off at the expense of continuous "needless" UPS updates. Placing an inserter loop, removing/inserting modules on signals, next to every beacon simply takes too much space to be a feasible alternative.
Re: Efficiency of entities that have no power.
Posted: Fri Jan 20, 2017 7:24 pm
by Rseding91
Optera wrote:Rseding91 wrote:"Powering down" things is one of the worse ways you can stop a factory. Simply not giving it any resources to consume/use is the ideal way.
The problem is: "powering down" an entity means the normal update logic on the entity can't run because there's no power to do things like "move the inserter arm". The entity has no update notification when power is restored so it can't disable itself.
Another reason for making beacons switch on/off on signals. Sadly switching beacons wasn't voted higher in circuit feature poll.
Currently you have to decide between draining power for more UPS or switch power off at the expense of continuous "needless" UPS updates. Placing an inserter loop, removing/inserting modules on signals, next to every beacon simply takes too much space to be a feasible alternative.
Making beacons switch off on signals would be the exact same as switching off through loss of power. It wouldn't save any additional UPS.
Circuit "switch off" is just a flag in the entity that forces it to not run the normal update logic. It's also one of the worse ways to "power down" something.
Re: Efficiency of entities that have no power.
Posted: Sun Jan 22, 2017 3:14 am
by BenSeidel
Rseding91 wrote:Circuit "switch off" is just a flag in the entity that forces it to not run the normal update logic. It's also one of the worse ways to "power down" something.
I have found that removing the power gives greater UPS benefits than just stopping the material flow when you have heavy use of enabled conditions on your inserters. It could just be my imagination though.
Re: Efficiency of entities that have no power.
Posted: Sun Jan 22, 2017 3:34 am
by Rseding91
BenSeidel wrote:Rseding91 wrote:Circuit "switch off" is just a flag in the entity that forces it to not run the normal update logic. It's also one of the worse ways to "power down" something.
I have found that removing the power gives greater UPS benefits than just stopping the material flow when you have heavy use of enabled conditions on your inserters. It could just be my imagination though.
Enable conditions also force the entity to stay active in the case of inserters because the inserter can't work due to the condition but otherwise is ready to go. There's no alarm system for when the logistic network changes.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 9:17 am
by Optera
What would be the most CPU friendly way to manage 1k+ beacons?
- Have them on all the time?
Requires more power producing entities.
- Use inserters to remove the modules on circuit condition?
Adds at least 2 inserters per beacon for another 2k entities.
- Switch them off with power switches?
"one of the worse ways you can stop a factory", but it doesn't add a lot of extra entities.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 9:35 am
by Rseding91
Optera wrote:What would be the most CPU friendly way to manage 1k+ beacons?
- Have them on all the time?
Requires more power producing entities.
- Use inserters to remove the modules on circuit condition?
Adds at least 2 inserters per beacon for another 2k entities.
- Switch them off with power switches?
"one of the worse ways you can stop a factory", but it doesn't add a lot of extra entities.
Leave them fully powered at all times. Solar panels have zero CPU cost to exist so you can just make more of them to give power to your beacons.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 12:53 pm
by Optera
Rseding91 wrote:Optera wrote:What would be the most CPU friendly way to manage 1k+ beacons?
- Have them on all the time?
Requires more power producing entities.
- Use inserters to remove the modules on circuit condition?
Adds at least 2 inserters per beacon for another 2k entities.
- Switch them off with power switches?
"one of the worse ways you can stop a factory", but it doesn't add a lot of extra entities.
Leave them fully powered at all times. Solar panels have zero CPU cost to exist so you can just make more of them to give power to your beacons.
What about accumulators? I doubt calculating remaining charge is free.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 1:18 pm
by bobucles
It's been my experience that thousands of idling biters is more CPU demanding than factory stuff. All those health regeneration checks, those random wandering motions, and always looking for something to kill. There has to be a better way.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 1:20 pm
by orzelek
Optera wrote:Rseding91 wrote:Optera wrote:What would be the most CPU friendly way to manage 1k+ beacons?
- Have them on all the time?
Requires more power producing entities.
- Use inserters to remove the modules on circuit condition?
Adds at least 2 inserters per beacon for another 2k entities.
- Switch them off with power switches?
"one of the worse ways you can stop a factory", but it doesn't add a lot of extra entities.
Leave them fully powered at all times. Solar panels have zero CPU cost to exist so you can just make more of them to give power to your beacons.
What about accumulators? I doubt calculating remaining charge is free.
AFAIK both solar panels and accumulators follow same mechanics - they work as one grouped entity if the are connected to same networks.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 1:33 pm
by hoho
orzelek wrote:AFAIK both solar panels and accumulators follow same mechanics - they work as one grouped entity if the are connected to same networks.
I don't think they do. It's possible to have accumulators with different charge in same network. You have that every time you connect a new one to the network.
Though I wouldn't be surprised if all accumulators with equal charge level are grouped into one.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 4:13 pm
by Optera
hoho wrote:orzelek wrote:AFAIK both solar panels and accumulators follow same mechanics - they work as one grouped entity if the are connected to same networks.
I don't think they do. It's possible to have accumulators with different charge in same network. You have that every time you connect a new one to the network.
Though I wouldn't be surprised if all accumulators with equal charge level are grouped into one.
Every entity can be part of multiple networks causing different charge and drain. Destroyed poles, newly placed entities and power switches switching once a tick at worse make generating groups from scratch every tick necessary. I don't see much potential to save CPU time by grouping accumulators.
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 5:31 pm
by ssilk
Solar panels and accumulators work as one entity if in one network (and have the same charge level).
Re: Efficiency of entities that have no power.
Posted: Thu Feb 02, 2017 5:55 pm
by Rseding91
Optera wrote:Rseding91 wrote:Optera wrote:What would be the most CPU friendly way to manage 1k+ beacons?
- Have them on all the time?
Requires more power producing entities.
- Use inserters to remove the modules on circuit condition?
Adds at least 2 inserters per beacon for another 2k entities.
- Switch them off with power switches?
"one of the worse ways you can stop a factory", but it doesn't add a lot of extra entities.
Leave them fully powered at all times. Solar panels have zero CPU cost to exist so you can just make more of them to give power to your beacons.
What about accumulators? I doubt calculating remaining charge is free.
Accumulators are grouped like solar panels are.