Server/yue

泰拉瑞亞伺服器提供玩家一個透過網絡去同其他玩家玩Multiplayer/yue嘅平台. 泰拉瑞亞嘅Windows版已經有埋伺服器軟件喺入面. 如果喺Linux上面行伺服器嘅話，就一定要喺下載區下載伺服器文件. 伺服器亦都可以淨係用嚟玩單人遊戲，咁樣你就可以調整遊戲入面嘅Time/yue.

開伺服器之前要注意嘅嘢
泰拉瑞亞伺服器預設係喺TCP端口7777度行. 如果你嘅網絡環境係用緊NAT嘅話（例如普通家庭用戶），個端口一定要進行端口映射先可以比其他玩家加入. 如果進行唔到端口映射啲話，可以揀用一啲VPN服務，譬如話Hamachi或者Radmin VPN嚟代替（雖然如果用上面呢啲服務嘅話，每一個玩家都要安裝VPN軟件）. 泰拉瑞亞伺服器預設最大玩家數係八個人（1.4.0.1嘅時候係十六個人），但係依樣嘢可以喺伺服器初始化嘅時候或者喺伺服器設定文件「serverconfig.txt」入面改. 唔係用緊NAT嘅網絡環境（例如商業用戶或者數據中心用戶）通常唔使進行端口映射，但係仍然需要畀玩家穿過防火牆.

如果將伺服器行喺雲端服務供應商上面例如AWS或者GCP嘅話，就要確保TCP同埋UDP嘅端口7777係開放咗畀人連接入去嘅.

公共伺服器
伺服器可以喺下面嗰個伺服器列表度搵到:

加入伺服器
想加入伺服器，玩家要喺主畫面度揀多人遊戲選項，然後揀角色，再輸入埋伺服器嘅IP同埋端口. 通常唔同嘅伺服器都對玩家有唔同嘅要求. 例如有啲伺服器會要求玩家用Difficulty/yue或者Difficulty/yue嘅角色嚟玩，另外有啲會要求玩家去到一定嘅等級先可以加入. 通常一個公共伺服器會有註冊（/register）同登錄（/login）系統，而玩家必須有一個角色擁有一個獨一無二嘅名同埋密碼.

公共伺服器通常係由一班會去維蔎規則嘅管理者去運行. 呢啲規則一般會係禁止使用模組或者作弊軟件，禁止冒充身分，同埋諸如此類嘅嘢. 不過亦都有啲伺服器會俾玩家用佢哋單人遊戲入面嘅角色帶埋身上面嘅嘢入去伺服器入面.

你最近玩過嘅伺服器列表會保存喺多人遊戲入面嘅「透過IP加入」選項入面.

開服指引 (Windows)
之後玩家就可以喺遊戲菜單入面嘅多人遊戲選項加入伺服器.
 * 32位元Window到嘅TerrariaServer.exe預設可以喺 搵到.
 * 而喺64位元Window到嘅嗰個程式可以喺 搵到.
 * 如果你冇Steam嘅話，就會喺 搵到.
 * 如果你用GOG嘅話，就會喺 搵到.

事前準備
首先我哋要準備一啲必要嘅工具去開啟我哋嘅伺服器， 呢啲通常已經預先安裝咗喺個系統入面.

以Debian為基底系統，要執行

開啟伺服器

 * 1) 去下載區入面攞最新下載嘅連結， 然後用  去下載.
 * 2) 用  呢條指令去解壓縮檔案.
 * 3) 用  入去你啱啱解壓縮咗嘅檔案夾入邊. 要注意1.4.1.2版本嘅檔案夾名稱係'1412'，而將來嘅版本係會唔同嘅.
 * 4) 用 進入Linux資料夾.
 * 5) 用 加一個執行許可畀伺服器二進制文件.
 * 6) 用  開啟伺服器.  要注意64位元版本係TerrariaServer.bin.x86_64，而32位元版本係TerrariaServer.bin.x86.
 * 7) 擺你個世界嘅檔案夾喺   而令到個伺服器可以讀取到你個世界.

背景入面運行伺服器
Tmux 係一個現代嘅終端服用器類軟體，具備左畀多過虛擬命令行終端同時運行嘅能力. 我哋會用佢喺背景入面運行我哋嘅伺服器.


 * 1) 用 開啟Tmux.
 * 2) 喺Tmux入面執行 嚟開啟伺服器.
 * 3) 而家伺服器應該好似平時咁運行緊.  要將伺服器程式由Tmux分離獨立咁運行要使用以下組合鍵 d.
 * 4) 你而家應該要返返去前一個命令行終端.  用 可以睇到伺服器程式喺背景入面運行.
 * 5) 要重新合併返嗰個伺服器程式去到主要終端進行修改或者停止嘅話,只要執行 就可以.

注意事項

 * 有啲時候我哋要用 將變數「Term」輸出.

