All About "Folder Packing"
Disclaimer: While anyone who is motivated can certainly learn this, this guide may be difficult to follow for the beginning modder. This is intended for the intermediate level modder (or very enthusiastic beginners). As always if you want to learn any modding skill… read up on it, and then tackle it yourself. With that said, intelligent questions are always welcome from people who have got their "hands dirty" trying this out. In my opinion "folder packing" models is very useful modding skill.
Folder packing is a way to trick a model into using different textures than the default without hex editing and without using the <MATERIAL_OVERRIDE> tag (which only works on monsters anyway).
Advantages and Disadvantages of the method
- Less daunting than hex editing
- Works on more stuff than <MATERIAL_OVERRIDE>
- Works when the hex is too complex for a basic hex edit (like yeti.sms)
- Simple and easy once you understand it
- Allows bonus pack monsters to work without the rest of the bonus pack
- More daunting than <MATERIAL_OVERRIDE>
- Larger file sizes (and more folders) than mods made using hex editing or <MATERIAL_OVERRIDE>
- Can be confusing at first (it’s an intermediate level modding skill)
Theory and Application
To understand how (or more importantly why) folder packing works you have to understand how Fate’s models locate their textures. There are a few key facts, that I will try to present in a logical order.
Fate’s models were designed to be kept in the same folder as their textures.
… therefore …
Each model was encoded by the designers with a different set of default texture names
… therefore …
Models look for their textures based on the file names, not a file path (like with items.dat)
… therefore, because no file path is specified …
Models can only look for their textures within their own folder and will use any textures in their folder that have their default texture names.
What this all means when taken together is that: any model can be made to use modified textures as long as you save your modified textures under the model’s default texture names, and in the same folder as the model (hence the name "folder packing").
I will explain this again from a backwards angle…
If you first, take your modded texture and save it using a default texture name from the main game, and second put it in a folder with a copy of the model that normally uses the texture name that you "borrowed", then in the end that copy of the model will pick up and use your modded texture.
This is important… so let me explain it to you again another way…
if you take a model from the main game and make a copy in a new folder, you can trick that copy into using a new texture by giving the new texture the same file name as the original texture.
That is about as clear as I can make it; if it’s still not clear in your mind you may want to re-read those last few sentences a couple of times before reading on.
First let’s go over how to folder pack a static model (a *.MDL file), we will talk about animated models afterwards (*.SMS files).
Before you can begin with a static model there is one key piece of information that you must have about the model you are working on…
…the model’s default texture name(s).
How do I find the default texture name? Most of the game’s static models are in the ITEMS folder of the main game. There are over 200 models and their textures all rattling around together in the ITEMS folder.
So how do you determine which textures go with which model?
There are 3 ways to make this determination for models in the ITEMS folder:
Looking at the file names can give you a clue to begin with, for instance when you see axe1.mdl, axe1.png and axe1ref.png all right next to each other its a good bet that those *.PNG files go with that *.MDL file. But in other cases there will be more variation, for instance archercap.mdl, archercap2.mdl, and archercap3.mdl go with archerhat01.png, archerhat02.png, and archerhat03.png respectively. Even though the names differ slightly it is still pretty easy to make the connection; but its a bit harder to pick up that they all use the same *.PNG as their alpha layer… archerhat_a.png. (If you don’t already understand how alphas layers work then you may have a hard time following how some of this works. For background info in this subject see this thread: The Icon Ramble.
If looking at the file names isn’t making it clear for you, you can always familiarize yourself with the model in game then go to items.dat to see which model is referenced in the code, then go flip through the thumbnails of all the textures till you find the ones that seem to match with the model’s in-game appearance. This is a crude but effective way to find which texture names go with which models.
If all else fails you can peek into the *.MDL file with a hex editor and look for the texture names in the hex, without actually “editing” anything in the hex. This is actually the easiest way if you have use of a hex editor, but the very idea of hex editing may freak some people out. (See this thread for a link to a free hex editor: Guide to Hex Editing).
Once you know the default texture names for the model you are working on you can get down to business. If you have understood every thing up to this point the rest is just details. At this point I am just going to tell you how to do it. I am not going to explain why any of these steps are necessary. I think we have covered all that pretty well in the theory section.
Let’s assume that you are making a mod called “My Mod”… here is a step-by-step break down:
In your mod create a folder with a unique name that will hold your model. Pretty much the only rule is that this new folder shouldn’t share a name with a folder in the game. For this example lets call the folder STUFF.
Copy the original *.MDL from the main game ITEMS folder into the folder called STUFF and rename it if you’d like. In this case lets say that we are starting with the charm.mdl and we will rename it to newstuff.mdl.
Copy your re-worked texture into the folder and rename it to the default texture name. In this example the texture must be renamed to healcharm.png to work with the original charm.mdl.
Copy the intended alpha texture into the folder and rename it to the default alpha texture name. In this example the alpha texture must be renamed to healcharma.png.
In the mod’s items.dat file change the model entry to:
And then test the mod.
That’s pretty much it for static models. (Remember that you will need to delete the *.DDS files in this folder if you make any changes to the textures).
For animated models (like a monster, or the visuals for a spell) it’s actually a little easier because you don’t have to do any leg work to chase down the default texture names, they are automatically folder packed for you. Let’s assume in this example that in your mod called "My Mod" you want to put a new texture that you have made on to the Myconid model, and that you have already coded the new monster completely except for the model. Here are the steps:
Go to the main game and look in the MONSTERS folder for the folder that has your monster of choice in it. Right click and copy the entire folder (this is so you automatically get all the animations and other goodies that are in there)… then paste that folder into the MONSTERS folder in your mod and rename it. So you find the MUSHROOMMAN folder in the main game and copy it into your mod’s MONSTERS folder, then rename the MUSHROOMMAN folder to FUNGUSMAN.
Open the folder and overwrite the default texture with your replacement texture using the default file names. So in our example you save your new texture in the FUNGUSMAN folder under the name of… wait a minute… there are 3 textures in here. two that have color and one for a glow layer. If you want to fuss with finding out which is the default for color go ahead but otherwise replace both of them with your new texture. So save your new texture as mushroomman_color.png and mushroomman_blue.png . Leave the glow layer alone (unless you have a replacement ready to go for that - then swap it in too). Renaming the actual *.SMS itself is an option (just like with a static model), but in this case let’s don’t rename it.
Next delete all the *.DDS files from this folder.
Finally, go into the monsters.dat in your mod where you have already coded your monster and put the model line as:
(if there were any material override in the monster’s coding you would need to remove it).
There you have it. Folder packing explained, start to finish.
CREDITS: My understanding of this method comes from a combination of experimentation and reading gbrown’s posts in this thread: https://forum.wildgames.com/showthread.php?t=2848.