Custom Content Without Contamination

Posted by on Apr 15, 2015

Custom Content Without Contamination

While creating a level for almost any game, you are most likely going to use some custom content. The issue is that for Hammer and the game to read this content it must be placed inside of the game’s folder. This can lead to you have content others don’t have, or you contaminating your “pure” game files. In Counter-Strike: Global Offensive having different files from the server will result in a kick from the server and temporary ban. We want the best of both worlds – we want Hammer to see the content, and we want to play online. Follow this guide to set up Content Without Contamination. This was written with Counter-Strike: Global Offensive in mind, but this does apply to all games that use custom content.

This is really useful when you’re working with a team out of a cloud sync service. All members mount the same shared folder, and then have the same content. If you’re working on a single player game, or a mod that will ship VPKs this is not useful to you. This is only useful if you’re required to pack custom content into your BSP before shipping it.

In this guide we’ll cover the system and practices I use to develop levels with my custom content. This includes:

  • Organizing your content correctly.
  • Mounting external content in Hammer.
  • Automatically packing your level with all your custom content.
  • Creating a project specific compile configuration.

Sounds exciting? Because it is! Let’s get started. The first part is about getting the content into Hammer without getting the content into the game.

Part 1


    • Move all your custom content into a dedicated “Project” folder somewhere on your computer. I suggest NOT keeping your level in sdk_content\maps. I HIGHLY SUGGEST keeping your project folder inside of a cloud storage folder such as: Dropbox, Google Drive, OneDrive, or any other popular provider.
      1. Here is an example for one of my projects. I use this structure for every project I start.
        • Dropbox
          • Level Design
            • Portal 2
            • Garry’s Mod
            •  CSGO
              • Facade
              • Osaka
              •  Silo
                • Concepts (Concept content is stored in this folder)
                  • Doors
                  • Halls
                  • Stairs
                  • Rooms
                  • Controls
                  • Misc
                • Raw Content (Raw, uncompiled content is store here)
                  • Maps (VMFs, VMX, PRT, LOG, Ect..)
                  • Materials (PSDs, PNGs, JPEGs used in material creation)
                  • Models (3Ds Max, Maya, QCs, along with any other model related files)
                  • Resource (Any resource files, E.G. your level’s mini-map)
                  • Sounds (Any RAW sound files that are being edited)
                  • Scripts (Scripts, Nut files, various manifest files)
                • Content (All sub-folders store their respective content to be used inside the game. Typically they would be copied into your games folders, possibly overwriting game critical data.)
                  • Maps
                  • Materials
                  • Models
                  • Resource
                  • Scripts
                  • Sounds
    • (Optional) I suggest that you then scrub your game install folder then verify your game’s cache. This is to ensure that you’ve returned your game back to its full default content.
      PurgeVerify2
    • Browse to your game’s exe folder. In my case this is: C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive
    • Create a new folder called csgo_dev. Your folder should look like this.csgodev
    • Inside your game’s root folder, in my case the csgo folder, you’ll see a file called gameinfo.txt. Copy this file into your csgo_dev folder.
    • Open the newly copied gameinfo.txt inside your csgo_dev folder.
      1. Your file should look like something like this:
        "GameInfo"
        {
        	game	"Counter-Strike: Global Offensive"
        	title	"COUNTER-STRIKE'"
        	title2	"GO"
        	type multiplayer_only
        	nomodels 1
        	nohimodel 1
        	nocrosshair 0
        	bots 1
        	hidden_maps
        	{
        		"test_speakers"		1
        		"test_hardware"		1
        	}
        	nodegraph 0
        	SupportsXbox360 1
        	SupportsDX8	0
        	GameData	"csgo.fgd"
        
        	FileSystem
        	{
        		SteamAppId				730		// This will mount all the GCFs we need (240=CS:S, 220=HL2).
        		ToolsAppId				211		// Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
        		SearchPaths
        		{
        			Game				|gameinfo_path|.
        			Game				csgo
        		}
        	}
        }
    • Under SearchPaths we can see what content is being mounted in the game and Hammer. Remove the two existing Game search paths. Your FIRST search path needs to be the full path to your CSGO install directory. Every path under the CSGO path should be your project folders. You can add as many as you want, just add a new line for each one. Hammer loads the content in order from top down. Note that custom sound scripts may not work if CSGO is above your other mounted content. But if CSGO isn’t first instances may not work. Pick your poison.
      "gameinfo"
      {
      	game	"Counter-Strike: Global Offensive"
      	title	"COUNTER-STRIKE'"
      	title2	"GO"
      	type multiplayer_only
      	nomodels 1
      	nohimodel 1
      	nocrosshair 0
      	bots 1
      	hidden_maps
      	{
      		"test_speakers"		1
      		"test_hardware"		1
      	}
      	nodegraph 0
      	SupportsXbox360 1
      	SupportsDX8	0
      	GameData	"csgo.fgd"
      
      	FileSystem
      	{
      		SteamAppId				730		// This will mount all the GCFs we need (240=CS:S, 220=HL2).
      		ToolsAppId				211		// Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
      		SearchPaths
      		{
      			Game				"C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo"
      			Game				"C:\Dropbox\Level Design\CSGO\Collaborations\Silo\Content"
      		}
      	}
      }
      
    • Open Hammer.
    • Click on Tools -> Options.
    • Under Game Directory, update this path to point to our csgo_dev folder.
      game_dev
    • If we look in Hammer all of our custom content is showing as it should for this project. But if you compile the level and check it out in game, all custom content will be missing! This is actually good. We have completely separated our custom content from the game’s content. This will prevent all contamination with the game’s pure files.HammerNotGame

