Software Engineer
vlcsnap-2020-11-12-17h13m33s446.png

Projectile Aiming

Projectile Aiming

 

Projectile Aiming

  • Helper scripts calculate velocities for projectiles to hit a target.

  • Supports linear projectiles (green) and ballistic projectiles (orange).

  • Uses the target’s velocity to predict its future position and hit moving targets.

Position Prediction

The aimers fire ahead of the target, predicting their future position based on their current velocity this frame. One potential problem with this is that if targets change direction often, many projectiles will miss. Another problem is the jarring speed with which it finds the player’s new velocity, which could look odd in certain game situations.

Weighted Velocity History

These projectile firers are calculating the future position of the target using a weighted average of its velocities over the last second, weighted towards the more recent velocities linearly. This avoids the aim of the projectiles jarringly changing by a large amount, and makes it harder to abuse the aim prediction by changing direction a lot.

Firing with the AimHelper script

Firing with the AimHelper script

Future work

This projectile aimer was inspired by a GDC talk on predictable projectiles by Robot Entertainment’s Chris Stark.

This is an ongoing project, and I would like to add:

  • Designer-friendly variables to tweak.

  • Support for avoiding hitting rooves.

  • Implementation into a game of mine.