TrenchBroom

Problems I was having with it

  • double click and tool resets.

    • https://github.com/TrenchBroom/TrenchBroom/issues/4569

  • E and Q don't move up and down relatively.

    • https://github.com/TrenchBroom/TrenchBroom/issues/4570

  • No Box Select.

  • No Insec.

Explanations

Tools

  • Quick explanations and tips {0:00 -> 3:43}

  • shift + MB1

    • select individual faces.

  • shift + MB1 drag

    • Moves the face of the geometry (pseudo-extrusion of geometry).

  • ctrl + MB1 drag

    • Duplicates the selection.

  • alt + MB1 drag

    • Moves the selection on the z axis.

Brush
  • Enter

    • Confirms the object.

Clip
  • Requires at least 2 points to work, and at most 3 points.

  • If the 3 points cause any resulting geometry to become concave, then the Clip will not be performed.

  • ctrl + Enter

    • Flips which half of the geometry will be clipped.

Topology

Terrain
  • Small pond .

    1. Duplicate several cubes and place them perfectly touching.

    2. Make a 'func_detail_wall' out of them; maybe it's not necessary, etc.

    3. Select everything and drag vertices using the 2D view.

Circular Topology
Prefabs

Texturing

  • Texturing and UV controls .

    • Great video, very useful.

    • It basically explains everything about Texturing and UVs.

    • Everything explained is for general use. Nothing is Quake-specific.

Entities

BrushEntities
  • "Move Brush to World Spawn"

    • Removes any entity the brush had and turns it into a "classic" / "generic" brush.

    • In other words, it gives it classname -> worldspawn .

      • ~I think the correct label is Make structural ; maybe the app updated and changed the name to that.

FuncGodot

Initial Setup

  • Initial setup .

    • I used this methodology to set the explanations below, since I considered the order used by that author better than the order adopted by the official documentation.

Generic 'FuncGodotLocalConfig.tres'
  • Documentation .

  • The generic one can be used inside the Addons , since it is only used to create a config file in the path: C:\Users\caior\AppData\Roaming\Godot\app_userdata\Expedicao na Neve .

  • ~I believe this file is only to indicate the path of TrenchBroom on the system.

New and unique 'TrenchBroomGameConfig.tres'
  • Documentation .

  • It is used to create a new 'Game' in TrenchBroom's games folder.

  • A new one should be created for the project; I like to name it 'trenchbroom_gameconfig.tres'.

  • The Game Name  is the name of the 'Game' in TrenchBroom's games folder.

  • The Fgd File  will be the created 'master_fgdfile.tres'.

TrenchBroom Preferences
  • Documentation .

  • The pathing  in preferences is the same path used by Map Editor Game Path  in FuncGodotLocalConfig.tres .

New and unique 'func_godot_fgd.tres'
  • Documentation .

  • It is used to store entity information (aka, all objects, enemies, terrain, etc).

  • You should create a new func_godot_fgd.tres , which will be the map's "master_fgdfile"; I like to name it 'master_fgdfile.tres'.

  • In this 'master_fgdfile', the following will be added:

    • Base Fgd Files :

      • Will be the generic func_godot_fgd.tres  from the Addons folder.

    • Entity Definitions :

      • Will be the new Entities created manually in the future.

  • ~From what I understand, it's just a generic "fgd that loads other fgds", being considered the "master_fgd".

Creating entities

FuncGodotFGDPointClass.tres
  • Script Class :

    • Create a script that inherits from the node type defined in Node Class .

    • The script must be of type @tool  to be able to read the functions:

      • func _func_godot_apply_properties(entity_properties: Dictionary) -> void:

      • func _func_godot_build_complete(entity_properties: Dictionary) -> void:

    • *Note:

      • To access information from the entity_properties : Dictionary , you can use entity_properties["property_name"] .

Compiling the map in Godot

Node 'FuncGodotMap'
  • Create any node and add a FuncGodotMap  as a child of that node.

    • Considering that every time you rebuild, all children of that node are deleted, you should therefore avoid making that node the root of the Scene to prevent unintentional deletions.

  • Local Map File :

    • .

  • Global Map File :

    • Overrides the Local Map File .

  • Map Settings :

    • Stores a FuncGodotMapSettings.tres .

    • "it's possible to get clever and use different Map Settings resources on the same map file and get completely different results like referencing completely different textures or completely different entities utilizing common relative texture paths or class names."

    • I preferred to create my own FuncGodotMapSettings.tres , to store my information without risk of deletion.

New and unique 'FuncGodotMapSettings.tres'
  • Documentation .

  • Inverse Scale Factor

    • "How many pixels does a meter equal out to".

    • The default is 32.

    • *My choice:

      • I chose to set it to 16, since I want to use a Texel Density of 16px per meter.

  • Skip :

    • Path to the Skip texture.

  • Clip :

    • Path to the Clip texture.

  • Uv Unwrap Texel Size

    • Apparently only for UV2.

    • *On testing:

      • Changing the value does absolutely nothing to the texture applied to an object.

  • Use TrenchBroom Groups Hierarchy

    • "If true, will organize Scene Tree using Trenchbroom Layers and Groups. Layers and Groups will be generated as Node3Ds . All structural brushes will be moved out of the Layers and Groups and merged into the Worldspawn entity. Additionally, any Layers toggled to be omitted from export in TrenchBroom will be freed on map build before the Layers' children can apply func_godot_properties  or call _func_godot_apply_properties()  and _func_godot_build_complete() ."

