I noticed that there are plenty of tutorials how to set up a simple multiplayer game by using two windows (one with editor in game mode and another from built game mode). However, I got stuck at the start when I am trying to set up real connection with my friend, who uses computer from remote place (lets assume that my friend is not on the same LAN as me, e.g. lives somewhere in different country). More particular questions here are:
How to properly find my and my friend’s IP address and port which we could use for setting up host server on one of our computers? (I remember there can be also internal and external IP addresses).
When we both find these IP addresses and ports, where we should enter them to properly set up master server and connection?
Disclaimer: I’m still learning the networking too - and haven’t tested online play only because I haven’t progressed far enough yet.
Anyway yeah just for testing and everything, you can direct connect through IP and port (assuming the appropriate port is forwarded on the firewall/router/modem) by just contacting someone, have them go to whatismyip.com and give you the public ip to them. Then either in your code decide a default port or enter it when starting a server through the gui or something - and hand the port and IP off when you start up the server, or connect the client.
Now for release - that’s a whole 'nother ball game! You better have some kind of master server who every player announces themselves to when they start a match. This way players can browse all active servers, through some gui magic. That is only the start though - you need NAT punch through to help players (especially mobile devices) get past firewalls/routers/gateways/modems or whatever other network issue is going on through the interwebs. This is possible (supposedly, I haven’t tried) through the new service unity offers, which the name escapes me right now, but is free for us to test for the time being that helps with matchmaking.
Hope I scratched the surface at least on those topics lol.
Hi guys, I’m struggling with this step right now. I’m trying to test using my own a friend’s IP address but the editor tries and eventually does not connect. No errors. Any ideas?
I started to use Unity’s Matchmaker system and it seems to work well, no IPs needed to find or enter, matchmaker just finds the host room and the client can connect to it. Try it, I guess it’s an easy way to get started.
System.FormatException: FAILURE Returned from server: Failed because of invalid projectid setup. Please verify project setup at https://multiplayer.unity3d.com.
Ok, this is where I got hung up. In the video it shows him putting the product ID into a field in player setting instead of clicking on the cloud icon.
The problem now is that the cloud icon does nothing. I have a services tab open, I"m logged into my account but nothing shows up. Do I have to be a pro user to use this service?
Great that you solved it. Now the most important thing is to check if it actually works between two separate computers, which are not on the same LAN (I would start with simplest player movement sync’ing to see if it works).
I ran into a similar problem as yours a month or so ago. For me it was due to the way my router was hooked up, and I fixed it using this awesome asset from the asset store. You may be having a different problem than I- but if you continue having issues, check out my thread from a while back.