As promised, I wanted to take a WHOLE state of the game post to describe why howie [and rockets] changed, why they went bad, and why they are better and will continue to improve.
To start it all off, this is all LegacyElite84’s fault 🙂 [Evidence]
But, a point was made. If you are going to be making long range, indirect shots under the guidance of your team and the map, you need accurate weapons. Secretly, I knew this could be an issue, but I was not aware how bad it really was until that thread and me digging into it more.
So, time for a bit of background into how MAV handles weapons and projectiles.
This is a chart of everything at play when a howitzer round is fired [under the old system]. There is a lot going on here! With rockets, you get the additional force of an acceleration curve, which is then capped out at a max speed.
So lets talk about all these forces for a bit. The natural forces are gravity, drag [or air resistance], and the initial velocity of the round. This is fairly normal, but I couldn’t just stop here. The reason is, straight ballistic trajectories are actually a bit weird with how they react to angle changes.
As you can see, the difference in distance between angles is not very consistent. This means raising the gun 5 degrees will actually have a different impact to the range depending on which 5 degrees they were! This is compounded even MORE when you add in drag.
Also, the initial velocity the rounds would need be shot at would be incredibly high [like sniper rifle levels] to even be able to hit the distances required for the ranges that howitzers need to hit!
So, extra forces were added to ‘fix’ this issue. An anti gravity force was added to allow much slower projectiles but still have long ranges. There was also a ‘out of range’ force added which would significantly increase the amount of drag as a projectile started to get out of it’s stated range.
The issue though, was balancing all these forces required exact timing and tuning to get the pretty arcs we all want to see from the howitzers, but also have them hit at range. Making the drag force to strong would make the rounds look like they hit an invisible wall and fell out of the sky. Turning the anti gravity force off to late would make the round sail past it’s target by hundreds of meters! All this was being calculated on the fly, based on the rounds current traveled distance and it’s estimated distance that it would continue to fly. Once the error rate got to high, the system would bail out and hand the round over to gravity and drag. This worked well enough, but as we see from the bug report, it wasn’t good enough for calculated assaults.
A new solution!
Lets replace physics entirely with my favorite math curve, the bezier spline curve, aka the b-spline!
Here is the system now:
Now we can calculate the entire trajectory off of 4 points in 3d space and ensure that it lands within 1 meter of the stated range! Even better, since we are using a pure math curve, we can even replicate rounds already in-flight to other players in multiplayer games! And we have full tuning of the ‘arc’ by adjusting the tangent points on the curve! Oh man, this solution is perfect!
Or not. Because now these things can happen:
Choosing the points and the tangents is REALLY important now. I was doing a bad job choosing points for the landing point, causing rounds the fly upwards and do some really funky things. During this time, I also made [looking back at it] a terrible tuning choice. Normally, aiming completely flat would give you 40% of your total range and you would gain range linearly to 100% as you increased your aim upwards. This means aiming upwards covered 60% of your ‘power curve’. I foolishly made the choice to change this to an 80/20 ratio at the same time as rolling out this update. This meant you were having to aim upwards a LOT more.
So, is it salvageable?
I believe so. The great part of this solution is how tune-able it really is. I adjusted how I find the landing point. It will always be the current stated range as measured linearly. This will also adjust to the height of the terrain, allowing you to get good flight arcs even to the top of the hill in Outpost Alpha. There is also dynamic adjustments that happen the the landing zone tangent, which smooths out the arc even when shots are landing in vastly different target heights.
And for the close range shots, the system completely ignores the ground when aiming below a flat angle, allowing the shots to fly a natural arc until they collide with something or someone. This means you can send rounds directly below you from the hill in Outpost alpha without having to guess about weird flight paths.
Oh, and the ‘power curve’ has been changed back to what it was 😉
Overall, I feel like this solution is better, more sustainable, can be tweaked to accommodate future needs, allows the AI to use much simpler aiming math to base dial you, and is an overall win. I will have to see what the critics say once 0.6.11 releases though 🙂[If you don’t get the title reference, that’s fine. I am just old.]