Running your own server

From Open RuneScape Classic Wiki
Jump to: navigation, search

Known Gotchas

- MySQL 5.7 and below (released 2015) lacks the ability to use if exists within SQL queries. Version 8, released in 2018, contains this and works fine. Same with MariaDB. If you do not use current versions of MySQL or MariaDB, importing the game server SQL database will result in an error.

- The server must be running when the client is launched as the client needs to download the config from the server to configure what features it should use. Right now it does not retry if it cannot immediately connect to the game server and will crash if one is not available.

- New installs with Docker require this set, otherwise Ubuntu's UFW can't block Docker MariaDB containers from external communication and thus bruteforce attempts:

       sudo nano /etc/default/docker

- If manually importing database .SQL files, ensure that the players.sql file is imported first, then the server.sql file. The reason being is that the server.sql file acts as an upgrade to any player data related tables.

- The YAML parser for connection.conf uses # for inline comments. If a SQL connection password includes that character, it will not work properly.

Apache Ant is used to compile the Java files.

To set a user as an administrator, update the openrsc_players table entry for the desired player and set group_id = 0. To return them to a regular player, set them to group_id = 10.

Connecting the client to the game server

The game client reads the contents of Cache/ip.txt and Cache/port.txt to determine what game server to connect to and fetch the configuration from.

PC game launcher and updater function

The PC launcher always replaces the contents of the Cache folder with the official website versions that it is configured to connect to if they do not match. The PC Launcher module relies on multiple things, such as checking a file on GitLab for the launcher version, Cache folder and md5 generated text files within in the website downloads folder that a shell script is used under Deployment_Scripts to write, and will overwrite the contents of the locally downloaded Cache/ip.txt and Cache/port.txt at every launch when it checks for a md5 comparison and downloads. A better design would to not fetch the ip.txt and port.txt at all, exclude them from the md5 check, and generate them if they do not exist on PC Launcher button press instead.

Running a single game server

Simply copy a desired premade server/*.conf file, edit as desired, then rename it as local.conf. If local.conf exists, that file will always override default.conf. No edits to build.xml are needed for normal operation.

It is possible to execute multiple game servers within the same system process by editing server/build.xml

       <target name="runserver">
       <java classname="com.openrsc.server.Server" fork="true">
           <arg value="default.conf"/>


       <target name="runserver">
       <java classname="com.openrsc.server.Server" fork="true">
           <arg value="openrsc.conf"/>
           <arg value="rsccabbage.conf"/>

For some reason, ordering rsccabbage.conf before openrsc.conf results in errors from experience. Note: delete local.conf before trying to use multiple presets at once or it will conflict.

Setting the stage of a quest ID in the database to -1 will mark it as complete for the player.

Editing the database for a logged in player will result in it not saving as when they log out, it will be overwritten.

Several config parameters to be aware of

Prevents login to server unless client Config has

       public static final int CLIENT_VERSION = 4;


       <entry key = "client_version">4</entry>

Client has this but it may not affect anything since client doesn't download cache updates inside it anymore

       private static final int CACHE_VERSION = 4;

Only on android does this matter but I like both android and pc client Config to be near-identical

       public static final int ANDROID_CLIENT_VERSION = 45;

web server /downloads/android_version.txt


android client version triggers prompt to download and install updated APK

Launcher Constants determines if the launcher jar should be entirely re-downloaded

       public static final Double VERSION_NUMBER = 20190713.203000;

Production game server crontab

0 */1 * * * make -C /opt/Game backup db=openrsc 0 */1 * * * make -C /opt/Game backup db=cabbage 0 */24 * * * make -C /opt/Game backup db=wiki 0 23 * * * make -C /opt/Game clear-backups days=7 1 */1 * * * cp -Rf /opt/Game/server/avatars /opt/Website && chmod -R 777 /opt/Website/avatars

  • /30 * * * * python3 /opt/cloudflare-ddns/ -z

@reboot make -C /opt/Website restart @reboot make -C /opt/Game restart @reboot make -C /opt/Game run-server

Cloudflare dynamic DNS python script configuration

       sudo nano /opt/cloudflare-ddns/zones/
       %YAML 1.1
       # Cloudflare DDNS example configuration
       # Your Cloudflare email address
       cf_email: '[email protected]'
       # Your Cloudflare API key
       cf_api_key: REMOVED
       # Cloudflare zone name
       # If you're updating '' set this to ''
       # List of records
       # If you're updating '' record, set its name to '@'.
       # Only write the subdomain ('ddns' for '')
           - '@':
               type: A
               proxied: false
               log: ERROR
           - '@':
               type: AAAA
               proxid: false
               log: ERROR
       # This is the method used to discover the server's IP address
       cf_resolving_method: 'http'

Building and running in a dev environment

An IntelliJ IDEA project has been included in the Game repository folder for the server, client, and launcher. Similarly, an Android Studio project has been included for the Android client.

One option for compiling and running the server and client is to use the Apache Ant build.xml files under each folder directory. Alternatively, more quick options can be set up in the IntelliJ IDEA as shown below.

Run/Debug configurations

Server configuration

Client configuration

Anonymizing player data for database sharing

If during the process of development, it is desired to share the database with developers for testing purposes, the following SQL queries are suggested for anonymizing all player data to ensure privacy and security in the event the database is shared externally. The password hash and salt combination result in all players having the password "test".

       TRUNCATE `chat_logs`;
       TRUNCATE `droplogs`;
       TRUNCATE `expired_auctions`;
       TRUNCATE `friends`;
       TRUNCATE `ignores`;
       TRUNCATE `live_feeds`;
       TRUNCATE `logins`;
       TRUNCATE `game_reports`;
       TRUNCATE `player_change_recovery`;
       TRUNCATE `player_contact_details`;
       TRUNCATE `player_recovery`;
       TRUNCATE `player_security_changes`;
       TRUNCATE `private_message_logs`;
       TRUNCATE `recovery_attempts`;
       TRUNCATE `recovery_questions`;
       TRUNCATE `staff_logs`;
       TRUNCATE `trade_logs`;
       TRUNCATE `generic_logs`;
       TRUNCATE `npckills`;
       UPDATE `openrsc_players` set pass = '$2y$10$PxPZ.MWFY2S/qpbHGOAOZO6BwHdMbLOKO.gcLAqW.jg..2uglneL6';
       UPDATE `openrsc_players` set salt = 'JaQbN"a5J%OL7"K!I3Zy£#I;G}cKaT';
       UPDATE `openrsc_players` set email = ;
       UPDATE `openrsc_players` set creation_date = '0';
       UPDATE `openrsc_players` set login_ip = '0';
       UPDATE `openrsc_players` SET `creation_date` = '1587918361', `login_date` = '1587918361'

Need more help?

Contact developers on Discord in #diy-server-hosting