Page 1 of 3

Make plane flight height static

Posted: 29 Apr 2008, 23:46
by Satirik
why does planes flight height is calculated from the ground ? it REALLY sucks .... could you please fix that bug ?

Re: Make plane flight height static

Posted: 30 Apr 2008, 00:25
by Argh
That's not a bug, it's a feature. And I think we'd all like it changed a bit.

However, there are many issues involved with this. Basically, you can't just do it as a fiat distance without considering all of the problems it'd cause:

1. Ground height varies. Can't have planes flying through mountains, etc.

2. OTA planes fly at really, really low altitudes. The Brawler, for example has a cruisealt of 100.

3. Fixing this, by setting the CruiseAlt to the maximum height + cruisealt, would require massive changes to the average mod's balance of planes, or planes that were broken, period.

What we need is for aircraft to look ahead at the terrain every second or thereabouts, and see if it's rising or falling, and by how much, and then steer to correctly stay at CruiseAlt over that time period, except when attacking. That way, low-flying planes work.

And high-flying ones, if CruiseAlt > than HeightExtreme (the tallest point on the map, Y) could just skip steering based on the ground except during attack behaviors, giving them a massive improvement in performance, as well.

Re: Make plane flight height static

Posted: 30 Apr 2008, 01:34
by smoth
DO NOT WANT

Re: Make plane flight height static

Posted: 30 Apr 2008, 02:51
by Neddie
smoth wrote:DO NOT WANT
Agreed, every machine let alone every setting has different ideal specs.

Re: Make plane flight height static

Posted: 30 Apr 2008, 05:42
by MadRat
Wouldn't one need to plot some kind of pathfinding in your scenario, Argh? If a unit is not able to go a certain pathway across the map then it would make sense it has to plan the correct path.

Re: Make plane flight height static

Posted: 30 Apr 2008, 06:05
by Argh
Wouldn't one need to plot some kind of pathfinding in your scenario, Argh?
Nope. Right now, what happens is that the planes re-adjust and attempt to make their height == CruiseAlt every SlowUpdate (I believe) using the current height of the map as their reference. If they fail to gain enough height, they collide with the map mesh (which we've all seen a thousand times).

What I'd do is to check 5 or so heights ahead of the plane, based on velocity, and then try to meet the desired CruiseAlt. No pathfinding is needed- if it cannot make the change in time, it should still collide with the map, imo- making it change course would be too expensive. However, if done correctly, the number of times this would occur would be a lot less.

Here, lemme draw a quick 'n nasty diagram...

Image

In this diagram, we're seeing the results of the current code. At points ABCD, the aircraft is checking the height of the ground, and if its relative altitude != CruiseAlt, then it adjusts, up or down, until the next check.

This results in very poor behavior. Since the airplane doesn't know where it's going, only where it is, it's adjusting to the past, not to the future. Hence, it tends to over-correct in places, or undercorrect in others, such as the adjustment seen in C, where it "sees" a lower value and adjusts too late, leading to events like the collision depicted in D.

Image

This is how it would work, if the plane took several heights on a straight-line path ahead of itself, and adjusted to meet the destination point required. For each point ABCD, it's checking the relative heights of several sub-points ahead of the flight, and then arrives at a decision to fly to a new height over time. Because it's looking ahead, instead of where it's been, it doesn't over-correct or under-correct as much. It can still make mistakes, if it needs to suddenly turn, for example- it won't be "seeing" the terrain to either side of its flight path. But it will stay much closer to its ideal CruiseAlt during long straight flights.

This is basically a simplification of the system used IRL for fighters and helicopters- they use a GPS receiver and a heightmap representation of the Earth's surface... we're using Spring's absolute location, and the known positions of the heightmap pixels...

As another alternative... planes could have a second cruisealt, that kicks in if they've been flying in straight lines long enough, that simply takes them higher. Also very simple, and would work, and we could make it default to CruiseAlt for backwards-compatibility purposes, etc.

Heck, if we combined both ideas, we could have terrain-following aircraft that flew lower during normal cruising, allowing for modern fighter behaviors ;)

Re: Make plane flight height static

Posted: 30 Apr 2008, 16:50
by Zpock
It simply could just not change altitude unless the ground has risen/lowered more then x % of the cruise altitude? So the planes don't "jerk around" but aslo don't fly into mountains.

Re: Make plane flight height static

Posted: 30 Apr 2008, 17:00
by Pxtl
Zpock wrote:It simply could just not change altitude unless the ground has risen/lowered more then x % of the cruise altitude? So the planes don't "jerk around" but aslo don't fly into mountains.
Well, a ceiling and floor value would be nice to help spread the planes out in 3D a little better. Is anybody actually working on this stuff or are we all just spitballing?

Also, is it possible for a plane/gunship to attack a ground-target if its firing range is less than cruisealt? Will a plane _ever_ deliberately change altitude?

Re: Make plane flight height static

