-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a flat threshold for the brain energy manager #6514
Add a flat threshold for the brain energy manager #6514
Conversation
New economy stats are from trigger manager
Prevents the 0.1 of max storage ratio from getting so large when playing with mods that it is difficult to restore unit functions
This reverts commit 0c7abdd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the additional annotations.
I think at this point it may be more interesting to have a thread check the economy status every tick instead of using the army stats triggers. The polling approach does not consume any noticeable resources, but it does significantly improve the readability of the code.
If we do that, we can also remove the need of some energy in your storage. We could just check both the storage and your economy. Combine that with the missile production fix of @4z0t in assembly and we can also expect less rapid fluctuations.
By economy do you mean the energy trend? What if you are in a mass + energy stall? What if we wanted to get rid of the energy-disabled shield energy drain? About getting rid of the energy drain, it could be applied just like mass fabricators where they turn on gradually to avoid energy fluctuations. With more complexity, the brain could immediately turn on as many as the current energy trend can support. |
Of course there are exceptions, but nothing that a little debouncing can't fix. My point was primarily about replacing the event-based system with a polling-based system. It's only polling a few numbers. Any other complexity (such as gradually enabling consumers) can be debounced and then applied. The event-based system is a little undocumented, and if I am not mistaken then you can only have 1 active trigger per type. Which is a little error prone. |
Just tested that multiple triggers per type works, they just need unique trigger names otherwise the triggers stop working. I think the trigger system was designed for campaigns, looking at how the trigger manager is designed, so I agree it's fine to do polling in the future for some AI brain economy functions that run constantly in comparison and don't have to be mapper friendly. |
Issue
Caused by #3699. When playing with mods that add extreme amounts of energy storage (T3 energy storage + multiple storage multiplier mods), an energy stall can disable your shields for minutes because they require 0.1% of the max storage to be full to activate, and energy storage can easily reach hundreds of millions while energy production remains rather tame in comparison.
Description of the proposed changes
Changes the trigger for when units are re-enabled to be based off available max storage. The ratio is still 0.1, but above 100k storage the ratio no longer increases.
If the amount of energy storage is passes over/under the threshold during an energy stall (when the energy ratio/flat amount is in effect), the ratio/flat trigger is switched to the other type.
Testing done on the proposed changes
Toggle the omnis in this set of units to control your energy amount.
First, deplete all energy to activate the new triggers.
Now you can add 20 storages and see that only 10k energy is needed to reactivate the shield.
You can also delete the storages while waiting for 10k energy and it will almost instantly reactivate due to the ratio making 500 energy the new trigger.
Additional context
Checklist