-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Introduce AI production considerations #16633
Conversation
Keep in mind that the AI infantry compositions need to add up to 100% in RA atleast due to #11797. |
namespace OpenRA.Mods.Common.Traits | ||
{ | ||
[Desc("Controls AI production.")] | ||
public class BotProductionConsiderationInfo : ConditionalTraitInfo |
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.
BotProductionComposition
is probably a better name for this.
If I can fix this to not noticeably regress the AI in each mod it would be best to merge with the bogus legacy definitions and then aim to implement a new AI skeleton in a followup. I have created #16634 to plan this. |
Why random? |
See #16126 |
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.
The AI in TD seems to work quite well already with silos disabled.
nuk2: 10 | ||
proc: 20 | ||
Limit: 4 | ||
silo: 10 |
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.
This should be removed (or effectively limited) as discussed on IRC.
Priority: 3 | ||
Actors: | ||
hpad: | ||
Limit: 2 |
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.
No new line at the end of the file.
It's not working with classic production queues. |
It's working after defining So my issue was completely unrelated to |
I'm hoping to resurrect this for Next + 1, so adding to the milestone. |
I am kinda confused reading all the file changes, so I will just ask. |
- Consideration metrics split out to a BotProductionConsideration trait - Unit composition fractions, build limits, and delays are now actually used - AI will now build ONLY items specified in considerations
- Add structures that were not listed - Remove duplicate definitions - Require HQ before building HPAD in TD
9d1aae8
to
8624126
Compare
@@ -267,15 +189,20 @@ Player: | |||
ConstructionYardTypes: construction_yard | |||
IgnoredEnemyTargetTypes: Creep | |||
UnitBuilderBotModule@vidious: | |||
======= | |||
BotProductionConsideration@units-vidious: | |||
>>>>>>> c91beaba0b... Overhaul bot production logic. |
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.
You have rebase conflicts in here...
Too many other things are happening right now to even pretend that we can come back to this soon. Moving to the Future milestone 😢 |
This PR extracts the metadata that the AI uses to decide what to build into its own trait, and generalizes the capabilities to be much more useful. The new
BotProductionConsideration
traits can be combined to reduce duplication, and can be toggled using conditions to modify the AI build priorities at runtime.The main usecase for this is to let us define production overrides for the different difficulty levels (e.g. capping harvesters to 3 for Easy AI) without having to duplicate the entire module. I've implemented priority levels and the ability to toggle considerations using conditions which means that these overrides can be changed at runtime, opening up possibilities such as tech transitions and in the future replacing the hardcoded priority overrides. I've implemented an example of this in TD, with the AI only building helipads once they have a comm center, as it is useless to them earlier.
In the future I expect
BotProductionConsideration
can be superseded by more specialized traits defining team types for units, and build orders for buildings.Prerequisite for #16126 (which I still believe is important for the next release)
Fixes #8029
I've set up TD reasonably well in the new system, but i'm at a complete loss at how to handle RA and D2K - opening as a draft to get some feedback and ideas on how to proceed.
The production percentages for these mods are just completely bogus with arbitrary numbers that are nowhere close to adding up to 100%. This partially explains why the AI production has always been wonky - in practice it is driven by priority overrides and limit caps, and otherwise basically random.
Consider the unit percentages: if we ignore the issue where they are completely ignored unless there are more than 12 idle units in the base (which is rare), then the percentages are still likely to be ignored. Many of the units define percentages in the 25-60% range, which will never be achievable. These units will therefore always pass the test to be built if they are picked by the random shuffle. Buildings have the opposite issue, with most structures requesting a 1% fraction, meaning that the AI wants to build approximately 0 of everything, which is rounded up to 1.
Migrating the numbers as they are doesn't make much sense and will probably regress behaviour - I have fixed several bugs that caused the limits and time delays to be ignored in some cases, and the unit percentages to be ignored almost all of the time.
I think the best option forward will be to get rid of the rush/normal/turtle/naval AIs here, and implement new production considerations from scratch that make some degree of sense. We can then have variants that e.g. build twice as many infantry/vehicles/air/defenses, and expose them either explicitly as "<X> AI"'s, or scope creep towards #16126 by going straight to a single "Normal AI" with the variants as random choices.