-
-
Notifications
You must be signed in to change notification settings - Fork 307
Connecting to the Master Server
If you have not already, we would suggest reviewing the Master Server Quick Start documentation to get familiar with the Master Server and to setup the stand alone executable.
When you first initialize your NetworkManager (as seen in MultiplayerMenu.cs
) you will need to provide it with the NetWorker that you wish to use for standard game network communications. To do this the NetworkManager has a method MasterServerRegisterData
that you can use in order to get the registration data object to allow you to register your game server with the Master Server. Below is an example of how to use the MasterServerRegisterData
method to generate the json data needed to register the game server.
string serverId = "myGame";
string serverName = "Forge Game";
string type = "Deathmatch";
string mode = "Teams";
string comment = "Demo comment...";
bool useElo = false;
int eloRequired = 0;
JSONNode masterServerData = NetworkManager.Instance.MasterServerRegisterData(networker, serverId, serverName, type, mode, comment, useElo, eloRequired);
You may be curious what to do next with this data and the answer is to send it into the NetworkManager's Initialize
method as seen below.
// This should be the IP address of the machine that your master server is hosted on
string masterServerHost = "127.0.0.1";
// This can be left as the default port (15940) if you did not change it when hosting the master server
ushort masterServerPort = 15940;
NetworkManager.Instance.Initialize(networker, masterServerHost, masterServerPort, masterServerData);
With all of this setup your game server should now be automatically registered on the Master Server once this method is called.
Getting Started
Network Contract Wizard (NCW)
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
Master Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
-
Connection Cycle Events
-
Rewinding
-
Network Logging
-
Working with Multiple Sockets
-
Modify Master and Standalone servers
-
NAT Hole Punching
-
UDP LAN Discovery
-
Offline Mode
-
Ping Pong
-
Lobby System
-
Upgrading Forge Remastered to Develop branch or different version
-
Forge Networking Classic to Remastered Migration Guide
-
Script to easily use Forge Networking from sources
-
Run Two Unity Instances with Shared Assets for Easiest Dedicated Client Workflow