PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Unpack PAK0 if you can... WOW !

I unzipped the PAK file i.e. twice, from the zip and the gz, and the menu speed difference is amazing.  When I saw it load and the menu speed I LOL !!  I mean WOW I can't stress how much difference it makes.

Carpedium - Don't leave after all your good work.  I NEED a 'slightly' faster version to run on my E115.  After unpacking the PAK (and I know it shouldn't make a difference) suddenly the whole thing is playable, but a few more frames ...
Moose or Chuck · 01 Mar 2001, 13:56 UTC
The game itself shouldn't run ingame faster because you unpacked it. But loading speeds would indeed be greatly increased.
yeah, the gzip algorithm is pretty slow, but it does a great job at compression.
Yea, I mean ya gotta hand it to Dan, in following the Quake evolution on Brighthand, NOBODY ever mentioned a solution to storing the PAK files on your device.  This feat has really been sorely overlooked, or overshadowed I guess.

An FYI, I only keep the the pak0.pak file unGzipped, as it contains the game essentials like menu etc.  I keep the registered pak1.pak file Gzipped still, which cuts it's overall filesize in half (15+ megs).
Moose or Chuck · 01 Mar 2001, 20:05 UTC
Boy I love my 1 GB MicroDrive ;D
Ditto to that Moose!  I have all my MP3's, like 13 big programs, and LOTS of room for this!  
Tommy · 06 Mar 2001, 06:25 UTC — registered Doom
Hi 999

I guy name Jerome need your help loading the registered Doom see the thread

http://www.pocketmatrix.com/cgi-bin/forum/welcome.pl?board=Pocketquake&action=display&num=200
In case anyone cares, here's why the gzipped pak file is so much slower. A "pak" file is merely a conglomeration of many individual files and directories. It is not actually compressed - its sole purpose is to keep a whole directory tree and files in one single neat package. The pak file contains a lookup table (like a directory) that tells where each file is located (how far to seek into the pak to access that file). That is where the problem arises. Any compression algorithm is bad at seeking, because seeking requires 1, that you only seek forward, and 2, that you decompress as you go. The problem is that I doubt the pak file is optimized so that the files are in the order that they are loaded. If a file is requested that is located before the last read file, then gzip has to go back to the beginning of the file and decompress everything up to the start of the target file.

So, if a person were to modify a pak file so that the order of the entries were as Quake loads them, I would think that the loading would speed up exponentially.

Dan East
Dan, thanks for the details.

Has Carpediem left the forum/development for good or is he still around?

I only ask as I'm salivating at the thought of squeezing a little more out of my frame rate.

Does any one have any thoughts on the best way of doing this using the config etc. or is there a new release on it's way (Please Carpedium make me happy!)

Quake still is arguably the best true deathmatch game available, especially online and to have it on my E115 !!!! Heaven.

Thanks fo all the work guys, you should be charging for this.
I've always been irritated with id's PAK files- the fact that they seem to "hide" everything from me. So I was determined to get around it.

The PAK file is exactly how Dan explained it. But a little known fact is that it can be unpacked, and the game will run from those individual files and folders- without the aid of a PAK file. Which means the PAK file(s) can be deleted.

I pulled this off on my PocketPC. I can start PocketQuake and the main menu literally pops up 5 seconds later. A SinglePlayer game loads in 1 second flat. I AM NOT KIDDING!

Now, I have the option to add/remove individual maps, textures, models and sounds. You know, the stuff I don't necessarily need (like ALL 21 maps).

It doesn't increase FPS whatsoever, but we already knew this. It doesn't affect gameplay, or sacrifice visual quality.

A few tricks are involved to get this to work properly- which I discovered only by looking at the WinQuake source code.

Yeah, certain limitations exist. But for absolute control over my file system, it's a pretty good trade-off.
Moose or Chuck · 07 Mar 2001, 14:47 UTC
And randall, it isn't any larger in size on your device is it?
Now I need to find my own unpakker. I used to have one somewhere (hears sounds of shuffling paper). Nope, can't find it.
Well, that's one of the limitations. It is around 17 megs unpacked. Pretty hefty in size. It loads like a bat outta hell. I dumped most of the maps and only kept the ones I play most often.

It's down to 8.5 megs now.

I can trim it down even further, but 8.5 megs is a good size. I can add/remove maps easily to maintain my free memory.

I'll unpack the Pak1.pak file and see how far I can trim it down later this afternoon. I used Qped 2- it's pretty easy to use.
You guys can verify this for me, but you should be able to mix and match between pak, pak.gz, and extracted files. This is the order Pocket Quake searches for individual game files:

