Skip to content

Features

YaLTeR edited this page Jul 28, 2024 · 32 revisions

bxt-rs Modules

Each module represents a feature or a set of features of bxt-rs. Console commands and variables starting with an underscore (_) are not meant for normal use.

This wiki page is generated automatically with src/bin/gen-wiki.rs. Do not edit it by hand.

bxt_disable_loading_text

Disabling the LOADING text.

Console Variables

  • bxt_disable_loading_text (default: "0")

    Set to 1 to disable the LOADING text.

bxt_emit_sound

Emitting and stopping sounds.

Console Commands

  • bxt_emit_sound <sound> <channel> [volume] [from] [to] [attenuation] [flag] [pitch] Plays sound file directly from SV_StartSound.

  • bxt_emit_sound_dynamic <sound> <channel> [volume] [from] [to] [attenuation] [flag] [pitch]

    Plays sound file directly from S_StartDynamicSound.

  • bxt_emit_sound_stop_sound_except <list of channels seperated by space>.

    Stops emitting sounds from every channel except given list of channels.

bxt_fade_remove

Removing the screen blackout effect.

Console Variables

  • bxt_fade_remove (default: "0")

    Set to 1 to disable the screen blackout effect.

bxt_fix_widescreen_fov

Correcting widescreen vertical field-of-view.

Console Variables

  • bxt_fix_widescreen_fov (default: "0")

    Fixes reduction in vertical field-of-view of widescreen. Compatible with bxt_force_fov.

bxt_force_fov

Overriding the field-of-view.

Console Variables

  • bxt_force_fov (default: "0")

    Field-of-view to set.

    This variable will work even when default_fov doesn't work or when default_fov is set by the demo. Set to 0 to disable the override.

bxt_hud_scale

Changing the scale of the HUD elements like health and ammo count.

Console Variables

  • bxt_hud_scale (default: "0")

    Sets the scale of the HUD elements. For example, 2 makes them 2 times bigger.

    Setting to 0 disables the bxt-rs scaling code, making it a safer default than 1.

bxt_lightstyle

Change rendering light styles.

Console Commands

  • bxt_lightstyle_apply [preset]

    Apply lightstyle changes. Takes an optional argument for instantly applying a preset.

Console Variables

  • bxt_lightstyle (default: "0")

    Preset controls. Must invoke apply command to take effects. Persists across level changes.

    • 0: Off
    • 1: Maximum brightness
    • 2: Full bright
    • 3: Maximum darkness
    • 4: Mildy darker
  • bxt_lightstyle_custom (default: "")

    Custom controls. Takes precedence over preset when using bxt_lightstyle_apply.

    First value is effect. Second value is amount. E.g.: bxt_lightstyle_custom "1 nomnomnom".

bxt_novis

Rendering entities behind walls.

Console Variables

  • bxt_novis (default: "0")

    Set to 1 to render entities behind walls.

bxt_remote_forbid

Forbidding this game from connecting as a remote client to other instances.

Console Commands

  • bxt_remote_forbid [0|1]

    Disconnects this game from other game instances, and forbids future connections. If called with argument 0, then lets the game connect again.

bxt_scoreboard_remove

Hiding the scoreboard.

Console Variables

  • bxt_scoreboard_remove (default: "0")

    Set to 1 to hide the scoreboard.

bxt_shake_remove

Removing the screen shake effect.

Console Variables

  • bxt_shake_remove (default: "0")

    Set to 1 to disable the screen shake effect.

bxt_skybox_remove

Disabling the skybox drawing.

Console Variables

  • bxt_skybox_remove (default: "0")

    Set to 1 to remove the skybox.

bxt_tas_log

Logging the player state during TAS playback.

This is a useful subset of bxt_tas_log, including RNG state dumping, when you can't use the one from the original Bunnymod XT.

Console Commands

  • bxt_tas_log <0|1>

    Enables (1) or disables (0) TAS logging into the file at bxt_tas_log_filename.

