Page MenuHomeWildfire Games

Remove separate gaia range query from BuildingAI
Needs RevisionPublic

Authored by temple on Nov 28 2017, 4:43 AM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Currently BuildingAI treats gaia different than other players, in particular ignoring healers and enemy towers for example. This is particularly annoying on Danubius where your units can chase healers all over the map; it would be nice if a tower could take them out.

We should attack any damage receiver except non-dangerous animals, since it's a bit silly to attack your starting chickens. There's a bit of a loophole with defensive animals like gaia elephants, which aren't dangerous (violent or aggressive) but can attack back. Since we can't manually control BuildingAI (yet, anyway), the alternative is to make them also attack those by default, but it seems bad to pick a fight with an elephant who will then destroy your tower.

Hmm, actually testing now, and elephants don't attack back. Seems like a bug? And I thought you used to be able to trick an elephant into attacking an enemy's civic center? Maybe later I'll explore what's going on with this stuff...

Test Plan

Agree that the new behavior is better than the old.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

temple created this revision.Nov 28 2017, 4:43 AM
temple updated this revision to Diff 4422.Nov 28 2017, 5:00 AM
elexis added a subscriber: elexis.Nov 28 2017, 5:21 AM

Thanks for investigating that. I agree that all units except non-dangerous animals should be attacked, specifically that random gandalf on danubius. I like that it results in deletion while increasing the usability.
Patch appears correct and complete on first sight.

It's hard to identify any downsides to this. It's kind of only relevant for danubius currently because that's the only case where gaia units that can't attack run around.
If there are gaia trade carts around, that means someone resigned already. If then there is a battle and someone owns a tower, that tower will be less efficient by targetting the gaia trader carts. Who cares though.

in particular ignoring healers and enemy towers for example

It ignored and still ignores towers of both gaia and regular players, no?

it seems bad to pick a fight with an elephant who will then destroy your tower.

While we're already talking about fun side issues of matches: Arrows can miss the target and hit a gaia elephant. That can be abused if a gaia elephant is in CC attack range, then dance around that elephant and it will attack the enemy CC. I had uploaded an a21 or 22 replay for that where I could pull that ingame (only feasible on small mapsh however)

Ideally towers would still attack elephants once those start attacking one of our entities, or at least that buildingAI entity. Not important though.

binaries/data/mods/public/simulation/components/BuildingAI.js
163

So this IID_Attack was the reason healers were ignored

temple added a comment.EditedNov 28 2017, 5:35 AM
In D1076#42771, @elexis wrote:

in particular ignoring healers and enemy towers for example

It ignored and still ignores towers of both gaia and regular players, no?

Towers would attack enemy towers (that's pizza), but they wouldn't attack gaia towers, because while towers have an Attack component they don't have a UnitAI component, so they failed the test at L183.
Now we only check for damage receiver, so both enemy and gaia towers will pass, so we'll have tower wars with both.

it seems bad to pick a fight with an elephant who will then destroy your tower.

While we're already talking about fun side issues of matches: Arrows can miss the target and hit a gaia elephant. That can be abused if a gaia elephant is in CC attack range, then dance around that elephant and it will attack the enemy CC. I had uploaded an a21 or 22 replay for that where I could pull that ingame (only feasible on small mapsh however)

That's what I was talking in the last paragraph of the summary, it seems it doesn't work anymore? I took out the dangerous animal test so that my cc or tower would attack elephants directly, but they just sat there and died. Maybe I was doing it wrong? Anyway, I'll explore later.

It ignored and still ignores towers of both gaia and regular players, no?

Ah yes, reading helps.

I think we (fatherbushido and me) added buildings and ships to the restricted classes of animals to prevent that.

temple added a comment.EditedNov 28 2017, 9:03 PM
In D1076#42775, @elexis wrote:

It ignored and still ignores towers of both gaia and regular players, no?

Ah yes, reading helps.

I think we (fatherbushido and me) added buildings and ships to the restricted classes of animals to prevent that.

Okay, I see the discussion at #1487, thanks.

This also removes the "preferential" treatment of enemies over gaia. Not that I guess any of that has been considered since fixing a single map seems important.

In D1076#42910, @leper wrote:

This also removes the "preferential" treatment of enemies over gaia. Not that I guess any of that has been considered since fixing a single map seems important.

I'm not sure what you mean?

Perhaps we could also prefer attackers of player 3 over attackers of player 2 and add custom range queries for that ;-)

Rephrased: The gaia champions from your resigning opponent or scripted campaign enemy are just as dangerous as the non-gaia champions.
We have prefered classes in the templates to do a smart target selection. (BuildingAI just ignores that because thats the kind of thing BuildingAI does. fatherbushido and me did set the prefered targets of ships once, completely useless).

Agreed that targeting Gaia over enemy units doesn't seem obviously better or worse. Ideally buildingAI, like unitAI, would pick the "best" foe, but that's for another day imo.

mimo added a subscriber: mimo.EditedNov 29 2017, 6:23 PM

I disagree. Gaia is generally a nuisance, while enemies are the "Enemy". If attacked simultaneously by enemies and gaia, i will nearly always (except rare cases) retaliate first against enemies, and only after againt gaia. By doing so, you:

  • have the chance that gaia will also attack the enemies currently attacking you
  • i prefer to eliminate all enemies, even if that mean i will loose my structure against gaia. It's always better to have gaia capture/destroy your structure rather than being captured by the enemy.

That said, looking at the code, it seems that both entities (gaia and enemies) were only concatenated, without any effect on the preference. So that patch won't change anything. But while at it, we may modify the weight of the enemies compared to gaia: for example, increasing the preference (by 1 or 2 units) when it is a gaia entity.

wraitii requested changes to this revision.Dec 1 2017, 12:26 PM

Alright so let's ensure enemies come first and go.

This revision now requires changes to proceed.Dec 1 2017, 12:26 PM
temple added a comment.Dec 1 2017, 3:22 PM

Changing targeting preferences should be done in a separate patch in my opinion.

The weighted targeting here is bad, and UnitAI and BuildingAI should use the same system, so it should be a part of Attack. I'll work on this.