Connecting to a Dedicated Server
Overview
This guide outlines methods to connect to a dedicated server in Unreal Engine, depending on your DefaultEngine.ini
configuration. The connection is facilitated using the Execute Console Command node in Unreal Engine. Three distinct methods are detailed below: SteamCore PRO Sessions, SteamCoreSockets, and IpNetDriver.
A step-by-step video tutorial is available: Watch the Video
Method 1: Using SteamCore PRO Sessions
This method leverages the SteamCoreSockets NetDriver for connecting to a dedicated server.
- Configuration: Refer to the SteamCoreSockets Configuration Guide.
- Steps:
- Use the Find SteamCore PRO Sessions node to discover available multiplayer servers.
- Connect to a server using the Join Session node.
The provided example automatically joins the first session found and is intended for demonstration purposes only. For production environments, implement a comprehensive server list UI. Refer to the Blueprint example project for guidance.
Method 2: Using SteamCoreSockets (Bypassing Online Subsystem)
This method uses SteamCoreSockets to connect directly to a server without relying on the Online Subsystem.
- Configuration: See the SteamCoreSockets Configuration Guide.
- Console Command:
open steam.P2PAddr:Port
- Replace
P2PAddr
with the server’s Steam address. - Replace
Port
with the appropriate port number.
- Replace
This example demonstrates connecting to the first available server. For production, implement a proper session browser to allow users to select from available servers.
Method 3: Using IpNetDriver (Bypassing Online Subsystem)
This method is used when not relying on Steam or any other Online Subsystem, utilizing the IpNetDriver.
- Configuration: Refer to the IpNetDriver Setup Guide.
- Console Command:
open <IP>:<Port>
- Replace
<IP>
with the server’s IP address. - Replace
<Port>
with the appropriate port number.
- Replace
Best Practices
- Always implement a server browser for production to allow users to select from available servers rather than auto-joining the first session.
- Ensure proper configuration in
DefaultEngine.ini
to align with your chosen connection method. - Test thoroughly to confirm compatibility with your networking setup.