\quake\(individual unpaked files)
\quake\pak0.pak
\quake\pak1.pak (pak2.pak, etc)
\Storage Card(s)\quake\(individual unpaked files)
\Storage Card(s)\quake\pak0.pak
\Storage Card(s)\quake\pak1.pak (pak2.pak, etc)

If both a pak0.pak and pak0.pak.gz file exist in the same directory, then only the pak0.pak file will be used for that dir.
So, you can unpak select files, and leave the rest of the files in the .pak or .pak.gz files. PQ will find the unpaked files first and not touch the pak / pak.gz file (for that file). Or, a kind person could create a pak0.pak with only the basic menus, fonts, menu sounds, etc, and create a pak1.pak.gz containing the actual levels. Those using the registered pak1.pak could just name the file pak2.pak.
Note that PQ will use the source it finds first in the above search order. Thus if you have a decompressed pak0.pak on your storage card (or completely unpak the files), and still have pak0.pak.gz on your device (\quake\), then it will find the gz file first and use it. That obviously would not be the desired effect.
Is that crystal clear? :)

Dan East
Yes it is VERY CLEAR as a matter of fact. The structure and order of preference is very similar to that used in the Quake2 engine. I used to mess around with Sin, Halflife and Quake2.

Indeed, you can mix and match in the manner you described.

I am not 100% sure about the order-of-preference. I know the unpacked individual files get preference above all else, like you stated (Dan). Sin's super-charged Quake2 engine preferred files in Pak2 over Pak1. This allowed updates to be included in the newest PAK file, thus ignoring previous versions of the file in the older PAK files.

Dunno if this is true for all Quake engines and PAK files, but it is easily verified. I'll check on this later.

Re-packing the files without the maps would be around 7 megs + or -. Gzipping would further reduce it to about 3.5 megs + or -. But then the slow load time would start all over again.

There is a slight catch to re-packing the file. It requires the something I found in the source code:

"\quake\id1\gfx\pop.lmp" must exist in order to use a modified PAK file. This seems to be the only way Quake verifies if the user has a registered version or not. For registered users, this file is in pak1.pak. Un-registered users, of course, do not have this file.

Unpacking that ONE file and putting it in "\quake\id1\gfx\", enabled me to have a registered version without the cumbersome pak1.pak. Dunno, how ethical this is but it works. How does this coincide with the free source agreement with id software?

All this pak0.pak.gz pak1.pak PAK stuff is kind of confusing unless you really know what the files do.

Peter packed a pack of pak1.paks; unpacking pak0.pak.gz packed packs of files in Peters iPaq. LOL
You're exactly right about the pop.lmp file being the method Quake uses to determine if it should be "registered" or not. I noticed that today in the source code while I was verifying the search order. The registered version of that file is required to run a dedicated server, or play modified wads. I don't condone swapping that particular file, I'm just stating the obvious.

The search order I specified is exactly the way it is, based either on the way I implemented it (the gzip and CF card support), or the way it is originally written in the source (looks for un-paked files before looking in the .pak). Also, it searches the pak files numerically (pak0.pak then pak1.pak, etc). Based on the source, it is also possible to have an unlimited number of pak files as long as the sequence is not broken within that directory. So it would seem that you cannot have pak0.pak on your device, and pak1.pak on the CF card. The pak1.pak will not be found unless there is a pak0.pak on the card. You could have a pak999.pak, as long as pak files 0-998 are in that directory too. I need to modify the source to allow the pak number sequence to span directories.
Can someone verify that if you have pak0 on your device, and pak1 on the card, the pak1 file is not recognized?

Dan East
Last modification: Dan East - 03/07/01 at 19:01:24
Wow, this whole pak thing gets confusing after a while.

I don't have the room on my Casio to test the order-of-preference, with the pak1.pak, pak0.pak and individual pak files. Instead, I tested it on my laptop using a registered version of WinQuake. Dunno how this compares to PocketQuake.

For the record, unpacked or individual files are considered "modified files" by the Quake engine. Quake must be registered to use modified files.

The order-of-preference depends on the presence of the pak0.pak, pak1.pak and unpacked files. This is because of the way the engine looks up the "gfx/pop.lmp" file.

Here are four different ways of mixing the files, and the order-of-preference. (* identifies the preference)

(1.)  *pak1.pak
      pak0.pak
      (unpacked files)


(2.)  *pak0.pak
     (unpacked files)


(3.)  *(unpacked files)
      pak1.pak


(4.)  *(unpacked files)

