Modify

Ticket #374 (closed bug: fixed)

Opened 3 years ago

Last modified 21 months ago

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

warzone-artillery-predict.diff (1.1 KB) - added by Adam Olsen <rhamph+warzone@…> 3 years ago.
warzone-predict.diff (1.5 KB) - added by Adam Olsen <rhamph+warzone@…> 3 years ago.
Handle EMP as well
warzone-predict-3.diff (3.0 KB) - added by Adam Olsen <rhamph+warzone@…> 3 years ago.
warzone-predict-3b.diff (57.5 KB) - added by Rhamphoryncus 3 years ago.
Missed a bit. Bluh.
warzone-predict-4.diff (2.3 KB) - added by Rhamphoryncus 3 years ago.
buggy.diff (2.3 KB) - added by Per 3 years ago.
Normal diff instead of git diff

Change History

Changed 3 years ago by Adam Olsen <rhamph+warzone@…>

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@…>

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

Committed in r7155. Backported to 2.2 in r7156.

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.

Changed 3 years ago by Adam Olsen <rhamph+warzone@…>

comment:5 Changed 3 years ago by Zarel

  • Status changed from closed to reopened
  • Resolution fixed deleted

Changed 3 years ago by Rhamphoryncus

Missed a bit. Bluh.

comment:6 Changed 3 years ago by Per

That last patch is full of noise.

comment:7 Changed 3 years ago by Rhamphoryncus

Sorry, ignore it, 3 is right.

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.

Changed 3 years ago by Rhamphoryncus

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.

Changed 3 years ago by Per

Normal diff instead of git diff

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

comment:12 Changed 21 months ago by Buginator

  • Milestone 2.2 deleted

Milestone 2.2 deleted

View

Add a comment

Provide an email address (will not be publicly visible) in the Author field or register an account (uses your forum account).

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.