How to create Pak files Created 3 years ago2020-05-18 17:13:35 UTC by abbadon abbadon

Created 3 years ago2020-05-18 17:13:35 UTC by abbadon abbadon

Posted 3 years ago2020-05-18 17:13:35 UTC Post #344229
Hi. I have tried to use Wally and Pakscape to make a PAK file, and both two failed because some errors (lenght of the file, or s**t like that), I have tried everything but, since PAK files are old, I did not find any solution except "download Wally" or "download Pakscape", no tutorials whatsoever.
Is tehre a program that TRULY works? or any SERIOUS tutorial, not "do it with Wally/Pakscape, it is easy!!"... because, no, I repeat, I tried with no luck.
Thanks in anticipation. :)
Posted 3 years ago2020-05-19 00:09:03 UTC Post #344232
Maybe that error message is actually important? Instead of assuming the tool is broken and ignoring the message, you should read the error message and think about what it's saying. If it's about file lengths, then you might be trying to add a file with a very long path. PAK supports paths of 55 characters maximum (plus a null terminator). Take a look at the files you're trying to add and see if any are too long.
Penguinboy PenguinboyHaha, I died again!
Posted 3 years ago2020-05-19 09:27:09 UTC Post #344235
Hi penguin, the folder has only three letters as its name, inside a 10 letter folder all in the root drive. The rest are the common HL folders,so, no, I have read well the message, even I have renamed asset's names just in case.

Folder is as follows:

C:\zionwarcry\zwc\

Even will al lenght of folder's and subfolder's names put togheter it will be no more than 32 letters in lenght, far shorter than those "55" characters you did say. :( I'll try to use names as short as "a" or "b" for assets, but it will be a pain in te ass to change all ents names in the map editor and in the very SDK...
Posted 3 years ago2020-05-19 10:21:02 UTC Post #344236
What is the error exactly, and why are you trying to create pak files? They have nothing to offer that you can't accomplish by just putting files in the game or mod directory.
Posted 3 years ago2020-05-19 14:14:51 UTC Post #344239
Mmmm... PakExplorer throws this:
User posted image
And... Yes, PakScape, and I swear I don´t know why, now ALMOST works, It throws me a pak file that´s incomplete... There are some files, no matter how lenghty is its name, that are not include and when I try to add them in PakExplorer the "Invalid name...", blah, blah appears again.

BTW: I want a pak file for the sake of order because it will not be a "modificable" mod. Oh, I am doing this because the mod now is 100% complete. Only the manual and the installer are left to be done. :)

Well. I realized that, for some reason even with a full pak (I have tried the "very-short-names" method) the Xash engine does not like very much the pak I have done because it does not work. Well, less work for me!!. Thanks aniway to you all this time ;) and sorry for a questions apparently so easy to fix. :pwned:
Posted 3 years ago2020-05-20 09:37:05 UTC Post #344247
Do any of those filenames contain non-ASCII characters, such as letters with an accent or a tilde?
Posted 3 years ago2020-05-20 14:11:38 UTC Post #344248
No, not at all, I´m spanish, but all my material except very little things is all done in english. ;) But, don´t worry, the pak thing was something I want to do just for the sake of order and, well, I think it´ll look cool if you just can see a pak and the config files instead of a bunch of subfolders. :)
Posted 3 years ago2020-05-20 15:54:19 UTC Post #344249
Aniway, the mod, after 15 years and 15 years, at last can be considered Oficially finished!!
Pag 1Pag 1
Pag 2 (of 2) Quick reference CardPag 2 (of 2) Quick reference Card
The full manual is still being written, it´ll be long and with lots of info, but that can wait because what´s needed to play the mod is in that QRC, the rest of options are quite intuitive if you have played Half-Life (or its mods) before. :)

Thanks to all of you people who have contributed to it!!! :P
Posted 3 years ago2020-05-20 21:46:35 UTC Post #344256
The only version that offers me stability and bug-free gameplay is 48/98 (Build 3598), the rest are an absolute mess that don´t let me make a standalone game, pushing me to use the old mod structure for HL (A folder inside the HL folder that must run inside CUSTOM GAME menu).

I quit of using half-life version for three reaons: edict limitation that always make crash the Mod, among other failures, and because I cannot use materials, and, of course, because Xash has menu background map support. :)
Posted 3 years ago2020-05-21 18:44:25 UTC Post #344262
I remember that some years ago, maybe 4 or 5 years, some guy I know who loves Sven Coop tried to use my mod along with another mod of CS I´ve done changing skins and using some files that let me change some parts of the gameplay (I swear I cannot remember what its name was), and he have had some trouble with that, aniway, after that, I discovered Xash3D and I fixed my problems with edicts and I stick with Xash3D until now. Aniway, THANK you so much for your help!!! :P
Posted 3 years ago2020-05-22 06:10:48 UTC Post #344267
Mmmm, I wonder how I can use Opengl32 with my mod. The gane estructure is like the one of an standalone game, it not depends of a HL folder with its Valve folder inside, and there's no OpenGL.dll anywhere :(
Posted 3 years ago2020-05-22 07:09:21 UTC Post #344268
That is called graphics programming. opengl32.dll is usually inside the System32 directory, so there's no need at all to put your own into your game folder.

