Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.12k stars 430 forks source link

Performance question #70

Closed MostHated closed 6 years ago

MostHated commented 6 years ago

Hey there again, I had a question in regards to performance. I came across this benchmark a while back and saw the grotesque memory usage that UNet required once you started to get to the 500-1000 connection range. Is this something that MLAPI would end up still being susceptible to, or would it not be a worry?

Thanks,

TwoTenPvP commented 6 years ago

Yes we are affected by any bugs, issues or performance gains or losses the UNET transport has. We use the UNET transport by default. But you can easily change the transport to use.

MostHated commented 6 years ago

Well, you say "you can easily change the transport to use", but you have to remember that what is easy for you isn't exactly that easy for the rest of us. You practically build an entire networking replacement in just a few short weeks. I have spent the last 4-5 weeks simply trying to get several different ones to work properly to just send a MessagePack serialized message while having 2 binded rudp listener ports. That is why we are turning to you in the first place. If it was that easy I would be able to just use LiteNet as it is, or make my own. That is not the case though, I am here because I rely on tutorials, examples, and help from the experts.

That being said, I saw a drop down for Transport and it has "Custom" in there, but also saw in the commit notes "Removed LiteNetLib as a builtin transport". What all would need to be done or changed to use it and what ends up being different in the usage and implementation of MLAPI within my game if it is changed to use LiteNet?

angusmf commented 6 years ago

Your use of MLAPI should stay exactly the same. There just has to be some "adapter" code to go from the underlying transport (UNET by default) to the MLAPI interface. Since you've dug into MSF, you are somewhat familiar with transport level code probably. That's what you'd be dealing with to plug in a new transport.

TwoTenPvP commented 6 years ago

When I say "you can easily change the transport to use". I really do mean it. You just write a class that implements the IUDPTransport interface.

And to use LiteNetLib. Do this:

  1. Download the LiteNetLib dll
  2. Download the LiteNetLib transport from here
  3. Select "Custom" in the NetworkingManager
  4. Before starting the Manager, just set the transport by doing: NetworkingManager.singleton.NetworkConfig.NetworkTransport = LiteNetLibTransport;