UE4+启动脚本及项目配置

开发情景:PC版多人联机VR游戏(其中有一台独立服务器,4个客户端,还有一个OB上帝视角)

启动逻辑:iPad配置游戏时长,游戏地图,游戏人数等参数。然后iPad通知代理程序,启动Server,OB,Client程序。

文件解释:.bat为启动脚本,.config为iPad配置的参数文件由代理程序写入游戏目录下,.default为游戏默认配置

一、游戏启动脚本配置

1、Server端

  • GameServer.bat
@echo off

:: custom variable
set GamePath=.\SFGameServer.exe
set ConfigFiles=.\SFGameServer.config
set DefaultFiles=.\SFGameServer.default
set LogFile=MapServer.log

:: read config file
setlocal enabledelayedexpansion

for /f "tokens=1,2 delims==" %%i in (%DefaultFiles%) do (
	set Command=!Command!%%i=%%j?
)

for /f "tokens=1,2 delims==" %%i in (%ConfigFiles%) do (
	set Command=!Command!%%i=%%j?
)

echo !Command!
start %GamePath% ?GameType=MapServer?!Command! -server -game -log -log=%LogFile%
endlocal
  • GameServer.config
BattleMaxNum=1
FightTime=60
MapName=1,4
HostServerIp=192.168.2.30
  • GameServer.default
MULTIHOME=192.168.2.200
AutoReload=1
ConfineTime=60

2、OB端

  • GameOB.bat
@echo off

:: custom variable
set GamePath=.\SFGameOB.exe
set ConfigFiles=.\SFGameOB.config
set DefaultFiles=.\SFGameOB.default
set LogFile=Spectator.log

:: read config file
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims==" %%i in (%DefaultFiles%) do (
	set Command=!Command!%%i=%%j?
)
for /f "tokens=1,2 delims==" %%i in (%ConfigFiles%) do (
	set Command=!Command!%%i=%%j?
)

echo !Command!
start %GamePath% ?GameType=Client?!Command! -game -log -log=%LogFile%
endlocal
  • GameOB.config
BattleMaxNum=1
FightTime=60
MapName=1,4
HostServerIp=192.168.2.30
  • GameOB.default
HostServerPort=7777
RoomId=0
TeamId=100
HeadId=0
WeaponId=0
UserName=Observer
PlayerTempId=3
ClientType=3

CaptureType=1
[email protected]
CapturePort=1111
Point1=4
Point2=5
Point3=9

IsVrMode=0
MusicValue=130

3、Client端

  • GameClient.bat
@echo off

:: custom variable
set GamePath=.\SFGame.exe
set ConfigFiles=.\SFGame.config
set DefaultFiles=.\SFGame.default
set LogFile=Client.log

:: read config file
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims==" %%i in (%DefaultFiles%) do (
	set Command=!Command!%%i=%%j?
)
for /f "tokens=1,2 delims==" %%i in (%ConfigFiles%) do (
	set Command=!Command!%%i=%%j?
)

echo !Command!
start %GamePath% ?GameType=Client?!Command! -game -log -log=%LogFile%
endlocal
  • GameClient.config
BattleMaxNum=1
FightTime=300
MapName=1,4
HostServerIp=192.168.2.30
  • GameClient.default
TeamId=1
StoreId=1101011
PlayerTempId=3

HostServerPort=7777
RoomId=1
HeadId=0
WeaponId=0
BackpackId=1
UserName=测试玩家1
ClientType=1

CaptureType=4
[email protected]
CapturePort=1111
Point1=5
Point2=6
Point3=9

IsVrMode=1

二、项目工程配置

1、GameUserSettings

设置应用打包后运行时窗体的分辨率及位置

[/Script/Engine.GameUserSettings]
bUseVSync=False
ResolutionSizeX=1280
ResolutionSizeY=960
LastUserConfirmedResolutionSizeX=1280
LastUserConfirmedResolutionSizeY=960
WindowPosX=-1
WindowPosY=-1
bUseDesktopResolutionForFullscreen=False
FullscreenMode=2
LastConfirmedFullscreenMode=2
PreferredFullscreenMode=2
Version=5
AudioQualityLevel=0
FrameRateLimit=0.000000
DesiredScreenWidth=1280
DesiredScreenHeight=960
LastRecommendedScreenWidth=0.000000
LastRecommendedScreenHeight=0.000000
发布了40 篇原创文章 · 获赞 14 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/zhangmei126/article/details/103459365