本地服務器
本地服務器是玩家在本地網絡(比如家庭wifi)中建立的服務器,建立服務器的玩家擁有對這個服務器的完全控制權。
使用本地服務器的原因有很多。它能夠讓你做到:
- 和朋友一起遊玩時不受別人打擾
- 遊玩官方服務器中沒有的地圖
- 用管理員指令和工具對地圖進行測試
- 以及更多!
然而,建立本地服務器仍然有許多缺點。你需要一些特殊的方法來讓你的朋友加入你的服務器,並且相比起官方服務器,其他玩家在你建立的本地服務器中會遭受更多網絡的影響。注意本地服務器只會在本地保存過圖記錄,這意味着你在本地服務器中完成地圖並不會將記錄同步到官方服務器。
建立和加入本地服務器
在新版DDNet客戶端中,建立本地服務器非常簡單。
- 找到遊戲的開始菜單
- 點擊「運行服務器」
- 一個黑底白字的命令行窗口會彈出(這可能需要一小段時間)。從這個窗口中複製rcon的密碼(也可以在遊戲路徑的autoexecserver.cfg文件中查看並設置)。
- 打開遊戲客戶端的瀏覽服務器界面,在上方選擇局域網,刷新後即可加入。
- 進入遊戲後,按f2打開服務器控制台rcon,然後輸入密碼來獲得管理員指令的使用權限。
然而,這樣建立的服務器只能夠讓處在同一局域網中的玩家加入。如果其他玩家不在你身旁,那麼想要讓他們加入就需要更多步驟。
讓本地服務器連接至公網
這一步需要你進行端口映射,其方式取決於你的路由器品牌和類型。
- 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
sv_port
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
sv_register 1
, 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.
Setting Up on Linux Server
Linux
Method 1 (Compiling server) [Show/Hide] |
1.Update the Server
2. Install git
3. Make a directory
3. Clone the repository from Github
4. Install all required dependencies
5. Go into ddnet folder
5. Compile DDNet
6. Open Server
7. forward a port to the server (default is 8303) 8. Connect via Client on the IP
9.Play More Information are available at https://github.com/ddnet/ddnet |
Method 2 (Using precompiled binaries) [Show/Hide] |
1. Download binaries from DDNet download page
2. Extract into folder 3. Open Server
4. Forward a port to the server (default is 8303) 5. Connect via Client on the IP
6. Play |
More Information about Port forwarding are available at http://portforward.com/
Server Settings and Maps
Everything settings and map-wise can be found in your Teeworlds folder.
- On Windows, you can find it in AppData/Roaming/Teeworlds.
- On Linux, you can find it in (insert location here).
- On Mac, you can find it in (insert location here).
Server Autoexecutables
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.
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.
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:
- sv_rcon_password <rcon password>
- sv_password <password to join>
- sv_name <server name>
- sv_register 1 (shows the server on the Internet tab)
- sv_test_cmds 1 (allows the use of cheat commands)
Server Maps
Server maps can be found in Teeworlds/maps. To load a map ingame, use the server command sv_map <mapname>
.
See also
- DDNet Server configuration in Arch Wiki
- https://github.com/ddnet/ddnet-maps - DDNet maps repository