Make plane flight height static - Page 2

Make plane flight height static

Requests for features in the spring code.

Moderator: Moderators

User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Make plane flight height static

Post by KDR_11k »

smoth wrote:I have my flyers at a higher height BUT when given a larger height aircraft FLY IN CIRCLES.
Increase the TurnRadius tag. Fighters have a TR of 500, bombers of 1000. If they fly higher than their turn radius they lock up. They are also more likely to abort an attack because of terrain but there's no way to fix that in 76b1, it's fixed in SVN though.
HoneyFox
Posts: 20
Joined: 01 Aug 2007, 06:44

Re: Make plane flight height static

Post by HoneyFox »

Maybe we can prepare another height map which has been *blurred* from the exact height map and then added a certain amount. (some tool may needed to generate the smoothed height map.)
Thus peaks in maps will be hills which increase its altitude gradually, and vice versa.

edit: here the "blur" means:
if altitude map is like this

Code: Select all

1    1    1    1    1
1    1    1    1    1
1    1   10    1    1
1    1    1    1    1
1    1    1    1    1
then after the "blur" procedure the smooth map should be like:

Code: Select all

1    1    2    1    1
1    4    6    4    1
2    6   10    6    2
1    4    6    4    1
1    1    2    1    1
the smoothed value should not be smaller than the original value, but can be bigger. That is a one-way blend. (ie, the "10" in the middle of the sample map above does not decrease but remains 10, but values beside it will increase to 6 or 4 or so.)

the radius of the "blur" procedure can make aircrafts increase or decrease its flight altitude more smoothly and if is set to a good value, the bombers will climb up to the height of a hill when they are still one screen away from the target, and their bombs will not miss.

what's more, this height map can be made when ppl are making their maps and thus Spring doesn't need much calculation in-games.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Make plane flight height static

Post by Neddie »

Except what about the current maps? Unless you have a method of inserting it in all current maps or making it optional, it causes a complete map replacement or will be ignored entirely.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Make plane flight height static

Post by lurker »

It would be far faster than pathing to do during loading.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Make plane flight height static

Post by jK »

IIrc the heightmap is already handled in mipmaps, the only problem is that you need a max()-lowres heightmap (which saves the max value of the quad and not the average). so it is easy to create it and the performance decrease should be small, too. Duno how much the air AI needs to be changed.
User avatar
Tribulexrenamed
Posts: 775
Joined: 22 Apr 2008, 19:06

Re: Make plane flight height static

Post by Tribulexrenamed »

This feature was always considered amazing in the game Warzone2100, in which the distance between a VTOL (equivalent of TA planes) and the ground elevation was always constant. The popular "VTOL effect" was always much in demand, in which VTOLs would encounter a very steep height difference on a map, and rapidly rise or fall. Maps with cliffs that produced this effect were very popular, and to be honest, seeing 100 VTOLs rapidly flying up and over a mountain was a very impressive sight. Perhaps in mods where aircraft are mostly slow and designed for ground attack (as in Warzone 2100), an option can be made cruiseAltMode=0 that supports this type of flight, which is extremely CPU friendly. Then, cruiseAltMode=1 would be the equivalent of the current system. For options 2 and maybe 3, planes would take a larger range of height samples ahead of them, and either fly to an altitude calculated with a moving average, in which the maximum height was weighted, or fly over a vertical path consisting of a smoothed height model. I think the former would be more CPU friendly, and efficient. However, the weight on the max height would have to be adjusted to insure no collisions with the map. Fixed altitude aircraft flight seems like a bad idea to me, due to collisions with the maps. Any fixes to this would cause planes to fly at different altitudes in the same mod on different maps, such as a mountainous and flat map.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Make plane flight height static

Post by yuritch »

