[Tutorial] Pakrat

Discussion in 'Tutorials & Resources' started by Ravidge, Apr 4, 2010.

  1. Ravidge

    aa Ravidge Grand Vizier

    Messages:
    1,544
    Positive Ratings:
    2,492
    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.
    [​IMG]

    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.
    [​IMG]

    ------

    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.
    [​IMG]
    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.
    [​IMG]
    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.
    [​IMG]
    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)
    [​IMG]
    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.
    [​IMG]

    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
    [​IMG]

    ------

    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.
     
    • Thanks Thanks x 39
    Last edited: Apr 4, 2010
  2. DaBeatzProject

    aa DaBeatzProject

    Messages:
    1,276
    Positive Ratings:
    1,091
    This might be VERY helpful for some people! Thanks!
     
  3. Gerbil

    aa Gerbil

    Messages:
    575
    Positive Ratings:
    376
    Pakrat has a scan function?! :O
     
  4. grazr

    aa grazr Old Man Mutant Ninja Turtle

    Messages:
    5,436
    Positive Ratings:
    3,557
    Finally a good tutorial on pakrat. People these days don't seem to like zipping whole directories into their tf folder. Less slaps for me.
     
  5. The Political Gamer

    aa The Political Gamer

    Messages:
    4,468
    Positive Ratings:
    1,682
    Oh my god thank you so much for this! Now I know how to pack custom models! :D
     
  6. demoman501

    demoman501 L1: Registered

    Messages:
    7
    Positive Ratings:
    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
     
  7. Keonyn

    Keonyn L2: Junior Member

    Messages:
    56
    Positive Ratings:
    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.
     
  8. Ravidge

    aa Ravidge Grand Vizier

    Messages:
    1,544
    Positive Ratings:
    2,492
    * 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.
     
  9. Nutomic

    Nutomic L11: Posh Member

    Messages:
    888
    Positive Ratings:
    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.
     
  10. grazr

    aa grazr Old Man Mutant Ninja Turtle

    Messages:
    5,436
    Positive Ratings:
    3,557
  11. Grim Tuesday

    aa Grim Tuesday

    Messages:
    1,257
    Positive Ratings:
    371
    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.
     
  12. Hawk

    Hawk L7: Fancy Member

    Messages:
    419
    Positive Ratings:
    212
    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!
     
    • Thanks Thanks x 1
  13. Ravidge

    aa Ravidge Grand Vizier

    Messages:
    1,544
    Positive Ratings:
    2,492
    That's pretty clever, never would have thought of that!
    Cool tip :)
     
  14. grazr

    aa grazr Old Man Mutant Ninja Turtle

    Messages:
    5,436
    Positive Ratings:
    3,557
    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?
     
  15. HeaH

    HeaH L8: Fancy Shmancy Member

    Messages:
    553
    Positive Ratings:
    102
    Great tutorial, thanks! bookmarked
     
  16. cbite

    cbite L1: Registered

    Messages:
    1
    Positive Ratings:
    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.
     
  17. iller

    iller L1: Registered

    Messages:
    4
    Positive Ratings:
    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?
     
  18. Ravidge

    aa Ravidge Grand Vizier

    Messages:
    1,544
    Positive Ratings:
    2,492
    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.
     
    • Thanks Thanks x 1
  19. DisruptedHunter

    DisruptedHunter L2: Junior Member

    Messages:
    89
    Positive Ratings:
    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?
     
  20. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,031
    Positive Ratings:
    3,975
    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.
     
    • Thanks Thanks x 3
    Last edited by a moderator: Oct 1, 2012