Make the AI respect BuildLimit

Bug #894993 reported by Marshall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ares
Fix Released
Medium
DCoder DCoder

Bug Description

In the unmodded AI, there are two TaskForces that include TANY (Tanya) (I haven't checked how many triggers would invoke this). No checks are performed to make sure BuildLimit won't be broken when an AI trigger runs.
In my mod, I have seen the AI build three instances of a new hero unit due to the different TaskForces that include it.

Would be nice if the TeamType could specify
A) The trigger must be aborted if the BuildLimit of any units would be broken, or
B) The TaskForce can still be created but the offending units would have to be excluded (if this means the TaskForce would be empty then abort the trigger)

Revision history for this message
Bug Importer (bug-importer) wrote :

Thos damn AI cheats! Too many of 'em, must all be sorted out, not just this one!

Revision history for this message
Bug Importer (bug-importer) wrote :

The AI ignores all Prerequisite settings, unless it has an Prerequisite in the trigger like: AI must have at least 1 Tech Lab

If you play against an Allied AI it builds spy's before it has a Tech Lab

Revision history for this message
Marshall (m-edward) wrote :

Yes, but that can be fixed by setting up TechLevels correctly.

Revision history for this message
Bug Importer (bug-importer) wrote :

@Marshall
I find this hard to believe. As far as I know the game is always on Tech 10.

What you say is this:
AI builds refinery = tech 2 so it can build tech 2 units.
AI builds barracks = tech 3 so it can build tech 3 units.
AI builds radar = tech 4 so it can build tech 4 units.
etc.

~ZeroMD

Revision history for this message
Black Temple Gaurdian (black-temple-gaurdian) wrote :

Yeah, thats how it is.

Revision history for this message
Marshall (m-edward) wrote :

The AI does not build units based on TechLevel, it builds units because an AI Trigger was executed that told it to build the units.

In the unmodded aimd.ini, all the Spy triggers are TechLevel 5. It's a simple matter to change these to TechLevel 8, the TechLevel of the Allied Battle Lab - then the AI no longer 'cheats' in this respect.

However, adhering to the BuildLimit is something that would require a change to the executable.

Revision history for this message
MRMIdAS (mrmidas) wrote :

I would LOVE it if the AI considered buildlimit beofre it constructed ANYTHING, to stop my "elite" Tanya being built 6 times when it's got a build limit of one.

Revision history for this message
OmegaBolt (omegabolt) wrote :

IMO this should be completely optional, as some modders might want the AI to cheat. You could also make it depend on the AI difficulty.

AI.RespectBuildLimit= [0 = not at all (default), 1 = easy mode only, 2 = medium only, 3 = hard only, 4 = always]

You should also be able to stack these, like...

AI.RespectBuildLimit=1,3

That'd mean only in medium mode would the AI cheat.

There could probably be a better system for this, but its just an idea.

Revision history for this message
Marshall (m-edward) wrote :

I don't think it needs to be optional. If it is, then the default should be "AI respects build limit" as I think most people would want this.

In fact, we definitenly don't need it to be optional. It already is - the mod author can simply create a clone of the unit that has no build limit that only the AI can build.

Revision history for this message
Bug Importer (bug-importer) wrote :

Code related to this issue has just been checked in; DCoder wrote in revision 581:
Related to issue #318 - [GlobalControls]AllowBypassBuildLimit=yes,yes,yes ; easy, med, hard
will prevent the AI from abusing BuildLimits in most cases. Note that due to a parser limitation it only recognizes "yes" and not other known truisms for now.
Related to issue #340 - rewrote the code to use Valueable and Customizable where applicable, some debug::logs might be broken as a result. Also improved nearest tower search. Will be quite surprised if it works right!
Related to issue 318,340 .
SVN: http://svn.renegadeprojects.com/listing.php?repname=Ares&path=%2Ftrunk%2F&rev=581&sc=1

Revision history for this message
Bug Importer (bug-importer) wrote :

nice ;)

Revision history for this message
Bug Importer (bug-importer) wrote :

Code related to this issue has just been checked in; DCoder wrote in revision 599:
Related to issue #318 - Reordered difficulty values so that it's really e,m,h now.
Fixed issue #946 - AlphaLights should work correctly now. I have no idea how they worked so far, since the code was really wrong!
Related to issue 318,946 .
SVN: http://svn.renegadeprojects.com/listing.php?repname=Ares&path=%2Ftrunk%2F&rev=599&sc=1

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

I'm marking this as resolved - the AI will ignore a teamtype which involves a taskforce with unbuildable units. The proposed addition of letting the teamtype decide for itself will be implemented in the future (0.6, with other AI enhancements). This means that now it's your turn to test this.

Revision history for this message
MRMIdAS (mrmidas) wrote :

shouldn't "AllowBypassBuildLimit=yes,yes,yes" be "AllowBypassBuildLimit=no,no,no" to disallow the buildlimit from being bypassed?

not that it matters to the game, but reading it is slightly confusing.

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

Woops, good catch. This flag defaults to no, which means the AI will obey the limit by default, and setting it to "yes" will revert to old unlimited behaviour. Now that I said this I wonder if that's the right approach for, say, CannisRules, which is not likely to be updated to co-op with Ares...

Revision history for this message
MRMIdAS (mrmidas) wrote :

i'd say keep the default behaviour to allow the bypass, if a modder wants the AI to not cheat, he can disable it pretty easily.

Revision history for this message
modder666 (modder666) wrote :

This is a yes and no, working and not working situation. While the AI obeyed BuildLimit=1, it ignored BuildLimit=0.

Revision history for this message
MRMIdAS (mrmidas) wrote :

yeah, thats because 0 is "no limit"

Revision history for this message
modder666 (modder666) wrote :

You obviously haven't tested this. BuildLimit=0 is documented to disallow players from constructing buildings while giving them to the AI, as in this tutorial: http://forums.revora.net/index.php?showtopic=78580

Revision history for this message
MRMIdAS (mrmidas) wrote :

that's very odd, wonder what the default is, because 0 is usually "no limit"

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

Default is 2147483647 , or 0x7FFFFFFF.

Revision history for this message
modder666 (modder666) wrote :

So how will the magical DCoder handle making the AI obey BuildLimit=0 structures?

Revision history for this message
YR M0ddEr (yr-m0dder) wrote :

Tested in 0.1.886

So what I did was to put TANY in every single allied task force in aimd.ini.
First, I tested with adding AllowBypassBuildLimit=yes,yes,yes to [GlobalControls].
The result was that AI builded all the task forces and there were tons of tanya on the map.
Then I removed those two tags(default is no), and there was never more than one TANY on the map.

This can be closed.

Revision history for this message
Renegade (renegade) wrote :

Closed as per comment above.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.