Soji's thoughts on Distance Lag.

Post Reply
User avatar
Venom
Contributor
Contributor
Posts: 335
Joined: Fri Feb 11, 2011 12:24 am
Favorite Aircraft: F-15E Strike Eagle
Location: Ohio
Has thanked: 36 times
Been thanked: 46 times

Soji's thoughts on Distance Lag.

Post by Venom » Thu Oct 31, 2013 7:43 pm

As any aerobatic pilot may know, distance lag has been the enemy of YS Aerobatic Flying since it's existance. If you do not
know what distance lag is, feel free to visit Scarecrow's thread HERE. I recently contacted Mr. Yamakawa on this matter wondering if there were any plans to alter the YSFlight network code to help fix this, here is his response.
Hi Venom,

I wish I could do something. But, nothing can travel faster than the speed of light. The light can go only 7.5 times around the world per second. So, if the server to client distance is at the earth's circumference, you cannot avoid 1/7.5 second lag.

If you are connecting between NY and CA, probably it is 7 times shorter than the earth's circumference. If you have nothing in between your client and the server, the lag will be reduced to 1/52 second. If you are in a bicycle simulator, you are in good shape. This lag will cause only less than 1ft difference. However, if you are flying an airplane flying at Mach 0.8 near sea level, 1/52 second lag will make 17ft difference.

It is the best case that you have nothing in between the client and the server, and connected straight line geodesic distance. In reality, network packets goes through many routers, and they are not located on a straight line. Also, each router takes some time to receive and dispatch a packet. Therefore, chances are, you will get an order of 1/20 second lag even when you are lucky, which will give you 43ft lag.

YSFLIGHT does indeed some interpolation and extrapolation to reduce the lag, but unless some theoretical physicists come up with a new theory that allows data packets travel faster than the speed of sound, it is difficult to reduce the lag further.

Some network games do aggressive path prediction to virtually eliminate the lag, but in those games, instead of the data traveling faster than light, the airplane in the game often travel faster than light, and you may see an airplane suddenly disappear and appear behind you. (That also happens in YSFLIGHT in a slow connection.)

So, it would be the best if you can get together occasionally. Flying a formation with someone connected to the same network hub is much easier than to do the same between Pittsburgh and Japan. (I did a few times and it was fun though.)
Image

User avatar
Scarecrow
Senior Veteran
Senior Veteran
Posts: 1264
Joined: Thu Feb 03, 2011 3:08 am
Favorite Aircraft: T-50B
Location: IND
OS: Windows
Has thanked: 61 times
Been thanked: 287 times

Re: Soji's thoughts on Distance Lag.

Post by Scarecrow » Fri Nov 01, 2013 3:43 am

Venom,

Thanks for posting Mr. Yamakawa's response! Makes it easier for us to understand.

However, I am a bit "confused" on:
Some network games do aggressive path prediction to virtually eliminate the lag, but in those games, instead of the data traveling faster than light, the airplane in the game often travel faster than light, and you may see an airplane suddenly disappear and appear behind you. (That also happens in YSFLIGHT in a slow connection.)
How does this play out for flight simulators like Lock On, for example? I wonder.

Thanks for sharing.

"si hoc legere scis nimium eruditionis habes"

Image

User avatar
Vic Viper
Staff
Staff
Posts: 515
Joined: Thu Feb 24, 2011 7:01 pm
Favorite Aircraft: F-22A Raptor
Location: -9° 59' 6.90", -138° 49' 35.51
OS: Fail10PremiumEdition
Has thanked: 323 times
Been thanked: 185 times
Contact:

Re: Soji's thoughts on Distance Lag.

Post by Vic Viper » Fri Nov 01, 2013 12:33 pm

I've experienced this is racing games, where the proximity of the cars also causes some issues. I believe Soji is right, those games try their best to predict but often are wrong, cars end up almost in front and behind me simultaneously, especially if the driver is from across the pond.
Image
VFA-49 FORUM

"Why are we still here? Just to suffer? Every night, I can feel my leg... and my arm... even my fingers. The body I've lost... the comrades I've lost... won't stop hurting... It's like they're all still there. You feel it, too, don't you? I'm gonna make them give back our past"

