Project::OSiRiON

Development => Programming => Topic started by: Ingar on 2016-08-20 18:26:17

Title: Hitting the target
Post by: Ingar on 2016-08-20 18:26:17
The AI currently doesn't lead its aim. This means it will aim at the player's current position
instead of trying to predict where the player will be when the bullet reaches its target.

I don't really intend to change this behaviour, a decent aim would probably make the AI unbeatable.

Station turrets on the other hand, should be rather nasty and could seriously benefit from aim correction.
Without it, they're rather useless because they're too easy to dodge.

To solve this, we need some mathematics.

I wrote down the problem in the attached document and found some interesting lecture
in this post on reddit (https://www.reddit.com/r/gamedev/comments/16ceki/turret_aiming_formula/c7vbu2j), now I need some time to wrap my head around it ;D



Title: Re: Hitting the target
Post by: Ingar on 2016-08-24 19:28:00
The solution from the reddit post works perfectly.
I just had to brush up on my dot product properties and
quadratic equation solutions.

Turrets are mean now ;D

I wanted to use this on the HUD to draw an aim indicator,
but unfortunatly I don't have the weapon stats client-side,
and those are required to solve the equation.