I’ve been playing Survival Games (Like rust and unturned and hurtworld) a lot lately and I want to know how to have a multiplayer system like that with UNet. In the menu you can click view servers and a bunch of servers hosted by people all over the world come up. Dedicated servers rented by youtubers or just a server hosted on a players computer. How to have something like this where the player sets up the server with UNet. None of that relay server or matchmaker. I would like some tips please
Is no one going to help me with this?
Please help.
There’s nothing stopping you from having a “dedicated server” architecture to your game. It just means that instead of some player calling StartHost() and the others calling StartClient(), the dedicated server will call StartServer() and all the players will call StartClient(). You can run the server in headless mode to avoid any unnecessary graphics processing. If you want one dedicated server instance to be able to host multiple separate game instances then you’re kind of on your own I think.
The matchmaking built into UNet would work perfectly fine for the lobby system you describe, I’m not sure why you are against using it. Also you don’t have to use the relays if you don’t want, but if a player is hosting a server behind a router there’s a pretty good chance that no one will be able to connect to it without the relays (unless you use something like the plugin linked in my signature).
If you really don’t want to use the built in matchmaking you’ll either have to find another third-party solution or write your own. Personally I’ve found some php / mysql hosted on an external server to work pretty well. You just need some way to store and retrieve the list of games. Steam lobbies would be another option if you have access to the steam API.