The unpacked files came from pak0.pak and included "gfx/pop.lmp". Numbers 1 and 2 appear to be consistent, but unexpected. Number 3 completely switches with the absence of pak0.pak.

Mixing the unpacked files with PAK files can certainly be done. It doesn't appear to be as cut-and-dry as "THIS FILE ALWAYS GETS PREFERENCE" as I previously stated.

I'd recommend using ONLY pak files, or ONLY unpacked files, but not mixing the two.
So is this the same with PocketQuake, or did you change it, Dan?
What I mean is, can someone actually test, this on a PocketPC?
According to the source, it should search for individual files first, then look in the pak file. That's not something I changed.

Dan East
so we can load custom files now, or what?
Here is the way I consucted the test.

I inserted a start.bsp file in pak1.pak
I inserted a start.bsp file in pak0.pak
I inserted a start.bsp file in the \quake\id1\maps folder


Start.bsp is the the first map of a SinglePlayer game.

Each file was actually a different map, which I renamed "start.bsp". This was to make it easier to differentiate which file was being loaded when I started a SinglePlayer game.

In the case of playing a custom map, the custom map only exists in ONE location: \quake\id1\maps\
So that location gets preference, since it doesn't have much of a choice.

I can't account for the discrepency when the file exists in all locations.

On a different note: I unpacked pak1.pak and pak0.pak and combined their contents. All the map files were deleted to reduce the total size to 9.0 megs.

Essentially I have pak1.pak and pak0.pak on my Casio- without all the bloat from the map files (I don't have a memory card or drive). Now Ican play pak1.pak maps! :)

Once again, repacking and gzipping the file will reduce its size even further.

Last modification: randall - 03/08/01 at 13:09:45
Dr. Phat:

Yes, we can play custom maps. I suspect we have been able to do this all along, I just haven't been able to test it until now (limited space).

There are requirements that MUST be met in order to play custom maps with the current build(s) of PocketQuake.

1. PocketQuake requires pak1.pak to verify the game is registered (actually, only "gfx/pop.lmp" is required). Without this verification, playing custom maps and modified PAKS is not possible.

2. All custom textures, models, sounds and extra graphics must be present either in a PAK file or as individual files.

3. You must have enough room on your device to meet all these requirements AND have enough extra memory to run the game.

Normally, this would require at minimum 24 megs af storage for the PAK files alone (both files gzipped). I have trimmed it down to 9 megs + the size of the custom map. A typical custom map is less than 1 meg.

Keep in mind that custom maps can have a higher-than-normal polycount- especially nowadays since we have much faster computers. These kinds of maps will run painfully slow on a PocketPC... high polycount = low FPS.

SOOOOOOooooo, the short answer is YES, you can play custom maps. and YES, I have actually verified this by PLAYING a custom map on my Casio (IMP1SP1.bsp)



Moose or Chuck · 09 Mar 2001, 14:14 UTC
Let's say you have a gfx.wad file in both pak1.pak, pak0.pak, and pak9.pak.
The engine searches each pak file, starting with 0, going up to 9. The engine says, "Hey look, there's that gfx.wad file I need, horrah! But wait! I haven't looked through pak1 or pak9 yet. Let's take a gander." So it does, it then finds gfx.wad in both pak1 and pak9, so it has 3 to deal with! But... the pak files are numbered sequentially. And of course, a normal person start's (old) with 0 and ends (new) with 9. So, it looks like the newest files should be in pak9.pak, "I'll use pak9's gfx.wad," exclaims the engine.
That is how it works.
Knowledge learned from many months of Q2 and Sin pak editting, may or may not be applicable. Void where prohibited ;).Last modification: Moose Master - 03/09/01 at 12:14:53
In a nutshell Moose, that is pretty much how it works. But Sin and Quake 2 seemed to be a little more consistent by ALWAYS giving preference to individual files, regardless how many times they appear in other PAKs.

For some odd reason I really miss the Sin days of editing...
1st one to make a playable map for quake gets dr. phat's phat seal of phatness! and a pat on the back! from everyone on the board! Hopefully!
Moose or Chuck · 10 Mar 2001, 09:48 UTC
Hehe.. That won't be to hard. I'll make a big cube with no lighting, it will run at 80FPS!! Muahahaha, Deathmatch here I come 8).

I also miss the days of SiN. SiN had the most kick arse Deathmatch games ever, levels above Quake2. I don't know what made it so much fun either. I think it was the maps, they were pretty realistic (real world type realistic).

