Counter-Strike 2 Workshop Tools/Level Design/Compiling

== Different types of compiling ==
There are 4 different types of compiling in the Source 2 Hammer Editor.
===== Full Compile =====
This compiles builds world, generates lighting, physics, vis, nav, and steam audio by default. Cubemaps will be built after the compile is finished.
The lightmap resolution used by this compile setting is only 1024 and quality is set to Standard. These compile settings are not recommended for final release. 
===== Fast Compile ===== 
This compiles builds world, physics, and nav but does NOT generate lighting, vis, or steam audio by default.
This setting is useful for quick layout changes and quickly seeing something in game for scale or general "feel" when lighting is not needed.
===== Final Compile ===== 
This compiles builds world, generates lighting, physics, vis, nav, and steam audio by default. Cubemaps will be built after the compile is finished.
The lightmap resolution used by this compile setting is only 2048 and quality is set to Final. These compile settings are okay for final release but it is preferred that an 8192 resolution compile is done instead for Final Release. 
===== Entities Only ===== 
Compiles Only World. This compile setting is COMPLETELY SAFE to do after a full VRAD compile and will NOT overwrite any lightmap information if done. Extremely useful when used in conjunction with Build Physics to fix map clipping or out of bounds exploits without having to do a full recompile. 
===== Custom Settings ===== 
This allows you to customise all of the settings to compile. Adjusting any settings of a preconfigured compiled like the ones above will result in the compile becoming "Custom". 
==Command Line==
Command Line gets updated with all of the settings you select in the "Build Map" window instantly. You can copy and paste these settings into a .bat file placed inside of your and run it to compile a map without having CS2 Tools open.
This can be useful if your computer is low on certain resources such as VRAM which may get eaten up by the Tools being open even if they're only running in the background. 
==Crashes==
=== Failed to read scene_meshes.dmx ===
A crash that occurs as a result of the scene_meshes.dmx file located in being too big. The max file size this file can be is 2GB and if it exceeds this file size the compiler will not be able to read it. The file size is usually a result of having too many complex meshes on your map and over time these add up until the file size becomes simply too big. 
====== Troubleshooting ======
To Troubleshoot this issue simple start by hiding meshes or props you think to too complex into a selection set and then compiling. You only need to wait for World to finish building in order for the scene_meshes.dmx file to be updated and from there you just need to observe the file size to determine whether or not you're in the clear. Once you find the culprit or culprits, it's time to re-evaluate your geometry and either optimize it or figure out a solution which results in lowering the tri count on these complex meshes.
=== Light mapper didn't return valid triangles: failing.===
Error usually also includes an "Encountered accessviolation" or "VK_ERROR_DEVICE_LOST".
An error that results in VRAD failing for unknown reasons, you may notice this for the first time if you've updated your Nvidia GPU drivers and compile as it appears to be a result of a series of bad drivers from Nvidia. 
====== Solution ======
The only current solution is to use the older 561.09 drivers from Nvidia which can be found HERE. Simply search for your GPU and then click FIND. From there, click View More Versions and find the GeForce Game Ready Driver with Driver Version : 561.09. Once downloaded you should be able to compile without issue. 
This issue is still present in Nvidia's most recent (as of writing) 566.36 driver.
==Helpful Tips==
Some helpful things to look at after running a compile
*Lightmap - A lightmap.exr file is created in the folder after a successful VRAD compile that shows exactly how the lightmapper packed your map's face's lighting. This can be extremely helpful in seeing if you have any egregiously large mesh faces eating up precious lightmap space or if you are having weird lighting issues it's a good place to start for figuring out what the problem might be.
*Visibility - After a successful VIS compile a .los file is created in your folder, this file lets you Load Compiled Vis Data (Map>View Compiled Vis Data) and view the voxels created by VIS during the compile. From here you can look around and make sure there arent any rogue voxels or any other possible VIS related issues. It's also helpful to make sure and verify there are no VIS related issues in game. Further information on this topic and other VIS related topics can be found here
*Packing - Before publishing a map it is useful to look at the file size usage your map is taken up. Thankfully, the CS2 Workshop Publishing Tool shows you a colorful, helpful bar which will show you exactly what is eating the most of your maps file size. Each individual colored section represents a different content type (.vpk, .vtex_c, .vmat_c, etc) and clicking on Contents will show you a preview of each files size, extension, and path so you can quickly and easily know when a random 8k file has eaten up resources. Another helpful tip, delete or move the .los file from your maps folder. The Workshop Publisher tool will pick up the .los file and add it to your published map which can add hundreds of Mbs when a map is fully finished and ready for release.