I’m just starting to get ahold of networking in unity, but it seems that all of the tutorials I come across assume I want to put out a game wherin clients connect to an authoritative server I maintain. I get why, security and all, but that’s not the case with this.
What I’m working on is a strictly small-scale co-op game, say 1-4 players. There’s no need for an authoritative server, as who cares who “cheats” if people are co-operating with friends?
What I’d like is the ability to have a player load up the game, create a server, and other players connect to that. A server browser would require a maintained server on my part, I believe (right?), but I don’t see any reason why the option to directly connect shouldn’t also be available.
I know the Third Person non-auth portion of the networking examples basically does this, but I find myself getting bogged down in either components of the other examples from the project or the superfluous non-networking aspects. I tried modifying that example to simply turn the third person view into a first person one, simply changing the control components and attaching a camera to the actor-prefab, but I’ve either screwed up the data syncing or somehow made the actors invisible in the process.
Does anyone know of a tutorial which just shows that simple process? Just allows 2 clients to connect peer-to-peer, perhaps with rudimentary control of a simple primitive for display purposes? This looks right, but requires I run a fox server in the tutorial.
I suggest you use the Networking Tutorial offered by Unity, it is simple and it has some nice example scenes with code and all, and it lets you do just that, 1 player create a server (non-auth) and others connect to it.
You don’t need an authoritative server at all.
To make the server non-authoritative, make each user spawn it’s own player instead of the server spawning them.
I assume you are also talking about the master server, you don’t need to use it but the problem you will have then is that the client won’t get a list of available servers. So you will have to enter the remote ip address yourself.
K, but I DO need an auth server to do a server browser/lobby, got it, thanks. I assume it’s also possible to mix/match the two. Use an auth to get players into the game, then once it’s started they run it themselves. Should be a reasonable means to get something working within the max connection limits of most of the free networking/server architecture out there, as the only active connections would be those waiting to play.
nope, authoritative != master server.
Master server = relay host so clients can connect to servers, doesn’t have any game logic.
The only thing it does is send a list of available games to the connected client so it can connect to them.