This is a Game Modification boilerplate for Node.js of Urban Terror (UrT) version 4 game, based on ioQuake3 (ioq3) game engine.
We inject our hook declarations to functions of Mickael9's UrT engine code via compiler extensions, and link modified UrT objects with our hook implementations and our TCP API implementation to an executable. It interacts via API with our Game Mod's business-logic code in Javascript.
As of we, you also most likely to be lucky building and locally running this project if you get the following installed and available from your PATH
:
- Unix-like OS.
- Latest stable GNU Make tool (check
make -v
in terminal). - Latest stable GCC or Clang in
PATH
(checkcc -v
,gcc -v
, andclang -v
in terminal). - Latest stable official Node.js with NPM bundled (check
node -v
andnpm -v
in terminal). - Latest stable official MongoDB (Community Server is enough) running on
localhost
at default TCP port27017
(checknetstat -ntlp | grep :27017
in terminal). - GNU Wget for downloading of external files (check
wget -V
in terminal). As you get this all, go to repo directory and type:
make run
This will automatically clone latest code of Mickael9's repository to ioq3
directory and download minified UrT game directory q3ut4
from cloud (128 MiB), extract the files, perform build, install NPM packages and locally run of UrT server.
Below steps will set up 2 UrT servers: one for shooting modes (on default port) and one for jump mode (on port 1337
).
- Prepare APT resources for MongoDB:
sudo apt update
sudo apt -y install gnupg2
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get install mongodb-org
- Prepare APT resources for Node.js:
wget -qO- https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs
- Install other dependencies:
sudo apt-get install build-essential gcc git libcap2-bin make screen unzip
- Add user
urt
.
sudo useradd -s /bin/bash -m urt
- Login to user
urt
, clone this repo, compile the binary, and install NPM dependencies:
sudo login -f urt
then:
git clone --depth=1 "https://github.com/tarquas/node-urt4.git" ~/node-urt4
cd ~/node-urt4
make lib-release
make run-prepare
finally, exit from urt
shell:
exit
- Install and run the services:
cp /home/urt/node-urt4/init.d/* /etc/init.d
systemctl enable urt-mod
systemctl enable urt-game-guns
systemctl enable urt-game-jump
service urt-mod start
service urt-game-guns start
service urt-game-jump start
Consoles of service processes are available via screen
:
- for a mod:
screen -x urt/urt-mod
- for UrT server:
screen -x urt/urt-game-guns
- for UrT jump server:
screen -x urt/urt-game-jump
To take advantage of mousewheel and Shift+PgUp/PgDn
scrolling inside the screen, use once:
echo "termcapinfo xterm* ti@:te@" | sudo tee -a /etc/screenrc
- Run the game and connect to your server. Go to mod console:
screen -x urt/urt-mod
Find your name in list of players and grant yourself administrator privileges (in example below your player is #2):
list
setlevel 2 admin
-
Press
CTRL+A,D
to detach from mod console screen. -
In game console type
!help
(any of.!@&/
may be used instead of!
, but note that when using/
some commands may be shadowed by client game engine f.x./map
).
- A C/C++ compiler and linker collection must be chosen to support
alias
andweak
function attributes (this is used to organize our hooks). Latest GCC or Clang must most likely be fine. - We use Node.js as execution environment of our business logic written in Javascript. Latest stable version is recommended.
- We use NPM package manager to manage our Node.js' third-party modules we use in our Javascript code. Since it's bundled with Node.js, it's not needed to install it separately.
Patched game engine (with hooks) supports the minified PK3 files (files which are not related to serverside engine are removed or truncated to zero). It allows to save resources on your server.
Compare the sizes of some bundled PK3 files to sizes of their original versions:
Minified 3.2M ut4_beijing_b3.pk3 4.4M ut4_facade_b5.pk3 1.7M ut4_orbital_sl.pk3 4.6M ut4_tohunga_b8.pk3 14M total
Original 25M ut4_beijing_b3.pk3 31M ut4_facade_b5.pk3 15M ut4_orbital_sl.pk3 18M ut4_tohunga_b8.pk3 88M total
We also provide 2 packs of maps, which may be quickly installed after all basic installation (after make run
succeeded):
- fun pack for gun mode:
make installmaps-fun-1
- jump pack for jump mode:
make installmaps-jump-1
After you install new PK3 or alter list of maps in config, you can apply the changes by:
- For PK3 either restart the engine or issue command
fs
as an admin (from game or server console); - For map config restart the mod by issuing command
~q
from server console.
Mod and game engine are free to run alone without each other.
This allows you to make changes in mod code (in /src/app
) and restart the mod without restarting the game engine.
However, modification of ioq3 hooks (in /src/hooks
and /include
) requires recompilation and restart of game engine.
The game engine alone will temporarily lose all mod features until the mod gets started again and catches API connection from engine. Also, mod can handle multiple game engines (f.x. shooting and jump server in default setup).
All dev bros are free to do with this stuff anything they want without any legal limitations if they keep this software free. Also you're free to collaborate here, make proposals, features, bugfixes, pull requests etc. etc.