I’m just starting to investigate Unity 2.01’s networking capabilities and have, what I hope is, a simple question:
How would I use Unity’s new networking capabilities for a simple 2 computer, peer to peer network?
I’m just starting to investigate Unity 2.01’s networking capabilities and have, what I hope is, a simple question:
How would I use Unity’s new networking capabilities for a simple 2 computer, peer to peer network?
You would still need a server to do that. What you can do is make one player a player-server, and have the other player connect to it.
This isn’t a limitation with Unity specifically, it’s the way Raknet works IIRC, and that makes sense. We just have to do work-arounds to make the game seem like it’s P2P instead of client-server.
HTH,
-Jeremy
Really if you have 2 machines, there is zero difference between server - client approaches and peer 2 peer.
Any Unity instance can host a server and play the game at the same time.
Except from a code design standpoint, you have to think in terms of client-server when planning out your code is all, how you handle prediction and lag compensation (if any) and who owns what, etc. As long as you’re in the right mindset you are fine.
-Jeremy
I believe creating a P2P mesh style network is impossible at the moment, since we can only connect to one master peer at once. If you decide to ‘grow’ your P2P solution in future, you might want to consider this.
i.e. you decide you want to run a couple of independent ‘chat’ sessions, or participate/poll 2 different game sessions.
Don’t shoot me if its not true, but using the built in networking system it is always a client connecting to a server (which might be a customer playing the game who acts as server), but with only 1 connection from each client to a server.
If you want to open multiple connections, then I guess you would have to use raw tcp-sockets to implement your own networking system, but thats at a very low level and I also don’t really know HOW to do that. Just that these functions may be available to you in mono.
I remember having asked something before on forums about connecting to an irc server. That would have been through mono sockets instead of the networking system.