Mirror - Open Source Networking for Unity

That link is one of the most pathetic things I have ever read. I’m sure aabramychev and the rest of the networking team are just doing their best, but Unity Technologies has a valuation of over one BILLION dollars and has over 1500 employees. The fact that they thought it was okay to leave something as important as networking to be written by the community almost makes me want to give up on Unity altogether. It blows my mind how many games released today are multiplayer and yet a company as massive as this treats their networking solution like a second class citizen. Now we rely on a single unpaid member of the community to fix something that a company with plenty of cash and staff to throw around should be working on.

Anyway, thanks for your effort vis2k! It’s very generous of you to do Unity’s work for them and release it for free. I will always be a big supporter of anyone who decides to create an open source project to help the community. Best of luck!

6 Likes

Thanks. I guess it’s like he said, HLAPI was just an example on how to use LLAPI. The LLAPI is UNET. And that works impressively well and is far from easy to do.

HLAPI is just one way to do a high level architecture, there’s value in not being tied to any. I think this architecture with SyncVars/Commands/Rpcs is really good though, it just needs some cleaning up.

3 Likes

Alex is the LLAPI guy. And how do you know they have 1500+ employees? I am not saying you are wrong. Just wondering about your sources? Only one I can find is Wikipedia. But there is no source on that number. So it could be made up.

You’re right about Alex, I’ll edit my post.

Actually the valuation is even higher than I had seen previously. This is the most recent interview I could find (May 2017). About halfway through the Q and A John Riccitiello says:

“We’re hiring 10 or 15 people a week, so yeah, that number changes. But every company like ours has some attrition. We’re at a low attrition number. We’ll probably finish the year with 1,500 to 1,600. We’re not hiring like we were two years ago, building up the company to do all the stuff we’re able to do now. But we’re still growing. Revenue is growing even faster.”

The article is actually pretty interesting if you want a sense of Unity as a company and where they are heading.

Fair enough, I mostly felt like ranting a little bit. Although I maintain there is no reason why Unity couldn’t create a fully-featured, non-example, robust high level architecture for the most popular use cases, or at least they could improve the old one. It would be a huge feature win for the engine.

I don’t want to derail your thread though so I’ll leave it at that. :stuck_out_tongue:
Can’t wait to see your work progress!

2 Likes

How frequently are you sending position updates and via what QoS?

if i could chime in about the HLAPI and a possible direction of this library - what I would really like out of the HLAPI is more dependency-injection-esque patterns. for example, the HLAPI already has ways for you to supply your own NetworkConnection class to use instead of the built in one. more stuff like this would be very helpful.

the thing about the HLAPI that really sucks is that if you don’t like one part of it, you have to change the source code, generate DLLs, and shove them into your unity application folder. this is tedious to maintain, especially if you have multiple HLAPI unity projects on your computer. ideally, it should be a cinch to inject changes into the HLAPI at the project level and not the system level so that all your different projects can play nicely with each other. it would also make upgrading unity versions a lot less painful

2 Likes

It uses the DefaultUnreliable channel like the original one. There’s another issue with default channels that I want to work on too. So right now the code always assumes that DefaultUnreliable is channel 0 in your NetworkManager. But if you reorder them it might wind up using Reliable, StateUpdate or whatever other channel there is in the first slot. Unless I am missing something. Will have to do more research there soon.

Frequency can be selected by the user via ‘Send Interval’ in seconds. So a smaller send interval means more updates. The video uses 0.1s. I just tested 0.5s and that works just as well.
3170117--241449--upload_2017-8-3_10-28-40.png

The original NetworkTransform sets the position in OnDeserialize immeditately without any interpolation, so any interval should look smoother than before.

Would be best if we can put the Scripts in the editor directly. Right now this is not possible because parts of NetworkTransport are internal. I mentioned this to Alex.

1 Like

I suggest using the Unreliable Ordered. Otherwise this might happend:
We get an update. And move them there.
We then get an older update. So we move them back!?
We then get an even newer update. So we move them really far ahead

1 Like

True. My current interpolation method keeps a history with timestamp anyway, so packets arriving out of order won’t be a problem.

Keep going vis. You’re doing well. Everyday we move closer to multiple scenes with a fixed HLAPI. I’m glad I could bring the Readbyte but to your attention and am happy that you have it working. Cannot wait until scenes are done, everyone is extremely pleased with what you have done so far.

1 Like

Will this work using a standalone authoritative server setup with latency correction(interpolation/extrapolation)?

Progress: still playing around with different NetworkTransform interpolation methods. I found one that I really like, here is a gif again: https://gyazo.com/6f258fd69cc405b66059812abc0b8879

The gray dot is the ghost, which represents the last OnDeserialize call that the client received. The client follows that ghost pretty well and smoothly. This is a 500ms send interval by the way, which was used by an MMO I played 8 years ago. In 2017, we could get away with 250ms or 100ms and get even better results.

Thanks, will do.

If this works with the default HLAPI then it works with HLAPI Pro too.

I get 300 ms with Unet limited at 4k bandwith on my position synchronization.
You can get 150 ms or 100 ms with a hight sending rate :slight_smile:

If you can get a better synchronization than playing the past in 300ms, I am curious :p.
(Good luck to synchronize “when” 300ms is … I rewrote all the NetworkManager to have mine which suit me 100% for problems like that :smile:).

Well the least you can get is dependand on your sendrate. If you send once every 10 seconds. The least you can have is 100ms. (That’s the last two). If you send 20 times a second. The least is 50ms (That is if you only interpolate and don’t do any extrapolation)

Sorry I might have explained this wrong. We can of course use 100ms or 50ms send rates easily. What I meant was that 8 years ago that MMO I played used 500ms to minimize bandwidth. But these days everything is 10x as fast and so even 100ms won’t be a big deal anymore.

Correct, And even 100 ms is really low for realtime games. Usualy 50 - 75 is the norm there. (15-20 sends per second). But with my post above I was speaking about Interpolation latency. But sendrate is fairly game specific

15-20 send per second doesn’t mean 50-70 ms.

I synchronize at 15 send per second, on an unreliable channel (better for this things I rode…). With Unet you get 50-75 ms minimum (optic fiber or not, it’s Unet Server …) + the delay between your post and the sending. For a reason the delay is very very hight, i can’t get better than say…200 ms (for pure smooth movement). So I secure to 300 ms.

With an highter frameRate (40-60) you get your 100 ms, but you reach the 4k bandwidth limit (The Command/RPC with a Vector2 and the time when you send it)…

And you have to synchronize “when” is 300ms between client and server and others clients. It’s a mess that ServerTimeStamp is not synchronize between all clients… you have to synchronize it by yourself… Or say me if there is an other way to do it :slight_smile:

Extrapolation is great yes, but when you have a character which can jump, use tools to change movement etc… I don’t know how to do that ^^ .

Good morning everyone. Going to work on the NetworkTransform’s rotation interpolation today. Hopefully to release a test version soon.

UNET always waits for a few more other packets before it actually starts sending them out. You can modify that in the global config’s send delay.

1 Like

Progress: rotation synchronization + smooth interpolation: Screen capture - 176e66e3cfb9c535671e155645f3f2f6 - Gyazo
Note that the little twitch happens when going from 360 degree to 0 degree, where the interpolation goes all the way backwards. A better solution will come later, what matter is that the networking part works pretty well.

2 Likes

Progress: fixed 360 wrap around issue, now the rotation is perfect thanks to Quaternion.Slerp: Screen capture - 01d041d47068990be417dc5ed47fb819 - Gyazo

2 Likes