Saturday, January 23, 2016

unity - Server logic on client side?



I am very confused by the PUN implementation of the Photon networking engine. It looks like I don't have to write a separate server so I'm very curious how this works. I have done quite some KryoNet developing and fiddled around with LidGren, these libraries require you to create a server and client.



  • The client sends minimum data to the server.

  • The server verifies this data and runs the gameplay logic from it.

  • The server sends back minimum data so the client can update to the current server state.


Since PUN does not allow me to write my own server how does PUN work? I believe there is a server behind PUN but if it's the clients job of verifying the data this is a vulnerability.


So whats the deal with Photon? Can a competitive game make use of PUN?



Answer



Alright, since this question seems like it was answered in the comments, let's turn that into an actual answer shall we?



Photon Unity 3D Networking (PUN) works by connecting people to each other instead of to a server for gameplay implementation. So, in short, it works with P2P networking. The most popular example I can think of is Call of Duty Modern Warfare series that uses this sort of (P2P) networking.


The biggest issue with this implementation is that the server is actually a player and should they cheat, it would be really hard to catch them (a reporting system would be necessary but since they have the server on their machine now, chances are, they could mask their username to something else).


The solution that Photon Engine offers is the Photon Server although this sort of P2P method could be used with other kinds of servers but it would take a bigger effort than using their own server implementation. Time versus money kind of deal.


Quote from the asker because these comments are also relevant to the answer itself:



You have to install Photon and run the server with it using the binaries. I guess these binaries get uploaded and started on the Photon cloud. They even seem to have a Unity api for this but the link to the documentation does not work.


Well, it does seem like PUN is not useful for a competitive game. It's an amazing framework to create something like Wordfeud or Hangman to play with your FB friends. But nothing that is even really competitive. I got Photon server working currently and it seems to have potential. But the price is kinda high if you compare it to something like KryoNet or Lidgren and pay to host it. I also dislike the development, on each change I need to build the server, put the binaries in a folder, restart photon and start the server again. Normally you would just run the server from your IDE.



No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...