Half-Life - In 4 easy steps

I guess I found a somewhat nice solution now (port works!)
Nice work. FS_NOWRITE_PATH makes it write in user's directory instead (I have yet to follow the code path and understand how it works)? I didn't know that the engine already had that functionality and something like this was going to need to be added myself.
(edit: I have a little suggestion, you could add an exec in your scripts... )
As in:
Code:
LD_LIBRARY_PATH="$XASH_BIN_PATH:$LD_LIBRARY_PATH" exec "$XASH_BIN_PATH/xash3d" \
  -clientlib "$HL_CLIENT_LIB" -dll "$HL_SERVER_LIB" -console "$@"

I can do. Also tempted to merge your patch (unless you noticed any potential issues in your testing?)
 
FS_NOWRITE_PATH makes it write in user's directory instead (I have yet to follow the code path and understand how it works)?
There's an internal static var fs_writepath that's used for every write operation. The flag prohibits setting this static var when adding the path. So, adding another (dummy) path below $HOME seems to solve the issue.
Also tempted to merge your patch (unless you noticed any potential issues in your testing?)
Currently only did some "smoke testing", menus work, I can play the intro and control the player ...

Will need to do a lot more testing to be sure!
 
Ok, doesn't really work with that patch, it can't save games and bugs on automatic map changes (probably related to the problem with saving games)...

So, maybe the order of registering the "overlayed" paths is relevant? Will do more testing :eek:
 
Got it, no need to patch the code at all, it already does the "nowrite magic" when invoked with an rodir ;)

So, here's a little "pull request" (should apply with git am):
Code:
From 48454727693a255e827f83ff2393f3211e8f2a0d Mon Sep 17 00:00:00 2001
From: Felix Palmen <felix@palmen-it.de>
Date: Thu, 24 Feb 2022 13:45:51 +0100
Subject: [PATCH] Separate write location in $HOME/.openhl/

---
 system/bin/hl    | 6 ++++--
 system/bin/opfor | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/system/bin/hl b/system/bin/hl
index a7f0e92..7adfd4e 100644
--- a/system/bin/hl
+++ b/system/bin/hl
@@ -3,13 +3,15 @@
 PREFIX="$(cd "$(dirname "$(which "$0")")" && cd .. && pwd)"
 
 if [ -z "$XASH3D_BASEDIR" ]; then
- export XASH3D_BASEDIR="$PREFIX/share/xash3d/"
+ export XASH3D_BASEDIR="$HOME/.openhl/"
 fi
 
 XASH_BIN_PATH="$PREFIX/lib/xash3d"
 HL_CLIENT_LIB="$PREFIX/lib/xash3d/valve/libclient.so"
 HL_SERVER_LIB="$PREFIX/lib/xash3d/valve/libserver.so"
 
-LD_LIBRARY_PATH="$XASH_BIN_PATH:$LD_LIBRARY_PATH" "$XASH_BIN_PATH/xash3d" \
+mkdir -p "$XASH3D_BASEDIR"
+LD_LIBRARY_PATH="$XASH_BIN_PATH:$LD_LIBRARY_PATH" exec \
+ "$XASH_BIN_PATH/xash3d" -rodir "$PREFIX/share/xash3d/" \
  -clientlib "$HL_CLIENT_LIB" -dll "$HL_SERVER_LIB" -console "$@"
 
diff --git a/system/bin/opfor b/system/bin/opfor
index 28d6c3f..73cc74b 100644
--- a/system/bin/opfor
+++ b/system/bin/opfor
@@ -3,13 +3,15 @@
 PREFIX="$(cd "$(dirname "$(which "$0")")" && cd .. && pwd)"
 
 if [ -z "$XASH3D_BASEDIR" ]; then
- export XASH3D_BASEDIR="$PREFIX/share/xash3d/"
+ export XASH3D_BASEDIR="$HOME/.openhl/"
 fi
 
 XASH_BIN_PATH="$PREFIX/lib/xash3d"
 HL_CLIENT_LIB="$PREFIX/lib/xash3d/gearbox/libclient.so"
 HL_SERVER_LIB="$PREFIX/lib/xash3d/gearbox/libserver.so"
 
