I've been working on this for an hour or two now and my maths really isn't my strong suit which is definitely not a good thing for a game programmer but that shouldn't stop me enjoying a hobby surely?
After a few failed attempts I was hoping someone else out there could help so here's the situation.
I'm trying to implement a bit of faked intelligence when the A.I fires it's missiles at a target in a 2D game world. By predicting the likely position the target will be in given it's current velocity and the time it will take the missile to reach it's target. I created an image to demonstrate my thinking: https://i.sstatic.net/WCd0U.png which also contains the logic I use for accelerating the missile after launch.
The ship that fires the missile can fire within a total of 40 degree angle, 20 either side of itself, but this could likely become variable.
My current attempt was to break the space between the two lines into segments which match the targets width. Then calculate the time it would take the missile to get to that location using the formula. So for each iteration of this we total up the values and that tells us the distance travelled, ad it would then just need compared to distance to the segment.
startVelocity * ((startVelocity * acceleration)^(currentframe-1)
So for example. If we start at a velocity of 1f/frame with an acceleration of 0.1f the formula, at frame 4, would be
1 * (1.1^3) = 1.331
But I quickly realized I was getting lost when trying to put this into practice.
Does this seem like a correct starting point or am I going completely the wrong way about it?
Any pointers would help me greatly. Maths really isn't my strong suit so I get easily lost in these matters and don't even really know a good phrase to search for with this.
So I guess in summary my question is more about the correct way to approach this problem and any additional code samples on top of that would be great but I'm not averse to working out the complete code from helpful pointers.