Connection¶
The first step of online gameplay is initializing a connection to a server. As mentioned in the Architecture Overview section, Strix has two server types: master and room. A master server holds information for a particular cluster, and each room server of that cluster contains information about different rooms in the server and players in these rooms.
Under typical scenarios, connections and disconnections to and from servers take place in the following way in Strix:
A game client first connects to a master server.
Asking the master server, the client finds an appropriate room.
The client connects to the room server that has the found room and joins the found room.
It then performs game’s own logic as it communicates with the room server to perform multiplayer gameplay (and with other clients that are in the same room through the room server).
When the client finished using the room server, it disconnects from the room server.
The client then either gets back to step 2 to find next room server to work with or disconnects from the master server.
Connection and disconnection functions are provided as C# scripting API.
Note
Some connection management functionalities are provided also by StrixConnectUI prefab included in Strix Unity SDK, but it is primarily for a prototyping and not for a production use. See its documentation for details.
The Strix Unity SDK allows one master server connection and one room server connection simultaneously.
Room server connections require a connection to a master server first,
as the connections are usually made using the information obtained from the master server.
All of these connections are initialized through appropriate methods of the StrixNetwork
singleton.
Note
In Strix Unity SDK,
you usually don’t need to connect to a room server manually,
because StrixNetwork
singleton automatically connects to an appropriate room server
when you (try to) join a room.