Rss

  • youtube

SteamCore & Finding and Creating Multiplayer Games

DefaultEngine.ini

First, we have to configure our DefaultEngine.ini file to setup SteamNetworking, the ini file is located in your ProjectDir/Config folder.

[URL]
GameName=Triggered
Port=7777

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=True
SteamDevAppId=480
bVACEnabled=True
SteamAppId=480

[/Script/Engine.Engine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000 
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0 

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

Creating an Online Session

The above example will create a simple Online Session using Steam, which we will later be able to find using FindSteamCoreSessions.

Finding and Joining an Online Session

To find sessions we use the “FindSteamCoreSessions” node, note here that you will NOT be able to find your own session here, it will be filtered out from the search result.

Joining a session is done by using the “JoinSession” node

Finding & Joining Dedicated Servers

Depending on your setup, if you’re using SteamNetworking (Steam P2P) or not, the joining command is a little different.

First example is using SteamNetworking, the second method is using the traditional way of joining via IP, you can find more information here on setting up a dedicated server

SteamCore 1.13

  • Fixed CreateSession bug on dedicated servers
  • Added error messages when calling SteamAPI functions when steam is not properly loaded / available

SteamCore & Authenticating Steam Users

If you are hosting a multiplayer game (or single player), you might want to validate/authenticate the player. With SteamCore it’s very easy!

Getting Started

Begin by adding an event to the “GSValidate AUth Ticket Response” delegate in your Game Instance

GameInstance

Player Controller

Add these 2 events yo your PlayerController blueprint

GameMode (Optional)

We override the OnPostLogin event in our gameMode so we can call the Validate event in the joining players PlayerController

You can now validatre the Auth Response Data from Steam when authenticating users

Cleaning Up

Destroy/Invalidate the authenitcation ticket when the player exits the game (Inside the PlayerController)

SteamCore & Dedicated Server

DISCLAIMER

I will not give support for issues related to firewall and/or not being able to see your server, as this is out of the scope of this plugin, the Plugin is made to give users the ability to use Steam API functionality in blueprints and is not a Steam Networking or Unreal Networking plugin.

Choose your method of connecting

There are 2 ways of connecting to a dedicated server using Steam and Unreal Engine 4, the traditional way is running the console command “open 123.123.123.123” to connect via IP, the other way is using SteamNetworking and connecting via SteamID, I’ll cover both methods and setup down below!

The Traditional Way

If we want to use the traditional “connec to IP” way, we have to disable SteamNetDriver and SteamNetworking, see the DefaultEngine.ini config example below

[URL]
GameName=GameName
Port=7777

[OnlineSubsystemSteam]
bEnabled=True
SteamDevAppId=480
bVACEnabled=True
SteamAppId=480
bUseSteamNetworking=false 

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000 
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0  

[OnlineSubsystem]
DefaultPlatformService=Steam 

We should not add the NetDriverDefinitions or configure the SteamNetDriver, this is the only Steam-related config you need to get a dedicated server to run.

Using SteamNetworking

[URL]
GameName=GameName
Port=7777

[OnlineSubsystemSteam]
bEnabled=True
SteamDevAppId=480
bVACEnabled=True
SteamAppId=480
bUseSteamNetworking=True

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000 
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0  

[OnlineSubsystem]
DefaultPlatformService=Steam 

[/Script/Engine.Engine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

Here we add and configure SteamNetDriverso we can connect using SteamID and utilize SteamNetworking

Initializing the Dedicated Server

Finding our server

There are 2 ways of finding our server, either method works fine but “RequestInternetServerList” will give you more details about the server

Connecting to our server

Using Traditional IP

Using SteamNetworking

Server browser in Steam Client

Can’t find your server, or only visible as LAN server?

If your server is only listed on LAN and not Internet, you need to configure your firewall AND you must use a computer on a different network to see it listed on the internet, ask a friend to find it or disable your LAN connection to the server.

SteamCore Update 1.11

  • Increased Steam Authentication Key buffer size, authenticating with GameServers should now work properly
  • Create SteamCore Session & Find SteamCore Sessions have been updated