Testing Multiplayer

There are two different ways to test the multiplayer gameplay.

  • Peer 2 peer

  • Dedicated Server

For the final version of the game, it is strongly suggested to use the dedicated server for multiplayer, as peer 2 peer comes with more limited features (matchmaking is on the dedicated server) and because players won't need to setup their firewall and router for port forwarding.

A peer 2 peer option is still available to make it easier and faster to test things.

Peer to Peer

To test in peer to peer, build the game with the scene TestP2P as the first scene. And make sure the Game scene is also included in the build.

When opening the build you will be asked to join or host, and will be able to join someone else. You can simply run the build twice on the same pc, so that you can play with both players.

You can also open the Unity project twice instead of doing a build. (See at the bottom of this page)

Dedicated Server

You can either run the dedicated server locally or run it on a cloud server. To run it on the cloud, see the page Cloud Server Installation.

To run it locally. Make a build with only 1 scene: Server

You can also check the box "Server Build" to disable all graphics from the build.

Go in Resources/NetworkData, and change the game server url to the IP or url of your dedicated server (if you run it locally put

You can run the server build, and then connect to it from Unity or from a Client build. Client build should include the menu and game scenes.

In the client menu, click on Multiplayer. If it shows "Connecting to server..." this means it can't connect to it. If it shows "Finding opponent...", you successfully connected to your server.

Client Build

Server Build

(In newest Unity Version, there will be a Dedicated Server tab on the left side instead of a Server Build checkbox).

Opening the Unity Project Twice

Opening the unity project twice can save you some build time if you want to quickly be able to test two clients, or one client and one dedicated server, directly from Unity instead of having to make a build each time.

Check this tutorial (it is for one of my other assets) to learn how to open the same unity project twice: https://indiemarc.gitbook.io/netcodeplus/getting-started/testing-locally

Last updated