Console Variables

  • bxt_tas_log_filename (default: "taslogger.log")

    Filename of the log file to write.

  • _bxt_tas_log_write_full_rng_state (default: "0")

    Set to 1 to write the full engine RNG state every frame.

    This massively increases the log file size while being seldom needed, so it's not enabled by default.

bxt_viewmodel_remove

Removing the viewmodel.

Console Variables

  • bxt_viewmodel_remove (default: "0")

    Set to 1 to disable rendering viewmodel.

bxt_wallhack

Seeing through walls.

Console Variables

  • bxt_wallhack (default: "0")

    Set to 1 to enable the wallhack.

  • bxt_wallhack_additive (default: "0")

    Set to 1 to make the wallhack additive, which sometimes makes objects easier to see.

Campath

Loading and exporting campath motion .cam or .bvh by HLAE and its Blender addon.

Console Commands

  • bxt_campath_export_start [filename.cam]

    Starts capturing player's position and viewangle from either gameplay or demo into .cam format.

    Automatically stops when demo stops.

    When capturing motion from demo, in order to speed up, try timedemo "demoname".

  • bxt_campath_export_stop

    Stops capturing player motion.

  • bxt_campath_force_live

    Forces campath to execute and reset related states. Useful for playing back specifically during live gameplay.

Console Variables

  • bxt_campath_load (default: "")

    Loads campath .cam or .bvh file for playback during demo.

  • bxt_campath_offset (default: "-0.25")

    Offsets time values in second of each campath entry. Offset can be negative. Default is -0.25.

Comment command buffer overflow fix

Bunnymod XT spams demos with data stored in console command comments. They overflow the command buffer upon playback leading to console spam and commands being skipped. In particular, the command to play the next demo in bxt_play_run can get skipped, which means the demo playback interrupts mid-way.

This module strips prefix comments from console commands as they are added to the command buffer, preventing the overflow.

Console commands

Makes bxt-rs able to add console commands.

Console variables

Makes bxt-rs able to register console variables.

Custom HUD

Drawing custom HUD elements.

Help

Printing the list of modules, their console commands and variables and documentation.

Console Commands

  • bxt_help [module|command|variable]

    Without arguments, shows the list of modules and their status.

    With an argument, shows help for that module, command or variable.

Multiple demo playback

Playing multiple demos at once.

Console Commands

  • bxt_play_folder <folder>

    Plays back all demos in the folder in alphabetic order.

  • bxt_play_run <name>

    Plays back all name_N.dem demos in order.

Player-movement tracing

Makes bxt-rs able to use the game's player movement collision detection.

Skybox name

Changing skybox.

Console Commands

  • bxt_skybox_reload

    Forces skybox name change.

Console Variables

  • bxt_skybox_name (default: "")

    Sets skybox name.

    This does not take effect instantaneously unless reload command is also invoked.

    Example: bxt_skybox_name city

TAS optimizer

Brute-force optimization for TASes.

Console Commands

  • bxt_tas_optim_disable

    Stops and disables the optimizer.

  • bxt_tas_optim_minimize

    Minimizes the optimized script. This removes things like enabled autojump that does nothing because during this frame bulk the player never lands on the ground. It also joins together equivalent frame bulks.

  • bxt_tas_optim_reset

    Resets the optimizer path back to the non-optimized starting state.

    Use bxt_tas_optim_stop;bxt_tas_optim_reset after changing the optimization goal, or after toggling bxt_tas_optim_multiple_games, to start from scratch without having to replay the whole TAS.

  • bxt_tas_optim_save

    Saves the optimized script.

  • bxt_tas_optim_start

    Starts the optimization.

  • bxt_tas_optim_stop

    Stops the optimization.

  • _bxt_tas_optim_init <script.hltas> <frame number>

    Initializes the optimization with the given script, starting from the given frame.

    You're not meant to use this command directly. Instead, use bxt_tas_studio_optim_init (without arguments) if using TAS Studio, or bxt_tas_optim_init (without arguments) provided in Bunnymod XT, which sets the script name and frame number automatically.

  • _bxt_tas_optim_simulation_done

    Sends simulated frames to the remote server.

    You're not meant to use this command. It's run automatically by bxt-rs in simulator clients.

  • _bxt_tas_optim_simulation_start_recording_frames

    Starts recording frames to send to the remote server.

    You're not meant to use this command. It's run automatically by bxt-rs in simulator clients.

