====== Information ======
* 2004Scape Server ((https://github.com/2004Scape/Server))
* These notes provide a local single-player server for 2004Scape ((RSPS/RuneScape Private Server based on cache ''225'' from May 18th, 2004))
===== Media =====
* [[https://www.youtube.com/watch?v=E21y7rLZaNc|Launcher Presentation Video]]
* [[https://media.realmofespionage.xyz/index/category/2|Progress Pics]]
===== Prerequisites =====
* [[linux;distros;fedora_workstation_gnome|Fedora Workstation]]
===== Resources =====
* [[https://2004scape.org/img/rs2/worldmap/worldmap2.jpg|World Map]]
* [[https://2004scape.org/rs2/skills|Skills]]
* [[https://2004scape.org/rs2/quests|Quests]]
==== Web ====
* [[https://lostcity.rs/t/singleplayer-main-branch-scripts-and-desktop-start-launchers-on-windows-linux-freebsd/54|Lost City Forums]]
* [[https://2004scape.org/news|News]]
* [[https://rune-server.org/threads/lost-city-225-emulation.701698/|Rune-Server Forums]]
====== Dependencies ======
* https://github.com/2004Scape/Server?tab=readme-ov-file#dependencies
sudo dnf install git nodejs-npm java-openjdk-headless
====== Download Source ======
* https://github.com/2004Scape/Server/commits/main/
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
===== Extras =====
==== Icon ====
****
rm -f '/tmp/2004Scape-favicon.ico' && mkdir -p ~/'Projects/2004Scape-Server/ext' && wget -O '/tmp/2004Scape-favicon.ico' 'https://raw.githubusercontent.com/2004Scape/Server/7b0f1ec303dc1f76c7b29a2fff83b5797dafa01b/public/favicon.ico' && mv -f '/tmp/2004Scape-favicon.ico' ~/'Projects/2004Scape-Server/ext/favicon.ico'
==== World Map ====
* https://2004.lostcity.rs/img/rs2/worldmap/worldmap2.jpg
rm -f '/tmp/2004Scape-worldmap2.jpg' && mkdir -p ~/'Projects/2004Scape-Server/ext' && wget -O '/tmp/2004Scape-worldmap2.jpg' 'https://2004.lostcity.rs/img/rs2/worldmap/worldmap2.jpg' && mv -f '/tmp/2004Scape-worldmap2.jpg' ~/'Projects/2004Scape-Server/ext/worldmap2.jpg'
====== Initial Build ======
****
cd ~/'Projects/2004Scape-Server/src' && npm install --verbose
====== Settings ======
* [[https://github.com/2004Scape/Server/blob/main/.env.example|Upstream Settings]]
* ''NODE_PORT=44594'' is an easy fix to simultaneously-host [[servers:linux:games:2009scape_localhost|2009Scape]]
nano ~/'Projects/2004Scape-Server/src/.env'
WEB_PORT=8888
NODE_PORT=43594
NODE_PRODUCTION=false
NODE_ALLOW_CHEATS=false
NODE_DEBUG=false
NODE_STAFF=Test
NODE_PORT=44594
====== 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'
npm 'ci'
notify-send -i ~/'Projects/2004Scape-Server/ext/favicon.ico' '2004Scape localhost server update complete'
# 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 -czf ~/'Downloads/'$(date +%Y-%m-%d-%s)'-2004Scape-Server-localhost-Saves.tar.gz' -C ~/'Projects/2004Scape-Server/src/data' 'players'
sync
notify-send -i ~/'Projects/2004Scape-Server/ext/favicon.ico' '2004Scape Save Data Backed-up Successfully to Downloads'
# End
====== Desktop Launcher ======
===== 2004Scape =====
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/ext/favicon.ico
Actions=Map;Server;Saves;Update;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 Server — ' -- ~/'Projects/2004Scape-Server/scripts/localhost-server-start.sh'"
Name=Launch 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 Update]
Exec='/bin/bash' -c "ptyxis --standalone --title='2004Scape Updater — ' -- ~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'"
Name=Update Local Server
[Desktop Action Notes]
StartupNotify=false
Exec='/bin/bash' -c "gio open 'https://wiki.realmofespionage.xyz/games:linux:2004scape_localhost'"
Name=Install Notes
# End
====== Quick Commands ======
===== Execute =====
==== Server ====
cd ~/'Projects/2004Scape-Server/src' && npm start --verbose
~/'Projects/2004Scape-Server/scripts/localhost-server-start.sh'
ptyxis --standalone --title='2004Scape Server — ' -- ~/'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' --verbose && npm 'ci' --verbose
~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'
ptyxis --standalone --title='2004Scape Updater — ' -- ~/'Projects/2004Scape-Server/scripts/localhost-server-update.sh'
===== Save Data Back-up =====
tar -cvzf ~/'Downloads/'$(date +%Y-%m-%d-%s)'-2004Scape-Server-localhost-Saves.tar.gz' -C ~/'Projects/2004Scape-Server/src/data' 'players'
~/'Projects/2004Scape-Server/scripts/localhost-save-backup.sh'
===== World Map =====
* https://2004.lostcity.rs/img/rs2/worldmap/worldmap2.jpg
gio open ~/'Projects/2004Scape-Server/ext/worldmap2.jpg'
===== npm =====
cd ~/'Projects/2004Scape-Server/src' && npm run --verbose
cd ~/'Projects/2004Scape-Server/src' && npm run 'clean' --verbose
cd ~/'Projects/2004Scape-Server/src' && npm 'ci' --verbose
===== Git =====
git -C ~/'Projects/2004Scape-Server/src' fsck --full --strict
git -C ~/'Projects/2004Scape-Server/src' gc --aggressive --prune='all'
===== File Manager =====
==== Root ====
****
gio open ~/'Projects/2004Scape-Server/src'
==== Saves ====
****
mkdir -p ~/'Projects/2004Scape-Server/src/data/players' && gio open ~/'Projects/2004Scape-Server/src/data/players'
====== Troubleshooting ======
===== Specific Commit Rebase =====
* https://github.com/2004Scape/Server/commits/main/
git -C ~/'Projects/2004Scape-Server/src' reset --hard '42af1c2d152c9cfa174a49f56b51906d8a2c8374'
git -C ~/'Projects/2004Scape-Server/src' pull origin --rebase '42af1c2d152c9cfa174a49f56b51906d8a2c8374'
cd ~/'Projects/2004Scape-Server/src' && npm run 'clean'