Opened 3 years ago

Closed 3 years ago

#5968 closed defect (fixed)

Idle entities not reacting to nearby enemies.

Reported by: Freagarach Owned by: wraitii
Priority: Release Blocker Milestone: Alpha 24
Component: Simulation Keywords: UnitAI
Cc: Patch: Phab:D3456

Description

As can be seen in the attached replay, there are sometimes some idle javelineers of mine that do not attack nearby enemies.

Attachments (2)

commands.txt (310.1 KB ) - added by Freagarach 3 years ago.
r24761
commands.2.txt (40.4 KB ) - added by wraitii 3 years ago.
more minimal repro

Download all attachments as: .zip

Change History (8)

by Freagarach, 3 years ago

Attachment: commands.txt added

comment:1 by Freagarach, 3 years ago

Component: Core engineSimulation

by wraitii, 3 years ago

Attachment: commands.2.txt added

more minimal repro

comment:2 by wraitii, 3 years ago

The cause is pretty dumb and probably Phab:rP24217.

comment:3 by wraitii, 3 years ago

K, this is very much a release blocker... Phab:rP24217 has basically introduced edge cases in all unit range queries. The problem is UnitAI does some primitive range checking, using euclidian distance and not proper obstructionManager distance checking. But things don't stop there.

  1. Defensive checks distance to a held position, but the range check is for the entity itself, which is very much not at the held position. Using the los range update is incorrect here in almost every case.
  2. Even then, the range queries might return entities which are technically inside the vision range, but aren't visible because of #5606 (our entities become visible when their center-point is visible).
  3. Finally, range queries don't really guarantee that units are actually in range, so using those and checking range precisely and then forgetting about the units is probably not a good call in any case.

I fear I have to upgrade r24217 to include a 'force center-to-center' query mode or things might be very, very broken at the moment, because of point 2.

BTW this is easier to reproduce with rams, because of their slow speed and larger obstruction size almost guaranteeing that they'll be reported in the range query before they're actually in the proper range.

Last edited 3 years ago by wraitii (previous) (diff)

comment:4 by wraitii, 3 years ago

Priority: Must HaveRelease Blocker

comment:5 by wraitii, 3 years ago

Patch: Phab:D3456

comment:6 by wraitii, 3 years ago

Owner: set to wraitii
Resolution: fixed
Status: newclosed

In 24776:

Fix UnitAI range queries - allow queries to ignore sizes - partial revert of rP24217

Units sometimes ignored targets that entered their LoS. The cause is rP24217: range queries returned units farther away, and those units might actually be out of range if distance is computed center-to-center, which both UnitAI and LOS do. This meant that code relying on range query updates was possibly broken, and indeed units missed things (see ticket).

This introduces a boolean to switch between pre-rP24217 behaviour (entity-as-point, center-to-center range queries) and post-rP24217 (entities-as-circumscribing-circle, edge-to-edge range queries).
The former is used for UnitAI (where the new behaviour bugged), auras (where varying structure sizes made it awkward) and build restrictions(which simply did not really need it).

Reverts rP24643, rP24349 (with the exception of the iber monument footprint), and the template changes in rP24217 itself.

It also reduces alertRaiser ranges slightly, this was missed in the original diff.

#3381 is not reopened as BuildingAI still uses the new range queries.

Reported by: Freagarach

Comments By: Angen

Fixes #5968

Differential Revision: https://code.wildfiregames.com/D3456

Note: See TracTickets for help on using tickets.