Console Variables

  • bxt_tas_optim_change_pitch (default: "0")

    When set to 1, the optimizer will mutate the pitch angle on the frame bulks where it is set.

  • bxt_tas_optim_change_single_frames (default: "0")

    Set to 0 to make the optimizer mutate entire frame bulks at once. Set to 1 to make the optimizer mutate individual frames.

    Generally 0 gives better results and produces a script ready to be copy-pasted. 1 can be useful for fine-tuning, e.g. if you're very close but barely not making the jump.

  • bxt_tas_optim_constraint_type (default: ">")

    Type of the constraint. Can be < or > for less-than and greater-than constraint, respectively.

  • bxt_tas_optim_constraint_value (default: "0")

    Value to constraint against.

  • bxt_tas_optim_constraint_variable (default: "")

    Set to a variable to constrain it. Possible values are the same as bxt_tas_optim_variable.

    A constraint is set by bxt_tas_optim_constraint_variable, bxt_tas_optim_constraint_type and bxt_tas_optim_constraint_value. It forces the variable to be less-than or greater-than the value. For example, you can set pos.x < 300 or speed > 500. Then those brute-force attempts that do not satisfy this constraint get discarded.

  • bxt_tas_optim_direction (default: "maximize")

    Direction to optimize bxt_tas_optim_variable towards. Can be minimize or maximize.

  • bxt_tas_optim_frames (default: "0")

    How much of the script, in number of frames, can be mutated in the single-frame mode.

    Use when you want the tail of the script to remain unchanged, but still included in the optimization objective.

  • bxt_tas_optim_multiple_games (default: "0")

    Set to 1 to use multi-game optimization.

    When set to 1, instead of prediction, the optimizer will use game instances launched in parallel to run the script. This results in 100% accurate simulation including entity interaction, but is much slower compared even to accurate prediction.

    You need to start one or more game instances in addition to the one running the optimizer.

  • bxt_tas_optim_random_frames_to_change (default: "6")

    Number of individual frames to mutate on every iteration in single-frame mode.

  • bxt_tas_optim_rhai_file (default: "")

    Set to filename.rhai to use a Rhai script as the optimization objective.

    The optimization objective can be set either with console variables (bxt_tas_optim_variable, bxt_tas_optim_direction and constraints), or as a Rhai script. The script should define three functions:

    • is_valid(curr) that returns whether the brute-force attempt is valid (analogue of constraint),
    • is_better(curr, best) that returns whether the brute-force attempt is better than the best one,
    • to_string(curr) that returns a string representation of the optimization objective.

    Here's an example script:

    fn is_valid(curr) {
        // X pos < -3500
        curr.pos[0] < -3500
    }
    
    fn is_better(curr, best) {
        // New Y pos > best Y pos
        curr.pos[1] > best.pos[1]
    }
    
    fn to_string(curr) {
        // Need to convert to string manually at the moment
        curr.pos[0].to_string()
    }
    

    The script can also define a should_pass_all_frames variable set to true to receive an array of all simulated frames of the brute-force attempt, rather than just the last one. Note that this makes it considerably slower. Here's an example:

    // Set this to true to get all frames rather than just one
    let should_pass_all_frames = true;
    
    fn is_valid(curr) {
        // You can use -1 to grab the last array element like in Python
        curr[-1].pos[0] < -3500
    }
    
    fn is_better(curr, best) {
        // Loop through all frames to find the highest Z we ever reached
        let best_z = best[0].pos[2];
        for player in best {
            if player.pos[2] > best_z {
                best_z = player.pos[2];
            }
        }
    
        let curr_z = curr[0].pos[2];
        for player in curr {
            if player.pos[2] > curr_z {
                curr_z = player.pos[2];
            }
        }
    
        curr_z > best_z
    }
    
    fn to_string(curr) {
        // You can reference variables that you set in is_better() here
        curr_z.to_string()
    }
    

    The Rhai language has an online playground with examples, a VSCode extension and a reference which you can find on its website: https://rhai.rs/.

  • bxt_tas_optim_simulation_accuracy (default: "0")

    Set to 1 to enable whole-map player movement tracing.

    This makes the optimization considerably slower, so only use it when 0 makes the optimizer path go through entities.

  • bxt_tas_optim_variable (default: "pos.x")

    Variable to optimize. Can be pos.x, pos.y, pos.z, vel.x, vel.y, vel.z or speed, which represents the horizontal speed.

