BSPSource

repository·master·Indexed 21 days ago

https://github.com/ata4/bspsrc

A Java-based tool for decompiling Source engine .bsp map files back into .vmf (Valve Map Format) files for use in the Hammer editor. It includes a CLI for batch processing, options to configure entity and brush decompilation, and the ability to extract embedded materials and models. It supports most Source engine games but does not support GoldSrc or Source 2.

Tokens
1.8K
Snippets
4
Records
12
Agent score
75%

What's inside BSPSource

  1. Supported and unsupported engines

    master

    BSPSource is designed for the Source engine.

    • Supported: Most Source engine games work out of the box.
    • Unsupported:
      • GoldSrc (older engine)
      • Source 2 (newer engine)

    If you encounter errors with a specific Source engine game, you should open an issue on GitHub.

  2. Install and run BSPSource

    master

    BSPSource is a Java-based map decompiler that converts Source engine .bsp files into .vmf files for use in the Hammer editor.

    Installation Steps

    1. Download the appropriate release from the releases page:
      • bspsrc-linux.zip for Linux.
      • bspsrc-windows.zip for Windows.
      • bspsrc-jar-only.zip for any system with Java 24+ installed and configured.
    2. Extract the contents of the downloaded zip file to a new folder.

    Launching the Application

    Run the corresponding script for your operating system:

    • Windows: bspsrc.bat or bspinfo.bat
    • Linux: bspsrc.sh or bspinfo.sh
    # Example for Linux users
    chmod +x bspsrc.sh
    ./bspsrc.sh
  3. Use the BSPSource CLI

    master

    BSPSource is a command-line tool used to decompile BSP files into VMF (Valve Map Format) files. You can provide one or more BSP files or directories as positional parameters. If you use the --list flag, the tool will treat the provided paths as text files containing lists of BSP file paths (one per line).

    # Decompile a single BSP file
    bspsrc map.bsp
    
    # Decompile all BSP files in a directory
    bspsrc ./maps_folder/
    
    # Decompile using a text file containing a list of BSP paths
    bspsrc --list list_of_maps.txt
    
    # Decompile multiple files and specify an output directory
    bspsrc -o ./output_dir/ map1.bsp map2.bsp
  4. Run the BSPSource CLI

    master

    BSPSource is a command-line tool. You can launch it by executing the main class. If you run the application without any arguments, it will display the usage information (help text) to the console. To perform specific tasks, you must provide the appropriate commands and options as defined by the CLI surface.

    # To view usage/help:
    java -cp <classpath> info.ata4.bspsrc.app.src.cli.BspSourceCli
    
    # To execute a command:
    java -cp <classpath> info.ata4.bspsrc.app.src.cli.BspSourceCli <command> [options]
  5. Fix gray textures and error models in Hammer

    master

    If decompiled maps show gray textures or error models in Hammer, it is likely because the materials/models were embedded in the .bsp file (common in workshop maps or maps using csgo's automcombine prop feature) rather than existing in the game's base files.

    Solution

    1. In the BSPSource decompiler, check the Extract embedded files option.
    2. Once extracted, move the contents of the resulting material/model folders into your game's corresponding material/ or model/ directory.
  6. Entity restoration limitations

    master

    Some internal entities that are entirely consumed by vbsp cannot be perfectly restored during decompilation. If your map relies heavily on these, they may not function as expected in the .vmf file:

    • func_instance
    • func_instance_parms
    • func_instance_origin
    • func_viscluster
    • info_no_dynamic_shadow
  7. Configure Entity Decompilation

    master

    You can control which types of entities are written to the resulting VMF file using various --no_<type> flags. By default, most entity types are included.

    Available Entity Options:

    • --no_point_ents: Don't write any point entities.
    • --no_brush_ents: Don't write any brush entities.
    • --no_sprp: Don't write prop_static entities.
    • --no_overlays: Don't write info_overlay entities.
    • --no_cubemaps: Don't write env_cubemap entities.
    • --no_details: Don't write func_detail entities.
    • --no_areaportals: Don't write func_areaportal(_window) entities.
    • --no_occluders: Don't write func_occluder entities.
    • --no_ladders: Don't write func_ladder entities.
    • --no_visclusters: Don't write func_viscluster entities.
    • --no_rotfix: Don't fix instance entity brush rotations for Hammer.
    • --force_manual_areaportal: Force manual entity mapping for areaportal entities.
    • --merge_details: Merge func_detail brushes with touch into one entity.
  8. Global CLI Options

    master

    Common flags available for the bspsrc command:

    • -d, --debug: Enable debug mode. Increases verbosity and adds additional data to the VMF file.
    • -r, --recursive: Recursively decompile files found in subdirectories.
    • -o, --output <path>: Override output path for VMF file(s). Treated as a directory if multiple BSP files are provided.
    • -l, --list: Treat specified files as text files containing a BSP file list (one path per line).
  9. Configure Miscellaneous Decompilation Settings

    master

    General settings for the decompilation process.

    Miscellaneous Options:

    • --no_vmf: Don't write any VMF files, read BSP only.
    • --no_lumpfiles: Don't load lump files (.lmp) associated with the BSP file.
    • --no_prot: Skip decompiling protection checking (increases speed for unprotected maps).
    • --no_visgroups: Don't group entities from instances into visgroups.
    • --no_cams: Don't create Hammer cameras above each player spawn.
    • --appid <id>: Overrides game detection by using this Steam Application ID instead.
    • --format <format>: Sets the VMF format:
      • AUTO: Automatic
      • OLD: Source 2004 to 2009
      • NEW: Source 2010 and later
    • --unpack_embedded: Unpack embedded files in the bsp.
    • --no_smart_unpack: Disable 'smart' extracting of embedded files (smart extracting skips files generated by vbsp).
  10. Configure Brush Decompilation

    master

    Control how world brushes and displacement surfaces are handled during decompilation.

    Brush Options:

    • --no_brushes: Don't write any world brushes.
    • --no_disps: Don't write displacement surfaces.
    • --brushmode <mode>: Sets the brush decompiling mode. Valid modes are:
      • BRUSHPLANES: brushes and planes
      • ORIGFACE: original faces only
      • ORIGFACE_PLUS: original + split faces
      • SPLITFACE: split faces only
    • --thickness <value>: Thickness of brushes created from flat faces in units.
  11. Configure Texture Replacement and Fixes

    master

    Modify how textures are handled in the decompiled output.

    Texture Options:

    • --facetex <texture>: Replace all face textures with this one.
    • --bfacetex <texture>: Replace all back-face textures with this one (used in face-based decompiling modes only).
    • --no_cubemaptexfix: Don't fix environment-mapped materials.
    • --no_ttfix: Don't fix tool textures (e.g., toolsnodraw, toolsblocklight).
    • --nodraw_invis-sides: Apply toolsnodraw texture to brushsides which are not rendered in game (mainly sides facing the void).