[Tutorial] Pakrat

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,820
How to add custom content to your map with pakrat.
This question pops up every few weeks in the chatroom and I figured that instead of telling each person the same story over and over, it's much quicker to just hand them a url to this page right here! If you already use pakrat in your releases I doubt you will learn much from this read. I'm not even sure if this kind of article is needed, most people seems to have managed without it for this long :)
And as usual with my tutorials, excuse the swedish interface/button texts in some screenshots.

And please correct me if I make mistakes!

Pakrat:
A really old java application that is used to pack files into the .bsp (map file), it has not been updated in years and as a result of this it needs input from the user to catch everything. Pakrat is not the only option for packing things into your map, but it's the most common one by far and a lot of people seems to have problems with it, luckily I'm here to help.

Download: http://www.bagthorpe.org/bob/cofrdrbob/pakrat.html


I've made a small box filled with all kinds of custom content for this tutorial.
SS-2010.04.04-02.50.30y.jpg


I'm showing off how to pack a lot of different files here, all in the same tutorial. It's almost certain that you won't have all of these types of custom items in the same map (unless you really try to), if I'm talking about something you don't have (like menu photos for example), just skim over that part.

------

Open pakrat.jar.
Browse to your map and open it, you will get a list of all the files in your bsp, it's mostly empty except for a few things that were added during compile.

Here you have an option, you can choose to view the files as a tree structure ("View -> As Tree" or ctrl+T) or not. Personally I prefer the tree view so that's how it's going to look in the rest of the tutorial.
Pakrat_-_ctf_pakrat_a1.bsp-2010.04.04-03.42.36.png


------

Pakrat is a simple application so we'll only use the "Edit", "Add and "Scan" functions for this entire tutorial.

In short, there's really only 2 steps to the whole process:
1. Automatic scan + Edit file paths
2. Add missing items + Edit file paths


------

Step 1:
We will start with actually using pakrat's built in Scan function. So hit the little "Scan" button in the bottom right.
Pakrat_-_Scan_Files_-_ctf_pakrat_a1.bsp-2010.04.04-03.45.03.png

Here you need to add the gamedir. This should point at your base tf folder, once that is in order press "Scan".
Soon enough you will have a huge list of materials and other files.
Pakrat_-_Scan_Files_-_ctf_pakrat_a1.bsp-2010.04.04-03.49.29.png

Go ahead and press "Add Selected", It most likely will ask you if you want to fix-up a bunch of filepaths and you definitely want to do that, press "Yes to All" (Always! This dialouge box will pop up from time to time).
You can now go back to the scan window (it should still be open) and press "Done".

A few files are misplaced though and have to be tweaked by hand.
Pakrat_-_ctf_pakrat_a1.bsp-2010.04.04-04.04.19.png

Use the Edit button to correct the paths of individual files.
Map description .txt files goes in the "maps" folder (image)
Soundscape .txt files go in the "scripts" folder (image)

------

That was easy, since it was all automatic and we've made some huge progress.
Things that are successfully packed at this point:
Textures + overlays
Skybox
Soundfiles (.wav)
Model meshes
Soundscape
Map description


A lot is still missing in my example map though! (But if your map's custom content all fall into the above categories, you'd be done now (but remember to watch out for missing model textures! Continue reading))

------

Step 2:
If you have custom models in your map, you need to pack their textures manually otherwise they will show up as purple/black checkers ingame.
Just press the "Add" button and select the files you require (ctrl/shift click to select multiple) and add them. (.../tf/materials/models/props_swamp/ in my example)
Select_files_to_add_to_pak-2010.04.04-04.32.07.png

I have a picnic table in my map, and it has 2 skins, one dark and one light variant. When packing notice how I don't pack the "picnic_table_light" textures! All my tables use the dark skin, so there is no point to adding the secondary skin to the .bsp (avoid adding unused skins as much as possible, it adds to the filesize).

Just keep adding the stuff you have in your map.
Namnl%C3%B6s_-_Anteckningar-2010.04.04-04.48.44.png


Last item on the list is particles. Your .pcf (particle system) files are in the tf/particles folder, which appears empty if you don't change pakrat to display "All files" instead of "All valid pak files".
Add your pcfs and you need your particles.txt too! (in tf/maps) (image)

Edit those paths to something like this
Pakrat_-_ctf_pakrat_a1.bsp-2010.04.04-04.59.30.png


------

We're done, packed: (Green = added in step 1. DarkRed = added in step 2.)
Textures + overlays
Skybox
Soundfiles (.wav)
Model meshes
map description
soundscapes

model textures/skins
menu photo
detail sprites
particles


Go ahead and Save the new packed bsp. ("File -> Save BSP" or ctrl+S)

The end.
 
Last edited:

demoman501

L1: Registered
Apr 5, 2010
7
1
Been using packrat for years, great program for putting your custom content into maps. Just be careful not to go nuts and have a 30 meg map file. (been there done that) Servers and the people dling don't always like it.... :O
 

Keonyn