Built-in Entities

Clip
  • *From tests:

    • It's just a Collision Shape, no visual.

  • *From Quake videos:

    • It's just a Collision Shape, no visual.

Skip
  • *From tests:

    • It's just a Collision Shape, no visual.

  • *From Quake videos:

    • ~I don't remember.

func_ilusionary
  • ~Visual without collision.

  • ~Completely removes the face. No collision or visual.

Other options

.obj Export (built-in)
  • *When testing:

    • If the .obj and .mlt are exported to the same folder, just drag the .obj into the world and it will appear with the texture.

    • Obviously, no entity information is exported.

    • When placing the .obj in the world, each 1qu (quake unit) from TrenchBroom becomes 1 meter inside Godot , so for it to have a Texel Density of 16px -> 1m , it’s necessary to use a Scale of 0.0625 on the .obj.

    • *Note:

      • [bug Godot 4.3-dev2] / (2024-07-09) Import behaves oddly in Godot: If I re-export the .obj from TrenchBroom, the old or new instances do not update, even with Godot’s automatic Reimport, or by right-clicking the .obj in Godot and selecting Reimport.

        • When opening the .obj in Windows, it’s clearly updated, but Godot doesn’t notice this even after several reimport attempts and new instance creations.

      • Several errors appear during import in Godot, possibly as a result of entities being removed in TrenchBroom, maybe.

.gltf Export
  • Discussion about it .

    • "In my opinion, an external tool is best. It would work much like a normal Quake map compiler would, and it would interface with TB in the same way."

    • "Why would adding more exporter support change TrenchBroom's identity? Because these formats support a lot more features than what TrenchBroom can do. I am afraid that changing TB's core identity away from this use case and towards a more generic 3D editor will be followed by a lot of feature requests and pull requests for things that have little to do with level editing for Quake engine games. It will be difficult to serve all these interests in a single tool."

    • "The arguments I see are essentially all variations of "open TrenchBroom up to more use cases", but this can be done by writing an external compiler from .map to gltf. All the information that TB has is in the map file -- so it should be possible to achieve just as good a result with an external compiler as you would get by directly exporting from TB, but with the added benefit of being independent and enabling even more Quake-style editors to be used for creating maps in other technologies."

    • *Discussion summary:

      • They won’t implement an exporter for .gltf, since “that would make TrenchBroom lose its identity, etc.”. It was recommended instead to create a compiler that converts from .map to .gltf.

      • Thus, the ‘map-to-gltf’ compiler below was created.

  • map-to-gltf .

    • Requirements:

      • CMake .

        • "CMake is the de-facto standard for building C++ code".

      • "Compiler of choice".

        • No idea what that means.

    • Limitations:

      • No support for WAD files.

      • No support for CSG union between polygons yet . However, it merges polygons within a single entity based on their materials.

      • Untested on Linux.

.bsp Importer
  • Addon: Godot .bsp Importer .

    • "Converts the compiled .bsp".

    • "An importer addon to import Quake BSP files. Vanilla Quake1 BSP and the extended Quake 1 BSP2 formats are supported."

    • Explanation .

    • *Impressions without testing:

      • Requires compilation to generate the .bsp, which sounds considerably more annoying than just using 'func_godot'.

      • The functionality is quite simple, just drag the .bsp into the world and it works.

      • Godot’s Import settings control what is done with entity and texture data contained in the .bsp.

      • Justification from the addon’s author:

        • Qodot does not “clean up faces that were inside geometry,” so he preferred working with the compiled .bsp version of the .map.

      • Worth using?

        • I don’t think so. The addon is simple but presents no real advantage over 'func_godot', so compiling the .map and dealing with Godot’s import system sounds like a very high price to pay.

        • I’m satisfied with 'func_godot':

          • It’s more complicated to set up, but gives more intuition when creating and using entities, as well as many more customization options if needed.

          • It doesn’t require .map compilation and doesn’t depend on Godot’s terrible import system, making it very easy to see .map changes in Godot.

        • In summary, I don’t use this addon at all when compared to the major advantages of 'func_godot'.

  • .bsp (Binary Space Partitioning) .

    • .bsp is a binary file.

Qodot

Quake specifics

Entities
Light
Liquids

Quake Texturing

Texel Density
  • *Facts:

    • 1qu (quake unit) is exactly equal to 1px.

    • 1qu is represented by Grid 1 in TrenchBroom.

    • 64qu is exactly equal to the character’s height:

      • Assuming the player is 1.7m tall:

        • "64qu ~= 1.7m -> ~0.376px per centimeter -> ~37px per meter.

      • Assuming the player is 2.0m tall (as in Minecraft):

        • 64qu = 2.0m -> 0.32px per centimeter -> 32px per meter.

  • *In summary:

    • Quake has twice the Texel Density of Minecraft.

      • Minecraft 16px per meter.

      • Quake 32px per meter.

Texturing
  • "128x128px is fine for Quake textures".

  • .wad ("Where's All the Data")

  • About Wally .

Engines / Compilation