Guide:Setting up a Terraria server

Setting up your computer
The first thing you need to do is to discover your IP address, in order to do that click on the start button, then click on your search bar (or run button if you are using Windows XP) and type 'cmd', press enter. It will bring up a little command window. Type 'ipconfig' and press enter. You will see a whole bunch of words and numbers but don't worry and just scroll back to the top. Under the top one which is usually 'Ethernet Adapter Local Area Connection' or 'Wireless LAN adapter Wireless Network Connection 2' if you have a wireless connection, find 'IPv4 Address' which is your computers IP address. Now there are two possibilities. If you are using a router your IP address will be 10.x.x.x, 172.16(-31).x.x or 192.168.x.x, in which case you need to follow the steps below. If your IP address is something else you can continue to Setting up the server. Write down the IP address you found. Also take note of your Default Gateway; You need this number to forward the port and this is what you have to do next. Go ahead and write these two numbers down and close the window. Now open up a browser window and type your Gateway number. It might be 192.168.0.1 / .0.2 / .1.1 / 10.10.10.10 etc. It depends on how your network is configured. You should see your router configuration login screen. Now, for most modern routers, Username is 'admin' and the password is 'admin' as well. It also might be 'password'. You can try these combinations but if it's a few years old you may have to do some digging around.

Difference between LAN IP and Internet IP

 * If you are not sure about your IP address, there are a few ways to find out.

To play over Internet:

 * One of the most simple ways is to browse a website made for checking your IP, for example WIMI (What Is My Ip).


 * Alternately, you can type IP as a search query in Google. The first result will be your IP address.

To play on LAN:

 * Your LAN IP is easy to recognise, there are three type of LAN IPs: 10.x.x.x, 172.16(-31).x.x, 192.168.x.x., where "x" is a number from 0 to 255. For example, if your IP address is 172.28.54.23 don't worry, it's a valid LAN IP address, although usually it tends to be something like 192.168.1.1.

The other players will need to know this IP address to join your server!
 * You can add your server to a Terraria Server List to get more players.
 * (If they are unable to join your server, check the Troubleshooting section below.)

Setting up a "Host&Play" server

 * This is the most simple way of creating a server. You start Terraria and in the main menu you choose "Multiplayer", then "Host&Play", select a world to play in (or create a new one, then select), enter a password (if you leave it empty, there will be no password for your server) and there you go.

Difference between dedicated and non-dedicated servers

 * There are two kind of servers: dedicated, non-dedicated. The difference is that a dedicated server should run on a separated computer, which is "dedicated" to run the game as a server. Non-dedicated servers are those which use the "Host&Play" mode of the game. There are problems with this method, for one: if you disconnect the server will stop, meaning all connected players will disconnect as well. A dedicated server will run as a separate process. Regardless of whether you are connected or not, it will continue running until you stop it. It is recommended (if you have a computer to run as the server) to make it a dedicated server so it won't matter who is in the game or not (not to mention: for a proper internet server this is a basic requirement). There is another important feature of the dedicated server: it is "not fully" running the game, meaning it doesn't need any kind of graphical interface, because it only runs as a server, so it doesn't need that much of resources nor graphical drivers (no need for XNA), and it doesn't need a strong or new computer to work as a dedicated server.

Setting up dedicated server without configuration file

 * First try setting up a server WITHOUT a configuration file. To do this search for the folder where Terraria is installed and find the "TerrariaServer.exe" then run it. A new black window has opened. This is the server control interface, you will do everything from here and it awaits us now to choose a world. If you have a "clean installation" (you just installed Terraria and did not play with it) it will have no world(s). Otherwise the first options would be the list of worlds you have and then the two command options to create a new world or to delete an existing one.