L2: Junior Member
Mar 27, 2010
56
17
What's the best way to test that it got everything? I packed a test version of my file and it was placed on the clan server to let a few people look around. I double-checked and swear I had everything, but when they went in there were a few missing textures on the custom models. It worked for me obviously since I have the models and textures on my machine.

So is the only way to test to take it to another machine or uninstall my customs? Pardon if it's a newbie question, but this is my first attempt at using any customs and pakrat.
 

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,820
What's the best way to test that it got everything? I packed a test version of my file and it was placed on the clan server to let a few people look around. I double-checked and swear I had everything, but when they went in there were a few missing textures on the custom models. It worked for me obviously since I have the models and textures on my machine.

So is the only way to test to take it to another machine or uninstall my customs? Pardon if it's a newbie question, but this is my first attempt at using any customs and pakrat.

* The "best" way in my opinion would be to test on another machine, OR send it to a friend who checks it for you.
* If that is not possible, you could simply rename your folders that contain your custom content. "Materials" renamed to "xMaterials" (anything really, a one letter change is good enough to make tf2 unable to find the folder), "Models" to "xModels" and so on. Remember to start TF2 after these edits, or the materials will already have been loaded into the memory. Load your map and look for anything missing.
* If you just want to make sure something is packed into the bsp you could open it with GCFScape.
 

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
And heres the easy way of packing stuff:

Download Map Analyst, set your compile options as written in the readme, and worry about custom content no more.

I have never done it another way, and it works perfect.
 
Nov 14, 2009
1,257
378
And heres the easy way of packing stuff:

Download Map Analyst, set your compile options as written in the readme, and worry about custom content no more.

I have never done it another way, and it works perfect.

I tried it with my map, and it only didnt pack one thing: The skin for the picnic table from the swamp pack. Im not sure about particles, though.
 

Hawk

L7: Fancy Member
Dec 3, 2007
419
213
Here's a tip I have for automatically including the model textures:

For each custom model that your map includes, find a secluded area out of the player's view and use the model's texture on a small brush. When Pakrat does its scan, it will detect this texture and include it in with the other custom content. No worries!
 

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,820
Here's a tip I have for automatically including the model textures:

For each custom model that your map includes, find a secluded area out of the player's view and use the model's texture on a small brush. When Pakrat does its scan, it will detect this texture and include it in with the other custom content. No worries!

That's pretty clever, never would have thought of that!
Cool tip :)
 

grazr

Old Man Mutant Ninja Turtle
aa
Mar 4, 2008
5,441
3,814
I find it's easy enough to just open the bsp and grab the content from the folders in question without bothering to scan. I imagine the scan is only useful if you've used loads of custom content from all sorts of sources.

As for the model-material tip... Hammer doesn't show model textures in the texture browser. So i'm not sure how you figured this one out?
 

cbite

L1: Registered
Aug 19, 2011
1
0
I'm unable to load any maps in pakrat for some reason. I'm able to start pakrat, but as soon as I select a map nothing happens. I get the following message from the console:

Pakrat v0.95 - by Rof (rof@mellish.org.uk)
Reading cp_steel.bsp

It seems like it's trying to read the .bsp file but is unable to open it for some reason.
If I start the program through the pakrat.bat file instead of the pakrat.jar file i get the following message in the command prompt:

C:\Users\xxx\Desktop\pakrat>java -jar pakrat.jar
java.io.EOFException

I'm not sure if the message is relevant or not.
I've tried two different versions of pakrat, and both have the same problem.

Any thoughts on how I could solve this problem would be greatly appreciated.

Sorry for my bad English.
 

iller

L1: Registered
Jun 8, 2011
4
0
Is it normal for everything to get completely screwed up (every model missing or missing every texture) if you re-open a map you already just packed and try to repack different files into it? This is happening to me and It doesn't make sense since nothing is changing the Paths. Is it removing all the models on its own?
 

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,820
Is it normal for everything to get completely screwed up (every model missing or missing every texture) if you re-open a map you already just packed and try to repack different files into it? This is happening to me and It doesn't make sense since nothing is changing the Paths. Is it removing all the models on its own?

it is normal yes.
Why is it happening? I don't know, but you can not open a already packed bsp and then add or remove files from it afterwards. Not with pakrat at least.
 

DisruptedHunter

L2: Junior Member
Aug 30, 2009
89
1
I'm running into a problem using Pakrat, I've followed tutorials but all my custom stuff is appearing purple and black for everyone. For one map it eventually fixed itself but for the other maps I have up on my server they don't work. Any suggestions?
 

tyler

aa
Sep 11, 2013
5,100
4,621
You're not packing correctly. It sounds like you aren't packing the materials, because that's what the purple and black checkerboards represent. If these are models, make sure that in addition to the model file, you pack the texture. If it's just textures, you're doing the whole thing wrong.

You can also try PackBSP, which is essentially the same but I find it a bit easier. Some people have problems packing specific content, though, and maybe 1% of people can't make it start at all.

An easy way to check how other players will see your map is to rename your tf folder to tf_old, then launch TF2 and load your map. TF2 generates the tf/ folder from scratch so anything not in your map will be broken. After you're done just delete the new tf and rename the old one.
 
Last edited by a moderator: