# Where I Open Unity And Create A Project

This week I opened Unity and hit New; we decided to create a project to document from start to finish. First week’s plan is to get basic multiplayer in so we can start iterating on the gameplay components. First step is to design our multiplayer experience, we’re going with a small experience so we need a lobby system and a way for people to find the lobbies. After reviewing the options we had available I decided to go with TNet3.

Using TNet setting up a lobby server is really quick and easy being entirely C#. I spun up a dotNet core app so I could take it across environments, setting up a console app to pass in a few parameters and spin up a lobby server class to accept lobby connections. From there upload to the server and set up ports for listening.

Inside Unity we need to set up a client to connect to the lobby server, host, and join games. To connect to the lobby server we need to use a Lobby Client component that comes with TNet, We’re using a TNTcpLobbyClient for the reliability tcp has for this time insensitive procedure.

From there we need a way to host a game as well as get a list of hosted games from the lobby server. To Host we need to instantiate a TNServerInstance using TNServerInstance.Start, passing in a tcp port to listen on, udp port to listen on, and lobby server information to register with.

For retrieving the games from the lobby server we simply need to call LobbyClient.knownServers.list, it’ll grab the hosted games and return a list of ServerList.Entry elements we can iterate over and display to the user.

This first week was mostly getting this set up so we could run around a box and see each other’s hosted games. This gave us a great launching point to start into gameplay without having to worry about shoehorning the multiplayer in later in development. Next article I’ll go over how to replicate values and get into the game’s basic systems.

Your email address will not be published. Required fields are marked *