Skip to content

Conversation

KJeff01
Copy link
Member

@KJeff01 KJeff01 commented Mar 2, 2025

Deduct target weight of objects if line of fire is obstructed by terrain.

This is probably one of the most important bug fixes of all time. WZ makes a terrible mistake of not having the target auto-selection account for terrain obstruction (hills) in-between the attacker and potential target. This means the micro-AI can easily get tunnel vision on something it can't hit (within long range) but is visible at the same time. As such, objects that have the ability to shoot downwards have a colossal advantage over those that shoot upwards.

In effect the battles of campaign and low oil will feel a lot more fair and smooth with this fix. Hard to pass chokepoints with hills, like the one in Beta 6, should no longer draw out battles longer than usual if you don't click on something directly within a straight firing line. Or by rushing into them to reach the poorly selected unit.

Not sure if the two ifs should be side by side or turned into an if-elseif. I left it as it is in case guard behavior may wish to track a nearby damaged unit over a hill under vision. This PR should probably have a performance impact check done on it since this gets called a lot. Would like additional testing on this--I've already played up to Beta 3 with it so far.

Fixes #4163


In this video I recorded to show pastdue some weeks ago, you can see my units freely choosing enemy units that it can fire at, instead of the ones behind the hill as in Arc's video. This bug affects mobile units too, not just holding ones, so if I showed my tanks moving in this recording, they would still fire at the debug units I was putting to the right side of them (unlike any past release).

Weapon.Jitter.Fixed.mp4

Deduct target weight of objects if line of fire is obstructed by terrain.
@KJeff01 KJeff01 added this to the 4.6.0-beta1 milestone Mar 2, 2025
@KJeff01 KJeff01 merged commit 38662e5 into Warzone2100:master Mar 9, 2025
37 checks passed
@KJeff01 KJeff01 deleted the lineCheck branch March 9, 2025 22:58
@aco4
Copy link
Contributor

aco4 commented May 10, 2025

Does this change affect VTOL behavior?

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

Successfully merging this pull request may close these issues.

microAI is broken on non-flat terrain
2 participants