In order to use OpenGL, you might wanna install some stuff like GLEW, to be able to check for OpenGL extensions easily, and also (in case it's not been done), make sure you link against opengl32.lib:
User posted image
Then you can use OpenGL functions:
THIS is OpenGLTHIS is OpenGL
It doesn't require a custom OpenGL DLL at all.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-05-22 13:54:29 UTC Post #344272
Wow. I have recently updated my graphics card drivers and that included some Vulkan stuff, idk if some OpenGl stuff is updated aswell. Aniway, I´ll try Paranoia´s OpenGL32.dll, just in case. :)
Posted 3 years ago2020-05-22 16:28:22 UTC Post #344274
Don't use custom opengl32.dll files. All opengl32.dll does is provide an API to access OpenGL with. It supports the full OpenGL API up to whatever your OS, GPU and driver supports.

The actual driver is loaded by opengl32.dll and this process works with whatever your OS supports. You do not need a custom opengl32.dll. The only use of such files is to work around engine-level graphics code not doing what a mod wants it to do and to cheat.

As a modder you are unlikely to need it, and if you really need to override engine level graphics code there are better and safer ways (e.g. replacing the engine window with a custom one, redirecting engine functions so you handle it in client.dll, only when VAC is disabled of course just like when you use custom opengl32.dll files).

The vanilla engine deletes custom opengl32.dll files found in the game directory as part of basic anti-cheat (probably superseded by VAC but it was never changed).

See this for more information: https://www.khronos.org/opengl/wiki/FAQ#How_Does_It_Work_On_Windows.3F

@zooogor you clearly don't know how this works so please refrain from misleading others.
Posted 3 years ago2020-05-22 17:34:47 UTC Post #344276
In other words, if you take Paranoia's opengl32.dll, you are NOT gonna get its neat graphical effects. None of them. Chances are, something might even break.

If you want to add fancy graphics, you must implement all that yourself and none of it requires a custom opengl32.dll!
Bloom (outdated, relies on Cg)
Normal mapping (also outdated since it relies on Cg)

If you want those fancy effects, your best option is to just rewrite the whole renderer, use OpenGL 3.3 with GLSL shaders, and do your stuff from there.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-05-22 18:08:44 UTC Post #344277
replacing the engine window with a custom one, redirecting engine functions so you handle it in client.dll, only when VAC is disabled of course just like when you use custom opengl32.dll files
Oh, if only I were able to get everything rendered by the GPU and not the CPU. Imagine, with the GTX 1050 that my PC mounts, the Mod would not drop below 140 fps and now it does not go up from 25 until very late in the game, which is when many of the models used in the environment disappear and start throwing values of 50 fps...
But I must put up with what I´ve done so far! :) BTW: Thanks a lot Solokiller for pointing me to avoid the dll changing!!
Posted 3 years ago2020-05-23 09:21:31 UTC Post #344283
So, what you are trying to say to me is that, there´s a way Xash3D will make run my mod at 60 fps if I use the OpenGl32.dll from paranoia? I don´t care of VAC since this project is private and I don´t intend to make it to the public (yet), so if that solution works, I´ll be more than happy. But Solokiller points me to a direction that seemed to be fine tough and within the very folder of the mod. I am quite lost now, guys. :/ Sorry.
Posted 3 years ago2020-05-23 10:32:46 UTC Post #344284
Using custom opengl32.dll files will not improve performance. Using custom graphics code will improve performance if written properly.
Posted 3 years ago2020-05-23 12:27:23 UTC Post #344285
That´s what I´ve thought... Too beautiful to be true, hahaha!! :lol: I hope some day you´ll release something like the version of Xash I´m using but with a full working GPU render system embedded (I mean, my version of Xash HAS NOT a gpu rendering system, just CPU rendering)..
Posted 3 years ago2020-05-23 13:15:30 UTC Post #344286
The only reason Paranoia has a custom opengl32.dll is because they didn't know how to achieve things without it. Everything they did with a modified opengl32.dll was entirely possible with the original one, by using proper graphics programming techniques.

They did 3 things: added a stencil buffer, added an alpha buffer and modified the depth range. The alpha buffer was, interestingly, used to support really old GeForce graphics cards, in terms of storing render data for dynamic lights. There are other ways to do that without using a hacked DLL.