User avatar
VNAF ONE
Senior Veteran
Senior Veteran
Posts: 2146
Joined: Fri Feb 11, 2011 2:16 am
Favorite Aircraft: A-10C Thunderbolt II
Location: Indiana/Florida
OS: Windows 10
Has thanked: 230 times
Been thanked: 404 times

Re: Soji's thoughts on Distance Lag.

Post by VNAF ONE » Fri Nov 01, 2013 7:23 pm

This is super good input and I can understand it!!! Ya I'm no techie but this makes a lot of sense.

My next question though is what would it take for YS to act like other games like LockOn and FSX with formation stuff. I've flown with people from New Zealand and can get very close before I start to even see jumpiness. I know that Flake is working on some sort of similar protocol to reduce distance lag, but would it take a change to YS's configuration in order to make it calculate these "faster than the speed of light" changes?

I hope my words make sense because I might be sounding confusing right now.
VNAF Aerobatics Commanding Officer and Founder - - - YSAS Member - - - YS Aerobatic Pilot
YS ACC A-10 East Coast Demo Team pilot - - - B-1B Razor Demo Team pilot
VFA-49 GhostHawks Commanding Officer
Image

User avatar
Venom
Contributor
Contributor
Posts: 335
Joined: Fri Feb 11, 2011 12:24 am
Favorite Aircraft: F-15E Strike Eagle
Location: Ohio
Has thanked: 36 times
Been thanked: 46 times

Re: Soji's thoughts on Distance Lag.

Post by Venom » Fri Nov 01, 2013 7:55 pm

Scarecrow wrote:Venom,

Thanks for posting Mr. Yamakawa's response! Makes it easier for us to understand.

However, I am a bit "confused" on:
Some network games do aggressive path prediction to virtually eliminate the lag, but in those games, instead of the data traveling faster than light, the airplane in the game often travel faster than light, and you may see an airplane suddenly disappear and appear behind you. (That also happens in YSFLIGHT in a slow connection.)
How does this play out for flight simulators like Lock On, for example? I wonder.

Thanks for sharing.

I think he means that automatically, the game predicts the path of the aircraft and simultaneously, the plane appearing on separate clients screen will end up in the predicted spot. And all of this happens faster than the data can travel to the other clients on the server. I am guessing this is what happens when there are "Lag Jumps".


My next question though is what would it take for YS to act like other games like LockOn and FSX with formation stuff. I've flown with people from New Zealand and can get very close before I start to even see jumpiness. I know that Flake is working on some sort of similar protocol to reduce distance lag, but would it take a change to YS's configuration in order to make it calculate these "faster than the speed of light" changes?

I will be sure to ask him this, and get back to you VNAF!
Image

User avatar
Eric
Senior Veteran
Senior Veteran
Posts: 1535
Joined: Thu Feb 10, 2011 5:30 am
Favorite Aircraft: Super Hornet
Location: Chicago, Illinois
Has thanked: 59 times
Been thanked: 164 times
Contact:

Re: Soji's thoughts on Distance Lag.

Post by Eric » Fri Nov 01, 2013 9:02 pm

Interesting stuff. I was able to find a research paper on the subject of reducing latency with special routing algorithms: http://citeseerx.ist.psu.edu/viewdoc/do ... 1&type=pdf
Here's another paper on latency prediction (which is useful to YS because then we can calculate where the plane should appear to other clients): https://homes.cs.washington.edu/~arvind ... ctural.pdf

I'm going to do a bit more research to see if I can find anything on how other online games deal with this.

EDIT: Found a journal article that deals specifically with flight sims: http://pro.sagepub.com/content/55/1/1529.abstract
Unfortunately you have to pay for it.
I make this website.

User avatar
Venom
Contributor
Contributor
Posts: 335
Joined: Fri Feb 11, 2011 12:24 am
Favorite Aircraft: F-15E Strike Eagle
Location: Ohio
Has thanked: 36 times
Been thanked: 46 times

Re: Soji's thoughts on Distance Lag.

Post by Venom » Fri Jan 24, 2014 4:50 pm

