Multiplayer
Validate Players
warning
Requires EOSCore 2.0.1 and later.
EOSCore Validate Player checks a joining player on the dedicated server. It verifies the player's Connect ID token with EOS and checks whether the player has an active sanction. Use it in the server's PreLogin so that a player is refused before the connection is accepted.
What the node checks
- The Connect ID token is valid. EOS rejects forged or expired tokens.
- The player has no active sanctions. Any active sanction blocks the player.
The Callback returns:
- Result Code: the EOS result of the checks.
- Allowed: true only when the token is valid and the player has no active sanctions.
- Active Sanction Count: how many active sanctions the player has.
If EOS cannot be reached or any check fails, Allowed is false. The player is refused, so a banned player cannot get in during a network outage.
Client: send the token
On the client, get the Connect ID token and send it with the join request:
- Call EOS_Connect_CopyIdToken after the player has logged in with EOS.
- Add the token and the Product User ID to the join URL options, for example
?ProductUserId=<id>&Token=<token>.
Server: check in PreLogin
- In your Game Mode, override PreLogin and read
ProductUserIdandTokenfrom the options with Parse Option. - Build an EOS Connect Id Token with the Product User ID and the token, and call EOSCore Validate Player.
- In the Callback, when Allowed is false, return a refusal from PreLogin with Error Message set to a short reason.
Requirements
- The EOS platform must be initialized on the server, with the same EOS Configuration as the game.
- A dedicated server does not need a player login for the sanction query. Leave the local user empty.
- Sanctions are checked against the sandbox in the EOS Configuration the server uses. Use the same sandbox as the clients.
Limitations
- Every active sanction blocks the player. The node does not check the sanction type. To allow some sanction types, use Active Sanction Count and query the sanctions yourself with EOS_Sanctions_CopyPlayerSanctionByIndex.
- The check runs once per join. A player who is sanctioned while in the game stays in the game.