HaywireInteractive / OnAllFronts-Public

UE5 MilSim FPS / RTS Game (formerly ProjectM)
MIT License
112 stars 22 forks source link

Improve AI target tracking logic #967

Closed Leroy231 closed 4 weeks ago

Leroy231 commented 2 months ago

To see the issue we're trying to fix:

  1. Start L_Small_TrackTargetTest in client net mode
  2. run pm.SkipDealingDamage 1
  3. press Enter to enable combat
  4. Wait for soldier to start targeting other soldier. You'll see that the soldier turns towards target but by the time they shoot each time the target has moved.

To fix we should update ST_Soldier so that it runs the LookAtViaMoveTarget task constantly as long as it's in the loop of LookAtTarget -> CheckLOS -> Raise -> AimAndShoot -> AimBeforeShoot -> Shoot -> LookAtTarget. We could do this by nesting this whole loop inside the LookAtTarget state. We also need to add to FMassLookAtViaMoveTargetTask a UPROPERTY bool bLookForever which defaults to false but we set to true in the LookAtTarget state.