0

I am having problems with network traffic in Unity. A mojority of the traffic can be made to go between clients ( that are near each other in the game and hence need extra detail) in an effort to decrease server load. However the problem is that Unitys inbuilt networking routes everything through the server anyway.

I have just integrated the Lidgren DLL and am hopeful that this network library has a solution? Can i send traffic directly between clients and some to the server? (without it routing through the Server in the background anyway)

Thanks

Steven
  • 166,672
  • 24
  • 332
  • 435
Aaron
  • 45
  • 1
  • 8
  • First, you may want to ask on the game development Stack Exchange site. Second, you do realize that not having an authoritative server is a great way to simple client-side cheats, right? Third, peer-to-peer networking is kind of dead. It's very tricky to setup everything to allow fast, bi-directional communication between any two clients. It really only works well on a LAN :) – Luaan Sep 24 '14 at 11:15
  • Didn't think of that sorry. Yes I understand that about cheats perfectly, as much as it is a risk, the other option (overloading the server) is simply not feasible. Checks can be made along with other more efficient solutions. Every time another peer comes within the specified range a new connection can be made? I was hoping however with the original question that there would be a way to message peer to peer without specifically initializing a new connection? – Aaron Sep 25 '14 at 07:33
  • The clients in a client-server application don't really know about each other - the server acts as a proxy when they need to communicate with each other. Turning them into peers requires you to estabilish connections with each other, which will likely be blocked by a firewall / unable to pass through a router. And of course, it's impossible for you to know that you can connect to the others at all - in fact, with firewall management, you could exclude some players from direct connection, while leaving others - this could prove quite disastrous. You simply can't rely on peer-to-peer. – Luaan Sep 25 '14 at 07:46
  • Im trying to integrate lidgren now.. A server generally is capable of handling hundreds of concurrent connections.. so without deliberate intervention is it really a likely thing that someone wont be able to connect to a peer, but will be able to connect to a server - seeing as both peers are capable of connecting to the server? What im thinking is that to enter the region where pvp is possible you must be maintaining a connection to all peers in that area. I could limit this to say 50 people? So if a connection was then deliberately refused it would be like logging off in most MMOs -u lose. – Aaron Sep 26 '14 at 11:35
  • The problem is that you're mixing up one-side connection to a server, which will work unless you've got a restrictive firewall policy (like in a company network), and connection between two peers, which are both likely behind a firewall and a router of their own. The thing is, servers are always configured to be open to the necessary connections - clients rarely are. Even just to communicate bi-directionally over UDP, you usually need to do "NAT-punching" to allow data from the server to reach the client at all - but the original initiator *must* be the client anyway. – Luaan Sep 26 '14 at 11:43
  • In other words, it's not that it would be likely one of your peers wouldn't be able to send data to another peer - it's just that the other peer will not get the data, because he's behind a firewall/router/NAT. – Luaan Sep 26 '14 at 11:44

0 Answers0