Is there a way in unity to easily setup a connection between 2 clients using just the ip and port of the machine you are connecting to?
What I was looking for was a simple pure direct connection that wouldn’t relay through any of the popular multiplayer frameworks but would be just between 2 machines.
I wouldn’t need matchmaking or anything to be stored on 3rd party servers, I dont even need to authenticate the connection through my own login server, all connection burdens would be between the 2 players in their respective machines.
If I used for example the photon framework to do this, there would be a limit to 20 people playing at the same time even though they are only playing 2 player games,(max 20 clients connected), this implies that photon is relaying the connections and using their servers to maintain these connections which is exactly what I wanted to avoid. Also if photon servers are down connections cannot be established.
So is this possible in unity, a connection that is maintained only by the hosting machine and doesnt get relayed through any 3rd party servers? And if yes, how?
A way to detect other computers in lan would also work for me, since I dont mind if players needed to use fake lan ( software like hamachi) to connect with eachother, as long as the connection is not hosted by photon, unet etc.
Most network API’s support this, but your problem is the nature of today’s Internet. You’ll have to get the player hosting the game to log into their router and set up port forwarding rules specific to your game. Most gamers either won’t want to do that, or can’t handle that at all, which is the point of setting up your own dedicated server or using a 3rd party service.
Try Mirror. I’ve used that and so far managed to get two devices connected to each other. one as a host and the other a client.
However, I want to be able to change some of the logic and have struggled to find much documentation on Mirror. Not sure if Unity’s “Networking” will also work with it. Also, mu understanding is that the unity networking features apparently has been deprecated but are still available to me in Unity 2019.3 - I’m finding this whole thing rather confusing. I would also like to know how you can achieve what you are trying to achieve.
Try Mirror and see if you have any luck (and do let me know please :-))