開服指引(RPI / 其他系統)
如果你用緊嘅作業系統冇一個預先建構咗嘅執行檔(例如樹莓派OS(之前係叫Raspbian)或者FreeBSD)嘅話，你可以用mono嚟開伺服器. 如果你想用一啲唔係行緊x86架構我嘅裝置例如樹莓派嚟開伺服器嘅話，上面講嘅方法就會好有用.

事前準備
注意：如果你用緊一個唔係x86架構嘅以Linux為基底嘅作業系統(例如樹莓派OS)嘅話，去到 為止，啲指引都同呢度一樣. 如果mono或者其他需要嘅庫（例如sqlite或者screen）冇預先安裝咗係個系統入面嘅話，你亦都需要自己去安裝.

開啟伺服器

 * 1) 下載 同埋取出啱你系統配置嘅泰拉瑞亞檔案(用樹莓派嘅人就跟住呢度去做).
 * 2) 進入Linux資料夾.
 * 3) 用 開啟伺服器.

個伺服器應該會好似預期咁行緊.

排解疑難
如果你遇到一個錯誤係同你講「Your mono runtime and class libraries are out of sync.」嘅話，就要去到泰拉瑞亞嘅資料夾入面剷走monoconfig、mscorlib.dll同埋其他以「Mono」或者「System」開頭嘅檔案. 喺Linux上面嘅命令例子: rm System* rm Mono* rm monoconfig rm mscorlib.dll

WindowsBase.dll 同埋 FNA.dll 應該喺檔案夾入面係唯二嘅.dll檔案.

注意：呢個程序亦都會剷走曬任何以「Mono」或者「System」開頭嘅無關檔案!

下載
泰拉瑞亞通常安裝包已經包括咗泰拉瑞亞伺服器軟件(喺上面可以見到)，但同時亦都可以下載取得:
 * 泰拉瑞亞伺服器 1.3.3.3
 * 泰拉瑞亞伺服器 1.3.4.4
 * 泰拉瑞亞伺服器 1.3.5.3
 * 泰拉瑞亞伺服器 1.4.0.1
 * 泰拉瑞亞伺服器 1.4.0.2
 * 泰拉瑞亞伺服器 1.4.0.3
 * 泰拉瑞亞伺服器 1.4.0.4
 * 泰拉瑞亞伺服器 1.4.0.5
 * 泰拉瑞亞伺服器 1.4.1
 * 泰拉瑞亞伺服器 1.4.1.1
 * 泰拉瑞亞伺服器 1.4.1.2

專有伺服器圖形介面(Dedicated Server GUI)係一個提供圖形操控比原版伺服器嘅第三方插件(原版伺服器本身係一個命令行軟件):
 * Dedicated Server GUI.

Tshock 同埋 TDSM 提供咗額外功能例如遊戲內部指令、白名單、玩家密碼同埋用嚟增加內容嘅插件介面(例如factions)比原版伺服器嘅第三方插件.
 * Tshock
 * TDSM (最新版本 1.3.2.1; 已停止更新)

Server files
The server consists of three files:
 * TerrariaServer.exe - The main server file. Can be run stand-alone.
 * serverconfig.txt - The server config files. Defines all parameters for the server (see below).
 * start-server.bat - A Windows Batch file which starts the server using the serverconfig.txt file. Also contains a loopback to restart the server if it should crash.
 * start-server-steam-friends.bat - functions as "Host & Play" would, but through the console. steam friends will be able to join your game through this.

List of console commands
Once a dedicated server is running, the following commands can be run:
 * - Displays a list of commands.
 * - Shows the list of players. This can be used in-game by typing /playing into the chat.
 * - Clear the console window.
 * - Shutdown the server and save.
 * - Shutdown the server without saving.
 * - Save the game world.
 * - Kicks a player from the server.
 * - Bans a player from the server.
 * - Show password.
 * - Change password.
 * - Print version number.
 * - Display game time.
 * - Print the listening port.
 * - Print the max number of players.
 * - Send a message to all players. They will see the message in yellow prefixed with   in the chat.
 * - Print MOTD.
 * - Change MOTD.
 * - Change time to dawn (4:30 AM).
 * - Change time to noon (12:00 PM).
 * - Change time to dusk (7:30 PM).
 * - Change time to midnight (12:00 AM).
 * - Settle all water.

Note that a forward-slash is not required to precede the command, as some command interfaces require. For a list of Tshock commands, refer to the TShock readme.

Command line parameters
The following is a list of parameters that can be entered when running TerrariaServer initially:
 * - Specifies a configuration file to use (see Server config file below).
 * - Specifies the port to listen on.
 * - Sets the max number of players.
 * - Sets the server password.
 * - Set the server motto of the day text.
 * - Load a world and automatically start the server.
 * - Creates a world if none is found in the path specified by -world. World size is specified by: 1(small), 2(medium), and 3(large).
 * - Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory.
 * - Sets the name of the world when using -autocreate.
 * - Adds additional cheat protection to the server.
 * - Disables automatic universal plug and play.
 * - Enables Steam support.
 * - Allows only friends to join the server or sets it to private if Steam is enabled.
 * - Sets the IP address for the server to listen on
 * - Sets the process priority for this task. If this is used the "priority" setting below will be ignored.
 * - Disables the text announcements Announcement Box makes when pulsed from wire.
 * - Sets the announcement box text messaging range in pixels, -1 for serverwide announcements.
 * - Specifies the world seed when using -autocreate

