An overview of the Networking Project

This document details what lesson each scene in the project gives and what to look out for. There are four main game scenes, Third Person, Car Racing, TPS-Auth and Castles, all explained below. They can be opened directly where a direct connect mechanism is used to connect server and clients, or with the loader scene where the master server is used.

Third Person
This is a straightforward non-authoritative server example. All logic is done on the client and they basically tell the server what has happened. The server acts mainly as a message relayer for clients. The players transform is synchronized with state synchronization and is interpolated in a special script.

Car Racing
This is exactly like the Third Person scene except the player object is a Rigid Body and the script used to do interpolation is therefore different.

TPS-Auth
This is a demonstration on what an authoritative server implementation looks like.  It uses a dedicated server and no player is spawned there. The clients send the user input of the players and receive their position from the server. Care must be taken when instantiating the player object. The client requests view IDs from the server and then instantiates the player manually with an RPC call. This is so that it is cleanly pushed into the RPC buffer on the server and can be removed when the player disconnects.

Castles
This scene demonstrates that you can have waiting area where players wait for the game to start, but they have already connected to the server. Here a local invisible payer is instantiated and you can walk around the level and chat with other players, before the actual game starts. The GUI for setting max players, player name and color is only shown when loading the scene directly in the editor. When the game starts the player information, name and chosen color, are distributed to other players so they all see each others information. RPCs are used a lot to synchronize this information. The server has a registration routine where he confirms the players requested settings, he can reject his color choice and give him something else.

Chat
There is a chat client in all the main scenes. There is also a test scene for just the chat example.