When your players are matched up they will receive a MatchFoundMessage. What's convenient about this message is that it has an array of participant IDs. This array will be the same to every player that receives it. So, knowing this, we can:

  • Have a Message Listener for MatchFoundMessage.
  • When this message is received, we can get that participant IDs array and compare our player's ID with the first index in the array.
  • If that player is indeed the first in the list, they will invoke the "open mapname?listen" command and then send a Log Event Request (Your custom API configured on GS) to send a message to every other player involved informing them of that player's IP (which you send as an input in the event together with the match ID and the Cloud Code you configure will process it and send a message to the other participants). This event could also save the host's IP to the matchdata object.

The other participants will have a Listener for that script message the host has sent with their IP. When this message is received, the other participant can take the IP and call the "open hostip".


It's good practice when doing multiplayer games depending on Unreal's network layer to have a GameSparks object in your GameInstance. Also, when your player first signs in, you should save their ID in your GameInstance, which will save you a lot of time when comparing your player's ID with any lists of participants or any checks.


You will need to retrieve the IP from Unreal. For sending it to GameSparks via LogEventRequest, here are tutorials that teaches you how:



Here's some Cloud Code on how to send a message:


//Send message to both players

//Instantiate a message

var message = Spark.message("joinThroughIP"); //Make sure you create this script Message in Configurator -> Messages and add the ext code

var playerArr = aStringArrayOfPlayerIDs; //This will be inputted via JSON Attribute and will just be the ID of the other player

//Add the other player to the list to send this message to

message.setPlayerIds(aStringArrayOfPlayerIDs);

//Add data relevant to the game, this will be the IP and any other info you'd like

message.setMessageData({"sender":"playerID","IP":"Some IP"});

//Send the message

message.send();


Your event's attributes can just be a JSON which you populate. Below are screenshots of how to receive and send that data to participants.