Left 4 Dead 2

Left 4 Dead 2

48 个评价
Separating custom from original content for easy modding
由 мяFunreal 制作
There's an easy way to separate custom content from original game content. Great for when you make multiple maps at once, or just want to keep your modded files away from original files so you can easliy delete everything.
   
奖励
收藏
已收藏
取消收藏
Introduction
This guide will teach you how you can savely separate your own content for mods or maps from the original game files. It even allows you to temporarily disable those custom files to see if your packed vpk file really contains everything the workshop subscribers need.

When you make mods or maps for a source engine game that has custom content in it you must somehow add it to the game files. Most people just put the files into the main game folder along with all other files from the game, which is a bad idea.
Because sooner or later you will make another piece of content and forget that you added content that is not native to the game and you will end up releasing a mod or map that has missing content.

Or the other problem you could run into is that you are aware that you have custom content and you want to get rid of the files, but you don't want to go through all the game files to search for those custom files and delete them individually.
Creating the custom content folders
The first thing you need to do is go to your basic game folder where you can see the DLC folders.
Once you are there, you can simply create a folder with a name of your choice. It is best to name a folder "mods" for general mod files while campaign and map folders should be specifically named after each map and campaign. That way content from one map cannot be mixed with that of another.

in the screenshot below i highlighted my custom folders in blue.
Making the game use the folder.
Once you have added the folders themselves you must also edit the gameinfo.txt file so that the game will see the folders and load files from it.
Garry's mod uses Mount.cfg to load date instead.

The gameinfo.txt file can be found in the subfolder of the basic game folder.
Steam\SteamApps\common\left 4 dead 2\left4dead2

Open the gameinfo.txt and add your own folders to the list.
All folders before the "update" folder have higher priority over the original game files, but the game will not prefer loose files in those folders over the pak01_dir.vpk files of any of the other folders.
But you could make your own pak01_dir.vpk files in your new folders listed above the "update" entry. This will make the game prefer those files over anything, besides installed addons.

In the screenshot below is an example of my gameinfo.txt with custom folders highlighted.
The lines that begin with // will be ignored, so that the game will not read files from that folder.
.

Once you are done with your mod or map, or just want to work on another map so you need to disable your current custom content, you can either edit the gameinfo.txt to comment out an entry by adding // at the front of the lines like i did, or rename the content folder.
Making Gmod use the folder.
Garry's Mod does not use the gameinfo.txt for mounting, it uses "Mount.cfg instead"

Gmod's Mount.cfg is in
garrysmod\cfg
Just add your folders like this.


Making crowbar compile to Gmod still requires the gameinfo in that custom content folder though.
Making Crowbar use the folder
I myself like to keep my compiled models and all the stuff that belongs to them in a "mods" folder that I can clear out every once in a while. But you need to do one more thing so that Crowbar will compile models for that folder.

First you need to have a gameinfo.txt in that "mods" folder. But you do not need to update that gameinfo.txt when you add or remove folders. Crowbar just needs that file to be present.
You can simply copy the one you modified earlier into this folder.
.

Then you need to add a new game entry to crowbar so that is will compile to your mods folder, instead of your main game folder where the original files are.
The "gameinfo.txt" field in crowbars "Set Up Games" tab is used to determine where your content will be moved after compiling. Select your new "mods" folder for the gameinfo.txt location and you are done. Save your settings and use that game when you compile models for L4D2. Or any other source engine game you would like.
24 条留言
мяFunreal  [作者] 9 月 21 日 上午 4:35 
Well, collisionmodels of players or infected in either l4d games shouldn't be modified anyways. At least in l4d2, the host will force its collisions onto the clients, owerwriting custom physics.

So its no real use.
Dread Drake 9 月 20 日 下午 9:40 
That's actually what I was thinking about for a long time
But I assume different Source Engine branches have their own physics iterations

Beside client side and server side ragdolls, there also included hardcoded classes and separated surfaceprop materials which also affect the simulation in general
The model that built and works fine with GMod, may works a bit different in L4D2, resulting bad collision detection and weird mass/interia distribution that makes ragdolls stucked in a walls, poor selfcollision and pushouts in momentum of solver deactivator. It's usually seen very well on any Valve's model since HL2. VPhysics is very strange and non predictable thing I have ever worked within

Well anyways, thanks for clearing this up, seems like there's only way through VPK package when it comes to ragdoll stage, unfortunately
мяFunreal  [作者] 9 月 20 日 上午 3:07 
Model replacements like that just aren't possible in a quick way because of how the engine was built. HLMV should be used for most cases, but testing ragdolls isn't possible.

But you could always use Gmod to test the models over and over, and then when you're happy you can compile it for l4d.

Its all painfully annoying workarounds, sure. But there is a way
Dread Drake 9 月 19 日 下午 4:04 
Good trick, may help with realtime mat updates

But how to manage the entire content then ?
I'm looking for a way where I can compile the models without exiting from the game.
I do specific things related to ragdoll data and constraints. Every time I should recompile the model to make the actual changes on it. The amount of those compilations goes crazy, like 40-70 times. Just imagine: every time I should to pack VPK ( as an addon or dir ), then enter the game, load the map, check if it works how I wanted, and If not, then we start again. Almost one minute for all stuffs

As I said, in CSS I still remain on main menu in windowed mode, simply compile the model and then load any map with already updated model and it takes about 10 seconds
I wish if there was the same way for l4d2, but I cant found a way to use relative game path rather than annoying VPK
мяFunreal  [作者] 9 月 19 日 下午 3:27 
Oh you can get around that.
You make the "actual" vmt that the model uses a simple patch.

Like this:
patch
{
include "materials/ -path to the actual vmt you edit here- .vmt"
insert
{
}
}

Then you pack that into the pak01.
After that, you can edit whatever vmt you're loading through the packed vmt and reload that one ingame.

Another alternative is modifying the model itself to load another cdmaterials folder (hex editing, very bottom of file has the paths) and then slap your vmt files in there.
that way you don't need to repack materials either, but you got a custom model instead.
Dread Drake 9 月 18 日 下午 2:58 
There's short example why I need it so hard:

I want to update one shader that is used by the model. Let's call it "skin.vmt"
I can do the changes on it, then without exiting from game I can dump console command "mat_reloadmaterial skin" and it will reaload the shader...
But not in L4D, because the shader is packed onto VPK which requires rebuilding and game restart = 1 minute of wasting time
Dread Drake 9 月 18 日 下午 2:45 
Any way to use forward paths for custom content in l4d2 ? Building VPK every time is insanely long and annoying in a way of compiling models a bunch of times, or just the updating a single texture. It's simply delaying the workflow at this point, demanding to do extra steps
The way how it works in GMod and CSS are straight enough
мяFunreal  [作者] 2024 年 11 月 30 日 上午 6:07 
No, Hl2 still uses this setup here. But you'll need to edit every gameinfo for all the parts of the game.
Majka 2024 年 11 月 30 日 上午 6:00 
Will HL2 be the same as for Gmod?
мяFunreal  [作者] 2024 年 5 月 3 日 上午 4:22 
Audio caches only need to be rebuilt if you edit audio in a way that would warrant it in the first place. Like making sounds with different lengths. that requires a soundcache.

But simply having this folder is not enough to require new soundcaches.