Posted: 30 Apr 2008, 17:56
by Satirik
smoth wrote:DO NOT WANT
everybody who can't bomb something on a montain because the bombers are doing shit knows how annoying it is, maybe it could be just an option : having a flight height depending on the max height of the map

Re: Make plane flight height static

Posted: 30 Apr 2008, 18:18
by smoth
yeah, when they are flying low. While you may want this feature, it is not a one size fits all solution. I like the aircraft flying with the terrain and it works as my aircraft fly high enough for it to not be an issue. I will not support a code change that changes the way the aircraft work in a way that I feel would not be correct.

SO NO I DO NOT WANT.

I have my flyers at a higher height BUT when given a larger height aircraft FLY IN CIRCLES. Part of the problem is that the aircraft are flying low in several projects and they will do things like that when they fly low, maybe they need a tag but a *fix* is not necessary.

*edit for further clarification*
The reason I bring up the issue with higher flight heights is that the aircraft function poorly past certain heights

Re: Make plane flight height static

Posted: 30 Apr 2008, 18:37
by Masure
Image

Image

Re: Make plane flight height static

Posted: 30 Apr 2008, 19:05
by manored
Agree with masure :) Having torpedo planes only launch torpedos the flying over deep enough water would be good too.

Re: Make plane flight height static

Posted: 30 Apr 2008, 19:17
by smoth
hey massure, if the aircraft was flying higher then it was then it wouldn't do that. oh wait... most of the projects feature units flying LOW TO THE GROUND. scenario b is the case MOST of the time in gundam. I will say having the bomber fly up to the proper attack height once the order is give would be good BUT AIRCRAFT FLY IN CIRCLES AT HIGH HEIGHTS! which is a point you guys are missing.

Re: Make plane flight height static

Posted: 30 Apr 2008, 19:37
by Masure
Smoth, I don't disagree with you.

I don't say all planes should fly high. But there should be an "flying high option" for aircrafts to allow them to bomb properly the hills.

Re: Make plane flight height static

Posted: 30 Apr 2008, 19:39
by yuritch
Pxtl wrote:...Also, is it possible for a plane/gunship to attack a ground-target if its firing range is less than cruisealt? Will a plane _ever_ deliberately change altitude?
Fighter-type planes definilety do this - they dive on the target and fire when in range. I seem to remember bombers doing this, too. And a plane can go to any height during dogfight-style air combat - a fighter with cruisealt=100 can easily attack something with cruisealt=1000, it will climb to the required height.
Gunships most probably won't change height to attack, but I'm not sure about this - never tried a gunship with weapon range shorter than cruisealt.

Re: Make plane flight height static

Posted: 30 Apr 2008, 20:22
by smoth
Masure wrote:Smoth, I don't disagree with you.

I don't say all planes should fly high. But there should be an "flying high option" for aircrafts to allow them to bomb properly the hills.
there should but unfortunately the drunk plane behavior will happen. It gets down to an issue with the weird aircraft code. MANY of us hate the aircraft and the aircraft code unfortunately the code is really bad and need a rewrite. Such a thing will change the way the aircraft work and there will be massive crying.

Re: Make plane flight height static

Posted: 30 Apr 2008, 20:23
by Argh
It simply could just not change altitude unless the ground has risen/lowered more then x % of the cruise altitude? So the planes don't "jerk around" but aslo don't fly into mountains.
Well, that's pretty much what I'm talking about. By looking ahead farther, they'd quit jerking around, because they'd be aiming at a distant target, instead of simply rising or falling with the terrain beneath them, which is completely unrealistic anyhow.

I was thinking it could just check the heights to see what trend exists as a slope, do a check to make sure none of the spot-checks massively vary (if much lower, do nothing, if much higher, raise the new target point more), and if not, then just go for a point in line with the trend.

And Smoth, what I'm proposing would result in high-flying aircraft that performed much better, because if their CruiseAlt > HeightExtreme, they'd not even bother, and fly flat, except when attacking. I'm not talking about attack code changes- that's not the same stuff in the MoveType, IIRC. Probably they're flying in circles because they're getting funny values from the angle of the ground, if far enough away from the heightmap.

Re: Make plane flight height static

Posted: 30 Apr 2008, 21:07
by Pxtl
Thinking it over, it should be looking for a local maximum and considering the distance to that maximum to calculate the slope to climb at. Using an average would run into troubles because the maximum could be above-average-enough to cause hitting the ground.

Re: Make plane flight height static

Posted: 30 Apr 2008, 22:35
by smoth
correct pixtl, it would be neat to see a solution but there are many issues and frankly there is no simple fix. Make no mistake, I do want a fix for aircraft I just did not want the initial proposal.

Re: Make plane flight height static

Posted: 01 May 2008, 02:59
by Forboding Angel
smoth, if you set maxacc they seem to stop doing that, additionally I use different "methods" for my bombers. Plane behavior sucks no matter how you look at it.

Btw all my planes fly at > 800 cruisealt (bombers fly at 1000) and they act correctly.

This is a bandaid tho, we need a REAL solution.