TAS recording

Recording of real-time gameplay into a HLTAS script.

This is not perfect and needs a Bunnymod XT patch to set host_frametime directly instead of going through the host_framerate console variable (thus missing precision due to the f64->f32->f64 roundtrip) for better sync. Nevertheless, it was very useful for diagnosing and fixing a number of TAS determinism issues.

Console Commands

  • bxt_tas_recording_start <filename.hltas>

    Starts recording gameplay into a HLTAS script.

  • bxt_tas_recording_stop

    Stops gameplay recording.

TAS server time fix

Fixes server-side movement non-determinism when the player is stuck.

TAS studio

Interactive editor for TASes.

Console Commands

  • bxt_tas_studio_branch_clone

    Clones the current branch.

  • bxt_tas_studio_branch_focus_id <index>

    Focuses branch with the given index.

  • bxt_tas_studio_branch_focus_next

    Focuses the next visible branch.

  • bxt_tas_studio_branch_hide_and_focus_next <index>

    Hides the currently focused branch and focuses the next visible branch.

  • bxt_tas_studio_branch_hide_id <index>

    Hides the branch with the given index.

  • bxt_tas_studio_branch_show_id <index>

    Shows the branch with the given index.

  • bxt_tas_studio_close

    Closes the TAS studio.

  • bxt_tas_studio_convert_hltas <tas.hltas>

    Converts the HLTAS into a TAS project with the same name and .hltasproj extension, plays it back and opens the TAS editor.

  • bxt_tas_studio_delete

    Deletes the selected frame bulk or the line under cursor in the camera editor.

  • bxt_tas_studio_delete_last

    Deletes the last frame bulk of the current branch.

  • bxt_tas_studio_hide

    Hides the frames before the one under cursor to avoid clutter. If there's no visible frame under the cursor, makes all frames visible.

  • +bxt_tas_studio_insert_camera_line [key]

    Hold to insert camera lines in the camera editor mode.

  • bxt_tas_studio_load <tas.hltasproj>

    Loads the TAS project, plays it back and opens the TAS editor.

  • +bxt_tas_studio_look_around [key]

    Hold to look around in the TAS editor.

  • bxt_tas_studio_new <filename> <starting command> <FPS>

    Creates a new TAS project ready to use with the TAS studio.

    • filename is the filename of the project that will be created. The .hltasproj extension will be appended automatically.
    • starting command is the command to launch the map or load the save which the TAS will start from, for example "map c1a0" or "load tas-start".
    • FPS is the initial FPS for the TAS, for example 100 or 250 or 1000.

    The TAS will use your current movement settings such as bxt_bhopcap and sv_maxspeed.

    Example: bxt_tas_studio_new full_game "map c1a0" 100

  • bxt_tas_studio_optim_apply

    Applies the current best optimization result to the current branch.

  • bxt_tas_studio_optim_init

    Initializes the optimization starting from the selected frame bulk.

  • bxt_tas_studio_redo

    Redoes the last change to the script.

  • bxt_tas_studio_replay

    Replays the currently loaded TAS up to the stop frame.

  • bxt_tas_studio_replay_views

    Replays the currently loaded camera views of TAS up to the stop frame.

  • bxt_tas_studio_select_next

    Selects the next frame bulk.

  • bxt_tas_studio_select_prev

    Selects the previous frame bulk.

  • bxt_tas_studio_set_commands <console commands>

    Sets the console commands of the selected frame bulk.

  • bxt_tas_studio_set_frame_time <frame time>

    Sets the frame time of the selected frame bulk.

  • bxt_tas_studio_set_pitch <pitch>

    Sets the pitch of the selected frame bulk.

  • bxt_tas_studio_set_stop_frame [frame]

    Sets the stop frame to the frame under the cursor, or to the given frame number, if provided. The stop frame is a frame where the TAS playback stops and shows the TAS editor UI.

  • bxt_tas_studio_set_yaw <yaw>

    Sets the yaw of the selected frame bulk.

  • bxt_tas_studio_set_yawspeed

    Sets the yawspeed of the selected frame bulk for constant turn rate strafing.

  • bxt_tas_studio_smooth

    Applies smoothing to the hovered segment.

  • bxt_tas_studio_split

    Splits the frame bulk at frame under cursor.

  • bxt_tas_studio_toggle <what>

    Toggles a value on the selected frame bulk.

    Values that you can toggle:

    • s03: speed increasing strafing
    • s13: quick turn strafing
    • s22: slow down strafing
    • s00: speed increasing strafing to the left
    • s01: speed increasing strafing to the right
    • s10: quick turn strafing to the left
    • s11: quick turn strafing to the right
    • s06: left-right strafing
    • s07: right-left strafing
    • s40: constant turn rate to the left
    • s41: constant turn rate to the right
    • s50: accelerated turn to the left
    • s51: accelerated turn to the right
    • lgagst: makes autojump and ducktap trigger at optimal speed
    • autojump
    • ducktap
    • jumpbug
    • dbc: duck before collision
    • dbcceilings: duck before collision, including ceilings
    • dbg: duck before ground
    • dwj: duck when jump (useful for the long-jump module)
    • forward: +forward
    • left: +moveleft
    • right: +moveright
    • back: +back
    • up: +moveup
    • down: +movedown
    • jump: +jump
    • duck: +duck
    • use: +use
    • attack1: +attack1
    • attack2: +attack2
    • reload: +reload
  • bxt_tas_studio_undo

    Undoes the last change to the script.

  • bxt_tas_studio_unset_pitch

    Unsets the pitch of the selected frame bulk.

  • bxt_tas_studio_unset_yaw

    Unsets the yaw of the selected frame bulk.

  • _bxt_tas_studio_convert_hltas_from_bxt_tas_new <tas.hltas>

    This is a command used internally by Bunnymod XT. You should use bxt_tas_studio_convert_hltas instead.

  • _bxt_tas_studio_smooth_globally

    Applies smoothing to the entire script.

