Skip to content

Projectile underrange corrections#7385

Draft
efrec wants to merge 7 commits intobeyond-all-reason:masterfrom
efrec:demo/projectile-underrange-correction
Draft

Projectile underrange corrections#7385
efrec wants to merge 7 commits intobeyond-all-reason:masterfrom
efrec:demo/projectile-underrange-correction

Conversation

@efrec
Copy link
Copy Markdown
Collaborator

@efrec efrec commented Apr 10, 2026

Work done

This offsets the recent targetborder change – which caused units to aim at the nearest point on their targets – by redirecting the fired projectile toward the target's center-mass as though it were aimed and fired with targetborder = 0.

The correction consists of a few steps:

  • Infer the targetBorder-based position and the ideal aimPos-based position
  • Find the angle between the two from the projectile
  • Rotate the projectile's velocity by that angle

These steps also respect the weapon's maximum lead limit, do not allow redirecting the projectile beyond its normal range, and restricts the maximum angle of correction to a reasonable size.

Asked Gemini nicely for an image and it got me 25% of the way to this:

image

Addresses Issue(s)

Units like Legion Gladiators appear functional on paper with decent stats for extended skirmishes, but they show catastrophic DPS loss (zero DPS) against the retreat. We saw this repeatedly during Faction Wars on any map open enough for medium tanks. This was not my previous experience with the unit before, so I highly suspect the target border change.

When I'd considered tweaks to those units, one possibility was to make their accuracy and lead prediction worse, since this actually makes some shots hit by random chance. We should avoid unintuitive configuration in general, but this was especially bad to me. Worse prediction should not give better prediction.

Testing

In my testing, the difference in the initial velocity is very small, but the chance to hit retreating units is noticeably higher (still poor) on units with slow plasma projectiles. I am satisfied that it is an improvement to BAR's unit IQ and to plasma units in general.

This is not quite a full solution for BAR's kiting advantage. ZeroK explored an option to do that: weapon_projectile_retarget.lua

I think that is a pretty good solution, also, but it wasn't what I'd intended to do. If a more complete concept is wanted, then I'd need to test against these, as well.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Integration Test Results

16 tests  ±0   8 ✅ ±0   3s ⏱️ ±0s
 1 suites ±0   8 💤 ±0 
 1 files   ±0   0 ❌ ±0 

Results for commit c486eb0. ± Comparison against base commit 0756437.

♻️ This comment has been updated with latest results.

@efrec efrec marked this pull request as ready for review April 10, 2026 03:37
@efrec
Copy link
Copy Markdown
Collaborator Author

efrec commented Apr 10, 2026

Before: many misses, inaccuracy is almost always short, even hits are shallow/short.

2026-04-09_23-23-52.mp4

After: few misses, inaccuracy seems random, hits are solid.

8mb.video-CL1-wRQxMes7.mp4

@efrec efrec changed the title Demo/projectile underrange correction Projectile underrange corrections Apr 10, 2026
efrec and others added 2 commits April 10, 2026 09:44
@efrec
Copy link
Copy Markdown
Collaborator Author

efrec commented Apr 13, 2026

tl;dr: Going to make a change and retest.

I recorded some stats to get a better idea of this change. Different units performed differently but I wanted to focus on units like Thugs and Brutes, first.

Test 1

Units showed more indirect hits with aim correction. Weak hits/splash damage as a proportion of total damage increased from 4.5% to 6.2% for Thugs with correction, and from 9.8% to 13.2% for Brutes.

Takeaway: When shots tend to miss left/right rather than up/down, this type of aim correction is a poor solution. We should only do this correction when chasing, in fact. That was something I'd suspected already.

Pic to show the difference in trajectory for Thug vs Thug with the aim correction. This is from spawning a second projectile instead of reorienting the first:

image

The projectile on the target-border path will land closer to the target's feet when missing left or right, dealing >85% damage reliably to an enemy Thug.

Test 2

I limited correction to retreating targets and repeated the tests. I added more units and gave them more room to roam, so the results are a bit different. After 30,000 shots fired in each fightertest:

New Thug test:

  • uncorrected: 0% correction rate, 88.8% damage rate (3.2% splash)
  • correction: 39% correction rate, 89.7% damage rate (4.4% splash)

New Brute test:

  • uncorrected: 0% correction rate, 57.4% damage rate (12.4% splash).
  • correction: 55% correction rate, 58.3% damage rate (14.0% splash).

Which is essentially no difference.

Next

I'll make an aimbot next to test the upper end, and maybe reformulate after. Drafted for now.

With one quick change, I got a different test scenario (corthud vs corak) from 57% damage rate up to about 72%. That seems like an excessive improvement tbh.

@efrec efrec marked this pull request as draft April 13, 2026 01:19
@efrec efrec force-pushed the demo/projectile-underrange-correction branch from a367cf6 to c486eb0 Compare April 13, 2026 01:46
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.

2 participants