Guide:Setting up a Terraria server
This page is intended to guide you through configuring and running your own Terraria multiplayer server for LAN or Internet play.
- 1 On windows
- 1.1 Your IP address
- 1.2 Setting up the server
- 1.2.1 Setting up a "Host&Play" server
- 1.2.2 Setting up dedicated server without configuration file
- 1.2.3 Connect to the Server
- 1.2.4 Setting up dedicated server with configuration file
- 1.2.5 Making a configuration file
- 2 On FreeBSD
On windows[edit | edit source]
Your IP address[edit | edit source]
You'll need to give your router's global IP address to anyone you want to connect to your server over the internet, or your IPv4 address to anyone trying to connect via the network (over LAN). One server can allow both types of connections simultaneously. To find them:
Global IP:[edit | edit source]
- The fastest way to get your global IP is to google "IP". The first result will be your IP address.
- Alternately, you can use a website made for checking your IP, for example WIMI (What Is My Ip).
To play on LAN:[edit | edit source]Click the start button, then click on your search bar (or the "run" button, if you are using Windows XP) and type 'cmd', then press
x" is a number from 1 to 254. For example, 172.28.54.23 or 192.168.1.1.
Setting up the server[edit | edit source]
Setting up a "Host&Play" server[edit | edit source]
This is the simplest way of playing multiplayer. Works well for in-home LAN games. Start Terraria, and in the main menu, choose "Multiplayer" then "Host&Play". Select a world to play in (or create a new one, then select) then enter a password (or leave blank for no password). If you have trouble with this, try contacting someone more experienced with this on the official Terraria website.
Setting up dedicated server without configuration file[edit | edit source]
First, try setting up a server without a configuration file. To do this, search for the folder Terraria is installed in, find "TerrariaServer.exe", then run it. A black window with white text should have opened. This is the server control interface, where you will be doing pretty much everything (entering commands and viewing information). If you're going to be hosting a server often, it's recommended that you create a shortcut to it on your desktop. When it starts, it should ask you to choose a world. If you have a "clean installation" (you just installed Terraria and did not play it yet), it will probably have no worlds. Otherwise it will list the worlds currently available on your computer. The last two command options create a new world, or delete an existing one.
Creating and selecting world in server console[edit | edit source]
NOTE: steps 1-4 are only necessary if creating a world.
- To do so, simply type
- Select world size,
- Next you need to select the size of the world, for example choose
- Name the world,
- 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!").
- It will now generate the new world.
- Note: 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.
- Type corresponding number,
- Now you select the world you want to play on, type the corresponding number of the world and
Note: By default, Terraria saves all worlds into "C:\Users\UserName\Documents\MyGames\Terraria\Worlds". World file names do not always correspond to the name of the world. Example: a world can be named "Brave New World" but the file might be named "world1.wld", though it will start with "Brave_New_World.wld" as its name.
Choosing the other options in the console[edit | edit source]
- Set number of maximum players.
- Decide on the number of maximum players allowed on the server (default is 8, if you simply hit
- 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).
- 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
NOTE: By default, Terraria saves all worlds to "C:\Users\UserName\Documents\MyGames\Terraria\Worlds". World file names are not always the same as the name of the world. Example: "world1.wld" can be named "Brave New World".
Connect to the Server[edit | edit source]
From the Same Computer[edit | edit source]
In the Terraria game, go to Multiplayer->Join via IP->Select your character->Type in "localhost" or "127.0.0.1".
Over the Network[edit | edit source]
For other computers on your network/router, type in the 'IPv4' address of the computer you're running the server on. You'll notice when you run IP config on each computer on your network, the only number that changes under 'IPv4' is the last one. Each device (i.e. phone, iPad, Kindle, etc) connected to your network's WiFi has their own number accessing your router. The last number of the IPv4 can change for each device from time to time if your router uses "dynamic IPs". However, to connect to the Terraria server, no one will need the other computer's IP's, just the computer running the server.
Over the Internet[edit | edit source]
For friends connecting "over the internet", they'll need to enter your Global IP (meaning your router's IP), but this won't work until you set up port forwarding on your router (See below).
Note:Check the Troubleshooting section for additional tips.
Setting up dedicated server with configuration file[edit | edit source]
To run a server with a pre-made configuration file you must search for your Terraria installation folder, then run "TerrariaServer.exe -config <serverconfigfile>", where <serverconfigfile> is the configuration file.
- Use cmd, go to Terraria folder and type in "TerrariaServer.exe -config <serverconfigfile>" without the quotation marks, then
- 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 <serverconfigfile>" without the quotation marks (important, leave a SPACE between the ".exe" and the "-config"). It should look like this: "<...>\TerrariaServer.exe -config <serverconfigurationfile>" Then apply it. From now on this shortcut will start your server with the given configuration file.
- If you want to, you can make a batch file as well, in its function it's the same as a shortcut. First, you make a new text file (.txt), then edit it in any kind of simple editor (not Office, something like Notepad), then type in the commands like this:
- @echo off
- TerrariaServer.exe -config <serverconfigurationfile>
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 as well. Otherwise, if you type in the full path for the "TerrariaServer.exe" and the <serverconfigurationfile> 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:
- Make sure each server uses different configuration files!
- Make sure each server uses different worlds!
- Make sure each server uses different port numbers!
NOTE: Recommended to make each server a separated shortcut/batch file.
Making a configuration file[edit | edit source]
- 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):
#this is an example config file for TerrariaServer.exe #use the command 'TerrariaServer.exe -config serverconfig.txt' to use this configuration or run start-server.bat #please report crashes by emailing crashlog.txt to [email protected] #the following is a list of available command line parameters: #-config <config file> Specifies the configuration file to use. #-port <7777> Specifies the port to listen on. #-players <number> / -maxplayers <50> Sets the max number of players #-pass <password> / -password <password> Sets the server password #-world <world file> Load a world and automatically start the server. #-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). #-banlist <path> Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory. #-worldname <Ty> Sets the name of the world when using -autocreate. #-secure Adds addition cheat protection to the server. #Set’s the max number of players allowed on a server. Value must be between 1 and 255 #maxplayers=50 #Load a world and automatically start the server. #world=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\world1.wld #Set the port number #port=7777 #Set the server password #password= #Set the message of the day #motd=Please don’t cut the purple trees! #Sets the folder where world files will be stored #worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\ #Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large). #Create
#Sets the name of the world when using autocreate #worldname=Ty #The location of the banlist. Defaults to "banlist.txt" in the working directory. #banlist=banlist.txt #Adds addition cheat protection. #secure=1 #Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle #priority=0
- 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:
#Set the message of the day
- As it explains the following command. And it is also useful for turning off commands, like:
#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.
On FreeBSD[edit | edit source]
Surely, if you're reading this, you know what an IP is and how to setup your router/firewall/jail to have a dedicated space on your machine to put the server.
You'll need: TShock, an unofficial Terraria Server, see this: https://www.reddit.com/r/Terraria/comments/2a2gjn/how_to_run_a_dedicated_terraria_server_on_ubuntu/ and that: https://github.com/NyxStudios/TShock/releases/ .
Go to your jail, create a terraria user, then grab the last release of TShock, install screen, mono and sqlite3, unzip Tshock into terraria's homedir. Run this command once to initialize everything properly: (see https://www.reddit.com/r/Terraria/comments/2a2gjn/how_to_run_a_dedicated_terraria_server_on_ubuntu/cir0qna for details about the command)
mono --server --gc=sgen -O=all TerrariaServer.exe
Generate a world and quit (^C)
Once you generated your world, add the following code to /usr/local/etc/rc.d/terraria (available here: http://ix.io/iHD ) (don't know how to put the code here), and edit it according to your liking.
Edit your jail's rc.conf or whatever, terraria_enable="YES", restart the jail, and VOILÀ!
Feel free to ping moviuro @freenode (IRC) if you can successfully port these tips to Debian (rc.d is pretty similar to Debian's init AFAIK)
Server lists[edit | edit source]
Once your Internet server is running properly, consider posting it to one of the public server lists, so Internet users can find it and join:
- Official Terraria forum server list
- Fansite server list
- Terraria Server List
- TServerWeb - Terraria Server List and Server Manager
- Terraria Connect
Troubleshooting[edit | edit source]
- There could be many reasons if something is not right. You can usually separate it into three groups.
"The server is not starting!"[edit | edit source]
- This is mostly because of some typo or mistyping. 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!"[edit | edit source]
- This is usually a network related problem.
- 1st, make sure they try to connect to the right IP address. This is the server computer's IP address (IPv4) for networked computers, or the router's Global IP address for over the internet players.
- 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").
- 4th, (over internet) 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 as well, 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).
- 5th, (over internet) 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!!"[edit | edit source]
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 if you 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.
Note: The above can also be used as an exploit if you wanted to duplicate items without 3rd party software (but let's be honest, it's still cheating). This works because the character file and world file are independent of each other, and when running a server, it doesn't save the world when you exit with a character. All you do is run the server with the world that contains the items you want duplicated. Load up Terraria, pick the character you want to use, and connect to your server. Raid the world of all the items you want, then save and exit. This writes over your character file with the added items, but since you're running the world via a server, it won't write over the world file when you exit with your character. You can then alt-tab out to the the server console, and type 'exit-nosave'. This will close the world without saving, and will revert your world back to the way it was before you raided it with your character. Then just restart the server on the same world, with the same character and viola! Be aware of the game time when you're doing this. A server automatically saves the world at specific intervals (I think it's at 4:30am game time). The server console says when it's saving, so you'll know if you're good to go. But...it's still cheating.