This tutorial will show you the basics of using newbspguy to edit already compiled BSP files.
This tutorial uses UnrealKaraulov's fork of wootguy's bspguy due to the many added features, and the decoupling from a strictly Sven Co-op focused workflow of the original.
This tutorial is a work in progress. Feel free to edit and add relevant information that might be missed
Preface
The workflow of editing already-compiled maps is totally different from making a map from scratch.
In the past, it was easier to just decompile a BSP back to .MAP, and start building up from there, because the typical modding workflow assumes you start from a map in an editor. However, there are several drawbacks to this method:
- Decompilation is a messy process. Due to how the BSP data is structured, the entire level is chopped up across planes, which goes all over the place irrespective of the original brush shape. Decompilers faithfully follow the planes structure, resulting in brushes that likewise go all over the place. Many of them would also be invalid solids and need to be recreated.
- You lose all texture lighting data. 9 times out of 10 a custom map would be using custom texlights entries that are different, or absent, from the stock valve.rad. Your option is to recreate texlights by estimation and guesswork, which won't give you 100% of the original texlight values.
- You lose all clipping data, because no decompiler as of time of writing is able to recreate "Clip" brushes from the clipnode trees since clipnode trees are not technically part of the level geometry.
However, as of 2023, there now exists tools that let you edit already compiled BSPs directly, namely, bspguy and its fork newbspguy. The original tool was created exactly to port GoldSrc maps over to Sven Co-op, but both tools, especially the latter, can be used just as well to edit maps for any GoldSrc game/mod.
Pros, Cons, and Caveats
The advantages of editing BSPs in place are:
- Lightmaps are preserved.
- No messing with messy and invalid decompiled brushwork.
- No need to recreate clip brushes.
- Trivial brush entity duplication, that normally doesn't add to BSP model count.
The disadvantages are as follows:
- You cannot edit world brushes whatsoever.
- You cannot do crazy texture scaling since it's tied to the lightmap size.
- You cannot edit clip nodes.
Do note of these differences for compiled BSPs:
func_detail
is not a thing in compiled BSPs; they're transformed to normal brushes during compilation. You need to use func_wall
or func_illusionary
clip
brushes are also not a thing; they're transformed into clip nodes which you cannot edit. You can however use the default BSP solid models the program creates to artificially add collision. Do note that this adds to the BSP model count so be conservative.
origin
brushes are not a thing; the BSP models already has its own origin on creation, which you can move.
Setting up newbspguy
- Extract newbspguy into a folder.
- Run the program.
- Open File > Settings.
- Under General, click Reset All Settings.
- Under General > Game directory, set to location of your Half-Life installation.
- Under FGDs, add the FGD of your target mod. Please note that [new]bspguy doesn't support JACK's extended FGD.
- Under Asset paths, add relative paths in the following format:
<mod folder>/
. There should be at least these entries:
valve/
<the target mod>/
(if that isn't valve)
- Click "Apply settings". Close the options window.
General settings FGDs Asset paths
Editing maps
Provided you've set up the correct FGD and asset path(s), you are now set to edit the maps for your target mod. Here are some tasks that you should be able to master:
Adding point entities
- Create > Entity
- Right-click on the new entity > Properties
- Click on class, and in the dropdown menu, select the target entity.
- Edit the entity as you would in Hammer/JACK.
Adding and sizing solid entities
- Create > BSP Solid Model
- Right-click on the new brush entity > Transform
- Set
Target: Object
and 3D Axes: Scale
- Grab the edge handle and drag it to the desired size. Repeat for all directions as required.
- Reset to
3D Axes: Move
. Close Transform window.
- Right-click on the new entity > Properties
- Click on class, and in the dropdown menu, select the target entity.
- Edit the entity as you would in Hammer/JACK.
Duplicate entities
Simply copy and paste them. Both point and solid entities are supported.
You can also duplicate the BSP model of solid entities. This is only useful if the duplicated entity is in a different lighting condition from the original. You can then apply a different lightmap from the original BSP model. However do note that lightmap editing feature can be unstable. Duplicating a BSP model adds towards the BSP model count, so don't go wild on it.
Editing keyvalues
Editing keyvalues is the same as in Hammer or JACK. These notes might be useful:
- You can duplicate existing solid entities. They will share the same model, which is an index into their BSP model (in the form of
*number
).
- Be aware that compiler keyvalues e.g.
zhlt_*
do nothing.
[Re]texturing a face
- Switch to face editing mode by clicking on the second icon on the top right corner.
- Click on a face.
- Edit the face's name and shift values.
- Switch back to Object selection mode when you're done (first icon on top left).
You cannot make drastic edits to a face's scale since the face's lightmap is intrinsically tied to the texture scale, and large changes will corrupt the lightmaps.
- Angle edits not tested. It shouldn't be a problem if the "Lock angles" is checked (ie. only rotating the textures instead of skewing them)
Adding a sign
- Create a solid model as shown above. Set the size to match the sign's size in pixels, and set the entity to be
func_wall
or func_illusionary
.
- Assign the texture to the front face of the entity.
- Shift the texture to fit the face. Oftentimes it'd be easier to scale the model to fit the texture instead, then move it back to the intended position.
- Uncheck "Special" flag. The face will turn black, because there is no lightmap data on it.
- Select the face of the wall behind the sign. Be sure to pick a face roughly the same size or slightly larger as the sign (preferably the latter) in both dimensions.
- Right click > Copy lightmap.
- Select the sign face. Right click > Paste lightmap.
Adding brushes at an angle
You can either start by duplicating existing brush models, or creating a new one for scratch. For the latter, follow the previous method of applying a texture and lightmap to all faces.
Now the issue of turning the solid entity at an angle... The hard way would be to jump into the vertex editing mode and moving the vertices into position, with a lot of math if you want to keep the scale. A simpler way would be to turn the brush into a
func_tank
and set its angle and origin. it'd face the given direction at spawn. The default spawn flags should be sufficient; obviously don't set it to active.
Worldspawn model vertices can be edited using Face tool, but it not easy, and map crash if do big changes.
Whole map can be exported to .obj with all textures (for example convert part of map to .MDL to bypass BSP limits) but without lightmaps.
Also part of map can be compiled as func_wall and exported to .BSP model with working lightmap and collision to bypass BSP limits.
Also can export .wad from embedded textures. Import textures back to map. Can export files needed for HLRAD.exe for recompile lightmaps. Any bsp solid entity can be exported as .BSP model with working collision and lightmap.
New update has many bugfixes. Please create issue on GitHub if have problems or feature requests
This tutorial definitely needs a part 2 for the more advanced tasks e.g. vertex manipulation, bsp import/export, lightmap editing.
textures can be scaled as need because now lightmap can be recalculated after any changes.
Clipnodes can be edited only for non worldspawn models via Vertex Transformation widget.
As for vertex editing, I just don't recommend it at all too. It's way more cumbersome, and way way harder to get satisfactory result than to get completely broken result. I honestly don't know how a face whose vertices are non-planar would act inside the game. If there's face splitting ability in world faces and easier vertex shifting via handles vs textboxes then it might be feasible, but still not recommended because of the non-planar thing. *
The main takeaway is that just because it's doable with the BSP structure doesn't mean the game engine that's going to parse and run the BSP would like it. If the game engine doesn't like it, don't do it.
I still don't have any draft for a part 2 of this tutorial. 😅
EDIT 1:
* Tested face vertex editing. It messes up lightmaps elsewhere on a map.
aaalso added cull face feature
full VIS editor (but button create new leaf not works because still don't know how to add new leaf, game cant see new leaves)
fps optimization
updated cmd line options