[TL/DR] How/where can i start a handshake between two players that communicate through a relay server?
I have been since last year (ha!) trying to solve this puzzle.
I’m looking for a way that two players get connected through a nodejs server, so they both make a handshake and i can use the replication system from UE4.
i have override uIpnetdriver and trying to extend it and modify. So far what i have achieve is that when a client create a map with listen and other with connect both get connected to the relay server.
Now the client that is trying to connect to listen server is sending handshaking packages through the relay server to the client in listen mode.
The problem is that i can’t find a way that the listen client receive that package and begin the handshaking process. I have been trying to access some functions and properties, but, i can’t get further because they are private, so i cant access to their members/functions.
So the main question is How/where can i start a handshake between two players that communicate through a relay server?
Do not get confused in Listen Server and Relay Server connection. You are using UE4 Listen server mode, in which your client who is starting in Listen server mode, act as a server and also a client (which is authoritative), both of the clients should have replicated properties enabled to see the data changes on server happening, also only server should be allowed to change the values, only then they will be replicated to each clients, not the other way around.
If you want to connect your server to your own, you should not use listen server mode, instead use dedicated server
Maybe i didn’t make myself clear
I Have client A and Client B. They want to start a vs online match. They both use a mobile phone for it.
1-Client A start hosting a game as Listen Server
2- Client B tries to connect to client A using Client A IP address and port.
This setup works only if they are under a LAN or same wifi network. For Internet / mobile data connections this setup does not work because NAT. That’s why i need a relay server
1-Client A start hosting as Listen Server and notifies Remote Server about his state.
2- Client B tries to connect to client A using Client A Ip.
3- Client B sends packet to Remote Server. Remote server grab the package and send it back to Client A
4 -Client A gets Client B package, check magic header and stuff , make the handshake and send data back to Client B through Remote Server.
5- At this point Client A and Client B are sending packages each other through Remote Server. by passing Nat.
I want to use UE4 replication solution instead of coding my own
I want to avoid any solution that require to ask the client open their ports. In mobile that is just saying goodbye to your client.
Using a Dedicated server for a 1v1 game is overkill and expensive.
Right now i have achieved the communication between A and B, but i can’t find a way that Listen-server accepts B handshake and begin the game. and makes CLient B begin the game
There are people who have achieved the functionality which you are trying to create through a dedicated server of their own, generally they have used AWS for this as its quite extensible. But then you can also host your own server on your static IP and try connecting it to the client.
Also steam works also gives free server for testing it seems, you can use them as well.
OR else use some free cloud hosting server, host your UE4 server there and connect to it.
I heard STUN works on WebRTC and Unreal Engine also uses it. They have implemented a webRTC server in Pixel streaming feature. You can search about it there. Also share some insights when you found, would love to explore it
“For convenience, the Unreal Engine also ships with binary versions of the STUN and TURN reference servers that are defined in the C++ WebRTC SDK. You can find these in the Engine/Source/ThirdParty/WebRTC/rev.23789/programs/Win64/VS2017/release folder under your Unreal Engine install location. These implementations may not offer production-grade reliability, but they may help you get started.”
Did you end up having it working? Im curios about it, Im developing against EOS which offers the NAT functionality for free but Im pretty sure there is a hard limit on the relay piece (mobile connection) which I cant find BTW