歐洲卡車模擬2 - 專用服務器設置教程

大家好大家好我是你們的三哥??!
因為沒有找到教程,很不開心,于是決定自己做。
以下全是干貨,別眨眼。

省流/太長不看/無圖/大神版:
Steam中下載安裝“Euro Truck Simulator 2 Dedicated Server”;(在工具那欄,跟你們熟悉的壁紙軟件在一個分類下)
進歐卡,地圖和MOD設置好后點駕駛,控制臺執(zhí)行:export_server_packages;
啟動一次下載的程序,出現[MP] State: running;? Time: xxxxxx;? Players: 0時,ctrl+c關閉;
去我的文檔下,歐卡文件夾,找到server_config.sii,修改相關參數;(自行翻譯或參考文末翻譯)
PS:https://steamcommunity.com/dev/managegameservers,配置文件中server_logon_token的獲取方式,作用是處于無公網IP及無NAT穿透無端口轉發(fā)的情況下,Session search id不變的唯一方式,如有公網IP或在云端部署,忽略此條,可不填。
PPS:本程序無需依賴Steam,文件下載后可脫離Steam運行。同時有l(wèi)inux版本及SteamCMD版本,本教程不涉及。
省流/太長不看/無圖/大神版:END
Linux版:http://wk.liumu.xin/ETS2/de4d? 感謝@圖圖

萌新小白版本:
想Peach,去看視頻

萌新小白版本:END

Q&A
最容易出現的問題就是你找不到自己開的房間,有此情況去DOS界面找有沒有以下提示
*** ERROR *** : [unit] File '<C:/Users/Administrator/Documents/Euro Truck Simulator 2 | /home>/server_config.sii', line 5:
*** ERROR *** : [unit] The unit '_nameless.23d.d067.c760' (of type 'server_config') could not set the value of attribute 'description'.
*** ERROR *** : load_unit_tree() - Failed to load unit tree from file (/home/server_config.sii)
*** ERROR *** : [MP] Error: Server config failed to load? /home/server_config.sii, switching to default values.
主要看value of attribute后邊的提示,就是你配置文件這里的值有問題,過長或者有特殊符號,經測試只有房間名、簡介、密碼這里填寫不規(guī)范容易報錯,其他地方一般不會出問題。

如何多開:
您可以從?Steam?客戶端的庫選項卡啟動專用服務器,也可以通過啟動其可執(zhí)行文件直接啟動專用服務器。不需要游戲所有權。如果要啟動具有不同配置的服務器,可以使用以下啟動參數:
-server?"server?packages?file?name"?(loads?non?default?server?game?setup)
-server_cfg?"server?config?file?name"?(loads?non?default?server?configuration)
-homedir?"path"?(redirects?game/server?home?directory?on?Windows,?use?XDG_DATA_HOME?environment?for?the?same?thing?on?Linux)
-nosingle?(enables?multiple?instances?of?server,?will?be?default?in?next?patch)
如果您重定向了游戲的主目錄(存儲server_config、服務器.log、游戲.log?server_packages的位置),您還必須重定向服務器主目錄(這是使用?-homedir?參數完成的)

