====== Information ======
* 2004Scape Server ((https://github.com/2004Scape/Server))
* ''main'' Branch ((https://github.com/2004Scape/Server/tree/main))
* These notes provide a local singleplayer server for 2004Scape ((RSPS/RuneScape Private Server based on cache ''225'' from May 18th, 2004, [[https://github.com/2004scape/Server?tab=readme-ov-file#2004scape-server---may-18-2004|more info]])) on Linux
===== Media =====
* [[https://www.youtube.com/watch?v=E21y7rLZaNc|Desktop Launcher Presentation Video]]
===== Resources =====
* [[https://www.2004scape.org/img/rs2/worldmap/worldmap2.jpg|World Map]]
==== Web ====
* [[https://github.com/2004scape/Server/wiki/Feature-Complete-Progress|Feature Complete Progress]]
* [[https://github.com/orgs/2004Scape/projects/3|Progress - Quests]]
* [[https://github.com/orgs/2004Scape/projects?query=is%3Aopen|Projects List]]
* [[https://rune-server.org/threads/lost-city-225-emulation.701698/|Rune-Server Forums]]
* [[https://rune-server.org/threads/lost-city-225-emulation.701698/page-4#post-5805881|Info post]] (Jul 3, 2024)
===== Prerequisites =====
* [[linux;distros;fedora_workstation_gnome|Fedora Workstation]]
====== Dependencies ======
* https://github.com/2004Scape/Server?tab=readme-ov-file#environment-dependencies
sudo dnf install git-core nodejs-npm java-latest-openjdk-headless
===== Latest Java =====
sudo update-alternatives --config 'java'
ls -la '/etc/alternatives/java'
java --version
====== Download Source ======
****
cd ~ && mkdir -p ~/'Projects' && rm -Rf ~/'Projects/2004Scape-Server/src' && git clone --branch 'main' --depth '1' --recurse-submodules 'https://github.com/2004Scape/Server.git' ~/'Projects/2004Scape-Server/src' && sync
===== World Map =====
* https://www.2004scape.org/img/rs2/worldmap/worldmap2.jpg
rm -f '/tmp/2004Scape-worldmap2.jpg' && mkdir -p ~/'Projects/2004Scape-Server/ext' && wget -O '/tmp/2004Scape-worldmap2.jpg' 'https://www.2004scape.org/img/rs2/worldmap/worldmap2.jpg' && mv -f -v --context '/tmp/2004Scape-worldmap2.jpg' ~/'Projects/2004Scape-Server/ext/worldmap2.jpg'
====== Settings ======
* https://github.com/2004Scape/Server/blob/main/.env.example
* 2024/11/01: ''NODE_PORT=44594'' seems like an easy fix to simultaneously-host [[servers:linux:games:2009scape_localhost|2009Scape]]
nano ~/'Projects/2004Scape-Server/src/.env'
WEB_PORT=8888
NODE_PORT=44594
NODE_PRODUCTION=false
NODE_ALLOW_CHEATS=false
NODE_DEBUG=false
NODE_STAFF=Test
====== Scripts ======
===== Server Start =====
* [[#desktop_launcher|Desktop Action Server]]
mkdir -p ~/'Projects/2004Scape-Server/scripts' && nano ~/'Projects/2004Scape-Server/scripts/localhost-server-start.sh' && chmod +x ~/'Projects/2004Scape-Server/scripts/localhost-server-start.sh'
#!/bin/bash
cd ~/'Projects/2004Scape-Server/src'
npm start
# End
===== Server Update =====
* [[#desktop_launcher|Desktop Action Update]]
mkdir -p ~/'Projects/2004Scape-Server/scripts' && nano ~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh' && chmod +x ~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'
#!/bin/bash
git -C ~/'Projects/2004Scape-Server/src' reset --hard
git -C ~/'Projects/2004Scape-Server/src' pull origin 'main' --rebase
cd ~/'Projects/2004Scape-Server/src'
npm run 'clean'
read -n '1' -s -r -p 'Done! Press any key to exit.'
# End
===== Save Data Back-up =====
* [[#desktop_launcher|Desktop Action Saves]]
mkdir -p ~/'Projects/2004Scape-Server/scripts' && nano ~/'Projects/2004Scape-Server/scripts/localhost-save-backup.sh' && chmod +x ~/'Projects/2004Scape-Server/scripts/localhost-save-backup.sh'
#!/bin/bash
tar -cvzf ~/'Downloads/'$(date +%Y-%m-%d-%s)'-2004Scape-Server-localhost-Saves.tar.gz' -C ~/'Projects/2004Scape-Server/src/data' 'players'
sync
notify-send '2004Scape Save Data Backed-up Successfully to Downloads'
# End
====== Desktop Launcher ======
===== 2004Scape =====
* Requires above [[#scripts|Scripts]]
mkdir -p ~/'.local/share/applications/' && nano ~/'.local/share/applications/2004Scape-localhost.desktop' && sed -i 's/'CHANGEME'/'$USER'/g' ~/'.local/share/applications/2004Scape-localhost.desktop' && update-desktop-database --quiet ~/'.local/share/applications'
[Desktop Entry]
Name=2004Scape
Categories=Game;
Exec='/bin/bash' -c "gio open 'http://localhost:8888'"
Type=Application
StartupNotify=false
Icon=/home/CHANGEME/Projects/2004Scape-Server/src/public/favicon.ico
Actions=Map;Server;Update;Saves;Notes;
[Desktop Action Map]
StartupNotify=false
Exec='/bin/bash' -c "gio open ~/'Projects/2004Scape-Server/ext/worldmap2.jpg'"
Name=World map
[Desktop Action Server]
Exec='/bin/bash' -c "ptyxis --standalone --title='2004Scape localhost Server — ' -- ~/'Projects/2004Scape-Server/scripts/localhost-server-start.sh'"
Name=Launch Local Server
[Desktop Action Update]
Exec='/bin/bash' -c "ptyxis --standalone --title='2004Scape localhost Updater — ' -- ~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'"
Name=Update Local Server
[Desktop Action Saves]
StartupNotify=false
Exec='/bin/bash' -c "~/'Projects/2004Scape-Server/scripts/localhost-save-backup.sh'"
Name=Save Data Back-up
[Desktop Action Notes]
StartupNotify=false
Exec='/bin/bash' -c "gio open 'https://wiki.realmofespionage.xyz/games;linux;2004scape_localhost'"
Name=Installation Notes
# End
====== Quick Commands ======
===== Execute =====
==== Server ====
cd ~/'Projects/2004Scape-Server/src' && npm start --verbose
~/'Projects/2004Scape-Server/scripts/localhost-server-start.sh'
==== Client ====
* http://localhost:8888
===== Update =====
* https://github.com/2004Scape/Server/commits/main/
* :!: Running ''npm run clean'' requires starting the server once afterwards with an internet connection to download packages to start the server for playing offline
git -C ~/'Projects/2004Scape-Server/src' reset --hard && git -C ~/'Projects/2004Scape-Server/src' pull origin 'main' --rebase && cd ~/'Projects/2004Scape-Server/src' && npm run 'clean'
~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'
ptyxis --standalone -- ~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'
===== Save Data Back-up =====
mkdir -p ~/'Projects/2004Scape-Server/src/data/players' && gio open ~/'Projects/2004Scape-Server/src/data/players'
~/'Projects/2004Scape-Server/scripts/localhost-save-backup.sh'
===== npm =====
* Lists available ''npm'' commands
cd ~/'Projects/2004Scape-Server/src' && npm run --verbose
===== File Manager =====
==== Root ====
****
gio open ~/'Projects/2004Scape-Server/src'