Ticket #374 (closed bug: fixed)
Artillery prediction fix
| Reported by: | Adam Olsen <rhamph+warzone@…> | Owned by: | Zarel |
|---|---|---|---|
| Priority: | blocker | Milestone: | |
| Component: | other | Version: | git/master |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Operating System: | All/Non-Specific |
Description
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
Attachments
Change History
Changed 3 years ago by Adam Olsen <rhamph+warzone@…>
- Attachment warzone-artillery-predict.diff added
comment:1 Changed 3 years ago by Zarel
- Owner set to Zarel
- Status changed from new to accepted
Yay, math!
Changed 3 years ago by Adam Olsen <rhamph+warzone@…>
- Attachment warzone-predict.diff added
Handle EMP as well
comment:2 Changed 3 years ago by Adam Olsen <rhamph+warzone@…>
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.
comment:3 Changed 3 years ago by Zarel
- Status changed from accepted to closed
- Resolution set to fixed
comment:4 Changed 3 years ago by Adam Olsen <rhamph+warzone@…>
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.
comment:5 Changed 3 years ago by Zarel
- Status changed from closed to reopened
- Resolution fixed deleted
comment:8 Changed 3 years ago by Buginator
- Priority changed from major to blocker
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.
comment:9 Changed 3 years ago by Rhamphoryncus
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.
comment:10 Changed 3 years ago by Buginator
- Status changed from reopened to closed
- Resolution set to fixed
(In [7383]) Artillery prediction fix. patch by Rhamphoryncus (Adam Olsen)
fixes ticket:374 Thanks to per for the conversion
comment:11 Changed 3 years ago by Buginator
(In [7384]) Artillery prediction fix. patch by Rhamphoryncus (Adam Olsen)
fixes ticket:374 Thanks to per for the conversion
