Hey, so as I understand it, beacons check every 120 ticks if they have power.
So if instead they wouldnt require any power at all, and instead the power cost of the buildings would be increased accordingly, beacons should basically be free, and it would affect gameplay only by making power supply in beaconed builds slightly easier.
Alternatively I think it should be possible to check if a beacon has power only if a power pole nearby is built/removed.
Potentially beacon optimization?
Moderator: ickputzdirwech
-
- Burner Inserter
- Posts: 7
- Joined: Fri Aug 04, 2023 7:59 am
- Contact:
Re: Potentially beacon optimization?
Thanks for the idea but in terms of optimization we almost never take any external ideas because they rarely consider all the important corner cases that need to be considered. Your case is not an exception since you are describing a low level behavior of an entity (update process itself).
Having beacons update once every 120 ticks is already good enough to make them almost never appear on profiler and when they run they take so few amount of cpu power that i see no reason for optimizing them any further. In your proposition for example you are not considering effects beacon has in case when it is low on power (in which case the effect strength is scaled down) nor what happens when a beacon is powered by multiple overlapping electric networks. Having beacons update once every 120 ticks makes them behave relatively nicely when electric network is low on power, if beacons would be forced to update their effect strength every tick power changes then in case of brownouts they would start taking a lot of cpu time to update or would also need to be updated rarely which would require tracking which beacons are already pending an update due to low power. When adding such pieces of logic to track something, its easy to fall into trap of not realizing that all the tracking also has cost that sometimes can exceed the code it tries to avoid in which case we simply do not apply such changes.
Having beacons update once every 120 ticks is already good enough to make them almost never appear on profiler and when they run they take so few amount of cpu power that i see no reason for optimizing them any further. In your proposition for example you are not considering effects beacon has in case when it is low on power (in which case the effect strength is scaled down) nor what happens when a beacon is powered by multiple overlapping electric networks. Having beacons update once every 120 ticks makes them behave relatively nicely when electric network is low on power, if beacons would be forced to update their effect strength every tick power changes then in case of brownouts they would start taking a lot of cpu time to update or would also need to be updated rarely which would require tracking which beacons are already pending an update due to low power. When adding such pieces of logic to track something, its easy to fall into trap of not realizing that all the tracking also has cost that sometimes can exceed the code it tries to avoid in which case we simply do not apply such changes.
-
- Burner Inserter
- Posts: 7
- Joined: Fri Aug 04, 2023 7:59 am
- Contact:
Re: Potentially beacon optimization?
I see, thanks for explaining. I did not know that their effect gets weaker in brownoutes, makes sense tho.
Well maybe at some point you can figure out some multihtreading magic :)
Thank you for interacting so much with the community, you guys really are the best!
Well maybe at some point you can figure out some multihtreading magic :)
Thank you for interacting so much with the community, you guys really are the best!