I have been using Unity for a while now, and I have been learning how to create a multiplayer game for the past couple of days. I have gotten as far as creating a server, multiple people joining it and each user sharing their object data (position, rotation) using NetworkView. The method I used was to use a player as a host of a server, and have him host it until he leaves the game. This method really makes no sense, since the player can leave at any time and the game will be over. I was wondering how could I create a different scene, or maybe even a different project to use it as a server and have it only share data. Like RPC commands, calculating if a player has been hit by a bullet etc.
Here’s an example:
Player 1 presses down the mouse button while aiming at another player.
Player 1 then sends out an RPC call to the server telling it it’s location and the point at which the player is looking at.
Then the server decides if anyone has been hit, if so, take away health from Player 2.
Using this method, I would have to re-write every single function used by both Player 1 and 2, so I can use it in the server script. If that makes any sense.
Maybe i’m just being dumb and missing out on something really simple. I’ve seen really good multiplayer games created in unity. What is the most common way to share data between players and what approach should I take?