Writing a Pakrat replacement

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
I honestly don't think I'd use this that much. I prefer to be absolutely clear that everything is packed correctly and the only way I could personally do that would be to pack it myself.

It is the BSP. Manual packing is irrelevant. Resistance is futile. It wishes to improve itself. It will add your practical and algorithim approaches to its own. Your workflow will adapt to service it.

Among other future options... you will be able to skip running BSPZip, and thus not actually changing anything. In doing so, instead of saving a new mapname.bsp file, it will output a mapname.filelist, which is simply the same file list you would pass to BSPZip if you wanted to do things super-manually.

ex:
Code:
models\mything.mdl
c:\Program Files\Steam\steamapps\logon_name\team fortress 2\tf\models\mything.mdl
materials\foo\bar.vmt
c:\Program Files\Steam\steamapps\logon_name\team fortress 2\tf\materials\foo\bar.vmt
materials\foo\bar.vtf
c:\Program Files\Steam\steamapps\logon_name\team fortress 2\tf\materials\foo\bar.vtf
 
Last edited:

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
Couldnt you add an option to run this just after the compile finished? Theres that fancy point, where you can add your own exes to compile ;)

At least i have a programme that works that way :)

http://www.map-lounge.de/

(at the bottom, its named "materials manager")
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Currently working to parse the MDL format, at least just enough to get required VMT paths out of it. So-far for models/props/metal_box.mdl...
Code:
[00000000]        id:        49445354
[00000004]        version:        2C000000
[00000008]        ???:        88DB21F6
[00000012]        name: props/metal_box.mdl
[00000076]        length:        1872
[00000080]        eyepos:        0, 0, 0
[00000092]        illumpos:        0, 0, 0
[00000104]        min_hull:        -20, -20, -20
[00000116]        max_hull:        20, 20, 20
[00000128]        min_bb:        0, 0, 0
[00000140]        max_bb:        0, 0, 0
[00000152]        flags:        01000000
[00000156]        num bones:        1
[00000160]        idx bones:        664
[00000164]        num bone controller:        0
[00000168]        idx bone controller:        880
[00000172]        num hitbox:        1
[00000176]        idx hitbox:        880
[00000180]        num anim sequence:        1
[00000184]        idx anim sequence:        964
[00000188]        num sequence groups:        1
[00000192]        idx sequence groups:        1080
[00000196]        flag activity list version:        00000000
[00000200]        indexed events:        0
[00000204]        num textures:        2
[00000208]        idx textures:        1580
[00000212]        num cd textures:        1
[00000216]        idx cd textures:        1708
[00000220]        num skin reference:        2
[00000224]        num skin families:        2
[00000228]        idx skins:        1712
[00000232]        num body parts:        1
[00000236]        idx body parts:        1300
[00000240]        num local attachments:        0
[00000244]        idx local attachments:        880
 
Last edited:

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
<frankenstein> Muwhahahaha! IT LIIIIVVEESSS!</frankenstein> Beware the Swamp Pack buoy, vanguard of my evil empire!

Test code:
Code:
ByteBuffer bb = load("buoy_ref.mdl");
ModelData md = new ModelData(bb);
System.out.println("Name: "+md.getModelName());
for(String path: md.getTextureSearchPaths()){
	System.out.println("MatDir: "+path);
}
for(String path: md.getTextureNames()){
	System.out.println("MatName: "+path);
}

Output
Code:
Name: props_swamp/buoy_ref.mdl
MatDir: materials/models/props_swamp/
MatNames: buoy_diffuse.vmt
MatNames: buoy_diffuse2.vmt
MatNames: buoy_diffuse3.vmt

The red/blue/grey textures, respectively.
 

lustygoat

L2: Junior Member
Feb 14, 2009
66
23
When I try this:

C:\packbsp_alpha>run.bat -h

i get this:

'java' is not recognized as an internal or external command, operable program or batch file.

I have java installed, the java test on sun's page works fine, giving me this:

Your Java configuration is as follows: Vendor: Sun Microsystems Inc. Version: Java 6 Update 17 Operating System: Windows Vista 6.0 Architecture: x86

any ideas? fwiw, pakrat doesn't work right either... it lets me select a map, but then only spits out a console window with an analysis of the map file, no actual usable windows or buttons or anything.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
And so, the trouble shooting begins.

If the alternative are things that don't work and nobody knows about-it/why, I'll take the troubleshooting :) (On that note, did it "just work" for anybody?)
'java' is not recognized as an internal or external command, operable program or batch file.

