### Install Python Dependencies Source: https://github.com/matherunner/hldoc/blob/master/README.md Install the required Python packages listed in 'requirements.txt' after activating the virtual environment. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/matherunner/hldoc/blob/master/README.md Install Node.js packages required for the MathJax rendering script. ```bash npm install ``` -------------------------------- ### Build HLPR Documentation Source: https://context7.com/matherunner/hldoc/llms.txt Commands to set up a Python virtual environment, install dependencies, and build the HTML documentation with MathJax pre-rendering. Includes commands for cleaning build artifacts. ```bash # Create and activate Python virtual environment python -m venv venv . ./venv/bin/activate # Install Python dependencies (Sphinx, themes, extensions) pip install -r requirements.txt # Install Node.js dependencies for MathJax rendering npm install # Build the HTML documentation with MathJax pre-rendering python build.py build # Clean build artifacts python build.py clean ``` -------------------------------- ### TikZ Animation Loop Example Source: https://github.com/matherunner/hldoc/blob/master/STYLEGUIDE.md Generates multiple TikZ frames for animation by iterating within a \foreach loop. Each \tikzpicture environment creates a new frame. Ensure \pgffor is installed. ```tex \foreach \i in {1,...,5} { \begin{tikzpicture} % TikZ drawing commands here \end{tikzpicture} } ``` -------------------------------- ### Game Frame Timing Discrepancy Example Source: https://github.com/matherunner/hldoc/blob/master/source/basicphy.md Illustrates the observed timing differences between StartFrame and PlayerPreThink calls, highlighting potential issues with gpGlobals->time updates. ```none startframe, g_ulFrameCount = 3, gpGlobals->time = 1.001 prethink, g_ulFrameCount = 3, gpGlobals->time = 1.003 startframe, g_ulFrameCount = 4, gpGlobals->time = 1.002 prethink, g_ulFrameCount = 4, gpGlobals->time = 1.004 ... ``` -------------------------------- ### Create Python Virtual Environment Source: https://github.com/matherunner/hldoc/blob/master/README.md Use this command to create a Python virtual environment named 'venv'. Ensure Python is installed. ```bash python -m venv venv ``` -------------------------------- ### TikZ Document Class Setup Source: https://github.com/matherunner/hldoc/blob/master/STYLEGUIDE.md This is the standard document class for TikZ graphics. Ensure Baskerville 10 Pro and Dark Modern typefaces are installed before use. ```tex \documentclass{hlprtikz} \usepackage{tikz} \begin{document} \end{document} ``` -------------------------------- ### Player Velocity Delta Definition Example Source: https://github.com/matherunner/hldoc/blob/master/source/basicphy.md Shows how player velocity components are defined for network transmission, indicating limited precision and rounding. ```none DEFINE_DELTA( velocity[0], DT_SIGNED | DT_FLOAT, 16, 8.0 ), DEFINE_DELTA( velocity[1], DT_SIGNED | DT_FLOAT, 16, 8.0 ), ... ... DEFINE_DELTA( velocity[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ), ``` -------------------------------- ### Build HTML Documentation Source: https://github.com/matherunner/hldoc/blob/master/README.md Execute the build script to generate the HTML files for the documentation. ```bash python build.py build ``` -------------------------------- ### List all commands Source: https://github.com/matherunner/hldoc/blob/master/source/player.md Use the 'cmdlist' command in the game console to generate a list of all available console commands. This is useful for understanding the full range of player and game controls. ```console cmdlist ``` -------------------------------- ### Maximum Groundstrafe Speed Source: https://context7.com/matherunner/hldoc/llms.txt Calculates the maximum groundstrafe speed achievable in a steady state, considering friction and acceleration parameters. Provides an example value at 1000fps with default settings. ```mathematica Maximum groundstrafe speed (steady state): v_max = M * √(k_e * A * (2 - τ * k_e * A) / (k * (2 - τ * k))) At 1000fps with defaults: v_max ≈ 505.2 ups ``` -------------------------------- ### Maximum Acceleration Strafing - Speed After n Frames Source: https://context7.com/matherunner/hldoc/llms.txt Formula to calculate the player's speed after 'n' frames of airstrafing, assuming no friction. Includes an example calculation for frames needed to reach a target speed. ```mathematica Speed after n frames of airstrafing (no friction): ||v_n|| = √(||v_0||² + n * k_e * τ * M * A * (2L - k_e * τ * M * A)) Example: Frames to airstrafe from 320 to 1000 ups at 1000fps, default settings: 1000² = 320² + n * 0.001 * 320 * 10 * (60 - 0.001 * 320 * 10) n ≈ 4938 frames ``` -------------------------------- ### Activate Python Virtual Environment Source: https://github.com/matherunner/hldoc/blob/master/README.md Activate the created Python virtual environment. This command is for Unix-like systems. ```bash . ./venv/bin/activate ``` -------------------------------- ### Set pitch speed for precise viewangle control Source: https://github.com/matherunner/hldoc/blob/master/source/player.md To achieve precise viewangle control in TAS, 'cl_pitchspeed' can be set to a calculated value. This example demonstrates calculating 'cl_pitchspeed' to achieve a specific pitch change within a frame, accounting for game physics and potential floating-point inaccuracies by targeting a slightly higher value. ```console cl_pitchspeed = 9.5 * (360 / 65536) / 0.001 ``` -------------------------------- ### Bind a key to a command Source: https://github.com/matherunner/hldoc/blob/master/source/player.md The 'bind' command is used to associate a keyboard key with a specific game command. This is typically done in 'config.cfg' for default controls, such as binding the 'W' key to '+forward'. ```console bind "W" "+forward" ``` -------------------------------- ### Set Player Random Seed in CmdStart Source: https://github.com/matherunner/hldoc/blob/master/source/game.md This C++ function demonstrates how the player's `random_seed` is set within the `CmdStart` function, receiving the seed value from the engine. This is a key part of the shared RNG's seeding process. ```cpp void CmdStart( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ) { entvars_t *pev = (entvars_t *)&player->v; CBasePlayer *pl = dynamic_cast< CBasePlayer *>( CBasePlayer::Instance( pev ) ); [...omitted...] pl->random_seed = random_seed; } ``` -------------------------------- ### Optimize SVG with SVGO Source: https://github.com/matherunner/hldoc/blob/master/STYLEGUIDE.md Use the `svgo` program to optimize SVG files. The `--multipass` and `-p 2` flags can be used for more thorough optimization with Inkscape-generated SVGs. ```bash svgo ``` ```bash svgo --multipass -p 2 ``` -------------------------------- ### Set Document Theme Source: https://github.com/matherunner/hldoc/blob/master/source/_templates/base.html Sets the 'theme' data attribute on the document body to 'light'. This is typically used for client-side theme management. ```javascript document.body.dataset.theme = 'light' ``` -------------------------------- ### Enable Fullbright for Map Illumination Source: https://github.com/matherunner/hldoc/blob/master/source/practical.md Use `r_fullbright 1` to illuminate the entire map, essential for clear visibility during TAS development. This command requires `sv_cheats` to be enabled. ```console r_fullbright 1 ``` -------------------------------- ### Gravity Calculation (Leapfrog Integration) Source: https://context7.com/matherunner/hldoc/llms.txt Details Half-Life's split gravity calculation using leapfrog integration for vertical motion. Shows how velocity and position are updated before and after the position update step. ```mathematica Gravity calculation (leapfrog integration): Before position update (PM_AddCorrectGravity): v_z ← v_z - (1/2)*g*τ + b_z*τ b_z ← 0 Position update: r_z' = r_z + v_z * τ After position update (PM_FixupGravityVelocity): v_z ← v_z - (1/2)*g*τ Result matches classical mechanics: v_z' = v_z - g*τ r_z' = r_z + v_z*τ - (1/2)*g*τ² Where: - g = sv_gravity * g_e (entity gravity multiplier) - b_z: vertical basevelocity - τ: player frame time (τ_p) ``` -------------------------------- ### Reset m_flNextAttack on Restore Source: https://github.com/matherunner/hldoc/blob/master/source/weapons.md In CBasePlayer::Restore, m_flNextAttack is reset to UTIL_WeaponTimeBase() when CLIENT_WEAPONS is defined, effectively bypassing the switching delay after a saveload. ```c++ #if defined( CLIENT_WEAPONS ) // HACK: This variable is saved/restored in CBaseMonster as a time variable, but we're using it // as just a counter. Ideally, this needs its own variable that's saved as a plain float. // Barring that, we clear it out here instead of using the incorrect restored time value. m_flNextAttack = UTIL_WeaponTimeBase(); #endif ```