EEVblog Electronics Community Forum

Products => Computers => Programming => Topic started by: RoGeorge on February 03, 2022, 02:30:14 pm

Title: Half-Life and HL:OpposingForce - free open engine and game for Ubuntu or FreeBSD
Post by: RoGeorge on February 03, 2022, 02:30:14 pm
It is possible compile and play the "Half-Life" and the "Half-Life: Opposing Force" games in Linux or in BSD, for free, and without any Steam account.  No WineHQ required.

The game looks just like the original, but it is using an open source version of the game engine, and the Valve's maps were released, too, so it is OK to compile and play it (from the licensing standpoint - see the next link for more info about licensing).  This is not a cracked game.

Found out about the Open HL from  https://forums.freebsd.org/threads/half-life-in-4-easy-steps.80394/  :-+

------------------

Generic info about the game(s):
https://en.wikipedia.org/wiki/Half-Life_(video_game)
https://en.wikipedia.org/wiki/Half-Life:_Opposing_Force

------------------
 
To compile and play in Ubuntu 20.04 LTS:
Code: [Select]
        sudo apt install xorg git libfreetype-dev libfontconfig1-dev libsdl2-dev mono-complete cmake pkgconf

        # - in Debian, csc is known as mono-csc, a symlink to /usr/bin/msc
        #   the 'csc' name might conflict with another package, 'chicken-bin'
        #   usually, 'chicken-bin' is not preinstalled
        # - create a 'csc' symlink to the '/usr/bin/msc', so to keep the same build.sh
        cd /usr/bin
        sudo cp -s /usr/bin/mcs csc
           
        cd ~
        git clone https://github.com/osen/openhl.git
        cd openhl
 
        PYTHON=python3 sh build.sh
        # if the compilation fails, fix the errors, delete the 'export' directory
        #   then run only this line again.  Do not start anew and do not git clone again,
        #   because that is not necessary and the repository is very big (~300MB)
   
        # for Linux, the .so names has to be changed from libclient/libserver to client/hl
        sed -i 's/libclient\.so/client\.so/' export/bin/hl
        sed -i 's/libserver\.so/hl\.so/' export/bin/hl

        sed -i 's/libclient\.so/client64\.so/' export/bin/opfor
        sed -i 's/libserver\.so/hl64\.so/' export/bin/opfor

        # to run the Half-Life game
        export/bin/hl
   
        # to run Half-Life: Opposing Force
        export/bin/opfor

The directory "export" is portable, once built it can be moved and the games are self-contained, can be run from anywhere.  Tested in 4k on an Ubuntu 20.04 LTS + KDE Plasma (i7/nVidia).

------------------

To compile and play in FreeBSD 13.0-RELEASE:
Code: [Select]
# pkg install xorg git sdl2 mono cmake pkgconf
$ git clone https://github.com/osen/openhl.git
$ cd openhl
$ PYTHON=python3 /bin/sh build.sh

To play Half-Life
$ export/bin/hl

To play Opposing Force
$ export/bin/opfor