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

Account for visibility when selecting AI superweapon targets. #14492

Merged
merged 5 commits into from
Dec 22, 2017

Conversation

pchote
Copy link
Member

@pchote pchote commented Dec 10, 2017

This fixes the single biggest complaint from casual players – that the TD airstrike always knows exactly the best target to hit. This also helps make the AI feel more like a real player, as it will fire the weapons where it think the enemy base is, which may no longer be accurate.

I have tested and tweaked TD's AI, but RA and D2K will need to be tested during review.

Adding to the milestone because this gives us a very nice user-facing feature to talk about in the news post.

Closes #7659.

@pchote pchote added this to the Next release milestone Dec 10, 2017
@@ -125,7 +125,7 @@ public int GetAttractiveness(Actor a, Stance stance, Player firedBy)
if (a == null)
return 0;

if (!a.IsTargetableBy(firedBy.PlayerActor))
if (!a.IsTargetableBy(firedBy.PlayerActor) || !a.CanBeViewedByPlayer(firedBy))
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it belongs in the third commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

abcdefg30
abcdefg30 previously approved these changes Dec 11, 2017
@pchote
Copy link
Member Author

pchote commented Dec 11, 2017

Rebased.

var left = Math.Min(a.X, b.X) / 1024;
var top = Math.Min(a.Y, b.Y) / 1024;
var right = (Math.Max(a.X, b.X) + 1023) / 1024;
var bottom = (Math.Max(a.Y, b.Y) + 1023) / 1024;
Copy link
Member

Choose a reason for hiding this comment

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

Why add an almost full cell here?
I assume this expects that the division and rounding will take care of the excess, while the extra value is to fill the cell since the caller uses CenterOfCell? But we really should be able to handle that better.

penev92
penev92 previously approved these changes Dec 12, 2017
@pchote
Copy link
Member Author

pchote commented Dec 13, 2017

But we really should be able to handle that better.

I was trying to avoid touching an existing // HACK: HACK HACK HACK in the AI code, but you're right. Unfortunately I broke this rather thoroughly while trying to fix that, and don't have the time to correct and test it.

@pchote
Copy link
Member Author

pchote commented Dec 16, 2017

Updated.

var br = world.Map.CellContaining(pos + delta);
var checkFrozen = frozenLayer.FrozenActorsInRegion(new CellRegion(world.Map.Grid.Type, tl, br));
foreach (var scrutinized in checkFrozen)
if (scrutinized.IsValid)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this missing a Visible check, like the below method?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, Visible is checked inside GetAttractiveness. The IsValid check here is to make sure that Owner is not null. I have added a comment explaining this.

@penev92
Copy link
Member

penev92 commented Dec 19, 2017

The rest looks good 👍

@pchote
Copy link
Member Author

pchote commented Dec 21, 2017

Rebased and added comment.

Copy link
Member

@penev92 penev92 left a comment

Choose a reason for hiding this comment

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

+1

@abcdefg30 abcdefg30 merged commit 028f7c6 into OpenRA:bleed Dec 22, 2017
@abcdefg30
Copy link
Member

Changelog

@pchote pchote deleted the fix-ai-supportpower-maphack branch April 28, 2018 14:56
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.

A.I. uses SuperPowers with cheat-like precision
3 participants