-
Notifications
You must be signed in to change notification settings - Fork 12
Flate's Debian Ubuntu Compiling Guide
Written By Flate (edits by Futuza)
Download the Ubuntu 18.04.4 Live Server Image since we want to set this up from scratch as a non-bloated install. You can use a newer version if you want, but this guide assumes you are using 18.04.4.
Note if you want to do this with a virtual machine it should work just fine, if you need a free one you can get VmWare Workstation Player here.
Go through the install process, agree to installing the OpenSSH package if needed to connect to the VM via SSH (optional).
After logging into the system, we want to install a lightweight, resource-friendly GUI like the Lubuntu one (optional).
sudo apt install tasksel lubuntu-desktop
Download and install the required packages for compiling JK2/JKA/JKG game/-sourcecode:
sudo apt install build-essential git wget nano zip unzip debhelper devscripts libsdl2-dev libgl1-mesa-dev libopenal-dev libjpeg-dev libpng-dev zlib1g-dev libminizip-dev clang
Now let's build CMake from scratch since we want it to be perfectly built into the system. You can check which version is the latest by going here. Then just replace the version number with the most current (eg: v3.23.0
with v3.28.0
etc) and then do the following:
cd $HOME/Downloads
wget https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz
tar -xzvf cmake-3.23.0.tar.gz
cd cmake-3.23.0
sudo apt install libssl-dev curl
./bootstrap -- -DCMAKE_BUILD_TYPE:STRING=Release
make -j # (#= Number of assigned CPU Cores + 1)
sudo make install
Now that we have CMake ready to go, let's clone the JKG git repo to our machine.
cd $HOME/Downloads
git clone https://github.com/JKGDevs/JediKnightGalaxies.git
cd JediKnightGalaxies
Now select which branch you want to build. Master is the most stable, while develop is the most active branch with the newest features (but is also usually tested a lot less). For example you might switch to the develop branch with:
git checkout develop
Now, let's open CMakeList in nano (you can use another text editor if you want, but the following explains how to use nano):
nano CMakeLists.txt
Change the following line in the text file.
Before:
option(BuildPortableVersion "Build portable version (does not read or write files from your user/home directory" OFF)
After:
option(BuildPortableVersion "Build portable version (does not read or write files from your user/home directory" ON)
To save your changes, use Ctrl+o -> [Enter] -> Ctrl+x
Let's compile:
mkdir build && cd build && CXX=clang++ CC=clang cmake ..
make -j# (#= Number of assigned CPU Cores + 1)
Note: we want to use clang to compile since the latest version of gcc currently has some bugs that causes JKG to often not build correctly.
This should build everything. If you want to switch between Release/Debug builds just cd into the build directory and use ccmake ..
and you can then switch the type of build, configure it and generate. Then just use make to build.
First we'll need to create a directory for JKG, so navigate to the Jedi Academy GameData directory and create a directory called jkgalaxies
(this can be changed, but its what we use for official releases). Create a subdirectory within the newly created jkgalaxies directory called JKG
. Then move the compiled .x86_64 binaries from step 7 into the jkgalaxies directory along with the renderer .so file(jkgalaxies.x86_64
, jkgalaxiesded.x86_64
, rd-galaxies_x86_64.so
). Then place all other .so files, inside of the JKG subdirectory (cgamex86_64.so
, gamex86.so
, uix86_64.so
).
Second, we'll now need to move the JKGalaxies data into a pk3, navigate back to the git directory where you cloned Jedi Knight Galaxies. Find the directory called JKGalaxies
, inside will be a few directories and files (such as ext_data
, or JKG_Defaults.cfg
). We need to pack everything inside this directory (including all of its subdirectories) into a zip file which we will name zz_JKG_Assets5.pk3
. Move this pk3 file into the JKG subdirectory (where we put cgamex86_64.so and the other .so files).
Finally, similar to step two we're going to go back to the Jedi Knight Galaxies directory where we cloned the repo, and copy the contents of the JKGServer
directory into the JKG subdirectory.
When finished with step 8, your JKG install should look like this:
--- Jedi Academy (or Star Wars: Jedi Knight: Jedi Academy if on a CD game)
|
|----- GameData
| |
| |---- JKGalaxies-Client-Readme.txt
| |
| |---- jkgalaxies
| | |
| | |--- jkgalaxiesded.x86_64
| | |
| | |--- jkgalaxies.x86_64
| | |
| | |--- rd-galaxies_x86_64.so
| | |--- JKG
| | | |
| | | | -- cgamex86_64.so
| | | | -- gamex86.so
| | | | -- uix86_64.so
| | | | -- zz_JKG_Assets5.pk3
| | | | -- server.cfg
| | | | -- server
| | | | |
| | | | | -- accountlist.json
| | | | | -- ranks.json
| ---etc...
You may wish to make a script or use a make file to move these automatically for you after each compile.
Now we just need to make sure the game built correctly by trying to run it. Navigate to the jkgalaxies directory created in step 8 and run the following in terminal:
./jkgalaxies.x86_64 +set fs_game "JKG" +set fs_cdpath "." +set fs_basepath ".." +set r_fullscreen 0
Alternatively, you may wish to make a bash script (.sh) file containing the above instead.
This should launch the client. Keep in mind you can change the parameters of this command arg as needed with your setup, but this is the default setup for official releases (r_fullscreen 0 is not needed, but it is usually convenient to debug the game in windowed mode).
If you were using a virtual machine to compile, copy the compiled .so's and .i386/.x86_64's out of the VM to your native OS or to another machine running Linux.
Note: Virtual machines almost always lack the graphics drivers required to play the game directly.