Console Variables

  • bxt_hud_tas_studio (default: "1")

    Whether to show the TAS studio HUD when in the TAS editor.

  • bxt_tas_studio_camera_editor (default: "0")

    Switches the TAS editor to the camera editor mode.

  • bxt_tas_studio_line_width (default: "2")

    The line width used for TAS editor drawing, in pixels.

  • bxt_tas_studio_show_player_bbox (default: "0")

    Whether to show the player bbox for the frame under the cursor.

  • _bxt_tas_studio_auto_smoothing (default: "0")

    Enables automatic global smoothing when working on the TAS. Requires a two-game setup.

    As you edit the TAS in the editor, it will be simulated in the second game as usual, then it will be simulated again with global smoothing applied to the entire script. The global-smoothed path will be displayed in orange alongside the original path.

    This is useful when working with global smoothing, as it will ever so slightly change the inputs, which can easily snowball into desyncs. Seeing the smoothed path will let you adjust the TAS to avoid big desyncs.

  • _bxt_tas_studio_smooth_small_window_multiplier (default: "3")

    Smoothing small window impact multiplier.

    Smoothing averages camera angles in a window centered around every frame. Within this window,there's a smaller window which has a higher contribution to the final smoothed camera angle. Thisconsole variable defines how much stronger the influence of the camera angles in the smaller windowis compared to the big window.

  • _bxt_tas_studio_smooth_small_window_s (default: "0.03")

    Smoothing small window size in seconds.

    Smoothing averages camera angles in a window centered around every frame. Within this window,there's a smaller window which has a higher contribution to the final smoothed camera angle. Thisconsole variable defines the size of the small window.

  • _bxt_tas_studio_smooth_window_s (default: "0.15")

    Smoothing window size in seconds.

    Smoothing averages camera angles in a window this big centered around every frame.