Part 2


Now for the second part – the auto packing of your level on compile. This will auto generate a list of all your custom content, then pack it when you compile your level.

  1. Start by downloading BSPZIPWalker.exe – (BSPZIPwalker.exe is a custom application written by BenVlodgi to preform the same functions as DityHelper.jar. It functions exactly the same as DirtyHelper. We no longer need Java!)
  2. Place BSPZIPWalker.exe somewhere that it can stay forever.
  3. Open Hammer, then go to your compile settings. Change your compile settings to be the Expert Compiler. Assuming you’re using custom content in your level, you should have already been using the expert compiler. If you’re having issues getting these settings right you can contact me under the Ask a Question page.
  4. Click Edit->New. Then input your project’s name and click OK. My example will be Silo 6 thread full compileNewCompile
  5. Select your new compile configuration from the drop down. Then add your desired VBSP, VVIS, and VRAD settings. My Final Compile – HDR – AutoPack template is located here.
  6. Click New to add a new command to your compile configuration. This will be the command to have BSPZIPWalker.exe make our filelist.txt file.
    1. Under Command add: PATH\TO\BSPZIPWalker.exe
    2. Under Parameters add:
      "DRIVE:\PATH\PROJECT\Content" "DRIVE:\PATH\PROJECT\Raw Content\Maps\MAPNAME-filelist.txt"
    3. Be sure to replace DRIVE, PATH, PROJECT, and MAPNAME with the correct information for your computer.
      1. These are the parameters that will be used with BSPZIPWalker.exe. They will generate a mapname-filelist.txt file in your raw content\maps folder. bspzip.exe uses this file to pack content.
    4. Here are the parameters that I use:
      "Z:\Level Design\CSGO\Collaborations\silo\Content" "Z:\Level Design\CSGO\Collaborations\silo\Raw Content\Maps\de_silo-filelist.txt"
  7. Click New once again to add the last command. This command will tell bspzip.exe to use the filelist that BSPZIPWalker.exe has made for us in the previous step.
    1. Under Command click Cmds->Executable. Browse to your game’s bin folder and select bspzip.exe.bspzip
    2. Under Parameters add:  -addorupdatelist $path\$file.bsp $path\$file-filelist.txt $path\$file.bsp
      • This will will have bspzip.exe pack your content for you automatically when you compile.
  8. Make sure your compile settings are in this order
    1. $bsp_exe
    2. $vis_exe
    3. $rad_exe
    4. BSPZIPWalker.exe
    5. bspzip.exe
    6. copy file
      settings
  9. Give your compile a test. You should see it do two new things.
    1. Generate your file list. (You’ll only see this if you’re using the legacy DirtyHelper.jar, BSPZIPWalker.exe has no output)
      dirtyhelper
    2. Pack the content.
      Packing
  10. (Optional) If you ever load your level from Hammer using the Launch Map Windowed/Fullscreen compile configurations you’ll need to edit these. Replace the $gamedir variable with the full path to your csgo folder. Remember to include quotes. My parameters to load a map windowed from Hammer are:
    -windowed -w 1920 -h 1080 -dev -console -allowdebug -game "C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo" +map $file
  11. Load your level in game. All the custom content should be there!
    2015-04-15_00001

That should do it. Your content will now be in its own folder, but still usable in Hammer. Since the content does not exist in your game’s folder, only packed into the BSP, you will see the level how everyone else will when you ship. This will prevent you from forgetting to pack something before shipping.

Thanks for reading!
Happy Mapping!

Varachit DC Wirunpat, Dima Dimak Kudria, Robert Miller, Wayne Douglas, James Pryde, Sean Castillo, Andreas Olsson liked this post