-LD_LIBRARY_PATH="$XASH_BIN_PATH:$LD_LIBRARY_PATH" "$XASH_BIN_PATH/xash3d" \
+mkdir -p "$XASH3D_BASEDIR"
+LD_LIBRARY_PATH="$XASH_BIN_PATH:$LD_LIBRARY_PATH" exec \
+ "$XASH_BIN_PATH/xash3d" -rodir "$PREFIX/share/xash3d/" \
  -clientlib "$HL_CLIENT_LIB" -dll "$HL_SERVER_LIB" -console "$@"
 
--
2.35.1

Will update the port now :)
 
Yes, pretty nice this "just works" :) Port is now fixed as well, builds and runs fine!

There's a little glitch, during loading, it briefly shows some picture from an earlier scene ...
 
If you do, I don't suppose you could also let me know if any save games work across between versions?
Finally, an answer ... they work! :cool: You have to copy them preserving timestamps:
cp -p <wineprefix>/drive_c/Programme/Half-Life/valve/SAVE/* ~/.openhl/valve/save
Only little glitch: screenshot pics are missing.
 
Ugh, the worst place to be!

If you restart Half-Life and then bring up the console (before loading your game). Then type:
sv_cheats 1

Then load your game and /noclip should work.
Hey, was just reading this thread. I was playing hl1 earlier and just fyi ~ brings up console. Type sv_cheats 1 then ~ again to close the console. Press f6 to save the game then f7 to load game right where you saved and cheats are enabled. This works on steam and the original disk copies of the game. But on the original you need to add -console to your hl.exe
"hl.exe -console"

This was like the first 3D game for PC I became obsessed with. I played doom but there was something very special about half life. Brilliant devs and epic use of a game engine.
 
What about hl2? Is it possible to run it on freebsd?
I builded this open source engine for HL2 and it works fine on FreeBSD 13.2


1696674294770.png

1696674364092.png


Building instruction
 
Very very cool. Thanks for sharing.

I look forward to giving it a shot! I have been given about 5 copies of HL2 over the years but I never actually played through the game because I was too annoyed about the Steam DRM platform.

(The engine looks to have very few dependencies too which is great news!)
 
Half-Life - In 4 easy steps, but this has 64 replies, which gave me chills. >.<
And still it just works, none of this discussion here seems to be about issues getting it to work.

If you prefer a system-wide installation managed by pkg, my port also still works. Note it's a "hacky" port (and I have no intention to polish it or even get it into the tree, cause the legal situation seems a bit "dodgy" to me), but it certainly works.
 
If I understand this right, with this you just get the engine, but not the game itself? So after following these build instructions, what exactly do you have to do to actually be able to play Half Life 2?

Back in the day, in a similar way to Half-Life 1, Valve actually publicly provided to Fileplanet, Gamefront and others, the Half-Life 2 game data as part of their pre-cached Steam GCF files. The files were encrypted (same as when purchasing the retail DVD), however there are many open-source decrypting programs that can do this.

So, I believe that those original Half-Life 2 data files can be freely distributed. However I have tried and they are unfortunately a little too old and cause problems (when I get time, I will have a fiddle with this to see if I can get things to work).

However, Unlike HL1, the engine source code exists due to a leak (luckily), so ultimately the whole thing is verging quite close to piracy. Probably better to buy a copy from the Steam DRM platform and extract from the downloaded GCF (i.e gcfscape).
 
For bilding engine for CS GO need:

./waf configure -T release -8 --build-games=cstrike ./waf build

You can use for --build-games
hl2mp - Half-Life to Multiplayer cstrike - CSS dod - Day of Defeat

Also you can add prefix for game root directory:

--prefix=/path-to-root_game

And in this case it is better to use instead of ./waf build:

./waf install --prefix=/path-to-root_game
 
For bilding engine for CS GO need:

./waf configure -T release -8 --build-games=cstrike ./waf build

You can use for --build-games
hl2mp - Half-Life to Multiplayer cstrike - CSS dod - Day of Defeat

Also you can add prefix for game root directory:

--prefix=/path-to-root_game

And in this case it is better to use instead of ./waf build:

./waf install --prefix=/path-to-root_game
I have found a copy of Black Mesa somewhere on my external hardrive, which I would like to test using this method. It installs with wine, but does not run, so this is the structure I get after installation:

1697277439457.png

So what would be the "/path-to-root_game" here? The folder "Black Mesa"? And the code for "--build-games"?
 
I have found a copy of Black Mesa somewhere on my external hardrive, which I would like to test using this method. It installs with wine, but does not run, so this is the structure I get after installation:

View attachment 17102
So what would be the "/path-to-root_game" here? The folder "Black Mesa"? And the code for "--build-games"?
1. Create dir named as /Games/HL2 in your home root directory.

2. Copy your ~/.wine/drive_c/Program Files (x86)/Black Mesa/BMS directory to ~/Games/HL2 with all files and subdirectories.

3. Create dir named as src in your home root directory.

3. Go to src directory and download source engine:
git clone https://github.com/nillerusr/source-engine

3. Go to /src/source-engine and compile engine from source:
./waf configure -T release -8 --build-games=hl2
./waf install --prefix=~/Games/HL2


4. Go to ~/Games/HL2 and start game: ./hl2_launcher -game BMS

Quote Reply
Report Edit
 
1. Create dir named as /Games/HL2 in your home root directory.

2. Copy your ~/.wine/drive_c/Program Files (x86)/Black Mesa/BMS directory to ~/Games/HL2 with all files and subdirectories.

3. Create dir named as src in your home root directory.

3. Go to src directory and download source engine:
git clone https://github.com/nillerusr/source-engine

3. Go to /src/source-engine and compile engine from source:
./waf configure -T release -8 --build-games=hl2
./waf install --prefix=~/Games/HL2


4. Go to ~/Games/HL2 and start game: ./hl2_launcher -game BMS

Quote Reply
Report Edit
All went well until step 5 (3rd step 3):

Code:
$ pwd
/home/werner
$ ls | grep src
$ mkdir src
$ cd src/
$  git clone https://github.com/nillerusr/source-engine
Cloning into 'source-engine'...
remote: Enumerating objects: 36565, done.
remote: Counting objects: 100% (3503/3503), done.
remote: Compressing objects: 100% (3096/3096), done.
remote: Total 36565 (delta 421), reused 3100 (delta 388), pack-reused 33062
Receiving objects: 100% (36565/36565), 219.14 MiB | 13.58 MiB/s, done.
Resolving deltas: 100% (13897/13897), done.
Updating files: 100% (12382/12382), done.
$ ls
source-engine
$ cd source-engine/
$ ./waf configure -T release -8 --build-games=hl2
env: python: No such file or directory
$


EDIT: I saw in the guide that in that case I have to use the python3 prefix. I did, but unfortunately I got the following error:

Code:
$ python3 ./waf configure -T release -8 --build-games=hl2
Setting top to                                          : /usr/home/werner/src/source-engine
Setting out to                                          : /usr/home/werner/src/source-engine/build
Build type                                              : release
LTO build                                               : no
PolyOpt build                                           : no
Checking for 'clang' (C compiler)                       : /usr/bin/clang
Target OS                                               : freebsd
Target CPU                                              : x86_64
Target binfmt                                           : elf
Checking for 'clang++' (C++ compiler)                   : /usr/bin/clang++
Target OS                                               : freebsd
Target CPU                                              : x86_64
Target binfmt                                           : elf
Checking for program 'git'                              : /usr/local/bin/git
Checking git hash                                       : 5a4d0b7a
Checking for program 'strip'                            : /usr/bin/strip
Checking for program 'objcopy'                          : /usr/bin/objcopy
Checking for required C flags                           : yes
Checking for required C++ flags                         : yes
Checking supported flags for clang++ in parallel        : started
... -Wno-unused-but-set-variable                        : no
... -Wno-unused-function                                : no
... -Wall                                               : no
... -Wno-reorder                                        : no
... -Wno-unused-value                                   : no
... -Wno-unknown-pragmas                                : no
... -Winit-self                                         : no
... -fdiagnostics-color=always                          : no
... -faligned-new                                       : no
... -Wuninitialized                                     : no
... -Wno-unused-variable                                : no
... -Wstrict-aliasing                                   : no
... -Wcast-align                                        : no
-> processing test results                              : 13 test failed
Checking supported flags for clang in parallel          : started
... -fdiagnostics-color=always                          : no
... -fnonconst-initializers                             : no
... -Wcast-align                                        : no
... -Wno-unused-function                                : no
... -Wno-unused-value                                   : no
... -Winit-self                                         : no
... -Wno-unknown-pragmas                                : no
... -faligned-new                                       : no
... -Wno-unused-variable                                : no
... -Wuninitialized                                     : no
... -Wno-unused-but-set-variable                        : no
... -Wstrict-aliasing                                   : no
... -Wno-reorder                                        : no
... -Wall                                               : no
-> processing test results                              : 14 test failed
Checking for library dl                                 : yes
Checking for library bz2                                : yes
Checking for library rt                                 : yes
Checking for library m                                  : yes
Checking for program 'pkg-config'                       : /usr/local/bin/pkg-config
Checking for 'sdl2'                                     : yes
Checking for 'freetype2'                                : yes
Checking for 'freetype2' sanity                         : yes
Checking for 'fontconfig'                               : yes
Checking for 'fontconfig' sanity                        : yes
Checking for 'openal'                                   : yes
Checking for 'libjpeg'                                  : yes
Checking for 'libpng'                                   : yes
Checking for 'libcurl'                                  : yes
Checking for 'zlib'                                     : yes
--> appframework                                        : in progress
<-- appframework                                        : done
--> bitmap                                              : in progress
<-- bitmap                                              : done
--> choreoobjects                                       : in progress
<-- choreoobjects                                       : done
--> datacache                                           : in progress
<-- datacache                                           : done
--> datamodel                                           : in progress
<-- datamodel                                           : done
--> dmxloader                                           : in progress
<-- dmxloader                                           : done
--> engine                                              : in progress
<-- engine                                              : done
--> engine/voice_codecs/minimp3                         : in progress
<-- engine/voice_codecs/minimp3                         : done
--> filesystem                                          : in progress
<-- filesystem                                          : done
--> game/client                                         : in progress
<-- game/client                                         : done
--> game/server                                         : in progress
<-- game/server                                         : done
--> gameui                                              : in progress
<-- gameui                                              : done
--> inputsystem                                         : in progress
<-- inputsystem                                         : done
--> ivp/havana                                          : in progress
Cannot read the folder '/usr/home/werner/src/source-engine/ivp/havana'
$

In fact, the ivp folder is empty.
 
Well, I have emptied the src directory first and then did again:


Code:
$ git clone https://github.com/nillerusr/source-engine
Cloning into 'source-engine'...
remote: Enumerating objects: 36576, done.
remote: Counting objects: 100% (3514/3514), done.
remote: Compressing objects: 100% (3098/3098), done.
remote: Total 36576 (delta 430), reused 3110 (delta 397), pack-reused 33062
Receiving objects: 100% (36576/36576), 219.15 MiB | 9.01 MiB/s, done.
Resolving deltas: 100% (13906/13906), done.
Updating files: 100% (12382/12382), done.
$ git clone --recursive --depth 1
fatal: You must specify a repository to clone.

usage: git clone [<options>] [--] <repo> [<dir>]
...

The git clone --recursive --depth 1 in the instructions is mentioned under Linux and not under the BSD or common instructions. I'm sorry, but I am not a developer and I don't know how to use git. Can you please tell me what to do exactly at what point?
 
Well, I have emptied the src directory first and then did again:


Code:
$ git clone https://github.com/nillerusr/source-engine
Cloning into 'source-engine'...
remote: Enumerating objects: 36576, done.
remote: Counting objects: 100% (3514/3514), done.
remote: Compressing objects: 100% (3098/3098), done.
remote: Total 36576 (delta 430), reused 3110 (delta 397), pack-reused 33062
Receiving objects: 100% (36576/36576), 219.15 MiB | 9.01 MiB/s, done.
Resolving deltas: 100% (13906/13906), done.
Updating files: 100% (12382/12382), done.
$ git clone --recursive --depth 1
fatal: You must specify a repository to clone.

usage: git clone [<options>] [--] <repo> [<dir>]
...

The git clone --recursive --depth 1 in the instructions is mentioned under Linux and not under the BSD or common instructions. I'm sorry, but I am not a developer and I don't know how to use git. Can you please tell me what to do exactly at what point?
git clone --recursive --depth 1 https://github.com/nillerusr/source-engine
 
Back
Top