This project was adapted from the original OneLifeXcompile as an attempt to provide the tool for anyone to build, modify and even contribute to the game Two Hours One Life.
Windows Subsystem for Linux (WSL) was the main tool used for testing of the scripts in this repository. Other tools such as Virtual box may be able to make use of the scripts here, but have in mind it might not work. WSL 2 was not tested.
You can see a guide on how to activate WSL on Windows 10 here:
WSL Installation Guide for Windows 10
If your in a hurry enter the folder exclude-dir in this repository and then run the batch file
'activateWSLthenRestart.bat' as an administrator. Be warned it will restart your machine.
After you computer reboots install Ubuntu 20.04 LTS from the Microsoft
store. Open it and define a user and password.
I got you, fam. Run this from wsl:
wget https://raw.githubusercontent.com/Defalt36/TwoLifeXcompile/master/doEverything.sh;chmod +x doEverything.sh;sudo ./doEverything.sh
After you set up WSL on your machine open the CMD and type 'wsl' and you should see the terminal of your linux distribution. Alternatively you can run 'openTerminalHere.bat' from the repository files.
If you don't already have a work directory create a folder and name it 'workdir', then move the 'TwoLifeXcompile' repository to it or proceed to get instructions on how to acquire it.
To download the repository directly to your workdir first open WSL from CMD. Then use the
command 'cd' to navigate to the folder you want to place your files. In
my case I use 'cd /mnt/c/Users/defalt/Desktop/workdir
' as that is where my workdir
is located. '/mnt/c' is the corresponding path of C: on WSL.
Now run 'sudo apt-get install git
', wait for it to complete and then run
'git clone https://github.com/Defalt36/TwoLifeXcompile.git
'.
After the command completes, check to see if 'TwoLifeXcompile' was cloned into the right folder.
For convenience you can type:
ln -s "The path to your work directory" ~/workdir
This create a shortcut that will let you find you work directory easily using:
cd ~/workdir
The following scripts will install the required components to build the game in your linux distribution. You just have to run then once as long as you don't uninstall or use another distribution.
Make sure you have the correct folder opened in the terminal. Check the end of the line
to see if you are in the TwoLifeXcompile folder.
For me it is:
defalt@DEFALT-PC:/mnt/c/Users/defalt/Desktop/workdir/TwoLifeXcompile
Run:
./getBasics.sh
Run this if you want to be able to build the editor:
./installMissingLibraries.sh
First you will have to clone the game files. The command ./replaceClonedFolders.sh
should do this for you, but have in mind it will delete the game repositories you
previously cloned (if any).
Note that command will clone the minorGems, OneLife and OneLifeData7 repositories from the
TwoHoursOneLife github account. To clone from other sources you can use:
./cloneAlternative.sh
.
After successfully cloning the game repositories to your work directory run:
./applyLocalRequirements.sh
Before you start, if you already tried to compile anything run this command to remove
the files generated from previously builds.
./perform.sh --cleanall
Now you are ready for compiling the game. You have currently four basic options on how to do this using the repository scripts.
./fastBuildGame.sh
./buildTestSystem.sh
./createFullBuild.sh
./perform.sh -b g
'fastBuildGame.sh' will compile the game and then move the game to the folder windows_builds in your work directory.
It is faster because it does not convert the unix-style line endings to windows-style, an optional step.
'buildTestSystem.sh' is very similar to pullAndBuildTestSystem.sh from the OneLife scripts; In
fact, it is derived from it. It will clone the game repositories if they are missing and compile
the game, editor and server for you, modifing some files so it will be ready to be used for
testing. Be warned you will be editing the repositories files when you use the editor. You may
want to make a backup of the OneLifeData7 repository.
'createFullBuild.sh' will compile the game, server and editor and move all their files to a single
folder in order to make a full build. If you are using this, remember to run the 'initiateServer.bat'
file before running the server. 'resetServer.bat' is included to delete the server files if you are
unable to run it due to a crash.
'perform.sh' is a multi utility script. It can build and run the game, server and editor depending on
the flags you use. This is useful for testing.
You can run './cloneAlternative.sh' to clone the game repositories under any name or user.
This is useful for cloning your own repositories. You can also clone the original game
repositories with it if you input 'jasonrohrer' as the user you want to clone from.
The compile script recomended when building from other sources is 'buildTestSystem.sh'.
Most forked scripts keep the same function as the original ones, and others were renamed. You can read about what they do in this tutorial from the creator of the original project, Joriom: https://onehouronelife.com/forums/viewtopic.php?id=1438
exclude-list.txt
When you run ./applyLocalRequirements.sh some files from TwoLifeXcompile will be copied to
the game folders with the sole exception being the files listed here. The folder exclude-dir
and some files you may use are included for your convenience.
cloneAlternative.sh
Used for cloning from other repositories, branches or users.
installMissingLibraries.sh
You may have a lot of libraries in your system, but you need to have them installed
to your compiler for it to work. This script install the ones you need.
deleteAllServerFiles.sh
Did you forget to press control-c when exiting the server or you just want a fresh map? This script
will send all your server files to oblivion, solving the problem.
cleanServerMap.sh
Less destructive version of the above.
buildLatestTHOL.sh
Will automatically build the lastest version of Two Hours One Life for you.
buildLatestOHOL.sh
Will automatically build the lastest version of One Hour One Life for you.
perform.sh
read next section.
buildTestSystem.sh
This will clone missing repositories if any and build a test system for experimenting with
the game.
createFullBuild.sh
Build the game, editor and server and puts them in a single folder.
doEverything.sh
Will install, download and run everything you need, then it will
build the game, editor and server. This should be run at your workdir.
The 'perform.sh' script can be used to clean, build and open the applications quickly.
Its '-c' option will clean only the files specified in the 'toClean' variable inside the script.
The usage is ./perform.sh (FLAGS) (PARAMETERS)
.
Flags: '-b' Build; '-r' Run; '-c' Clean; '-cleanall' Clean all build files.
Parameters: 'g' Game; 'e' Editor; 's' Server.
Example: ./perform.sh -cbr gs
This will clean the files specified, build the game and
server and then run both.