開發情景: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