Join GitHub today
strafe air movement improvements : fix #4515,#4516 #189
Unit.cpp and WeaponLoader.cpp
--- make flight smoother and avoid shaking (#4515)
--- avoid collisions with target and ground (#4516)
This looks like a fairly arbitrary formula which would depend on the sort of behaviour someone wants for their aircraft. I think this value should be a unitdef (climbDistance?) with your formula as a default.
Looks like a major change and I have not noticed a problem with the diving behaviour in ZK with the latest engine. The range at which fighters start diving also sounds like something which should be configurable.
What is the desired elevation? I want fighters to fly quite low when ground attacking so perhaps this is something to configure as well?
Why? When messing with aircraft physics parameters it quickly becomes clear that large maxBank causes strange behaviour so people do not need protecting from entering large values. I can imagine applications for high maxBank such as a zero-gravity plane or a plane.
Could your formula be the default instead of an override. I like to be able to tell planes when they should think that they are able to turn around.
I'll try splitting into 3 commits, but could use more feedback on which changes should be split in a way that makes sense (or you want to avoid :) ). One can have the necessary changes for unit->lowestRange and most relevant part of the fix for #4516, the "abort dive when below 50% range( or turnRadius)".
I agree some of these should be unit defs, but as devs seemed against adding more I tried to do something that fit existing games as-is without adding new defs or forcing game devs to change values (mostly).
Even with this change the typical fighter (500-600 range weapon) still dives dangerously close to the target. It does lower fighter dps vs ground targets though unless they use burst weapons.
About the diving at 2x maxRange instead of 4x. The previous value sort of worked, but didn't make sense. That's 2000 range for the average fighter! It also made aircraft that engage far targets fly lower for a longer period of time, subjecting themselves to collisions and ground fire.
About desired elevation, it is modified by aircraft's cruisealt. It's tipically 150-200 above the target. Maybe 70% is too strict. Without it though, aircraft avoiding collisions with each other would still bump into the ground if you have a dozen attacking a ground target. This creates a feedback that keeps them higher.
About maxBank, it isn't clear enough. XTA bombers have 0.9.
The turnRadius is only overriden if it is lower than the minimum calculated. The problem with it is that sometimes aircraft are set higher maneuverability on one direction than on others (ex: maxElevator=0.01, maxRudder=0.003), so the formula gives a minimum turnradius that's too big for them, so they stray too far from the target before turning back.
I'll try ZK. What are the unitnames of fighters and bombers there so i can spawn some quickly?
I never added any unitdef before (i'm new to this). Which do you find most relevant? Maybe the "dive safety range" ? Or the "runAfterOverflyNearbyTarget range"?
so: every point you wrote should/could be a commit, 3 sounds very few for these changes.