Triangle drawing

Makes bxt-rs able to draw shapes in the 3D space.

Video capture

Recording videos from demos and TAS playback.

Console Commands

  • bxt_cap_start [filename.mp4]

    Starts capturing video. The default filename is output.mp4.

    If the filename ends with .wav, captures only the sound.

  • bxt_cap_stop

    Stops capturing video.

Console Variables

  • bxt_cap_fps (default: "60")

    Frames-per-second of the recorded video.

  • bxt_cap_sampling_exposure (default: "0")

    Controls the amount of motion blur. 1 is the highest, 0 is no blur.

    Check the following link for a visual interactive tool where you can play with the sampling parameters: https://bxt.rs/blog/motion-blur-for-half-life-video-recording-with-vulkan/#samplingPlayground

    Technically, exposure controls how many of a video frame's sub-frames are blended into it. E.g. 1 means that all sub-frames are blended together, 0.5 means that only half of the sub-frames are blended together, 0.25 means that a quarter of the sub-frames are blended and so on. The blending always happens towards the end of the frame: that is, an exposure of 0.5 means that every frame is an average of the second half of that frame's sub-frames.

  • bxt_cap_slowdown (default: "1")

    Slowdown factor for the recording.

    For example, 2 means that the video will be two times slower than the realtime playback. Especially useful for TASes.

  • bxt_cap_sound_extra (default: "0")

    How many extra seconds of audio to mix and capture past the end of the recording.

  • bxt_cap_volume (default: "0.4")

    Volume of the recording.

    This is the same as the volume console variable, but for the recorded video. The volume variable itself does not affect the recorded video.

  • _bxt_cap_force_fallback (default: "0")

    Set to 1 to force the use of simple OpenGL capturing instead of the fast GPU-accelerated Vulkan capturing. Try this if you get artifacts on the recorded video.

  • _bxt_cap_override_ffmpeg_args (default: "")

    Extra arguments to pass to FFmpeg.

    When using this variable, you might want to also add some of the following arguments, that bxt-rs adds automatically when this variable is unset: -c:v libx264 -crf 15 -preset ultrafast -color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv -chroma_sample_location center.

  • _bxt_cap_sampling_min_fps (default: "7200")

    Minimum recording FPS for frames that make up a sampled frame.

    Check the following link for a visual interactive tool where you can play with the sampling parameters: https://bxt.rs/blog/motion-blur-for-half-life-video-recording-with-vulkan/#samplingPlayground

Video capture (one video per demo)

Recording separate video for each demo being played.

Console Commands

  • bxt_cap_separate_start [directory]

    Starts recording every demo into its own separate video with the same file name. If directory is provided, stores the videos in that directory, otherwise stores them in the same directory as the corresponding demo file.

    This command should be coupled with playdemo, bxt_play_run or bxt_play_folder. For example: bxt_play_folder my_folder_with_demos;bxt_cap_separate_start.

    Use bxt_cap_stop to stop the recording.

Video capture (skipping non-gameplay frames)

Skipping loading or broken frames.

Console Variables

  • bxt_cap_skip_non_gameplay_frames (default: "0")

    Skipping recording non-gameplay frames such as main menu, loading screen, or demo load. Set to 0 to disable. Set to 1 to enable.

    Any values higher than 1 will be the extra 'gameplay' frames being skipped. For example, 2 means one extra gameplay frame skipped during capture.

Viewmodel sway

Adding CS:GO-like weapon sway.

Console Variables

  • bxt_viewmodel_sway (default: "0")

    Setting to 1 enables weapon sway.

  • bxt_viewmodel_sway_max (default: "100")

    Max of sway.

  • bxt_viewmodel_sway_rate (default: "0.02")

    Rate of sway.

_bxt_rng_set

Setting the engine RNG state.

Console Commands

  • _bxt_rng_set "<idum> <iy> <iv[0]> <iv[1]> ... <iv[31]>"

    Sets the non-shared RNG state. The parameter is 34 numbers.