The Problem
Given an initial 2D position, a target 2D position, an angle, and a constant-acceleration wind vector, calculate an initial velocity that will make a projectile hit the target.
Some Context
I am developing a simple 2D artillery game, similar to Worms or Scorched Earth. Players take turns selecting a projectile angle and initial velocity in an attempt to blow up the opponent. I've now come to the point where I am developing enemy AI, and for the hardest difficulty, the AI should always land their shot or come very close.
The Setup
Using information I found in this answer to a similar problem, I've set up parametric displacement equations as follows:
$$x(t)=\frac{1}{2}w\cos(\theta_w)\,t^2 + v_0\cos(\theta)\,t + x_0$$ $$y(t)=\frac{1}{2}(-g + w\sin(\theta_w))\,t^2 + v_0\sin(\theta)\,t + y_0$$ where $\bf x$/$\bf y$ is the target position, $\bf g$ is the gravity vector, $\bf w$ is the wind speed, $\bf \theta_w$ is the angle of the wind, $\theta$ is the firing angle, $\bf v_0$ is the initial velocity, $\bf x_0$/$\bf y_0$ is the starting position, and finally $\bf t$ is the time parameter.
Plotting these equations is easy enough and yields nice-looking trajectories. Where my problem deviates from the question/answer I linked is that my X component isn't linear because it also has an acceleration factor due to the wind. I've tried some naive attempts at substitution in an attempt to actually solve the system and couldn't get anywhere. I believe that what I need to do is solve a nonlinear system in two variables, specifically $v_0$, but I just don't know how to approach that kind of problem.
I'm perfectly happy using approximation or a numerical method to solve the problem, but for all of the searching I've done for solving nonlinear equations with numerical libraries, I couldn't put together how to solve simultaneous equations.
If it ends up making a difference, the game is being written in C#, so if a library or code base exists in .NET that could help me, that would be great!
You have 2 equations and two unknowns, namely the time $t$ and the initial velocity $v_0$. I'm assuming that all the other variables are known (otherwise the system is underdetermined).
Solve for $t$ first, using the quadratic formula. For the first equation (the choice is arbitrary) we find
$$t = - \frac{v_0\cos(\theta)}{w\cos(\theta_w)} \pm \frac{\sqrt{v_0^2\cos^2(\theta) - 2w\cos(\theta_w)(x_0-x)}}{w\cos(\theta_w)}.$$
$v_0$ can then be obtained by substitution of the positive root in the second equation.