UE4联网Steam

LAN联网很简单相信大家都会了,现在跟大家分享下Steam联网的设置

参考:https://wiki.unrealengine.com/Steam,_Using_the_Steam_SDK_During_Development

不过上面是英文版的,以下是我亲测可用的:

1.在UE4安装目录下 找到 Steamworks文件夹。

我的UE4安装在D盘Program Files文件夹里,路径是:

D:\Program Files\Epic Games\4.12\Engine\Source\ThirdParty\Steamworks

各位可以参考下。


2.该文件夹中,新建两个文件夹,名字分别为:Win64和Win32

新建后效果如图:

UE4联网Steam_第1张图片


3.在Steam安装目录下找到以下dll,复制到对应文件夹。

Win64

 steam_api64.dll	(Downloaded SDK)
 steamclient64.dll 	(Steam Client Install Dir)
 tier0_s64.dll		(Steam Client Install Dir)
 vstdlib_s64.dll 	(Steam Client Install Dir)

Win32

 steam_api.dll		(Downloaded SDK)
 steamclient.dll 	(Steam Client Install Dir)
 tier0_s.dll  		(Steam Client Install Dir)
 vstdlib_s.dll  	(Steam Client Install Dir)

我的Steam安装在了C盘,各位可以参考并找到自己的安装路径

C:\Program Files (x86)\Steam


4.打开你的工程文件的VS

UE4联网Steam_第2张图片


5.在Build.cs中加入以下代码

 PublicDependencyModuleNames.AddRange(new string[] { 
 	"OnlineSubsystem",
 	"OnlineSubsystemUtils"
 });
 DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");

UE4联网Steam_第3张图片


6.在Target.cs中的TargetRules中加入一句代码:bUserSteam = true;

UE4联网Steam_第4张图片


7.在Config文件夹下的DefaultEngine.ini文件中,加入以下代码:

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
 
[OnlineSubsystem]
DefaultPlatformService=Steam
PollingIntervalInMs=20
 
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
GameServerQueryPort=27015
bRelaunchInSteam=false
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
 
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemSteam.SteamNetConnection"

我的路径是:

D:\test\TestSteam\Config

UE4联网Steam_第5张图片


8.编译C++代码,编译好了以后打包。

9.把UE4源文件里的Engine\Binaries\ThirdParty\Steamworks整个复制到打包好的文件的Binaries\ThirdParty下。

我的路径是:

 D:\Program Files\Epic Games\4.12\Engine\Binaries\ThirdParty\Steamworks 复制到

UE4联网Steam_第6张图片


10.然后就可以运行了,按Shift+Tab 就可以调出Steam的界面!

UE4联网Steam_第7张图片

UE4联网Steam_第8张图片

你可能感兴趣的:(UE4联网Steam)