vpk.exe Packing: Custom Assets can't be loaded (fixed)

Got problems with your models? Struggling with textures? Get help with your custom assets.

vpk.exe Packing: Custom Assets can't be loaded (fixed)

Postby peegee on Mon Dec 30, 2013 4:06 pm

Hi interlopers,

i tried to pack my custom folders like "materials" with a small batch file with .bat ending into vpk format.
Placed it in the SteamApps\common\Source SDK Base 2013 Singleplayer\bin folder and started it.

Code: Select all
@echo off

set DirFileName="X:\path\path\path\SteamApps\sourcemods\STTR\materials"

start vpk.exe -M %DirFileName%
exit

so vpk.exe with -M option created materials_000.vpk, materials001.vpk and materials_dir.vpk
Surprise! It worked! This files could even be extracted with GCFshape.

And i added the pathes in the gameinfo.txt
Code: Select all
         game            |gameinfo_path|materials.vpk


and i tried
Code: Select all
         game            |gameinfo_path|materials_dir.vpk


But the content was not regonized by the engine. :cry:

Has anyone an idea how to pack custom content properly with vpk so that they can be shipped?
Thank you and have a HAPPY NEW YEAR 2014
Last edited by peegee on Tue Dec 31, 2013 6:14 pm, edited 1 time in total.
"All things are difficult before they are easy." Thomas Fuller
User avatar
peegee
Regular
Regular
 
Joined: Fri Aug 28, 2009 10:54 am

Re: vpk.exe Packing: Custom Assets can't be loaded [Fixed]

Postby peegee on Tue Dec 31, 2013 6:14 pm

Fixed :D
The problem was the missing response file and the simple way of packing.
Have the solution for the more complicated but working way here:

You have to follow the way mentioned on the developer page of valve
https://developer.valvesoftware.com/wiki/Vpk.
Scroll down down and down, an example of that file will be there under Response File.

After installing phyton i edited the pythonscript for my needs.
In this script the file endings which have to be packed are in. As well the path to
the vpk.exe. In my case the path to the bin folder in "Source SDK Base 2013 Singleplayer".

Code: Select all
# User settings (don't use the \ character)
target_folders = [ "materials", "models", "scenes", "sound" ]
file_types = [ "vmt", "vtf", "mdl", "phy", "vtx", "vvd", "pcf", "vcd", "wav" ]
vpk_path = "C:/Program Files (x86)/Steam/SteamApps/common/Source SDK Base 2013 Singleplayer/bin/vpk.exe"
 
# Script begins
import os,subprocess
from os.path import join
response_path = join(os.getcwd(),"vpk_list.txt")
 
out = open(response_path,'w')
len_cd = len(os.getcwd()) + 1
 
for user_folder in target_folders:
   for root, dirs, files in os.walk(join(os.getcwd(),user_folder)):
      for file in files:
         if len(file_types) and file.rsplit(".")[-1] in file_types:
            out.write(os.path.join(root[len_cd:].replace("/","\\"),file) + "\n")
 
out.close()
 
subprocess.call([vpk_path, "-M", "a", "pak01", "@" + response_path])



I added the folder "sound" and the ending "wav" in this script.
The ending ".py" was added and the edited script was placed in the mod folder.
After doubleclicking and executing that file automatically the content of that folders
were packed and a "response file" named "vpk_list.txt" were added.
In this list all names of the files added to the vpk are enlisted. The resulting vpak files were than named as
pak01_000.vpk
pak01_001.vpk
pak01_002.vpk
... and so on. Additionally a pak01_dir.vpk were added. It contains the path informations.
If you like to extract files from the .vpk files, you may open this _dir.vpk file with GCFScape.

Last Step: Editing the gameinfo.txt and adding the path to the vpk files:
Code: Select all
         // This lines are added by peegee for vpk regognition
         game+mod            |gameinfo_path|pak01.vpk

It will find the vpk files, the _000 etc is not necessary.

Than I removed the original files, except of the "materials/vgui" folder.

That's it. So lucky 2013 ends with a solved problem. :smt041
Last edited by peegee on Wed Jan 01, 2014 12:52 pm, edited 1 time in total.
"All things are difficult before they are easy." Thomas Fuller
User avatar
peegee
Regular
Regular
 
Joined: Fri Aug 28, 2009 10:54 am

Re: vpk.exe Packing: Custom Assets can't be loaded (fixed)

Postby Garrador on Tue Dec 31, 2013 6:27 pm

Great stuff! Will be using this on my own stuff as well. Thanks
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: vpk.exe Packing: Custom Assets can't be loaded (fixed)

Postby peegee on Sun Jan 05, 2014 2:01 pm

I have to admit that "scenes" did not work in vpk even they were in.
I figured it out today. Maybe you have more luck or
better exclude scenes and vcd-files from packing.
"All things are difficult before they are easy." Thomas Fuller
User avatar
peegee
Regular
Regular
 
Joined: Fri Aug 28, 2009 10:54 am

Re: vpk.exe Packing: Custom Assets can't be loaded (fixed)

Postby SM Sith Lord on Sun Jan 05, 2014 3:02 pm

Awesome, I've been wanting to convert my mod's assets into .pak files for a while but was fearful of the road bumps. Thanks for paving the road!
SM Sith Lord
Been Here A While
Been Here A While
 
Joined: Sat Nov 25, 2006 4:25 pm
Location: Los Angles, CA

Re: vpk.exe Packing: Custom Assets can't be loaded (fixed)

Postby peegee on Sun Jan 05, 2014 4:00 pm

And another candidate, who do not like to be packed:
All assets like weapons which have the same name like in the
original game but has been changed.
Reason for this: the engine first looks into the custom folder which is not packed,
then in the folders of the original game like ep2 and after this in the vpk file.

I changed a viewmodel of the crowbar and arm.
Replacing this in the model/Weapons/ folder it shows the desired viewmodel of my mod.
"All things are difficult before they are easy." Thomas Fuller
User avatar
peegee
Regular
Regular
 
Joined: Fri Aug 28, 2009 10:54 am

Return to Custom Asset Help

Who is online

Users browsing this forum: No registered users

cron