Fixed altitude aircraft don't have to collide with anything. cruiseAlt=1000; for ex. is really high enough to not collide with mountains in most maps. All that's needed is a second value that controls the min altitude, so for ex. at cruiseAlt=1000 and minAlt=200 the plane will try to go at 1000 units above sea-level ignoring terrain bumps if those are much lower, but will start to follow terrain (current aircraft behaviour) if it has less than 200 units of height difference with the ground (like it's flying over a mountain).
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Make plane flight height static

Post by [Krogoth86] »

@masure:
Unfortunately you've skipped situation 3 which would be the immediate result of a higher cruise alt which also let's you hit targets on hills:
Image

:wink:
User avatar
Tribulexrenamed
Posts: 775
Joined: 22 Apr 2008, 19:06

Re: Make plane flight height static

Post by Tribulexrenamed »

Good idea yuritch. I still think that multiple modes of dealing with cruisealt should be an option, for different purposes of aircraft.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Make plane flight height static

Post by KDR_11k »

Krog, blame your ranges and the gravity on your bombs.
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Make plane flight height static

Post by [Krogoth86] »

KDR_11k wrote:Krog, blame your ranges and the gravity on your bombs.
Yeah I know - wanted to point out that just setting the cruise-alts high isn't all you need for a good solution... :-)

Besides the fixed settings also have the disadvantage of not being map-dependent anymore what some mods might want...
User avatar
Tribulexrenamed
Posts: 775
Joined: 22 Apr 2008, 19:06

Re: Make plane flight height static

Post by Tribulexrenamed »

HoneyFox wrote:Maybe we can prepare another height map which has been *blurred* from the exact height map and then added a certain amount. (some tool may needed to generate the smoothed height map.)
Thus peaks in maps will be hills which increase its altitude gradually, and vice versa.

edit: here the "blur" means:
if altitude map is like this

Code: Select all

1    1    1    1    1
1    1    1    1    1
1    1   10    1    1
1    1    1    1    1
1    1    1    1    1

then after the "blur" procedure the smooth map should be like:

Code: Select all

1    1    2    1    1
1    4    6    4    1
2    6   10    6    2
1    4    6    4    1
1    1    2    1    1
the smoothed value should not be smaller than the original value, but can be bigger. That is a one-way blend. (ie, the "10" in the middle of the sample map above does not decrease but remains 10, but values beside it will increase to 6 or 4 or so.)

the radius of the "blur" procedure can make aircrafts increase or decrease its flight altitude more smoothly and if is set to a good value, the bombers will climb up to the height of a hill when they are still one screen away from the target, and their bombs will not miss.

what's more, this height map can be made when ppl are making their maps and thus Spring doesn't need much calculation in-games.

I hate whatever smoothing function you are using. Your relative maximum has been given far too little weight. It is much better to overestimate altitude, to insure no hill crashes. Try a gaussian filter like I have attached, and perhaps it could be applied at only maxima (and minima) determined by a laplacian approximation mask for better results. It is not a good idea to have this in the map file. The engine should preload this data on startup.
Attachments
gausmask.gif
gausmask.gif (2.81 KiB) Viewed 1636 times
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Make plane flight height static

Post by AF »

Such a blurred height map could also be used to smooth out bumps in the camera when traversing bumpy terrain.
User avatar
Tribulexrenamed
Posts: 775
Joined: 22 Apr 2008, 19:06

Re: Make plane flight height static

Post by Tribulexrenamed »

In that case, apply the transform everywhere. Good idea.

Edit: Sorry, I mean the filter.
HoneyFox
Posts: 20
Joined: 01 Aug 2007, 06:44

Re: Make plane flight height static

Post by HoneyFox »

Tribulex wrote:I hate whatever smoothing function you are using. Your relative maximum has been given far too little weight. It is much better to overestimate altitude, to insure no hill crashes. Try a gaussian filter like I have attached, and perhaps it could be applied at only maxima (and minima) determined by a laplacian approximation mask for better results. It is not a good idea to have this in the map file. The engine should preload this data on startup.
That is what i mean :-) gaussian blur.
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Make plane flight height static

Post by Satirik »

[Krogoth86] wrote:@masure:
Unfortunately you've skipped situation 3 which would be the immediate result of a higher cruise alt which also let's you hit targets on hills:
Image

:wink:
what ?!?
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Make plane flight height static

Post by rattle »

what ?!?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Make plane flight height static

Post by lurker »

AF wrote:Such a blurred height map could also be used to smooth out bumps in the camera when traversing bumpy terrain.
O_O Yes!

Satirik: The bomber has already dropped its load before it's in range of AA. (The diagram is a bit exaggerated.)
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Make plane flight height static

Post by Pxtl »

Problem: at what resolution do you generate the smoothed-map? Per mod? Per unit? Do fighters and bombers use the same smoothing? Or do you maintain a set of smoothing lists? Is it time to add movement classes for aircraft?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Make plane flight height static

Post by lurker »

Just do a simple blur over a couple hundred elmos and it'll work fine. Resolution doesn't really matter, but might as well just use the heightmap resolution.
As for the mod side, have planes specify a float between a static height over map average and the blurred heightmap.
Post Reply

Return to “Feature Requests”