- Home /
Can someone explain to me how pun2's networking works?
Hello, I am building my first multiplayer game and I decided to go with photon as my networking solution.
So far everything is going well but I don't quite understand how it all works.
For example there is a Master Client or a Host for each Room, which makes me think it's using a peer-to-peer connection, however a quick google search is telling me it's a client-server solution and also in my photon dashboard I have a server for which I even have to pay if I want the game to have a substantial player base.
Another annoyance I've experienced is hit detection in game. When I have the enemy's weapon collider collide with the player's body I am making an RPC call to all other clients, including the enemy, that the player has been hit which works fine until the player that is getting hit lags or minimizes the game. If that happens hit regestering becomes very unreliable and most of the time is impossible since the client that is making the rpc command for getting hit is experiencing massive fps drop. This once again looks to me as a peer to peer type of connection since in my mind if the game has a dedicated server running everything this shouldn't be a problem.
I am sorry if my question seems all over the place but I am new to this and I am pretty confused. If anyone can shed some light on my situation by explainging how it all works and maybe a few tips on how I should do hit regestering to make it more reliable, I would greatly appreciate it!
Answer by VanToRiaXVII · May 27 at 08:07 PM
PUN2 is completely peer-to-peer. What you can have with PUN2 is client authority, which means that the game's host is going to become the server where every input is validated.
There's also Photon Cloud, which is a relay service that goes over NATing issues that some players might experience.
What you're describing in the second part of your question is actually the problem with P2P gaming. You have to rely on the client to send their information to all the other players, so if one player is experiencing slowdowns, everyone else in the match will be affected. There are ways to mitigate the effect on other players, but at the end of the day, the only real way to solve it is to have a real client-server architecture. Which PUN2 doesn't offer, unfortunately.
Photon has come up with a new product, called Photon Fusion, that allows you to build authoritative servers. If you combine that with a simple infrastructure management solution like Edgegap, it can be really easy to get a client-server game running quickly.
Your answer

Follow this Question
Related Questions
Photon Unity Networking (Viking Demo) Error: Argument is out of range. 1 Answer
Update position via state syncronization results in weird movement. 0 Answers
Bullet Collision in Networking Game. 0 Answers
"Photon Networking" option not appearing under "Add Component" 1 Answer
OnPhotonSerializeView InvalidCastException : Specified cast is not valid. 1 Answer