Oh, and Dr. Phat, you do need to get offline once in a while. ;D
Last modification: Moose Master - 03/10/01 at 07:48:56
Dunno what it was about Sin that made it so cool.

Unfortunatly, not many people used SinScript in their maps- which was so easy to use and really enhanced the map. I wonder if anyone ever used those two prefabs I created with SinScript- "control tower" and "articulated boom lift".
Sorry this is getting "off topic"

WOW, how 'bout them PAK files, huh? Lots of stuff packed in them PAK files. oh yeah, lots of stuff... and... stuff. Or something.
Randall- my point exactly, its not a crime to stray off topic. it is just the way the conversation goes!
Moose- A deathmatch would be so phat! like phat to the extreme!
Can you make like unlimited ammo and weapons and stuff in the .cfg file?
Dan, I have pak0.pak and pak1.pak unpacked on my Casio. This method has worked very well so far, as far as game play goes.

For some reason PocketQuake doesn't like it when the *.dem files are unpacked. It won't even run the demos.

These files MUST reside in pak0.pak, so as a quick fix, I repacked the *.dem files. The resulting PAK is very small. But the fact that I am forced to use a pak0.pak is irritating.

I can't use a different PAK number (pak3.pak for instance) because the game requires the existence of pak0.pak and pak1.pak.

This doesn't happen on the PC version. Any ideas?
Randell

Concerning your demo problem. Personaly I have
Discarded the demos (got sick of waiting to
watch some other dude playin and besides them
things take up space)by editing the "quake.qc"
File just open it up (with any text editor)
and delete the line that says.


startdemos demo1 demo2 demo3

then get rid of the ".Dem" files altogether.
Yeah I edited the Quake.rc file by just commenting out the demos instead of deleting them:

//startdemos demo1 demo2 demo3

If I ever need to play the demo, I can add this to my autoexec.cfg file:

timedemo demo1

I still don't know why the demoX.dem files have to be packed in a PAK file.
Boy Randall, you are right. These .pak files are intriguing! ~
LOL

Phat, you are the funniest, most intriguing person I have ever seen online~

And your non-sensical blathering NEVER gets old~

Seriously, I know this PAK file stuff sucks and my posts are excedingly long. But I doubt I was writing this for Mr. "wah-don't-take-my-stars-away".

well randall
thanks for your input~
I was agreeing with you from another post of YOURS!  Asshole~
Moose or Chuck · 13 Mar 2001, 16:39 UTC
Hey look! I created a trend! Tildes!
Hip hip horray~
Moose or Chuck · 14 Mar 2001, 06:34 UTC
You know, you don't have to use sarcasm in every sentence~
gotta add my .02

you can balance the unpacking/packing for size vs performance !
1) unpack all the files you want to load on the pocket pc
2) take all the maps and repack then into 1 pak file
3) compress that pac file with gzip

this way your pocket pc will have all the speed it needs when loading model's sound and menu's AND the maps (the biggest files in the game) will be the smallest you can make them.

i did this with the regged version of quake and it takes up 27mb +/- total and loads and moves like the dickens !
this is in comparason to to loading 55+ mb of unpacked data onto you pocket pc ...
Just FYI (this may be common knowledge already), if you unpak the .pak file so you have many individual files in subdirectories, it will both take more storage space, and take slightly longer to load. Here's why: the FAT filesystem used by CE has an allocation size of 4096 bytes. That means that each individual file's size is rounded up to a multiple of 4096. Thus, statistically, you can add on 2048 bytes per individual file. Plus, each subdirectory entry takes up somewhere in the neighborhood of 10k.
It takes longer to load because with a pak file, Quake opens it once and keeps it open. The pak file contains an index showing exactly how far to offset into the file to access a particular subfile. So to begin loading a subfile Quake does a single seek into a file that is already open. In the case of individual files, Quake has to ask Pocket PC to open the file. The OS then has to find the file, allocate a handle for it, then do whatever other overhead filesystem crap needs to be done. Then Quake can begin reading the file, after which it is closed, and the OS has to deallocate those resources.

Just an FYI thing...

Dan East
Right now I have everything uncompressed on my storage card.  Dan, are you saying it would be better to keep the files in the paks?  
Wow, I haven't seen the nick Prometheus in a long time :)

I used to know a TK-Prometheus back in the Q1 days.

Well I've used this nick for about 4 years in RocketArena 2 and 3. I never did any clan Q1 stuff though.
About the FAT tables- yeah, that's even true for desktop computers. Although the numbers are different.