官方文檔對照
ATS / ETS2 dedicated server
===========================
1. Required files to run dedicated server
In the game home folder the following files are used to set up dedicated server session:
server_config.sii
?- contains session description and configuration, connections ports info, logon token and list of moderators
?- ports and logon token must be different for each session instance running at the same time
?- default configuration is generated automatically
server_packages.sii
?- contains map details, dlc and mods configuration
server_packages.dat
?- contains internal map data
server_packages.sii and server_packages.dat must be generated manually via calling `export_server_packages` command while normal game is running. Generated dedicated server configuration will be identical to your game configuration when `export_server_packages` command was called. These files are necessary for a dedicated server to start.?
2. How to launch a dedicated server
You can launch the dedicated server either from the Steam client's Tools tab, or by directly starting its executable. Game ownership is not required. If you want to launch a server with different configuration, use following startup parameters:
?-server "server packages file name"
?-server_cfg "server config file name"
2a. How to launch a dedicated server on linux without steam client installed
You may get the following error when starting a server with Linux: `[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.`
To launch server on linux `steamclient.so` library is required. You can either use provided launch_server.sh script or create a link to this library using `ln -s steamcmd/linux64/steamclient.so ~/.steam/sdk64/steamclient.so`
3. How to export server_packages
In config.cfg enable set g_console.
When game is running press `~` to open console and run `export_server_packages` or `export_server_packages destination file` command. server_packages.sii will be generated in the game home folder. It is necessary for map to be loaded when this command is called.
4. Data requirements
Dedicated server does not require any dlc or mod data. Everything needed is handled via server_packages.sii file. It is not required to copy any additional files. As the dedicated server does not use steam client, it cannot access the workshop.
5. Network address translation (NAT)
Dedicated server does not handle NAT punching and public IP or port forwarding is required to show server in session browser.
However, session direct search works even for server that is behind NAT and it is possible to connect to such server.
Search id is listed when starting dedicated server or in convoy info screen for hosted sessions.
6. Port setup
`connection_virtual_port` and `query_virtual_port` are virtual ports used for connection to server. Allowed range is <100,200>.
`connection_dedicated_port` and `query_dedicated_port` are physical ports used by steam game server api to fill sessions browser. For LAN games query_dedicated_port has be in range of <27015,27020>.
7. Server logon token
By default whenever a dedicated server is launched it is using an anonymous account. For such an account non-persistent server id is generated (used for direct search). To avoid this you can acquire a logon token on https://steamcommunity.com/dev/managegameservers (game ownership is required).
8. Session moderators
As the dedicated server does not have any form or user interface, it is not possible to promote any player to a moderator while the session is running. You can register moderators in server_config using their steam_id to automatically promote them once they join the session.
9. Quality of life
Any player who is a moderator can now change the game time. This can be done via chat message box by sending message `/set_time HH:MM'
10. How to close server
Press Ctrl + C.
11. Troubleshooting
In game home folder server.log.txt and server.crash.txt (when server crashes) files can be found to help solve any issue with a dedicated server.

ATS/ETS2專用服務器
===========================
1.運行專用服務器所需的文件
在游戲主文件夾中,以下文件用于設置專用服務器:
server_config.sii
-包含描述和配置、連接端口信息、登錄令牌和主持人列表
-同時運行的每個實例的端口和登錄令牌必須不同
-默認配置是自動生成的
server_packages.sii
-包含地圖詳細信息、dlc和mods配置
server_packages.dat
-包含內部地圖數據
server_packages.sii和server_packages.dat在正常游戲運行時,必須通過調用“exportserverpackages”命令手動生成數據。生成的專用服務器配置將與調用“export_server_packages”命令時的游戲配置相同。這些文件是啟動專用服務器所必需的。
2.如何啟動專用服務器
您可以從Steam客戶端的“工具”選項卡啟動專用服務器,也可以直接啟動其可執(zhí)行文件。不需要游戲所有權。如果要啟動具有不同配置的服務器,請使用以下啟動參數:
-server“服務器包文件名”
-server_cfg“服務器配置文件名”
2.如何在沒有安裝steam客戶端的情況下在linux上啟動專用服務器
使用Linux啟動服務器時,可能會出現以下錯誤:“[S_API FAIL]SteamAPI_Init()失?。粺o法找到正在運行的Steam實例或本地steamclient.dll`
在linux'streamclient上啟動服務器。因此需要“庫”。您可以使用提供的launch_server。sh腳本,或使用“l(fā)n-s steamcmd/linux64/streamclient”創(chuàng)建指向此庫的鏈接。所以~/.stream/sdk64/streamclient.so`
3.如何導出server_package
在config.cfg中啟用set g_console。
當游戲運行時,按“~”打開控制臺并運行“export_server_packages”或“export_seerver_packages-destination file”命令。server_packages。sii將在游戲主文件夾中生成。調用此命令時,必須加載映射。
4.數據要求
專用服務器不需要任何dlc或mod數據。所需的一切都通過server_packages處理。sii文件。不需要復制任何其他文件。由于專用服務器不使用steam客戶端,因此無法訪問車間。
5.網絡地址轉換(NAT)
專用服務器不處理NAT穿透,需要公網IP或端口轉發(fā)才能在房間列表中顯示服務器。
然而,房間直接搜索甚至適用于NAT后面的服務器,并且可以連接到這樣的服務器。
啟動專用服務器或托管會話的DOS界面,會列出搜索id。
6.端口設置
`connection_virtual_port和query_virtual port是用于連接到服務器的虛擬端口。允許范圍為<100200>。
`connection_dedicated_port和query_dedicated-port是steam游戲服務器api用來填充會話瀏覽器的物理端口。對于LAN游戲,query_dedicated_port的范圍為<2701527020>。
7.服務器登錄令牌
默認情況下,無論何時啟動專用服務器,它都使用匿名帳戶。對于這樣的帳戶,將生成非持久服務器id(用于直接搜索)。為了避免這種情況,您可以在https://steamcommunity.com/dev/managegameservers(需要游戲所有權)。
8.會議主持人
由于專用服務器沒有任何形式或用戶界面,因此無法在會話運行時將任何玩家提升為主持人。您可以在server_config中注冊版主,使用他們的steam_id在他們加入會話后自動提升他們。
9.便捷操作
任何一位主持人玩家現在都可以更改游戲時間。這可以通過聊天消息框發(fā)送消息“/set_time HH:MM”來完成
10.如何關閉服務器
按Ctrl+C。
11.故障排除
在游戲主文件夾server.log中。txt和server.crash。txt(當服務器崩潰時)文件可以幫助解決專用服務器的任何問題。

配置文件對照
SiiNunit
{
server_config : _nameless.228.434a.0fb0 {
?lobbyname: ""
//房間名稱
?description: ""
//房間簡介
?welcome_message: ""
//進入房間歡迎信息
?password: ""
//房間密碼
?max_players: 8
//最大玩家人數
?max_vehicles_total: 100
//玩家車輛總數(此處存疑)
?max_ai_vehicles_player: 50
//AI車流總數
?max_ai_vehicles_player_spawn: 30
?connection_virtual_port: 100
?query_virtual_port: 101
?connection_dedicated_port: 27015
?query_dedicated_port: 27016
//端口信息
?server_logon_token: ""
//服務器所屬Token
?player_damage: true
//玩家碰撞
?traffic: true
//AI車輛
?hide_in_company: false
//車庫內可見
?hide_colliding: true
//無碰撞區(qū)域內隱藏
?force_speed_limiter: false
//強制限速
?mods_optioning: false
//可選模組
?service_no_collision: false
?in_menu_ghosting: false
//瀏覽菜單時隱藏
?name_tags: true
//玩家名稱
?friends_only: false
//僅限Steam好友
?show_server: true
//房間展示
?moderator_list: 0
//主持人列表
}

獲取最新資訊的方式:? ??
- 關注我的B站 “我是你們的三哥啊”? ?
- 加入交流群(QQ): 950989423??
聲明:未經許可,不得以任何形式(包括但不限于:轉載、修改等)直接或間接地盜取此內容 ,保留追究權利