This document describes how to set up a local RTK server on a PC running Windows 10 and using VirtualBox 6.1.8. Any deviations from that setup may result in procedural discrepancies.
- Download Ubuntu Server 16.04 (32-bit)
- Download and install VirtualBox
- This document is based on VirtualBox 6.1.8
- Open
VirtualBoxand click theNewbutton to create a new virtual machine (VM)- Name: RTK
- Machine Folder: Your choice
- Type: Linux
- Version: Ubuntu (32-bit)
- Memory size: Your choice
- Create a virtual hard disk now
- VDI (VirtualBox Disk Image)
- Dynamically allocated
- File location: Your choice
- File size: Your choice
- Double-click on your new VM to start it
- On the
Select start-up diskdialog, click theChoose a virtual optical disk file...button- Click the
Addbutton and select theUbuntu Server 16.04image that you downloaded in the first step - Click
Chooseand thenStart - The VM will automatically boot into the
Ubuntu Serversetup
- Click the
- Choose your preferred language and then select
Install Ubuntu Server - Choose your language again, then your location, and then your keyboard layout
- Enter
rtkas theHostname - Enter
gmas theFull name for the new user - Enter
gmagain as theUsername for your account - Enter and confirm any
passwordof your choosing - Choose
<No>when asked about encrypting your home directory - Confirm or adjust your time zone
- Choose
Guided - use entire disk and set up LVMfor yourPartitioning method - Select the virtual optical disk that you created earlier for
Select disk to partition(should be the only option) - Choose
<Yes>forWrite the changes to disks and configure LVM? - Use the entire disk for
Amount of volume group to use for guided partitioning(should be the default option) - Choose
<Yes>forWrite the changes to disks? - Leave
HTTP proxy informationblank - Choose
No automatic updates <Continue>with the default selections forChoose software to install- Choose
<Yes>forInstall the GRUB boot loader Finish the installation:- The installation media should have been removed automatically
- In the
VirtualBoxmenu bar, ifDevices→Optical drives→Remove disk from virtual driveis not grayed out, select it to manually remove the media - Choose
<Continue> - After installation completes, the VM will automatically boot up and eventually prompt you for
rtk login:
- Login as
gmusing the password that you set during the previous setup - At the
gm@rtk:~$prompt, entersudo apt update- You will be asked for your password again since this is your first
sudocommand
- You will be asked for your password again since this is your first
- Enter
sudo apt upgradeand thenyto confirm - Enter
sudo apt-get install build-essential make mysql-server libmysqlclient20 libmysqlclient-dev lua5.1 liblua5.1 liblua5.1-devand thenyto confirm- Enter and confirm any password of your choosing for the
MySQL "root" userwhen prompted
- Enter and confirm any password of your choosing for the
- In the
VirtualBoxmenu bar, selectMachine→ACPI Shutdownto turn off your VM
- Use this guide to set up a shared folder between your
Host(i.e. Windows) andGuest(i.e. VM), but note the following caveats:- Ignore any discrepancies in the prerequisites; it will still work
- Select the top-level folder of your copy of the RTK repository for the
Folder Path - On the
Add Sharedialog, usertkfor theFolder Nameinstead ofshared - The guide includes a few redundant commands; these are harmless, so just follow the instructions and ignore any console output about not being able to do something because it was already done
- Be sure to use
rtkinstead ofsharedon any commands that reference theFolder Name- e.g.
sudo mount -t vboxsf rtk ~/shared - e.g.
rtk /home/gm/shared vboxsf defaults 0 0(separated by tabs)
- e.g.
- Ignore the
Bonussection
- In the
VirtualBoxmenu bar, selectMachine→ACPI Shutdownto turn off your VM
- Open
VirtualBox, select your VM, click theSettingsbutton, and select theNetworktab- Switch to the
Adapter 2tab, selectHost-only Adapterin theAttached todropdown and clickOK
- Switch to the
- Click the
Toolsbutton, and you should see an entry namedVirtual Box Host-Only Ethernet Adapter- Ensure that the
Enablecheckbox underDHCP Serveris checked - Make note of the IP address under
IPv4 Address/Mask
- Ensure that the
- Boot up your VM
- After logging in, enter
ip addr- Find the name of interface that does not have any sort of IP address listed (by default, this will be
enp0s8)
- Find the name of interface that does not have any sort of IP address listed (by default, this will be
- Enter
sudo nano /etc/network/interfacesand add the following lines to the end of the file:allow-hotplug enp0s8iface enp0s8 inet dhcp
- Press
Ctrl+x, theny, thenEnterto save your changesVirtualBoxremaps the rightCtrlkey by default, so use the leftCtrlkey
- Reboot your VM using
sudo shutdown -r now - After logging back in, enter
ip addr | grep 'inet[^6]'- One of the resulting lines should contain an IP address that matches the first three numbers of the IP address from step 5.2
- This is the IP address that will be used to connect to your RTK server, so make note of it
- If you don't see it in the results, try Troubleshooting Common Issues
- In Windows, use any text editor to open the
/rtk/conf/map.conffile from your copy of the RTK repository - Edit the values for
map_ipandloginipto use the IP address obtained in step 5.8- e.g.
map_ip: 192.168.56.101 - e.g.
loginip: 192.168.56.101
- e.g.
- Save the file, and the update will automatically sync to your VM via the shared folder configured in step 4
- Back on the VM, use the mysql_config_editor to set up an encrypted login path so that you can securely execute database migration scripts without manually entering your password:
mysql_config_editor set --login-path=migrate --host=localhost --user=root --password- When prompted for a password, enter the
rootMySQL password that you set in step 3.4
- Now you can automatically create and configure the
RTKdatabase using database migration scripts:~/shared/database/migrate.sh- Re-run this command any time a new script is added to the repository
- Navigate to the
rtksubfolder of your shared folder:cd ~/shared/rtk
- Build all servers:
make all
- Start each server:
./login-server &./char-server &- Wait for it to confirm connection to the login server
./map-server &- This one takes a while, but wait for it to confirm connection to the char server
- The servers can be stopped using
./shutdown-mithia-serverswhenever you are finished or need to reboot them
Note: You must rebuild the servers any time you make changes to the C code.
- On Windows, press
Windows key+rand entershell:programfilesx86 - Copy the included
/client/RetroTKfolder to the directory that was opened by the previous step - Create a shortcut to the copy of
RetroTK.exefor your desktop or any other desired location - Run the included
/client/WHE.exewith administrator privileges and create the following entry:- Name of hosts to add: tk0.retrotk.com
- IP address: The IP address found in step 5.8
- Run
RetroTK.exeto play
- Create a character via the normal in-game process
- Log out of the new character
- On the server, login to MySQL and promote the new character to a GM:
/usr/bin/mysql -u root -pUSE RTK;UPDATE `Character` SET `ChaGMLevel` = '99' WHERE `ChaName` = '[Your character's name goes here]';exit
- Log back in
Note: GM characters do not always cause the same in-game behavior as a normal character. For example, mobs may not spawn if the GM is in stealth mode (which it will be by default). So if you notice strange behavior, it might just be that you need to change the settings on your GM or use a non-GM character instead.
You may have noticed that item tooltips are missing. Item meta data is loaded only once at login, so use a GM to reload that data, and then log out and back in. GM commands are performed by "speaking" them in-game like any other regular chat. The GM commands for this are:
/reloadItem/metan
Note: You must reload item meta data any time you make changes to items in the database.
- Set up another encrypted login path so that you can run
mysqldumpcommands securely without manually entering your password:mysql_config_editor set --login-path=mysqldump --host=localhost --user=root --password- When prompted, enter the password for your
rootMySQL user
- Use cron to regularly execute a script that creates a full backup of your database:
crontab -e- Add the line
*/5 * * * * ~/shared/database/backup.shto the end of your crontab file - Save and exit
- Cron will now automatically backup your entire database to
/database/history/every 5 minutes- You may change the schedule by editing the cron expression
backup.shkeeps the latest 72 backups (i.e. six hours) by default
Note: This only backs up the database to your VM server (and your Windows PC via the shared folder). You would still lose everything if you lost your PC, so consider also using a cloud service (e.g. Dropbox) or some other backup method for the mysqldump files.
If you want to use database management software to connect to the MySQL database on your VM server from Windows (as opposed to always using the Ubuntu terminal as in step 10.3), perform the following steps:
- On your VM, allow remote connections to MySQL from any IP address:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf- Comment out the line that starts with
bind-address(i.e. add a#at the start of that line) Ctrl+x, theny, thenEnterto save your changes
- Log into MySQL:
/usr/bin/mysql -u root -p
- Create a root user that can login from your Host PC:
CREATE USER 'root'@'192.168.56.1' IDENTIFIED BY '[any password of your choosing]';GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.56.1';FLUSH PRIVILEGES;
- Now on Windows, download and install the database management software of your choosing
- Navicat is the one I see recommended most often, but it's like $300 for a license
- DBeaver is great free alternative, but the UI is less intuitive and might be confusing for inexperienced users
- Table Plus is another free option that is more limited but might therefore be less intimidating
- Open your database manager and connect to the database using the IP address of your VM. This will look different depending on which software you installed, but here are the main things you are likely to need to know:
- Host/Socket: The IP address of your VM (e.g.
192.168.56.101) - Port: 3306
- User: root
- Password: MySQL
rootpassword from step 3.4 - Database: RTK
- Host/Socket: The IP address of your VM (e.g.
- Use
Shift+PgUpandPgDownto scroll up and down in the Ubuntu Server terminal - MySQL Cheat Sheet