Hosting a Realm
Prior Knowledge
It is expected that you have basic knowledge of hosting game servers prior to this, especially if you're making a server public. If you don't know the basics, you won't be able to get support from the Toontown Realms staff, as we simply can't tutor running servers to everyone.
Before following the below steps, you should have basic knowledge of:
- How to port forward
- Server hosting for other games or software
- Understanding IP addresses, and the dangers of sharing your public IP
- How to edit JSON files
Hosting a server is slightly different depending on your target audience.
- If you want the server to be played by people inside of your home network, it's fairly simple.
- If you want the server to be played by people outside of your home network, you'll need a lot more setup
Setting up a server
- Download the Toontown Realms dedicated server.
- If you're on Windows or Linux with a desktop environment, you can download the launcher here
- If you're on a Linux installation without a desktop environment, such as a dedicated server (or just prefer to have a script instead of using the launcher), you should use the Python Patcher for Servers script found at the very bottom of this document. When using this script, you should have this script run each time you attempt to run the server, that way it always checks for an update automatically.
- Run the server software
- You can do this by creating a .bat file on Windows or .sh file for Linux in your installation directory, and putting the following into it. (You can also simply run the following into a terminal prompt in your installation directory)
- Windows:
(Exclude the pause if just running directly from your terminal)offline.exe --dedicated pause
- Linux:
./offline --dedicated
- Configuring the server
- After you run your server for the first time, it will generate all of the configuration files. To configure most server settings, close the server, then edit the
config/server.json
file. You can find more information on each config option here.
- After you run your server for the first time, it will generate all of the configuration files. To configure most server settings, close the server, then edit the
- Connecting to the server
- If you're playing off the same machine you're running the server on, you simply use localhost as the IP in Direct Connect. This won't work for other players.
- If you are playing only with people inside your home network, everyone else will need your host machine's local IP. On Windows, this can be found by opening up the Windows Terminal, and running the command
ipconfig
. You then will find the IPv4 address that corresponds to the internet adapter you're using. That IPv4 address is what will be used by others in your home to connect through the Direct Connect button.- For example, if you're using a hardwired ethernet connection on the host, you will typically find the IPv4 address under the
Ethernet adapter Ethernet:
section. Wireless adapters will typically show the name of the manufacturer.
- For example, if you're using a hardwired ethernet connection on the host, you will typically find the IPv4 address under the
- If you're playing with people outside your home network, you will need to forward port 7198, then give your public network IP to the others.
- As stated at the beginning of this page, it is expected you have basic knowledge of server hosting if you plan on hosting one for those outside of your home network, thus this tutorial will not showcase how to port forward, since it is different for every router. If you want to learn how to do this, it's recommended you search how to do it for another game, such as Minecraft, as the steps will be the same, except using 7198 instead of 25565 for the port.
Warning for hosting Public servers
It is highly recommended that you do not attempt to host public servers using your own home network, as this brings up security issues. Giving others you don't know your IP address can lead to others using that to cause harm to your home network, such as DDOS attacks, or finding your relative location. For more information, check out The Dangers of Public IPs � NASP.
Although it may be pricy, it's definitely recommended to be using a dedicated server if you're hosting a public server.
Python Patcher for Servers
import hashlib import os import stat import sys from pathlib import Path import requests PATCHER_LINK = 'https://releases.toontownoffline.net/' if 'linux' in sys.platform: MANIFEST_FILENAME = 'linux.json' else: MANIFEST_FILENAME = 'windows.json' EXECUTABLES = ('astrond-linux', 'offline') def get_hash(_filepath: str) -> str: hasher = hashlib.md5() with open(_filepath, 'rb') as f: for chunk in iter(lambda: f.read(4096), b''): hasher.update(chunk) return hasher.hexdigest() def download_file(fileLocation: str, _fileName: str, _filePath: str, _data: dict): Path(_data['path']).mkdir(parents = True, exist_ok = True) print('Downloading {}'.format(_filePath)) r = requests.get(PATCHER_LINK + fileLocation) if r.status_code != 200: print('Failed to download file {}, aborting!'.format(_filePath)) sys.exit(1) with open(_filePath, 'wb') as _f: _f.write(r.content) if _fileName in EXECUTABLES: print('Marking {} as executable.'.format(_fileName)) st = os.stat(_filePath) os.chmod(_filePath, st.st_mode | stat.S_IEXEC) r = requests.get(PATCHER_LINK + MANIFEST_FILENAME) if r.status_code != 200: print('Failed to get mainifest! Aborting.') sys.exit(1) manifest_dict: dict = r.json() files = manifest_dict['files'] for file in files: data = files[file] fileName = file.split('/')[-1] filePath = data['path'] + '/' + fileName if data['path'] else fileName if os.path.exists(filePath): _hash = get_hash(filePath) if _hash == data['hash']: print('{} doesn\'t need to be updated. Skipping.'.format(filePath)) continue else: download_file(file, fileName, filePath, data) else: download_file(file, fileName, filePath, data) Path('astron/databases/astrondb').mkdir(parents = True, exist_ok = True) print('Everything should be ready to go!') sys.exit(0)