Add Mod Content to Hammer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(How to add your mod's content to hammer editor without having to manually copy everything)
 
mNo edit summary
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
For this example, I am using my mod (Portal: Revolution) on the Portal 2 engine, but this works on any engine
For this example, a mod called "Portal Mod Test" (Game name: "mod_test") will be used. This works on all engines.


Portal 2 has the following mods included:
Portal 2 has the following mods included:
Line 9: Line 9:
</pre>
</pre>


When you start hammer, it loads the content from the mod described in Portal 2/bin/GameConfig.txt
When you start [[Valve_Hammer_Editor|hammer]], it loads the content from the mod described in Portal 2/bin/GameConfig.txt
Portal 2's GameConfig.txt
Portal 2's GameConfig.txt
<pre>
<pre>
Line 30: Line 30:
"GameExeDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
"GameExeDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
"MapDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
"MapDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
"BSPDir" "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Revolution\maps"
"BSPDir" "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test\maps"
"PrefabDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
"PrefabDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
"CordonTexture" "tools\toolsskybox"
"CordonTexture" "tools\toolsskybox"
Line 44: Line 44:
This is how I got around this:
This is how I got around this:


First, we need to add a new mod to '''Portal 2'''. My mod is called Portal: Revolution, so I will just add a mod called portal_revolution to Portal 2.
First, we need to add a new mod to '''Portal 2'''.
Portal 2 will now have these mods:
Portal 2 will now have these mods:
<pre>
<pre>
portal_revolution
mod_test
portal2
portal2
portal2_dlc1
portal2_dlc1
Line 54: Line 54:
</pre>
</pre>


To create the mod, just create a new folder ....Portal 2/portal_revolution and create a new gameinfo.txt
To create the mod, just create a new folder ....Portal 2/mod_test and create a new gameinfo.txt
Content of our gameinfo.txt: (Copy pasted from Portal 2)
Content of our gameinfo.txt: (Copy pasted from Portal 2)
<pre>
<pre>
Line 74: Line 74:
SearchPaths
SearchPaths
{
{
Game "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Revolution" // <== The location of my mod
                        // When the mod mod_test is mounted, all other portal 2 game content is loaded as well.
Game "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test" // <== The location of the mod
Game portal2_dlc2
Game portal2_dlc2
Game portal2_dlc1
Game portal2_dlc1
Line 85: Line 86:
</pre>
</pre>
What this does, is that first Portal 2's content gets loaded, and then our mod's.
What this does, is that first Portal 2's content gets loaded, and then our mod's.
Now, we need to tell hammer to load our mod portal_revolution instead of portal2.  
Now, we need to tell hammer to load our mod mod_test instead of portal2.


GameConfig.txt in ....Portal 2/bin/GameConfig.txt
GameConfig.txt in ....Portal 2/bin/GameConfig.txt
Line 94: Line 95:
{
{
"Portal 2"
"Portal 2"
{
{       // The GameDir is the content hammer will load.
"GameDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal_revolution"
"GameDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\mod_test"
"Hammer"
"Hammer"
{
{
Line 111: Line 112:
"GameExeDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
"GameExeDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
"MapDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
"MapDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
"BSPDir" "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Revolution\maps"
"BSPDir" "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test\maps"
"PrefabDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
"PrefabDir" "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
"CordonTexture" "tools\toolsskybox"
"CordonTexture" "tools\toolsskybox"
Line 122: Line 123:
</pre>
</pre>


You are done! You should now be able to open hammer and see all of your custom content! In case you override any assets, like textures or models, you will also see those instead of Portal 2's.
We're done! We should now be able to open hammer and see all of our custom content. In case you override any assets, like textures or models, you will also see those instead of Portal 2's.


'''Troubleshooting'''
'''Troubleshooting'''
In case that your GameConfig.txt gets resetted, just make it read-only.
In case that your GameConfig.txt gets resetted, just make it read-only.
[[Category:Tutorials]]

Latest revision as of 15:57, 5 January 2025

For this example, a mod called "Portal Mod Test" (Game name: "mod_test") will be used. This works on all engines.

Portal 2 has the following mods included:

portal2
portal2_dlc1
portal2_dlc2
update

When you start hammer, it loads the content from the mod described in Portal 2/bin/GameConfig.txt Portal 2's GameConfig.txt

"Configs" {
	"Games" {
		"Portal 2" {
			"GameDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2"
			"Hammer" {
				"GameData0"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\portal2.fgd"
				"TextureFormat"		"5"
				"MapFormat"		"4"
				"DefaultTextureScale"		"0.250000"
				"DefaultLightmapScale"		"16"
				"GameExe"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2.exe"
				"DefaultSolidEntity"		"func_detail"
				"DefaultPointEntity"		"prop_static"
				"BSP"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vbsp.exe"
				"Vis"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vvis.exe"
				"Light"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vrad.exe"
				"GameExeDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
				"MapDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
				"BSPDir"		"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test\maps"
				"PrefabDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
				"CordonTexture"		"tools\toolsskybox"
				"MaterialExcludeCount"		"0"
			}
		}
	}
	"SDKVersion"		"4"
}

We only care about the "GameDir". As you can see, the mod portal2 get specified. If you now just copy the line and replace one of them with your mod's location, it will work, but you will always get an error message when you start hammer! This is how I got around this:

First, we need to add a new mod to Portal 2. Portal 2 will now have these mods:

mod_test
portal2
portal2_dlc1
portal2_dlc2
update

To create the mod, just create a new folder ....Portal 2/mod_test and create a new gameinfo.txt Content of our gameinfo.txt: (Copy pasted from Portal 2)

"GameInfo"
{
	game 		"PORTAL 2"
	title 		"PORTAL 2"
	GameData	"portal2.fgd"
	gamelogo 	1

	SupportsDX8     0
	SupportsXbox360 1

	FileSystem
	{
		SteamAppId				620
		ToolsAppId				211
		
		SearchPaths
		{
                        // When the mod mod_test is mounted, all other portal 2 game content is loaded as well.
			Game				"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test" // <== The location of the mod
			Game				portal2_dlc2
			Game				portal2_dlc1
			Game				portal2
			Game				update
			platform			platform
		}
	}
}

What this does, is that first Portal 2's content gets loaded, and then our mod's. Now, we need to tell hammer to load our mod mod_test instead of portal2.

GameConfig.txt in ....Portal 2/bin/GameConfig.txt

"Configs"
{
	"Games"
	{
		"Portal 2"
		{       // The GameDir is the content hammer will load.
			"GameDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\mod_test"
			"Hammer"
			{
				"GameData0"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\portal2.fgd"
				"TextureFormat"		"5"
				"MapFormat"		"4"
				"DefaultTextureScale"		"0.250000"
				"DefaultLightmapScale"		"16"
				"GameExe"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2.exe"
				"DefaultSolidEntity"		"func_detail"
				"DefaultPointEntity"		"prop_static"
				"BSP"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vbsp.exe"
				"Vis"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vvis.exe"
				"Light"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vrad.exe"
				"GameExeDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
				"MapDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
				"BSPDir"		"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test\maps"
				"PrefabDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
				"CordonTexture"		"tools\toolsskybox"
				"MaterialExcludeCount"		"0"
			}
		}
	}
	"SDKVersion"		"4"
}

We're done! We should now be able to open hammer and see all of our custom content. In case you override any assets, like textures or models, you will also see those instead of Portal 2's.

Troubleshooting In case that your GameConfig.txt gets resetted, just make it read-only.