Introduction to a Simple Multiplayer Example

Checked with version: 5.3

-

Difficulty: Intermediate

Multiplayer Networking is inherently detailed and complex. There are particular issues and difficulties associated with synchronizing and communicating between multiple instances of a project which are often running on different machines that could be in different and distant parts of the world.

With Unity’s built-in Multiplayer Networking and the associated High Level API (HLAPI), we hope to make creating Multiplayer projects easier to use.

With this simple Multiplayer Networking Example, we will show how to set up a Networked Multiplayer project from scratch using the simplest of assets and scripts. With this example, we hope to give you a quick introduction to the most important aspects of the built-in Multiplayer Networking system and its High Level API.

This document is a step-by-step assignment showing how to set up a new Multiplayer Networking project from scratch using Unity’s built-in Multiplayer Networking system and its HLAPI. The steps in this lesson are relatively generic and are designed to convey the basic concepts behind the Multiplayer Networking system and can be customized for many different types of Networked Multiplayer games. By the time we are done, we should have an example that has two players controlling their own Player GameObjects in two different instances of the project with an authoritative Server controlling and synchronizing the action. The players should be able to shoot each other, defeat other players and static enemies, and finally respawn if they are defeated.

This lesson is targeted at Intermediate users. It is best to have read the section of the manual on Multiplayer Networking, particularly the pages on Networking Overview and The High Level API and it's child pages, including Network System Concepts.

To get started:

  • Create a new empty 3D project in Unity.
  • Save the default scene as “Main”.

Related documentation