Recently I talked with him again and here is what he had to say that other flight simulators are doing.
Sorry for the late reply. That's a very good question. There are many programming tricks that makes you feel like you are not having lags. My guess is other flight simulators are using one (or combination) of these.

For example, some (so-called) flight simulators in 1990s were drawing airplanes much bigger, like 10 times, of the actual size. Or, moving it 10 times slower than the indicated speed. By doing it, apparent distance-error immediately gets 10 times smaller. It was not for solving network-lag problem, but rather to show airplanes bigger on the screen. I played the game called "Strike Commander" so many times, and in that game I could see enemy airplanes very large on the HUD. But, definitely the airplanes were not drawn to the scale.

Another trick is to transmit relative location to the wing leader, rather than the absolute location, across the clients. It is possible if the program can identify the wing leader airplane. The program also needs to identify when other airplanes are leaving/joining the formation since the coordinates of the airplanes not in the formation should still be transmitted in the global coordinate. (I can use the same technique to enable motion of aircraft carrier in the network mode) It is, however, a technologically challenging and I cannot solve quickly.

Of course, better delay-estimation and path prediction can also a solution. The client can ping the server and the server echos back the signal to measure the turn-around time. But, the path-prediction can never be accurate.

The most effective among the above tricks is the scaling. But YSFLIGHT is calculating speed and drawing airplanes in the real scale. So, I wish I had a magical solution to this problem, but quite challenging.
Image

User avatar
Flake
Core Staff
Core Staff
Posts: 4354
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 836 times
Been thanked: 1238 times
Contact:

Re: Soji's thoughts on Distance Lag.

Post by Flake » Sat Jan 25, 2014 12:00 am

Soji Yamakawa wrote:Another trick is to transmit relative location to the wing leader, rather than the absolute location, across the clients. It is possible if the program can identify the wing leader airplane. The program also needs to identify when other airplanes are leaving/joining the formation since the coordinates of the airplanes not in the formation should still be transmitted in the global coordinate. (I can use the same technique to enable motion of aircraft carrier in the network mode) It is, however, a technologically challenging and I cannot solve quickly.
Glad to see we are thinking the same way.

If Yamakawa-San is reading this, I say please please PLEASE go with this route.

I might even do some mental work to find a solution and post here.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Eric
Senior Veteran
Senior Veteran
Posts: 1535
Joined: Thu Feb 10, 2011 5:30 am
Favorite Aircraft: Super Hornet
Location: Chicago, Illinois
Has thanked: 59 times
Been thanked: 164 times
Contact:

Re: Soji's thoughts on Distance Lag.

Post by Eric » Sat Jan 25, 2014 12:04 am

I know it will break all our existing network mods, but can we get YSFlight to switch to UDP instead of TCP? Maybe that would solve some of our issues.
I make this website.

User avatar
Flake
Core Staff
Core Staff
Posts: 4354
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 836 times
Been thanked: 1238 times
Contact:

Re: Soji's thoughts on Distance Lag.

Post by Flake » Sat Jan 25, 2014 1:31 am

Hows about rather then doing complex calculations, let the pilot choose?

Enter->Set Formation Target->1.2.3.4... (from currently flying pilots)

Grabs the aircraft ID, and then sends relative position packets based on this, whenever the aircraft is within 2* HT Radius as seen on their clients screen?

We could define a Flight Data Packet type 6 for this, and not break anything major.

For example:

a display team spawns for a demo. The wingmen press enter, choose formation target, then choose "[1] OfficerFlake (F-18_HORNET)"

YSF grabs the aircraft ID of that aircraft and sets it as the target.

Now, whenever the aircraft is within double it's ht distance, for example, if it's ht distance is 14m, then 28m, it should send flight data packet type 6, which is pretty much identical to the short data packets, except the position of and angles of the aircraft are relative to the flight lead, ALL as calculated from that own clients perspective.

I think this would be the fastest and easiest fix: pilots can quickly press enter then a button while flying, and prior to a break, could press enter, form, 0 to remove the formation...

If no body has objections to this idea, I will do a write up of my idea and send to Soji?

EDIT: Oh and of course, after defining a target, you could perhaps use autopilot->fly formation?
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests