- Home /
Photon Authoritative Using MasterClient
I want to make my game Server Authoritative a bit later on. I use PUN, and I am not that great with it. I plan on checking more into this on the PUN documentation later.
But, I was wondering, is there a simple way to have the server generate a fake client/player, that is the MasterClient always? I don't know how to do any back end things unfortunately. But, I don't want my game cheated to hell either.
Answer by jpthek9 · Jan 10, 2015 at 01:06 AM
Here's a piece of advice: Design your networking system with a preset plan. After you finish it, it'll be a huge pain to go back and change it, much less design it based on a completely different framework.
So for an authoritative server, every client sends the authority inputs, and the server simulates everything. Photon can't do that, so your idea of using the master client as the authority is the next best option. You do the exact same thing - send the master client inputs. If it's a first person shooter, you can just send when i.e. 'W' is pressed then send when 'W' is unpressed. Then the master client plugs these booleans into your character control system, simulates it, then sends everyone the position of the simulated units after the input. There are some downsides to this method you should carefully consider.
Easily hackable. If you're the master client, you control everyone's health, position, etc.
This puts all the burden on 1 person's computer - the master client - so if he's gone or can't handle it, you'll have to somehow make someone else the master client
For most games, it's better to send position updates. The only situations you would use this kind of networking is in 1. synced physics simulation and 2. artificial intelligence control.
If you really want to make a non-hackable FPS in perfect sync, check out how Halo did it: http://www.pcworld.com/article/2859392/microsoft-to-opensource-cloud-framework-behind-halo-4-services.html. Actually, they're planning to make their system open-source but you'll probably not be able to use it with Photon.
Answer by DwaynePritchett · Jan 10, 2015 at 04:28 AM
I understand. I have actually been designing with the change in mind. I have been designing it for functionality, but keeping in mind that I want to change it server authoritative later. You are right about it being difficult to change it later, I tried that route once over a year ago and broke it horribly. Which is how I got where I am today. My thing is, I want a "Dedicated" server to simulate a MasterClient. Player 0 if you will. So, a 16 player match would ignore his existence, and actually be a 17 player match. Anyways, I didn't know if there was any known/easy strategies for "faking" a master client player, where the master client is actually a server simulated client.
Unfortunately, that's not possible with Photon's cloud servers, or at least, there are better options. For something like that, you'd need to buy your own computers to host your own servers over your own network or use something like RakNet that provides you authoritative servers. I'm sorry this is the case but the authoritative server model is something very limited to large game companies. The authority master client will work just as well and by the time hackers are a worry, it means that your game has gotten popular so you have some more resources to spend on extending the game. Just find the guy with the lowest ping and make him the master client.
The authority master client will work just as well and by the time hackers are a worry, it means that your game has gotten popular so you have some more resources to spend on extending the game. Just find the guy with the lowest ping and make him the master client.
You took the words out of my mouth. This was my thoughts exactly. But, it is a shame Photon doesn't have an easy to use approach for this. I will cross the bridge if/when I get there I guess.
Hi will there be client lag when getting inputs 'authorized' by the master client, and to send it back? - So when another player decides he wants to walk, will there be significant and noticeable delay when the user presses W to the character moving?