Loading unpacked files should be slower, but I haven't noticed any difference. PocketQuake loads in 5 seconds; that includes the intitialisation files and completely loading a map. It's about 10 times faster than my desktop computer loads WinQuake. Harddrives are so slow.

I unpacked my files for convenience more than storage concerns (I like to mess around with the files). But I can see how re-packing the files would save more space.

Quake seems to look for PAK0.PAK first and if it doesn't find it, it just quits looking for any additional PAKS. It would be nice if PocketQuake would just grab the first (and all PAK files) it encounters and read through them as necessary. That way we could have 999.PAK, Fcorp.PAK, Realworld.PAK or any other name we like. Similar to Unreal Tournaments file structure (although UT's load time sucks)

I don't know how this would affect Program Memory, if at all. Is this possible or is it just a lame idea altogether?
Supertofu · 18 Mar 2001, 14:12 UTC — Unpacked Pak1.pak
what program do i need to unpak the file, and is there anyplace where a condensed, yet unpacked .pak file exists?
Supertofu · 18 Mar 2001, 14:16 UTC — Quake speed on em-500
Does unpacking really change the speed of the game on loadup.  As it is, it is brutally slow right now.  Also anyone heard of a software overclocker for em-500 yet, or any casio for that matter?
SuperTofu:

UnGzipping speeds it up dramatically on loadup.

Additionally, I've read that there is a slow transfer rate issue with the mmc on the EM-500.  The new update patch is supposed to have fixed that.  Try installing that patch and see if your load times get better.  I don't have a link handy, sorry.

Alternatively, you could just make a custom pak file with just the bare essentials and keep that locally.

I have a Casio EM-500, and I put Quake on the MMC card. I also have the update (it's on the CD), but the load times are still insane. 15 minutes from pocketquake.exe to shooting. The update was 2.4. I don't see a difference though. I don't think overclocking would make that much of a difference. Oh, when I try ungzipping pak0.pak.gz, the pak0.pak is 0 bytes.
Moose or Chuck · 18 Mar 2001, 15:20 UTC
There has been a more recent update, downloadable on the website. NOT on the CD. It's version 1.01 and I have the file on my HD if anyone REALLY needs it.
I can't remember exactly how I ungzipped my file, I know I used Winzip- can't remember if I had to download gzip or not. I do remember it screwing up once and creating a 0-byte file. I just ungzipped it again.

ungzipping makes a big difference. 15 minutes to load is just insane. My casio e-125 loads PocketQuake in 5 to 15 SECONDS, depending on the size of the map.

Unpacking isn't necessary, unless you want to make modifications to the files like 999 and I have done.

I use QPED 2 to unpack my files, but there are a million other programs that will do the job just as well.
Well, Casio devices must be particularly bad at something else besides floating point math. It takes around 30 seconds to startup with an iPaq, and 10 seconds to load a level, with a gzipped pak file.

Dan East
It takes that long to load on an Ipaq? Wow, I was impressed with the new load times of the 0.051 MIPS build, it is a good 5 seconds faster. I click the PocketQuake exe and almost instantly the "about" screen pops up.
Oh, wait, you were talking about the Ipaq loading the gzipped file.

I still never had it take 15 minutes to load a gzipped file.
Supertofu · 19 Mar 2001, 02:10 UTC — autoexec.cfg
Anyone have an autoexec.cfg for teh em-500 which has the keys mapped out and autorun-always on?
The startup time was reduced with the 0.04 version (the MIPS 0.04 was not the same). I removed a routine where Win Quake would "touch" all the bytes in the heap to make sure Windows actually made all the memory available to Quake up front. That is not necessary with Windows CE.

Dan East
I have a request to the mips pocket quake team:
can you please code in the ability to have pak files split over internal memory and cf/sd storage?
what i have done is taken registered quake 1 and extracted pak0 and pak1 into a folder retaining their dir structers and then repacked them - the the maps go into pak1 and everything else goes into pak0. then i gziped pak1 and left pak0 alone. this get registered quake down under 30mb (9mb pak0 and 29mb pak1) i would like to keep pak0 on internal memory and pak1 my 48mb flash card. i have tried to do this but it fails to find any maps when i start the game (but it does load) you could keep the hard coded path's and i belive that this would be very easy to do.
ie:
startup
check \quake\id1\ for pak files (remember whats there)
check \storage card\quake\id1\ for pak files (remember whats there)
start quake....

anyway just a suggestion that could make it quicker for me and others...

and this will make it quicker as i notice that playing the game i get the little pent symbol in the upper left witch means that its loading files and that slow it down - the symbol does not appear as long when using pak files from internal memory only...

keep up the good work !!!