But the funniest thing of all is, the stencil buffer was "needed" to prevent the flashlight texture from tiling itself, which was actually easily fixable without a custom DLL.
Here's an illustration:
Normal, with clamping to edgesNormal, with clamping to edges
Without clamping to edgesWithout clamping to edges
Instead of modifying opengl32.dll, they could've just used a simple flag for the texture: GL_CLAMP_TO_EDGE with, of course, a completely black border around the texture itself.
Here are 4 different options for texture wrapping:
User posted image
Taken from here.

The depth range modification was unnecessary, because they could've used some maths to adjust the depth values on the receiving end.
In case you're wondering, this is depth:
Black = close to the camera, white = far from the cameraBlack = close to the camera, white = far from the camera
These values go between 0.0 and 1.0, and it is generally used to blend fog, soft particles and such. I don't know how Paranoia's renderer utilised it, but editing the DLL was needless.

If you want to improve performance in Xash3D, or any HL mod, really, you have to learn about graphics programming with OpenGL. If you have access to Xash3D's source code, you can probably do some smaller optimisations without rewriting the renderer.
Otherwise, if you want a 2x, 3x, 5x improvement in framerates, you need to have quite some experience in modern OpenGL or Vulkan. The most ideal one IMO would be OpenGL 3.x.

One misconception is that rendering APIs like DirectX, OpenGL, Vulkan etc. automatically just render your frames and whatever you throw at them. People think they're like "plug'n'play", but no, they're not. Instead, you are the one who defines how OpenGL will work. You tell it how to render the triangles etc. There are many, many functions that the API provides to you, and you can use it. You are wrestling with your graphics card, yelling at it how to render your stuff.

The problem is, GoldSrc's renderer uses OpenGL in so-called immediate mode. And I've probably talked about this 120 times on TWHL Discord, but here's how immediate mode rendering works: (in a very very simplified way)
  • you tell OpenGL to "begin" rendering
  • you send texture data, vertex data (vertex positions, UV coordinates etc.)
  • you tell OpenGL to "end" rendering and wait for the next frame
The thing is, the CPU is always sending rendering data to the GPU, every frame. The GPU receives the polygons, the textures etc., but it immediately "forgets" it the next frame. This is reason #1 why GoldSrc and Xash3D can perform poorly with many wpolys and even more epolys. Of course, in the late 90s, video cards were built for immediate mode, so logically, it was the only option.
But, it's an issue today and it'll be an issue for God knows how long, because modern GPUs have to emulate this mode. Modern GPUs are built for something else, called retained mode.

Retained mode works this way:
  • upload data to the GPU's video memory (preferably when the map starts), and it stays there
  • render them and wait for the next frame
When you're not sending all the data every frame, you can theoretically render the entire map at 200fps, lol.

So, if you want better fps, learn graphics programming and rewrite a part of, if not the whole renderer to work more efficiently. Otherwise, don't make high-poly models.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-05-23 14:13:32 UTC Post #344288
So, if you want better fps, learn graphics programming and rewrite a part of, if not the whole renderer to work more efficiently. Otherwise, don't make high-poly models.
Yeah, Admer, that´s the point. But I have NO idea on how to do what you say, neither I have the time to start learnig a programming language from scratch, I´m too old :crowbar: . I don´t know how I got this far with the poor knowledge of C++ I have, I was so lucky of Sheppard and Solo being gentle and help me countless times, I will lnever thank them enough for that. :)

In the other hand I´ve done a heresy doing the mod as I did. I´ve done all the map as a big container with 12 high poly models as the main structure and a lot of models in it, that, in the end, result in a low framerate for the 50% of the gameplay. I took the engine without having considered that BIG handicap, stupid me, but 15 years ago many of the actual engines were not available, even they did not exist either, so I decided to use what I knew and with what was availabe at that time, and what had full support of modders.

Now I regret it a bit, but I think I managed to do a slightly good work, and, more important, I finished it without feeling completely ashamed of its quality. If it wasn´t for the rendering problem it could be perfect :)
Posted 3 years ago2020-05-24 09:06:30 UTC Post #344293
So once again, opengl32.dll is part of the OS API for OpenGL. If you want improved performance you'll have to write custom graphics code using shaders. Just like every other program you do that by accessing the OpenGL API through opengl32.dll, without replacing it.
Posted 3 years ago2020-05-24 10:50:37 UTC Post #344294
"i wonder what that means.. "custom graphics code" and where that should be "inserted""
We're going extremely off-topic from the original thread, but I believe I must show you an example of "custom graphics code" which will get compiled into client.dll:
Draws a quad on the screen, with a specific texture that gets modified every 10 framesDraws a quad on the screen, with a specific texture that gets modified every 10 frames
This can be taken to a whole new level, where you can replace the renderer entirely. So instead of using OpenGL 2.0 or whatever, you use OpenGL 3.3 with GLSL shaders.
A shader which transforms XYZ vertex coordinates into RGB colours, instead of applying a textureA shader which transforms XYZ vertex coordinates into RGB colours, instead of applying a texture
Admer456 Admer456If it ain't broken, don't fox it!
You must be logged in to post a response.