Opposing Force introduces two new entity classifications on top of the ones present in the base Half-Life game. Because these additions change the NPC relationship matrix, the corresponding relationship table entries need to be extracted from the Opposing Force server library and incorporated into the Unified SDK’s entity classification system. This tutorial walks through the extraction process using GDB on Linux, which allows you to read the relationship table directly from memory at runtime.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/twhl-community/halflife-unified-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Linux system with GDB installed
- The Half-Life dedicated server or client installed, including the
gearboxmod directory - Familiarity with running commands in a terminal
Extracting the table
Set up the library path and launch GDB
Open a terminal and navigate to your Half-Life installation directory. Set the
LD_LIBRARY_PATH environment variable so the game’s shared libraries can be found, then start GDB:Load the Half-Life executable and set the game arguments
Inside GDB, load the Linux Half-Life executable and configure it to run with the Opposing Force (
gearbox) mod:Run the game and load a map
Start the game with the Start a map from the in-game console or through the game menu before proceeding.
run command. Once it is running, start a map inside the game so that the server DLL is fully loaded into memory. The relationship table only becomes accessible after the DLL is initialised:Create and run the GDB extraction script
Create a file named Then source the script from within GDB to run it:The output will be written to
gdb_script.gs with the following GDB script. It iterates over the 16×16 relationship matrix and prints each entry:log.txt in your working directory.Integrate the extracted data
Open
log.txt and locate the printed matrix. The Opposing Force additions correspond to the last 2 columns and rows of the 16×16 table. Take those entries and add them to the existing relationship table in the Unified SDK’s entity classification system.Once added, verify that the pre-existing entries in the table still match the values extracted from the matrix to ensure nothing has been inadvertently altered.The extraction must be performed on the Linux version of Half-Life and Opposing Force because GDB is used to inspect memory at runtime. The Windows debugging workflow does not provide the same straightforward access to the symbol
CBaseMonster::IRelationship(CBaseEntity*)::iEnemy needed for this script.