Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Artillery prediction fix #374

Closed
wzdev-ci opened this issue Apr 10, 2009 · 27 comments
Closed

Artillery prediction fix #374

wzdev-ci opened this issue Apr 10, 2009 · 27 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_bug | by Adam Olsen <rhamph+warzone@...>


The target prediction code assumes all projectiles use a constant speed. Normally this is true, but artillery varies its speed to maintain a ballistic trajectory at longer ranges.

This patch uses sqrt(dist)/30 as a flight time predictor. This is totally a guess and a bodge, but seems fairly effective.

The prediction is still fairly naïve in a number of ways:

  • slight turning motions throw it out
  • slight hills throw it out, due to speed changes
  • despite hills affecting speed, it doesn't actually aim any higher, so it can quite easily miss a unit climbing a steep hill

Issue migrated from trac:374 at 2022-04-15 18:08:07 -0700

@wzdev-ci
Copy link
Contributor Author

Adam Olsen <rhamph+warzone@...> uploaded file warzone-artillery-predict.diff (1.1 KiB)

@wzdev-ci
Copy link
Contributor Author

Zarel changed status from new to accepted

@wzdev-ci
Copy link
Contributor Author

Zarel set owner to Zarel

@wzdev-ci
Copy link
Contributor Author

Zarel commented


Yay, math!

@wzdev-ci
Copy link
Contributor Author

Adam Olsen <rhamph+warzone@...> uploaded file warzone-predict.diff (1.5 KiB)

Handle EMP as well

@wzdev-ci
Copy link
Contributor Author

Adam Olsen <rhamph+warzone@...> commented


New version, handles delays due to EMP. Seems to work for artillery, but I didn't find a convenient example of normal direct weapons having problems to test with.

@wzdev-ci
Copy link
Contributor Author

Zarel changed status from accepted to closed

@wzdev-ci
Copy link
Contributor Author

Zarel set resolution to fixed

@wzdev-ci
Copy link
Contributor Author

Zarel commented


Committed in [7155].
Backported to 2.2 in [7156].

@wzdev-ci
Copy link
Contributor Author

Adam Olsen <rhamph+warzone@...> commented


Indirect fire has four range categories (for trajectory purposes, not hit chance purposes):

Long: fixed angle, variable (high) velocity
Medium: low variable angle, fixed velocity
Short: super high variable angle, fixed velocity
Point blank: direct fire

My previous patch confused the point blank/short threshold for the medium/long threshold. My new patch fixes this, although the threshold itself is a little fuzzy.

The original code had correct prediction for point blank and medium. My previous patch added correct prediction for long. However, there is still no correct prediction for short. Short also has significant problems with height differences, so it is often unable to hit targets that are much lower than it. I've added an extra range check (psStats->minRange < TILE_UNITS*3) to reduce how often it gets used, but I've been unable to eliminate it (without making point blank excessively large.)

IMO, there's a lot of ugliness here, but I want to get the medium/long threshold fixed before getting too deep in fixing other things. I did add a small check for projectiles passing below the map, but that's usually because they skipped past their real target.

@wzdev-ci
Copy link
Contributor Author

Adam Olsen <rhamph+warzone@...> uploaded file warzone-predict-3.diff (3.0 KiB)

@wzdev-ci
Copy link
Contributor Author

Zarel changed status from closed to reopened

@wzdev-ci
Copy link
Contributor Author

Zarel changed resolution from fixed to ``

@wzdev-ci
Copy link
Contributor Author

Rhamphoryncus uploaded file warzone-predict-3b.diff (57.5 KiB)

Missed a bit. Bluh.

@wzdev-ci
Copy link
Contributor Author

Per commented


That last patch is full of noise.

@wzdev-ci
Copy link
Contributor Author

Rhamphoryncus commented


Sorry, ignore it, 3 is right.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 5, 2009

Buginator changed priority from major to blocker

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 5, 2009

Buginator commented


Just a FYI, this is a git patch, so I couldn't apply it at this time.

Changing priority to blocker, since, we need a fix.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Rhamphoryncus uploaded file warzone-predict-4.diff (2.3 KiB)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Rhamphoryncus commented


Version 4, latest in the escapade:

  • Updated to trunk, including Zarel's slightly excessive casting fix
  • Ditches the TILE_UNITS*3 threshold, which should be a separate patch IMO.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Per uploaded file buggy.diff (2.3 KiB)

Normal diff instead of git diff

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Buginator commented


(In [7383]) Artillery prediction fix.
patch by Rhamphoryncus (Adam Olsen)

fixes #374
Thanks to per for the conversion

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Buginator changed status from reopened to closed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Buginator changed resolution from `` to fixed

@wzdev-ci wzdev-ci closed this as completed May 9, 2009
@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 9, 2009

Buginator commented


(In [7384]) Artillery prediction fix.
patch by Rhamphoryncus (Adam Olsen)

fixes #374
Thanks to per for the conversion

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 8, 2010

Buginator removed milestone (was 2.2)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented May 8, 2010

Buginator commented


Milestone 2.2 deleted

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

No branches or pull requests

1 participant