LAN Server/zh: Difference between revisions

From DDraceNetwork
(Created page with "* 和朋友一起游玩时不受别人打扰 * 游玩官方服务器中没有的地图 * 用管理员指令和工具对地图进行测试 * 以及更多!")
No edit summary
 
(76 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages />
本地服务器是玩家在本地网络(比如家庭wifi)中建立的服务器,建立服务器的玩家拥有对这个服务器的完全控制权。


使用本地服务器的原因很多它能够让你做到:
LAN 本地服务器允许玩家作为服主在家庭网络中建立服务器,服主对服务器拥完全控制权


* 和朋友一起游玩时不受别人打扰
有许多原因会促使玩家创建本地服务器,例如无法忍受网络波动或者不希望游玩过程受他人影响。下面是一些本地服务器的优点:
 
* 在私下里和朋友一起游玩地图
* 游玩官方服务器中没有的地图
* 游玩官方服务器中没有的地图
* 用管理员指令和工具地图进行测试
* 用管理员指令和工具测试地图
* 以及多!
* 当然重点不是地图而是联机!
 
然而,本地服务器也存在缺点。您要做许多步骤才能允许朋友加入服务器,相比起官方服务器,不知哪一个连接稳定。并且在缺少官方认证的情况下,完成地图的成绩不会上传,只能在本地查看,您也无法获得通关排名。


<div lang="en" dir="ltr" class="mw-content-ltr">
However, there are downsides to hosting a LAN server. They do require specific steps to allow friends to join, and often have unstable connections compared to official servers. Also note that LAN servers will only save ranks locally - if you finish a map on a LAN server, your rank won't translate to any official servers.
</div>


<span id="Creating_and_Joining_a_LAN_Server"></span>
== 建立和加入本地服务器 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
在新版DDNet客户端中,建立本地服务器非常简单。
== Creating and Joining a LAN Server ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
# 找到游戏的开始菜单
In the new client, creating a LAN server is very simple.
# 点击“运行服务器”
</div>
#* 一个黑底白字的命令行窗口会弹出(这可能需要一小段时间)。从这个窗口中复制rcon的密码(也可以在游戏路径的autoexecserver.cfg文件中查看并设置)。
# 打开游戏客户端的浏览服务器界面,在上方选择局域网,刷新后即可加入。
# 进入游戏后,按f2打开服务器控制台rcon,然后输入密码来获得[[Special:MyLanguage/Settings and Commands|管理员指令]]的使用权限。
# 介绍完毕


<div lang="en" dir="ltr" class="mw-content-ltr">
然而,这样建立的服务器只能够让处在同一局域网中的玩家加入。如果其他玩家不在你身旁,那么想要让他们加入就需要更多步骤。
# Navigate to the main menu
# Click on "Start Server"
#* A black console window should pop up (this might take a moment). Copy the rcon password from this window.
# Navigate to the server browser, and join the new server in the LAN tab
# After joining, press f2 to open the in-game server console and enter in your rcon password from earlier to get access to [[Special:MyLanguage/Settings and Commands|admin commands.]]
# You're done!
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
However, this only allows players on your local network to join. In other words - nobody else except you can join this LAN server online. To allow players to join online, you'll have to go through more steps.
</div>


<span id="Setting_Up_Your_LAN_Server_for_Online_Play"></span>
== 让本地服务器连接至公网 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
这一步需要你进行端口映射,其方式取决于你的路由器品牌和类型。
== Setting Up Your LAN Server for Online Play ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
# 在路由器上映射或者转发UDP端口8303。
This next step requires you to port forward, which depends on the brand and type of router you have.
#* 浏览器上一般都有关于端口映射或者转发的教程。内容通常会涉及到登录浏览器接口,不同的家庭各有所异。
</div>
#* 确保设置中使用了UDP协议而不是TCP或者两者共用。
#* DDNet默认使用8303端口,如果您对于服务器足够熟悉,也可以通过更改服务器配置文件中的<code>sv_port</code>参数来使用其它端口。
# 在 F2 服务器控制台或者服务器配置文件中使用<code>sv_register 1</code>可以让您的服务器出现在游戏服务器界面的互联网列表中。注意这么做会'''公开'''您的家庭网络IP,具有一定风险。


<div lang="en" dir="ltr" class="mw-content-ltr">
一些网络运营商会使用电信级NAT而不提供本地 IPv4 地址的完整级别保护,因此可能无法使用端口转发,以上将服务器联网的方法变得不可用。(关于 IPV6 的方法此处不涉及。)
# Port forward the UDP port 8303 through your router.
#* The easiest way to do this is to simply search "how to port forward" in your preferred search engine. This process usually requires you to log into your router interface, which, again, varies per household.
#* Make sure to choose the UDP setting, and not the TCP or the TCP/UDP setting.
#* You can forward a port other than 8303 if you set up the desired port using <code>sv_port</code> in your server autoexecutable. However, the default port is 8303 for DDNet. So, if you're not sure what you're doing, just forward port 8303.
# If you'd like your server to show up on the Internet tab, use the server setting <code>sv_register 1</code>, either in the f2 console or in the server autoexecutable. Note that this '''will''' make your IP publicly viewable if you host the server from your home network. So, use at your own risk.
Some ISPs might not provide you with a full native IPv4 address, but instead use carrier-grade NAT, and will thus not support forwarding ports. In this case you can't make your LAN server available for online play.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Setting_Up_on_Linux_Server"></span>
== Setting Up on Linux Server ==
== 在Linux上设置服务器 ==
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Linux"></span>
=== Linux ===
=== Linux ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{|- class="wikitable" style="width:100%;"
{|- class="wikitable" style="width:100%;"
| <div style=" display: flex; justify-content: space-between;"><div>Method 1 (Compiling server)</div> <div class="mw-customtoggle-methodOne" style="color:#0B0080;"><small>[Show/Hide]</small></div></div>
| <div style=" display: flex; justify-content: space-between;"><div>方法 1 (编译服务器)</div> <div class="mw-customtoggle-methodOne" style="color:#0B0080;"><small>[展开 / 折叠]</small></div></div>
|- class="mw-collapsible mw-collapsed" id="mw-customcollapsible-methodOne"
|- class="mw-collapsible mw-collapsed" id="mw-customcollapsible-methodOne"
| 1.Update the Server
| 1.上传服务器
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>sudo apt update && apt upgrade</code>
* <code>sudo apt update && apt upgrade</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
2. 安装git
2. Install git
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>sudo apt install git</code>
* <code>sudo apt install git</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
3. 创建目录
3. Make a directory
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>mkdir DDNet-Server</code>
* <code>mkdir DDNet-Server</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
4. 复制Github上的库
3. Clone the repository from Github
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>git clone --recursive --depth=1 <nowiki>https://github.com/ddnet/ddnet</nowiki></code>
* <code>git clone --recursive --depth=1 <nowiki>https://github.com/ddnet/ddnet</nowiki></code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
5. 安装依赖包
4. Install all required dependencies
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>sudo apt install build-essential cmake git libcurl4-openssl-dev libssl-dev libfreetype6-dev libglew-dev libnotify-dev libogg-dev libopus-dev libopusfile-dev libpnglite-dev libsdl2-dev libsqlite3-dev libwavpack-dev python google-mock</code>
* <code>sudo apt install build-essential cmake git libcurl4-openssl-dev libssl-dev libfreetype6-dev libglew-dev libnotify-dev libogg-dev libopus-dev libopusfile-dev libpnglite-dev libsdl2-dev libsqlite3-dev libwavpack-dev python google-mock</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
6. 进入 DDNet 文件夹
5. Go into ddnet folder
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>cd ddnet</code>
* <code>cd ddnet</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
7. 编译 DDNet
5. Compile DDNet
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>mkdir build</code>
* <code>mkdir build</code>
* <code>cd build</code>
* <code>cd build</code>
* <code>cmake -DCLIENT=OFF ..</code>
* <code>cmake -DCLIENT=OFF ..</code>
* <code>make -j$(nproc)</code>
* <code>make -j$(nproc)</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
8. 服务器,启动!
6. Open Server
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>./DDNet-Server</code>
* <code>./DDNet-Server</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
9. 转发服务器端口(默认为8303)
7. forward a port to the server (default is 8303)
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
10.使用 IP 通过客户端连接
8. Connect via Client on the IP
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Press F1
* Press F1
* connect "Server-IP"
* connect "Server-IP"
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
11.游玩
9.Play
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
更多内容参阅 [https://github.com/ddnet/ddnet github]
More Information are available at https://github.com/ddnet/ddnet
|}
|}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{|- class="wikitable" style="width:100%;"
{|- class="wikitable" style="width:100%;"
| <div style=" display: flex; justify-content: space-between;"><div>Method 2 (Using precompiled binaries)</div> <div class="mw-customtoggle-methodTwo" style="color:#0B0080;"><small>[Show/Hide]</small></div></div>
| <div style=" display: flex; justify-content: space-between;"><div>方法 2 (使用预编译的二进制文件)</div> <div class="mw-customtoggle-methodTwo" style="color:#0B0080;"><small>[展开 / 折叠]</small></div></div>
|- class="mw-collapsible mw-collapsed" id="mw-customcollapsible-methodTwo"
|- class="mw-collapsible mw-collapsed" id="mw-customcollapsible-methodTwo"
| 1. Download binaries from [https://ddnet.org/downloads/ DDNet download page]
| 1. [https://ddnet.org/downloads/ DDNet 下载页面(download page]上下载二进制文件
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
2. 解压到文件夹
2. Extract into folder
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
3. 启动服务器
3. Open Server
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>./DDNet-Server</code>
* <code>./DDNet-Server</code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
4. 转发服务器端口(默认为8303)
4. Forward a port to the server (default is 8303)
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
5.使用 IP 通过客户端连接
5. Connect via Client on the IP
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Press F1
* Press F1
* connect "Server-IP"
* connect "Server-IP"
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
6. 游玩
6. Play
|}
|}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
关于端口转发可以参阅 http://portforward.com/
More Information about Port forwarding are available at http://portforward.com/
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Server_Settings_and_Maps"></span>
== Server Settings and Maps ==
== 服务器设置与地图 ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
您可以在 Teeworlds 文件夹中找到设置和地图引导。
Everything settings and map-wise can be found in your Teeworlds folder.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Windows系统:位于 AppData/Roaming/Teeworlds 路径下。
* On Windows, you can find it in AppData/Roaming/Teeworlds.
* Linux系统:(地址待定)。
* On Linux, you can find it in (insert location here).
* Mac系统:(地址待定)。
* On Mac, you can find it in (insert location here).
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Server_Autoexecutables"></span>
=== Server Autoexecutables ===
=== 服务器配置文件 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
服务器配置文件中包含了启动服务器时自动运行的设置和指令,例如将随机的服务器管理员密码改为固定密码。
Server autoexecutables are files containing server settings that are automatically run every time you start your server. For example, this can be helpful if you want to keep a single rcon password to log in with every time.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
首先进入 Teeworlds 文件夹'''而非''' DDNet 文件夹,创建一个名为 '''autoexec_server.cfg''' 的文本文件,确保后缀完全一致。
To create an autoexecutable, navigate to your Teeworlds folder (not your DDNet folder!), and create a file by the name of "autoexec_server.cfg". Make sure it is a .cfg extension file and not a .txt file or anything similar.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
编辑该文件可以快速增加命令,每条命令独自占据一行。下面给出常见命令的示例:
To add commands, simply edit the autoexec_server.cfg file and add each command on a new line. Here are examples of commonly used commands:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 设置管理员密码:<code>sv_rcon_password <密码></code>
* sv_rcon_password <rcon password>
* 设置进入服务器密码:<code>sv_password <密码></code>
* sv_password <password to join>
* 设置服务器名字:<code>sv_name <名字></code>
* sv_name <server name>
* 在互联网列表公开服务器:<code>sv_register 1</code>
* sv_register 1 (shows the server on the Internet tab)
* 允许使用作弊指令:<code>sv_test_cmds 1</code>
* sv_test_cmds 1 (allows the use of cheat commands)
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Server_Maps"></span>
=== Server Maps ===
=== 服务器地图 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
服务器地图保存在 Teeworlds/maps 路径中,加载服务器地图可以使用服务器命令<code>sv_map <地图名></code>
Server maps can be found in Teeworlds/maps. To load a map ingame, use the server command <code>sv_map <mapname></code>.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="See_also"></span>
== See also ==
== 另见 ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* [https://wiki.archlinux.org/title/DDRaceNetwork#Server DDNet Server configuration in Arch Wiki]
* [https://wiki.archlinux.org/title/DDRaceNetwork#Server DDNet Server configuration in Arch Wiki]
* https://github.com/ddnet/ddnet-maps - DDNet maps repository
* https://github.com/ddnet/ddnet-maps - DDNet maps repository
</div>
[[Category:Tutorial{{#translation:}}]]
[[Category:Tutorial{{#translation:}}]]

Latest revision as of 12:42, 13 September 2023

LAN 本地伺服器允許玩家作為服主在家庭網絡中建立伺服器,服主對伺服器擁有完全控制權。

有許多原因會促使玩家創建本地伺服器,例如無法忍受網絡波動或者不希望遊玩過程受他人影響。下面是一些本地伺服器的優點:

  • 在私下裏和朋友一起遊玩地圖
  • 遊玩官方伺服器中沒有的地圖
  • 用管理員指令和工具測試地圖
  • 當然重點不是地圖而是聯機!

然而,本地伺服器也存在缺點。您要做許多步驟才能允許朋友加入伺服器,相比起官方伺服器,不知哪一個連接更穩定。並且在缺少官方認證的情況下,完成地圖的成績不會上傳,只能在本地查看,您也無法獲得通關排名。


建立和加入本地伺服器

在新版DDNet客戶端中,建立本地伺服器非常簡單。

  1. 找到遊戲的開始菜單
  2. 點擊「運行伺服器」
    • 一個黑底白字的命令行窗口會彈出(這可能需要一小段時間)。從這個窗口中複製rcon的密碼(也可以在遊戲路徑的autoexecserver.cfg文件中查看並設置)。
  3. 打開遊戲客戶端的瀏覽伺服器界面,在上方選擇局域網,刷新後即可加入。
  4. 進入遊戲後,按f2打開伺服器控制台rcon,然後輸入密碼來獲得管理員指令的使用權限。
  5. 介紹完畢

然而,這樣建立的伺服器只能夠讓處在同一局域網中的玩家加入。如果其他玩家不在你身旁,那麼想要讓他們加入就需要更多步驟。


讓本地伺服器連接至公網

這一步需要你進行端口映射,其方式取決於你的路由器品牌和類型。

  1. 在路由器上映射或者轉發UDP端口8303。
    • 瀏覽器上一般都有關於端口映射或者轉發的教程。內容通常會涉及到登錄瀏覽器接口,不同的家庭各有所異。
    • 確保設置中使用了UDP協議而不是TCP或者兩者共用。
    • DDNet默認使用8303端口,如果您對於伺服器足夠熟悉,也可以通過更改伺服器配置文件中的sv_port參數來使用其它端口。
  2. 在 F2 伺服器控制台或者伺服器配置文件中使用sv_register 1可以讓您的伺服器出現在遊戲伺服器界面的互聯網列表中。注意這麼做會公開您的家庭網絡IP,具有一定風險。

一些網絡運營商會使用電信級NAT而不提供本地 IPv4 地址的完整級別保護,因此可能無法使用端口轉發,以上將伺服器聯網的方法變得不可用。(關於 IPV6 的方法此處不涉及。)

在Linux上設置伺服器

Linux

方法 1 (編譯伺服器)
[展開 / 摺疊]
1.上傳伺服器
  • sudo apt update && apt upgrade

2. 安裝git

  • sudo apt install git

3. 創建目錄

  • mkdir DDNet-Server

4. 複製Github上的庫

  • git clone --recursive --depth=1 https://github.com/ddnet/ddnet

5. 安裝依賴包

  • sudo apt install build-essential cmake git libcurl4-openssl-dev libssl-dev libfreetype6-dev libglew-dev libnotify-dev libogg-dev libopus-dev libopusfile-dev libpnglite-dev libsdl2-dev libsqlite3-dev libwavpack-dev python google-mock

6. 進入 DDNet 文件夾

  • cd ddnet

7. 編譯 DDNet

  • mkdir build
  • cd build
  • cmake -DCLIENT=OFF ..
  • make -j$(nproc)

8. 伺服器,啟動!

  • ./DDNet-Server

9. 轉發伺服器端口(默認為8303)

10.使用 IP 通過客戶端連接

  • Press F1
  • connect "Server-IP"

11.遊玩

更多內容參閱 github

方法 2 (使用預編譯的二進制文件)
[展開 / 摺疊]
1. 從DDNet 下載頁面(download page)上下載二進制文件

2. 解壓到文件夾

3. 啟動伺服器

  • ./DDNet-Server

4. 轉發伺服器端口(默認為8303)

5.使用 IP 通過客戶端連接

  • Press F1
  • connect "Server-IP"

6. 遊玩

關於端口轉發可以參閱 http://portforward.com/


伺服器設置與地圖

您可以在 Teeworlds 文件夾中找到設置和地圖引導。

  • Windows系統:位於 AppData/Roaming/Teeworlds 路徑下。
  • Linux系統:(地址待定)。
  • Mac系統:(地址待定)。


伺服器配置文件

伺服器配置文件中包含了啟動伺服器時自動運行的設置和指令,例如將隨機的伺服器管理員密碼改為固定密碼。

首先進入 Teeworlds 文件夾而非 DDNet 文件夾,創建一個名為 autoexec_server.cfg 的文本文件,確保後綴完全一致。

編輯該文件可以快速增加命令,每條命令獨自佔據一行。下面給出常見命令的示例:

  • 設置管理員密碼:sv_rcon_password <密码>
  • 設置進入伺服器密碼:sv_password <密码>
  • 設置伺服器名字:sv_name <名字>
  • 在互聯網列表公開伺服器:sv_register 1
  • 允許使用作弊指令:sv_test_cmds 1


伺服器地圖

伺服器地圖保存在 Teeworlds/maps 路徑中,加載伺服器地圖可以使用伺服器命令sv_map <地图名>


另見