/rehlds

Reverse-engineered HLDS

Primary LanguageC++GNU General Public License v3.0GPL-3.0

ReHLDS C/C++ CI GitHub release (by tag) GitHub all releases Percentage of issues still open License: GPL v3 ReHLDS

Reverse-engineered (and bugfixed) HLDS

What is this?

ReHLDS is a result of reverse engineering of original HLDS (build 6152/6153) using DWARF debug info embedded into linux version of HLDS, engine_i486.so

Along with reverse engineering, a lot of defects and (potential) bugs were found and fixed

You can try playing on one of many servers that are using ReHLDS: Game Tracker

Goals of the project

  • Provide more stable (than official) version of Half-Life dedicated server with extended API for mods and plugins
  • Performance optimizations (use of SSE for vector math for example) is another goal for the future

How can use it?

ReHLDS is fully compatible with the official pre-anniversary edition of HLDS (engine version <= 8684) downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information.

Warning! ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.

Downloading HLDS via steamcmd

app_set_config 90 mod cstrike
app_update 90 -beta steam_legacy validate

Downloads

ReHLDS binaries require SSE, SSE2 and SSE3 instruction sets to run and can benefit from SSE4.1 and SSE4.2

Warning! ReHLDS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original hlds. This means that plugins that do binary code analysis (Orpheu for example) probably will not work with rehlds.

Configuring

Click to expand
  • listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
  • syserror_logfile <filename> // File for the system error log. Default: sys_error.log
  • sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
  • sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
  • sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an unknown command. Default: 0
  • sv_rcon_condebug <1|0> // Print rcon debug in the console. Default: 1
  • sv_force_ent_intersection <1|0> // In a 3-rd party plugins used to force colliding of SOLID_SLIDEBOX entities. Default: 0
  • sv_rehlds_force_dlmax <1|0> // Force a client's cl_dlmax cvar to 1024. It avoids an excessive packets fragmentation. Default: 0
  • sv_rehlds_hull_centering <1|0> // Use center of hull instead of corner. Default: 0
  • sv_rehlds_movecmdrate_max_avg // Max average level of 'move' cmds for ban. Default: 400
  • sv_rehlds_movecmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
  • sv_rehlds_movecmdrate_max_burst // Max burst level of 'move' cmds for ban. Default: 2500
  • sv_rehlds_movecmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
  • sv_rehlds_send_mapcycle <1|0> // Send mapcycle.txt in serverinfo message (HLDS behavior, but it is unused on the client). Default: 0
  • sv_rehlds_stringcmdrate_max_avg // Max average level of 'string' cmds for ban. Default: 80
  • sv_rehlds_stringcmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
  • sv_rehlds_stringcmdrate_max_burst // Max burst level of 'string' cmds for ban. Default: 400
  • sv_rehlds_stringcmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
  • sv_rehlds_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". See [wiki](https://github.com/dreamstalker/rehlds/wiki/Userinfo-keys) to collect sufficient set of keys for your server. Default: ""
  • sv_rehlds_attachedentities_playeranimationspeed_fix // Fixes bug with gait animation speed increase when player has some attached entities (aiments). Can cause animation lags when cl_updaterate is low. Default: 0
  • sv_rehlds_maxclients_from_single_ip // Limit number of connections at the same time from single IP address, not confuse to already connected players. Default: 5
  • sv_rehlds_local_gametime <1|0> // A feature of local gametime which decrease "lags" if you run same map for a long time. Default: 0
  • sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist.
  • sv_usercmd_custom_random_seed // When enabled server will populate an additional random seed independent of the client. Default: 0
  • sv_net_incoming_decompression <1|0> // When enabled server will decompress of incoming compressed file transfer payloads. Default: 1
  • sv_net_incoming_decompression_max_ratio <0|100> // Sets the max allowed ratio between compressed and uncompressed data for file transfer. (A ratio close to 90 indicates large uncompressed data with low entropy) Default: 80.0
  • sv_net_incoming_decompression_max_size <16|65536> // Sets the max allowed size for decompressed file transfer data. Default: 65536 bytes
  • sv_net_incoming_decompression_punish // Time in minutes for which the player will be banned for malformed/abnormal bzip2 fragments (0 - Permanent, use a negative number for a kick). Default: -1
  • sv_tags <comma-delimited string list of tags> // Sets a string defining the "gametags" for this server, this is optional, but if it is set it allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value. Default: ""
  • sv_filterban <-1|0|1>// Set packet filtering by IP mode. -1 - All players will be rejected without any exceptions. 0 - No checks will happen. 1 - All incoming players will be checked if they're IP banned (if they have an IP filter entry), if they are, they will be kicked. Default: 1

Commands

  • rescount // Prints the total count of precached resources in the server console
  • reslist <sound | model | decal | generic | event> // Separately prints the details of the precached resources for sounds, models, decals, generic and events in server console. Useful for managing resources and dealing with the goldsource precache limits.
  • rcon_adduser <ipaddress/CIDR> // Add a new IP address or CIDR range to RCON user list (This command adds a new IP address to the RCON user list. The specified IP or CIDR range is granted privileged access to server console. Without any Rcon users, access is allowed to anyone with a valid password)
  • rcon_deluser <ipaddress> {removeAll} // Remove an IP address or CIDR range from RCON user list
  • rcon_users // List all IP addresses and CIDR ranges in RCON user list

Build instructions

Checking requirements

There are several software requirements for building rehlds:

Windows

Visual Studio 2015 (C++14 standard) and later

Linux

cmake >= 3.10
GCC >= 4.9.2 (Optional)
ICC >= 15.0.1 20141023 (Optional)
LLVM (Clang) >= 6.0 (Optional)

Building

Windows

Use Visual Studio to build, open msvc/ReHLDS.sln and just select from the solution configurations list Release Swds or Debug Swds

Linux

  • Optional options using build.sh --compiler=[gcc] --jobs=[N] -D[option]=[ON or OFF] (without square brackets)
-c=|--compiler=[icc|gcc|clang]  - Select preferred C/C++ compiler to build
-j=|--jobs=[N]                  - Specifies the number of jobs (commands) to run simultaneously (For faster building)

Definitions (-D)
DEBUG                           - Enables debugging mode
USE_STATIC_LIBSTDC              - Enables static linking library libstdc++
  • ICC
    ./build.sh --compiler=intel
  • LLVM (Clang)
    ./build.sh --compiler=clang
  • GCC
    ./build.sh --compiler=gcc
Checking build environment (Debian / Ubuntu)
Click to expand
  • Installing required packages
    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install -y gcc-multilib g++-multilib
    sudo apt-get install -y build-essential
    sudo apt-get install -y libc6-dev libc6-dev-i386
    
  • Select the preferred C/C++ Compiler installation
    1) sudo apt-get install -y gcc g++
    2) sudo apt-get install -y clang
    

How can I help the project?

Just install it on your game server and report problems you faced. Merge requests are also welcome :)