Does c:\windows\system32\java.exe exist? The java.com installer should've put it in there for you. And the system32 folder should also be on windows' PATH by default, so "foo" will try to run "foo.exe" in that folder by default. (At least, I know that' show it works on XP.)

If it does exist, try opening the .bat file and editing "java" to read "c:\windows\system32\java.exe". If it doesn't... then maybe the Java install didn't work?
 
Last edited:

Cameron:D

L6: Sharp Member
Sep 28, 2008
363
145
It works for me... But it says the environment variable isn't set (Windows 7). I checked, and it is set under local account variables (I set it to the correct path too) and it still says that it is not set.
 

Jamini

L4: Comfortable Member
Nov 14, 2008
196
47
I had no problems (aside from needing to reset my environmental variables, since somehow my Java runtime environment PATH was erased.) getting it to work (with the UCMP, which actually crashed pakrat!)

Gotta say Terr, you are doing some really damn good work here.
 

SiniStarR

L8: Fancy Shmancy Member
Mar 31, 2009
585
116
im gonna throw a crap ton of custom stuff into a map and see what happens, if that what this alpha does.

EDIT: It opens when I hit the run.bat and then immediately closes, is it me doing something wrong?
 
Last edited:

Darth Cyrax

L2: Junior Member
Nov 29, 2008
94
8
I don't think you mentioned it in the log, so I'm going to assume it doesn't pack custom sounds(not soundscapes).
That would be nice, but not mandatory.
 

lustygoat

L2: Junior Member
Feb 14, 2009
66
23
Does c:\windows\system32\java.exe exist? The java.com installer should've put it in there for you. And the system32 folder should also be on windows' PATH by default, so "foo" will try to run "foo.exe" in that folder by default. (At least, I know that' show it works on XP.)

If it does exist, try opening the .bat file and editing "java" to read "c:\windows\system32\java.exe". If it doesn't... then maybe the Java install didn't work?

c:\windows\system32\java.exe doesn't exist. Perhaps because I'm on Vista? I do see java.exe's in these places:

C:\Program Files (x86)\Java\jre6\bin\java.exe

and

C:\Windows\SysWOW64\java.exe

I edited the batch file to point at one of those, like so:

"C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar packbsp.jar %*

and it works. Then I added a PATH environment variable to point at that jre6/bin directory, and the normal batch file works as well (just using "java -jar etc.")

I guess on Vista 64, the Java installer puts the .exe in these places, and doesn't bother setting a path environment variable?

Now when I run it on a real file, it gets to this point and stops:

[GCF] c:\program files (x86)\steam\steamapps\Source Sounds.gcf (hl2)
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
I guess on Vista 64, the Java installer puts the .exe in these places, and doesn't bother setting a path environment variable?
Ah. Not a Vista problem as much as a 64-bit thing. I'd try also using the 64-bit installer. I can't seem to find the right download link myself, but maybe there's some sort of weird autodetection going on that I can't test on this 32-bit OS...

I don't think you mentioned it in the log, so I'm going to assume it doesn't pack custom sounds(not soundscapes).
That would be nice, but not mandatory.
Maybe a bug? It ought to catch and include custom .wav references in soundscapes. (And ambient_generic, and control point sounds, etc.) Maybe post the soundscape?

Now when I run it on a real file, it gets to this point and stops:
[GCF] c:\program files (x86)\steam\steamapps\Source Sounds.gcf (hl2)
Do you mean it ends, or that it freezes?

That ought to be where it starts parsing the BSP. Does running [ame=http://forums.tf2maps.net/showthread.php?t=8013]vbspinfo[/ame] manually work? Perhaps the hllib.dll version doesn't work on x64? Hmmm.
 
Last edited:

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Gunna take this for a spin for cp_stark_a9. Please put your download link in your first post like any normal person so you dont have to search the whole thread for it :p

I'm gunna have to learn how to use command prompt, can you either step up work on a GUI or write a better tutorial on how to use your stuff as
Open a command-line window, and go to that directory.
is too vague since i have no idea how to do that.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
The next version will be a lot more vocal when something goes wrong. In the meantime, I hooked in the MDL parsing, so dependencies for MDL->VMT->VTF now work.

However, I have an architectual problem I need to fix. Due to how the model defines "search paths" for materials, If a VMT for a model is missing, I can't detect it appropriately as an error condition. :mellow:


Code:
MODEL
        models/props_swamp/gator_ref.mdl
        Working... OK

MATERIAL
        materials/models/props_swamp/gator_diffuse.vmt
        Working... OK

TEXTURE
        materials/Models/props_swamp/gator_diffuse.vtf
        Working... OK

I'm gunna have to learn how to use command prompt, can you either step up work on a GUI or write a better tutorial on how to use your stuff as is too vague since i have no idea how to do that.

  • Click "START" in the lower-left
  • Select "run"
  • Type "cmd" and press enter. Black box of mystery arrives.
  • Then the commands:
    • c: (changes disk if you are already on F: or something else)
    • cd c:\the\directory\you\put\it\in\ (Goes to the directory)
    • run.bat -h (Runs the doohickey)
 
Last edited:

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Can't get it to work at all. Just constantly gives me the no game directory given and no Vproject environment variable found.

I attempted to set it using "run.bat -g \..\team fortress 2\tf" (after using cd to sourcesdk folder) then running the run.bat <bsp> <newbsp> and got the same message
 

MrAlBobo

L13: Stunning Member
Feb 20, 2008
1,059
219
Gunna take this for a spin for cp_stark_a9. Please put your download link in your first post like any normal person so you dont have to search the whole thread for it :p

I'm gunna have to learn how to use command prompt, can you either step up work on a GUI or write a better tutorial on how to use your stuff as is too vague since i have no idea how to do that.

Should also stick it in your sig, you know...might as well advertise :p

Also...people who don't know how to use the command prompt shouldn't be allowed on a computer <_<
anyways, isn't the command prompt required when making custom models?

EDIT: ...I swear it wasn't in your sig before I posted this <_<
 

Cameron:D

L6: Sharp Member
Sep 28, 2008
363
145
Can't get it to work at all. Just constantly gives me the no game directory given and no Vproject environment variable found.

I attempted to set it using "run.bat -g \..\team fortress 2\tf" (after using cd to sourcesdk folder) then running the run.bat <bsp> <newbsp> and got the same message

I'm getting this error too.
I correctly set the environment variable too.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Albobo I've been using computers as far back as i can remember. (ie since i was ~5, cant remember earlier)

There have only been a tiny, tiny handful of times when one needs to use command prompt. And no, you dont need to when making custom models at all. You make a one liner .bat file and simply drag stuff into there which redirects to the valve one, and it all happens magically.