Creating world in server console

 * 1, Type "n", then ENTER.
 * To do so, you simply type "n" for the option "New World" then hit the ENTER.


 * 2, Select world size, ENTER.
 * Next you need to select the size of the world, for example choose "1" for "Small" and ENTER again (always finish command with ENTER).


 * 3, Name the world, ENTER.
 * Now you have to name the world. This name will show up when someone joins the game (for example, you choose the name "Brave New World" and when someone joins the game later he/she will see "Welcome to Brave New World!").


 * 4, It will now generate the new world then return to the world selection screen.


 * It is also possible to run the game first with "Terraria.exe", go to "Single Player", create a new world there, then exit and select it in the server console.


 * NOTE: Terraria saves all worlds as default into "C:\Users\UserName\Documents\MyGames\Terraria\Worlds". World file's names are not the same as the name of the world. Example: "world1.wld" can be named "Brave New World" but there are no signs of this in the file's appearance.

Select world in server console

 * 1, Type corresponding number, ENTER.
 * Now you select the world you want to play on, type the corresponding number of the world and ENTER.


 * 2, Set number of maximum players.
 * Decide on the number of maximum players allowed on the server (default is 8, if you simply hit ENTER without typing anything, then it will be 8).


 * 3, Set port.
 * Set server port number (default 7777, this could be very important for servers over the internet, but also for LAN servers, check Troubleshooting for more information).


 * 4, Set password.
 * Set the password of your server. This will be asked from anyone who tries to join your server. If you leave it empty and just hit ENTER, there will be no password for the server.


 * Now your server is running! Test is by starting your Terraria and connect to it (if you play on the same computer where the server is running, go to Multiplayer->Join->Select your character->Type in "localhost" or "127.0.0.1", if you are on a different computer type in the IP address of the server). It should be fine, but if not, then check the Troubleshooting section.


 * NOTE: Terraria saves all worlds as default into "C:\Users\UserName\Documents\MyGames\Terraria\Worlds". World file's names are not the same as the name of the world. Example: "world1.wld" can be named "Brave New World" but there are no signs of this in the file's appearance.

Setting up dedicated server with configuration file

 * To run a server with a pre-made configuration file you must search for your Terraria installation folder, then run "TerrariaServer.exe -config  ", where   is the configuration file.


 * How to do this:


 * 1, Use cmd or TC (TotalCommander), go to Terraria folder and type in "TerrariaServer.exe -config  " without the quotation marks, then ENTER.


 * 2, Make a shortcut of "TerrariaServer.exe", right-click on it, click on "Properties", edit the field "Target:" (originally: "<...>\TerrariaServer.exe"), type at the end, after "TerrariaServer.exe" the following: " -config  " without the quotation marks (important, leave a SPACE between the ".exe" and the "-config"). It should look like this: "<...>\TerrariServer.exe -config  " Then apply it. From now on this shortcut will start your server with the given configuration file.


 * 3, If you want to, you can make a batch file aswell, in it's function it is the same as a shortcut. First, you make a new text file (.txt), then edit it in anykind of simple editor (not Office, something like Notepad), then type in the commands like this:

@echo off cls TerrariaServer.exe -config  
 * Then save the text file (.txt) as a batch file (.bat), or save it as a text, then rename it and change its extension from ".txt" to ".bat". But in this example you will have to place the batch file in the Terraria folder to make it work and the configuration file must be in the same folder aswell. Otherwise, if you type in the full path for the "TerrariaServer.exe" and the   it will work anywhere and act as a shortcut. Example for full path:
 * "C:\Games\Terraria\TerrariaServer.exe -config D:\TerrariaCon\example.txt"
 * As you can see in this example, the configuration file doesn't need to be in the Terraria folder.


 * It is possible to run more than one server from one computer! But to do so there are three important things:
 * 1, Make sure each server uses different configuration file!
 * 2, Make sure each server uses different worlds!
 * 3, Make sure each server uses different port numbers!
 * NOTE: Recommended to make each server a separated shortcut/batch file.

Making a configuration file

 * There is an example configuration file in the Terraria folder, it looks like this if you open it in a text editor (not Office, something like Notepad):