Server config file
It is possible to start the dedicated server using a configuration file that enters the above parameters automatically. The config file must be called using the -config parameter. The file can have any name, but must be in the same folder as TerrariaServer.exe. If a server config file is defined and the file is not located during the server boot, then the server will ask the user to input the parameters as it would if run without a defined config file.

The following is a list of available config commands:
 * - Load a world and automatically start the server.
 * - Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
 * - Sets the world seed when using autocreate
 * - Sets the name of the world when using autocreate
 * - Sets world difficulty when using -autocreate. Options: 0(normal), 1(expert), 2(master), 3(journey)
 * - Sets the max number of players allowed on a server. Value must be between 1 and 255
 * - Set the port number
 * - Set the server password
 * - Set the message of the day
 * - Sets the folder where world files will be stored
 * - The location of the banlist. Defaults to "banlist.txt" in the working directory.
 * - Adds additional cheat protection.
 * - Sets the server language from its language code. Available codes:
 * = English
 * = German
 * = Italian
 * = French
 * = Spanish
 * = Russian
 * = Chinese
 * = Portuguese
 * = Polish
 * - Automatically forward ports with uPNP.
 * - Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.
 * - Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
 * Journey Mode power permissions for every individual power. 0: Locked for everyone, 1: Can only be changed by host, 2: Can be changed by everyone

Comment lines can be included using the hash symbol (#). Lines that begin with # will be skipped entirely.

Banning and un-banning
The command  will ban the indicated player from the server. A banned player, when they try to login, will be displayed the message:You are banned for [duration]: [reason]- [modname]. A banned player may then be un-banned by editing the file "banlist.txt," which is located in the Terraria folder. This document contains a list of all currently banned players. To un-ban a player, delete the player's name and IP address from the list.

System requirements

 * Windows Operating System
 * 500 MB free RAM for a small world (RAM depends on world size and number of players)
 * .NET Framework 4.0
 * XNA Framework

An easy method of installing .NET and XNA is to simply install the Terraria client, which should install both as part of its regular installation.

LAN
Below are instructions for a very basic LAN party setup. At the very least, all computers must be connected to the same network for this to work. If you feel so inclined, you can set the server to have a static LAN IP address, but that's not really necessary. Note that these instructions are targeted at people who have little to no networking experience, and just want to play games.
 * 1) Make sure that all computers are connected to the same network
 * 2) * Connect the computers to the network via ethernet if possible, since ethernet is almost always faster than wireless.
 * 3) * If you have a regular home router and want to connect many players, you can connect more computers to the network via ethernet by use of a switch. Simply plug any port of the switch into the router, and plug the rest of the computers (and the server) into the switch. If you don't have a switch, try to at least connect the computer running the server to the network via ethernet. If you can't do that, just make sure all computers are connected to the same wifi connection and it will probably work, just a bit more slowly.
 * 4) Get server information
 * 5) * First, make sure that the server is connected to the internet, or at least connected to your router. To test router connectivity, you can try logging into your router via web panel. Usually the router login information is printed on a sticker on the back of the router. If the page loads, great - just make sure the other computers are connected to the same network.
 * 6) * Windows:
 * 7) ** Open Command Prompt and run "ipconfig" to get information about your network. Record the IP address that appears after "IPV4 Address......" It should be something like 192.168.1.27, 172.16.0.55 10.0.0.42. This is the IP address you will use for joining on terraria. If the IP address starts with 127, look for one that doesn't. If it starts with 169, you're doing something wrong.
 * 8) *MacOS:
 * 9) **Open System Preferences > Network and record the IP Address. See above for what the IP should look like.
 * 10) *GNU/Linux:
 * 11) **Run "ifconfig" or "ip a" from a terminal window to get your local IP. See above for what the IP should look like.
 * 12) Connect the clients to the server
 * 13) * Open Terraria, click multiplayer, and connect to the IP address that you recorded from the second step.
 * 14) * You should be connected to the server!
 * 15) Troubleshooting (if something doesn't work)
 * 16) * Make sure that the firewall on the computer running the server is disabled, or at least allows traffic through on port 7777. Be sure to re-enable the firewall once again when you have the chance.
 * 17) * If your local IP address does start with 169, you should check your network settings to get connected to the internet.
 * 18) * The IP of the server may change, especially if the router restarts. If you are unable to connect to the server, go through step 2 once again to see if the IP has changed.
 * 19) ** If this becomes a recurring problem, you should look up "setting a static IP on (OS Name)", where OS Name is the name of the server's operating system.
 * 20) *If you set the port of the Terraria server to something other than the default of 7777, make sure that the clients are connecting to whatever port the server is configured to use.

History
Serveur 服务器