Skip to content
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

Fix AI air squad misbehaving in TS maps #18710

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

dnqbob
Copy link
Contributor

@dnqbob dnqbob commented Oct 11, 2020

Fixes #18705

I divide two scanning method into two if. I think the array is unnecessary for RectangularIsometric maps and may save some performance before we come out with better idea.

@pchote
Copy link
Member

pchote commented Oct 19, 2020

The real problem here is that the squad code is mixing up CPos versus MPos coordinates.

Replacing

var pos = new CPos((i % columnCount) * dangerRadius + dangerRadius / 2, (i / columnCount) * dangerRadius + dangerRadius / 2);

with

var pos = new MPos((i % columnCount) * dangerRadius + dangerRadius / 2, (i / columnCount) * dangerRadius + dangerRadius / 2).ToCPos(map);

may be a much simpler workaround for the issue. MPos and CPos are equivalent for MapGridType.Rectangular so there should be no changes in behaviour there.

@pchote
Copy link
Member

pchote commented Oct 19, 2020

This is a natural part two to #17855, so really should be on the milestone.

@pchote pchote added this to the Next Release milestone Oct 19, 2020
@dnqbob
Copy link
Contributor Author

dnqbob commented Oct 19, 2020

The real problem here is that the squad code is mixing up CPos versus MPos coordinates.

Replacing

var pos = new CPos((i % columnCount) * dangerRadius + dangerRadius / 2, (i / columnCount) * dangerRadius + dangerRadius / 2);

with

var pos = new MPos((i % columnCount) * dangerRadius + dangerRadius / 2, (i / columnCount) * dangerRadius + dangerRadius / 2).ToCPos(map);

may be a much simpler workaround for the issue. MPos and CPos are equivalent for MapGridType.Rectangular so there should be no changes in behaviour there.

Don't know if that is working. But I will have a try.

@dnqbob dnqbob marked this pull request as draft October 19, 2020 23:21
@dnqbob dnqbob marked this pull request as ready for review October 20, 2020 13:43
@dnqbob
Copy link
Contributor Author

dnqbob commented Oct 20, 2020

@pchote
Tested. it is fixed.

Change Cpos to Mpos by Pchote
Copy link
Member

@pchote pchote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested, but the code change looks correct.

Copy link
Member

@abcdefg30 abcdefg30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AI still behaves weird with air units, but this change is not making it worse (and makes sense).

@abcdefg30 abcdefg30 merged commit 48f4a98 into OpenRA:bleed Oct 30, 2020
@abcdefg30
Copy link
Member

Changelog

@dnqbob dnqbob deleted the Fix-Isometric-AI-airScan branch October 30, 2020 08:22
@dnqbob
Copy link
Contributor Author

dnqbob commented Oct 30, 2020

The AI still behaves weird with air units, but this change is not making it worse (and makes sense).

So AI air squad still won't attack when enemy actors at certain side of map? during my test it seems OK, although the target they pick become weird.

@abcdefg30
Copy link
Member

They still sometimes start to idle, or don't reload. See #6316.

@dnqbob
Copy link
Contributor Author

dnqbob commented Oct 30, 2020

They will land and take off immediately especially when the bot's base is under attack

In fact, when bot's base under attack the aircraft is controlled by protection squad, which overtake controls from air squad. You can use #17999 to fix. (#18039 also help a little bit on reload part for aircraft in protection squad)
update:
The former protection squad is simply grab a bunch of units, no matter it is air or ground and attackmove to target until target die. Then you will find aircraft running out of ammo try step to the head of enemy (AttackMove)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AI Airstate broken on TS/RA2 maps
3 participants