priority=1
 * 1) this is an example config file for TerrariaServer.exe
 * 2) use the command 'TerrariaServer.exe -config serverconfig.txt' to use this configuration or run start-server.bat
 * 3) please report crashes by emailing crashlog.txt to support@terraria.org
 * 1) the following is a list of available command line parameters:
 * 1) -config 				Specifies the configuration file to use.
 * 2) -port 				Specifies the port to listen on.
 * 3) -players / -maxplayers 	Sets the max number of players
 * 4) -pass / -password 	Sets the server password
 * 5) -world 				Load a world and automatically start the server.
 * 6) -autocreate <#>				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).
 * 7) -banlist 				Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory.
 * 8) -worldname 			Sets the name of the world when using -autocreate.
 * 9) -secure					Adds addition cheat protection to the server.
 * 1) Set’s the max number of players allowed on a server. Value must be between 1 and 255
 * 2) maxplayers=8
 * 1) Load a world and automatically start the server.
 * 2) world=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\world1.wld
 * 1) Set the port number
 * 2) port=7777
 * 1) Set the server password
 * 2) password=p@55w0rd
 * 1) Set the message of the day
 * 2) motd=Please don’t cut the purple trees!
 * 1) Sets the folder where world files will be stored
 * 2) worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\
 * 1) Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
 * 2) autocreate=3
 * 1) Sets the name of the world when using autocreate
 * 2) worldname=World
 * 1) The location of the banlist. Defaults to "banlist.txt" in the working directory.
 * 2) banlist=banlist.txt
 * 1) Adds addition cheat protection.
 * 2) secure=1
 * 1) Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
 * You can see that every line starts with a "#" sign. That sign "comments-out" everything in that line if it starts with "#". Meaning that those lines have no effect at all on the server. This is useful for both commenting in the file, like:


 * 1) Set the message of the day
 * As it explains the following command. And it is also useful for turning of commands, like:


 * 1) motd=Please don’t cut the purple trees!
 * Here, the server won't have "MessageOfTheDay", because it is "commented-out". So, if you want to use a command you just need to delete the "#" from the begining of the line. You can edit this file to your liking as much as you want. Every command is explained in the file. If you are ready, you just have to save the file and use it as a configuration file.
 * It is highly recommended to leave the original configuration file, make a copy of it and edit the copy, or open the original and "Save As..." another file, with a different name.

Troubleshooting

 * There could be many reasons if something is not right. You can separate it into three groups.

"The server is not starting!"

 * This is mostly because of some typo or miss-typing. Check everything again (especially true for those who use configuration file(s)), is everything typed correctly? If it's still no good try reinstalling the game.

"Others can't connect to the server!"

 * This is usually a network related problem.
 * 1st, make sure they try to connect to the right IP address (especially true over the internet).
 * 2nd, make sure your firewall is not blocking the "TerrariaServer.exe" or the server's port ("7777" by default).
 * 3rd, make sure the others join with the correct port number (especially true, if it's not the default "7777").
 * (Over internet)4th, if you are using a router you have to make sure it opens the server's port for you. In your router you need to do this by setting up the "Port Forwarding" or "Virtual Server", usually you need to make a new record there, it will ask a port number, this is your servers port (default "7777"), it will ask for an IP address aswell, this is your LAN IP address (not the Internet IP address). Also, make sure that that the list in "Port Forwarding"/"Virtual Server" is the list of "allowed" connections, if it's not then don't make any record (if you made one, you can delete it and it means that this should not be your problem).
 * (Over internet)5th, if your IP address is dynamic (not static or reserved) it is possible for it to change over time, so check your IP address again. Also, if you are using Dynamic DNS to get around this problem, tell the other players to always type in your Domain Name to join and don't use the saved list of connections which the game offers (the game only saves the IP address, not the domain name, so if your IP has changed it won't be aware of it).

"World not saved/Items disappear from chests after closing server!"
The Terraria server only saves the world automatically at regular time intervals.

If you close the server without issuing a save/exit command via the console (or use host and play), there's a chance that the world may not have saved the last few minutes of changes. So moving gear between chests and immediately closing the server without explicitly specifying the save/exit command May actually cause those items to disappear.

To ensure this isn't an issue: Always use a dedicated server, and remember to enter the "save"/"exit" commands rather than simply closing the console window via the red close button.