Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Fury on January 05, 2011, 11:57:39 am

Title: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 05, 2011, 11:57:39 am

EDIT: Here's the TL;DR of the rest of the thread so far (4/25/11).

We don't want to use a new, proprietary format, or a modified existing format, because that would require the addition of tools that we'd have to maintain.  It's basically been decided that non-solid 7z (LZMA) would be the best idea for this format, as 7-zip already exists on all supported platforms for editing archives, and the SDK is open source and compatible with FSO.  No further need to discuss this really, we just need to implement it now.

Chief

--Now here's the rest of the original post--

There was once discussion about allowing support for other file formats than Volition's vp file format for game assets. Obviously the usual suspects of zip, rar, 7z all popped up. They all offer the option to use variety of different compression options or no compression at all. Plus they're easier to manage than vp-files regardless of the vp-managers we have. Would there be other advantages? Certainly, but let's get back to those later.

I decided to perform some tests with data that is very relevant to our use scenario. Compression tests were done with exported MV_Advanced, MV_AnimGlows, MV_Assets, MV_CB_ANI_1, MV_CB_ANI_2, MV_Effects, MV_Intel_ANI, MV_Music, MV_radaricons and MV_Root from FSU SVN. Compression was done using 7-Zip 9.20 utilizing four threads.

For comparison, uncompressed and deflate. Deflate is the standard compression method used in ZIP archives we've all grown to love and hate.
Code: [Select]
Uncompressed 2.54 GB
Deflate Fastest 1.08 GB
Deflate Normal 1.02 GB
Deflate Ultra 1.01 GB
BZip2 is so slow that it's not even worth testing, compression ratio also less than that of PPMd and LZMA but better than deflate.

PPMd is the latest addition to ZIP, RAR and 7-Zip archivers.
Code: [Select]
PPMd Fastest 928 MB
PPMd Normal 860 MB
PPMd Ultra 840 MB

Now, let's test LZMA2 which is successor to LZMA, a popular compression algorithm used in 7-Zip.
Code: [Select]
LZMA2 Fastest 990 MB
LZMA2 Normal 844 MB
LZMA2 Ultra 837 MB

And next, otherwise identical to previous set of LZMA2 archives but these archives are not solid. In solid archives files are compressed as contiguous data blocks. This means that to extract one file from the archive, you also need to extract all other files in same data block. Size of solid data block depends on compression settings, it can be as small as 1MB or encompass the whole archive regardless of its size. Contiguous data blocks increase compression efficiency. Zip archives such as deflate compressed archives are non-solid. A non-solid archive is what you would say is requirement for "stream decompressing", or streaming.
Code: [Select]
LZMA2 Fastest 997 MB
LZMA2 Normal 887 MB
LZMA2 Ultra 885 MB

Now let's review how much RAM is needed to decompress these archives. Whether archive is solid or not has no impact on memory usage.
Code: [Select]
Deflate Fastest 2 MB
Deflate Normal 2 MB
Deflate Ultra 2 MB
PPMd Fastest 3 MB
PPMd Normal 18 MB
PPMd Ultra 130 MB
LZMA2 Fastest 3 MB
LZMA2 Normal 18 MB
LZMA2 Ultra 66 MB

Right, so that covers how small the archives are and how much RAM is needed to decompress. Compression speed is mostly irrelevant in our use scenario, so I'm skipping that. The bigger question is how fast is decompression of compressed archives? Let's try out, both archive and target directory for extracted content is on same physical hard drive which follows our typical use scenario. In this test I'm using non-solid LZMA2 archives as solid archives are unusable in our typical use scenario.
Code: [Select]
Deflate Fastest 2:16 min
Deflate Normal 2:16 min
Deflate Ultra 2:17 min
PPMd Fastest 8:53 min
PPMd Normal 11:43 min
PPMd Ultra 18:46 min
LZMA2 Fastest 2:08 min
LZMA2 Normal 2:10 min
LZMA2 Ultra 2:16 min

From these tests we can immediately rule out PPMd as usable compression algorithm for our use scenario. LZMA2 on the other hand performs admirably, beating even deflate in decompression speed. It is no wonder why some linux distros have adopted LZMA2 compression for use in their installation CD's and repositories as well as slowly gaining popularity in mobile devices for these very reasons.

And so, we have one last question remaining. Just how does LZMA2 compare to uncompressed archive? Again, let's find out!
Code: [Select]
Uncompressed 2:04 min

Are your eyes deceiving you? Certainly not. Fastest LZMA2 decompression is only 4 seconds slower, normal 6 seconds and ultra 12 seconds. And in this test scenario we decompressed 2.54 GB worth of data. The difference in speed should be lower during most mission loads.

Now we can get to the benefits. I can think of following benefits in having compressed LZMA2 archives play role of vp files:
- LZMA2 archives have pretty good checksum checks, so corrupted archives throws up an error. With vp-files you may just end up wondering wtf is going on without really realizing the cause, until JeffVader points out that your checksums in debug log aren't matching.
- Mods and campaigns can be downloaded to mod folders as-is. This is even more convenient with installers such as FSO Installer and Desura.
- Normally you'd keep both extracted vp files as well as downloaded compressed archive around, with support to such compressed archives to work like vp files, you'd only need to keep the compressed archive. This saves a lot of disk space if you have small HDD.

Nobody is forcing anyone to switch from vp files to whatever compressed archives, but it'd be real nice to have the option. Especially since the difference in speed doesn't really seem to be that much.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Turey on January 05, 2011, 01:28:13 pm
This seems like a great idea, assuming the LZMA2 code integrates cleanly with the existing codebase. I'm all for a test implementation.

Plus the bandwidth savings on installation are really awesome.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Nohiki on January 05, 2011, 01:40:07 pm
Can you throw the comparsion to .vp in there? :)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 05, 2011, 01:47:29 pm
A vp is for all intents and purposes same as uncompressed archive, which was covered.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: headdie on January 05, 2011, 02:17:40 pm
Interesting stuff and imo worth investigating,

this is probably a stupid question but how does opening several archives affect performance
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Rodo on January 05, 2011, 02:31:10 pm
I always wondered why VP's where still used, I can see a good feature if LMZA2 support gets implemented someday.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 05, 2011, 02:39:31 pm
this is probably a stupid question but how does opening several archives affect performance
I'm not quite sure what you mean. It's not any different from opening multiple files of any kind. Of course application used and file format does play a large role. But in that area 7z and LZMA have been designed to have small overhead. I opened MV_Assets.vp in VPView and then compared to opening MV_Assets.7z (LZMA2) in 7-Zip. VPView used approximately twice as much memory as 7-Zip did.

But in case of FSO opening the archives, I don't know. The tools and file format have been touted to be an excellent choice in embedded applications and mobile devices. So as far as archives go, I believe LZMA to be very efficient in that regard.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on January 05, 2011, 02:50:39 pm
The point would be moot, anyway. The engine rarely has more than one file handle open.

The important part for FSO's archive handling (and vp files are archives as well), is that FSO expects random access ability. That means, the ability to seek and retrieve any file from the archive at any time. As long as that is guaranteed and the overhead is reasonably low (overhead being defined as the time between the engine requesting a file, and the archive handler starting to stream the data), any archiving scheme can be worked into FSO. Eventually, anyway; I have no idea at this time how complex this would be.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Tomo on January 06, 2011, 03:15:14 pm
I found it was surprisingly easy to swap out opening individual files in a folder structure for opening ZIP (deflate) archives in an internal application at work.
Hardest bit was swapping out use of file handles all over the codebase for the datastream objects produced by the DLL I used.

- It also made the app run about ten times faster, mostly because it exchanged opening then closing about 4000 individual files to opening just one!
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Topgun on January 14, 2011, 02:52:58 pm
why not add tar support and gzip support? that way we we can release packages as .tar.gz and if the user wants they can decompress it into a .tar for faster loading times without converting it to a vp.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Tomo on January 14, 2011, 04:06:31 pm
Tar is inappropriate for this usage, as it is optimised for sequential access.

FS2 Open needs random access, as it doesn't extract the complete contents of VP files into memory at any point (and in fact could not do so).
During application start it just makes a list of the files available and where to find them when requested by a campaign or mission.
(Vastly simplified, it does process some data at load eg tables)

VPs start with a header that lists all the files and the folder structure contained within, each with a pointer to the location and size in the binary blob that the file actually occupies.

On mission load, the relevant data is loaded into the game engine.

Any compressed file structure must be equivalent - same information available in a header, and the 'game data' is then decompressed upon request.

There are several compressed packages that would be suitable, most with the bonus of true error-checking.
- VPs don't have this. If you've got a broken VP file, then it silently causes weird stuff to happen. You have to manually determine which VP is broken.

Source code for the library used by 7z is available, so it would be worthwhile taking a closer look at it to see if it is usable.
The 7z format itself looks like it may be suitable, as the folder and file structure is in the header.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 15, 2011, 01:06:23 am
Yep, tar is unsuitable for this. Also, gz has ****ty compression ratio when non-text files are involved.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Topgun on January 17, 2011, 07:25:07 pm
gz might have poor compression ratio but its fast.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: sigtau on January 17, 2011, 07:28:22 pm
I'd actually take the 7zip route first, considering it's significantly easier to support from what I understand.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on January 17, 2011, 10:12:14 pm
I'm pretty sure it was already shown that LZMA is about the most effective option.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on January 18, 2011, 05:22:33 am

LZMA is what 7z uses. As for supporting it, once the big obstacle of implimenting is over come, there won't be much in the way to NEED to support. Though it will be interesting to see if we can replace libpng's need for zlib with this instead instead of having to tack in yet another handler.

I think LZMA2-NS (non-solid) Normal is a good "default" to aim for. Takes a touch more RAM on decompressing than "Fastest" but the size trade off and the mere few seconds time difference strikes a good balance. 887mb space usage vs 997mb is a much better margin than 887 vs 885.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 18, 2011, 05:39:38 am
In theory non-solid LZMA2 7z archives are by far the most superior choice in our use scenario that I have tested. But how well it works in PRACTICE is different matter. Unfortunately I don't know any way to test it without actually first implementing it in FSO.

Topgun, gz was practically already tested (see deflate results) and it was all around worse than LZMA2. LZMA2 archives even had faster decompression than deflate, even though they had much superior compression.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Topgun on January 18, 2011, 08:40:48 am
ah, I didn't notice that, thanks.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on January 18, 2011, 10:36:35 am
And if we could just use the existing .7z extension or something else 7-zip can associate, we can just open them up with it.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: MatthTheGeek on January 18, 2011, 01:51:40 pm
Extensions don't mean anything. Nothing prevents you to associate any extension to any software you want.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on January 18, 2011, 01:55:56 pm
I'm aware of that, but the likelihood of every user being able to figure that out if it's not already handled is a lot lower.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: MatthTheGeek on January 18, 2011, 02:17:53 pm
Your point ? We're talking on a developer point of view here. The average end-user isn't supposed to have to crack-open the archive.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on January 18, 2011, 02:23:26 pm

And not all Developers are created equally.

Mod developers come in many different flavors. As do code Developers. And in short, the easiest usage scenario for ALL cases will be the best.

We already HAVE an obscure dedicated format. Why make another?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: karajorma on January 20, 2011, 03:09:04 am
We might not want users cracking open VP files easily. Right now if someone wants to open a VP file they need to figure out which tool to use (which gives us a chance to warn them not to replace anything in them).

You can easily replace files in a .7z file. They wouldn't come to us until they'd already ****ed their install over. Even if we can make our files usable in 7zip we should still name them .vp just to avoid that.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 20, 2011, 03:27:49 am
Err? I'd rather not have same extension as vp-files, otherwise you'd need to manually select app to open them in every damned time. If opening those files is such a concern, then I'd suggest supporting all extensions the LZMA libraries support plus one additional custom extension. That leaves the choice up to whoever creates the archives. Custom extension should be something that is not associated to any common file format. The custom file extension could be something like fso, fs7, fsa.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Trivial Psychic on January 20, 2011, 06:24:50 pm
How about calling them .vpc for VP Compressed?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: karajorma on January 21, 2011, 03:07:03 am
Yeah. That would work for me.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: QuantumDelta on January 21, 2011, 05:35:41 am
Psst;
http://www.google.co.uk/search?q=.vpc+file&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Pottuvoi on January 21, 2011, 06:14:27 am
How about .VP2 ?
Says what it needs and is not used elsewhere.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: pecenipicek on January 21, 2011, 06:29:03 am
.vplz mebbe?



(has always preferred extensions with more than 3 letters...)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on January 21, 2011, 01:58:32 pm
Call them .CVP for (Compressed Volition Package). Also not an extension that is in use.

I only worry with STARTING the extension with .vp and having the engine through some accident not looking at whether there is anything following the p and trying to load it like a regular VP. And failing. Or failing to load regular .vp files properly.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Tomo on January 21, 2011, 04:32:02 pm
I only worry with STARTING the extension with .vp and having the engine through some accident not looking at whether there is anything following the p and trying to load it like a regular VP. And failing. Or failing to load regular .vp files properly.
Don't worry about that - VPs and 7z have different magic numbers at the top of the file, and even the first byte is different so no chance of confusing them even if they have exactly the same file extension.

The only 'need' to make them different is to make it easier for us humans - .CVP is as good as anything else!
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: kkmic on January 21, 2011, 04:37:27 pm
I'm not sure what the consensus is, but solid archives are no-go.

This is from WinRAR help file:
Quote
Solid archives
A solid archive is a RAR archive packed by a special compression method, which treats all files, within the archive, as one continuous data stream. Solid archives are supported only by the RAR archiving format, ZIP archives are always non-solid. The archiving method for RAR archives is a user selectable option and may be Solid or non-Solid.

Solid archiving significantly increases compression, especially when adding a large number of small, similar files. But it also has a few important disadvantages:
  • slower updating of existing solid archives;
  • to extract a single file from a solid archive all preceding files must be analyzed. This makes extraction from the middle of a solid archive slower than extraction from a normal archive, but, if all files are to be extracted from a solid archive, the extraction speed will not be affected.
  • if any file in a solid archive is damaged, it will be impossible to extract all files which follow the damaged area. Thus if a solid archive is stored to media such as diskette, it is recommended to make use of the recovery record.
Solid archiving is preferable if:
  • the archive is updated rarely;
  • it is not necessary to frequently extract a single file or only part of the files from the archive;
  • compression ratio is more important than compression speed.

This means that in order to reach a particular file, all files in the archive that are stored before that particular file must be processed.
Doing that for every single file means a very slow loading. Unpacking the archive dynamically kinda defeats the purpose of the archive. Keeping everything from the archive in memory is not viable.

So, no-go for solid archiving, regardless of the method/archiver used
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Tomo on January 21, 2011, 04:48:31 pm
That's not quite true, as Fury mentioned at the start of the thread.

In a solid archive, all the other files in the block containing your required file must be processed. It's not the whole file unless your blocks are massive.
So if you pick a good block size given your expected file size, solid archives will be fine.

(In theory you can get really clever at the packing stage by arranging the files so that the ones you will always use together are in the same block. Not that I think it's likely to be worth bothering.)

Non-solid ones will of course still be faster to extract.

Either way, they'll be much smaller than at present.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on January 21, 2011, 09:34:28 pm
/me likes this idea.

Wasn't this brought up before?  I forget.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Topgun on January 21, 2011, 09:46:12 pm
/me likes this idea.

Wasn't this brought up before?  I forget.

It was brought up before but I guess the idea just died.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Echelon9 on January 21, 2011, 11:47:35 pm
/me likes this idea.

Wasn't this brought up before?  I forget.
Taylor, and then later myself, did have a look at this concept. There was some proof of concept code floating around, but it never got to a point at which it was widely circulated on these forums or IRC.

The thinking done ahead of the coding then arrived at largely the same conclusions as here (non-solid, algorithm akin to LZMA) if I remember correctly.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on January 22, 2011, 01:14:08 am
I'm not sure what the consensus is, but solid archives are no-go.
You may want to re-read the first post in this topic, as it states the very same thing and makes it a point that archives need to be non-solid to work for random access.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on February 26, 2011, 05:18:40 pm

Great BUMP for Justice.

Another reason why we need this: CF_MAX_FILENAME is maxed at 32. This apparently cannot be bumped because the VP File Format structure was only written to support 32. We can't raise the limitation in the engine, because a VP file still won't store at greater than 32 anyway.

So, the only way to have filenames longer than 32 characters (or any other values longer than 32 characters) will be in the implementation of this "Compressed" VP (or CVP) format.

And of course, we'd still need to make sure that any bumpage only affects when loading data from a CVP to boot.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Luis Dias on February 28, 2011, 01:06:05 pm

Great BUMP for Justice.

Another reason why we need this: CF_MAX_FILENAME is maxed at 32. This apparently cannot be bumped because the VP File Format structure was only written to support 32. We can't raise the limitation in the engine, because a VP file still won't store at greater than 32 anyway.

So, the only way to have filenames longer than 32 characters (or any other values longer than 32 characters) will be in the implementation of this "Compressed" VP (or CVP) format.

And of course, we'd still need to make sure that any bumpage only affects when loading data from a CVP to boot.


This means deprecation of .vp by all modders, which isn't that much of a trouble. LZMA is open-source, so no problem there too. I say go for it.

Quote
We might not want users cracking open VP files easily. Right now if someone wants to open a VP file they need to figure out which tool to use (which gives us a chance to warn them not to replace anything in them).

You can easily replace files in a .7z file. They wouldn't come to us until they'd already ****ed their install over. Even if we can make our files usable in 7zip we should still name them .vp just to avoid that.

I'm sure that any user knows that if you touch the game's files, probably they will **** up the game ;). Don't take people to be that stupid. For what is worth, I think going towards more general standards is better, in long term.

Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: mjn.mixael on February 28, 2011, 01:35:07 pm
I'm sure that any user knows that if you touch the game's files, probably they will **** up the game ;). Don't take people to be that stupid. For what is worth, I think going towards more general standards is better, in long term.

Go look at the support board and tell me if you would still assume that people know what they are doing...
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on February 28, 2011, 02:12:53 pm
In the end, there is nothing much we can do about this either way. However, we can mitigate it a bit by using a better checksumming algorithm than the one we're using currently.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Luis Dias on February 28, 2011, 05:05:20 pm
I'm sure that any user knows that if you touch the game's files, probably they will **** up the game ;). Don't take people to be that stupid. For what is worth, I think going towards more general standards is better, in long term.

Go look at the support board and tell me if you would still assume that people know what they are doing...

Exceptions make a good rule, mixael. There're always black sheep everywhere... but I get your point
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Goober5000 on March 02, 2011, 11:21:21 pm
This means deprecation of .vp by all modders, which isn't that much of a trouble.

It means no such thing.  On the contrary, it means that we'd support two different .vp formats.  This isn't really a big deal, since we already support multiple image and audio formats.


Quote
I'm sure that any user knows that if you touch the game's files, probably they will **** up the game ;). Don't take people to be that stupid.

You would think that, wouldn't you?  Unfortunately, experience has shown us that people are that stupid.  There have been threads on this very forum where people have edited the VP file directly, despite being told in no uncertain terms not to do so.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: ShivanSpS on March 27, 2011, 12:09:05 pm
ppl try opening files with compression programs first, so it wont matter.

My best bet is using password protection and no tell anyone about it. So in this way you can only make the CVP with a upgraded vpmage tool, witch it automatically sets the password to the file, and again only open them with upgraded vpview. Game code offcourse will known the password.
And if you want to add security, you can make the game code to have a 10 word dictionary and automatically change the password to another after loaded the .cvp once.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Mobius on March 27, 2011, 12:32:37 pm
/me likes this idea.

Wasn't this brought up before?  I forget.
Taylor, and then later myself, did have a look at this concept. There was some proof of concept code floating around, but it never got to a point at which it was widely circulated on these forums or IRC.

The thinking done ahead of the coding then arrived at largely the same conclusions as here (non-solid, algorithm akin to LZMA) if I remember correctly.

I remember Taylor's posts on the matter and, in fact, I have been willing to see the idea pass the planning stage for quite some time. By "compressed VPs", however, I thought Taylor meant a new file format, like "Compressed Volition Package" or something like that. I must have misinterpreted his posts, then.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Iss Mneur on March 27, 2011, 02:03:37 pm
ppl try opening files with compression programs first, so it wont matter.

My best bet is using password protection and no tell anyone about it. So in this way you can only make the CVP with a upgraded vpmage tool, witch it automatically sets the password to the file, and again only open them with upgraded vpview. Game code offcourse will known the password.
And if you want to add security, you can make the game code to have a 10 word dictionary and automatically change the password to another after loaded the .cvp once.
I think you misinterpreted the intent of using a different extension.  Its not to prevent people from fiddling with the VPs (the one that Goober mentioned actually hex edited the vp!) but just discourage them.

Unfortunately your solution would require SCP to maintain (update) yet one more tool and would add unnecessary work for the engine and the modders.  It is essentially a form of DRM that would not work (because the answers are in the publicly available source code) and would require coder time to implement.

/me likes this idea.

Wasn't this brought up before?  I forget.
Taylor, and then later myself, did have a look at this concept. There was some proof of concept code floating around, but it never got to a point at which it was widely circulated on these forums or IRC.

The thinking done ahead of the coding then arrived at largely the same conclusions as here (non-solid, algorithm akin to LZMA) if I remember correctly.

I remember Taylor's posts on the matter and, in fact, I have been willing to see the idea pass the planning stage for quite some time. By "compressed VPs", however, I thought Taylor meant a new file format, like "Compressed Volition Package" or something like that. I must have misinterpreted his posts, then.
Yes so would we, but in the big picture this is a rather low priority.

No you probably didn't misinterpret what was said.  There are several ways of implementing this.  Even I have had a look at doing it the way that you (Mobius) had interpreted it.  The method proposed in by Fury in this thread is probably the better one because it removes the need for yet another FSO specific tool.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Luis Dias on March 28, 2011, 02:00:21 pm
This means deprecation of .vp by all modders, which isn't that much of a trouble.

It means no such thing.  On the contrary, it means that we'd support two different .vp formats.  This isn't really a big deal, since we already support multiple image and audio formats.

Yeah, you're right, what in the god's name was I thinking?

Although in actual usage, it would become the mainstream way to publish campaigns.


Quote
You would think that, wouldn't you?  Unfortunately, experience has shown us that people are that stupid.  There have been threads on this very forum where people have edited the VP file directly, despite being told in no uncertain terms not to do so.

Well that kind of stupidity isn't worth fighting against and "punishing" all the others with it, IMHO...stupids do what stupids must.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: karajorma on April 03, 2011, 10:02:47 pm
You get over to the support board and spend your time fixing people's problems who have done just that for a few months and then you can tell us it's not worth doing.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 04, 2011, 11:36:05 am
password-protect the files and make the password:

Code: [Select]
I hereby take responsibility for stupidly editing this file even though I was told not to.  I will not complain when the game breaks.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: headdie on April 04, 2011, 12:17:26 pm
would it be possible to have two output modes for the new format.  The first is a typical file and is treated as such.  the second for "release" versions which contains a check bit or something in the file which when opened by community tools acts as a read only flag (i'm thinking using this rather than the existing read only flags as they are easily removed)  this way when a newbie wants to make a change they have to extract the file, change it and save it either in the appropriate folder or in a new container file making newbie errors easier to detect (most of the time) and increasing the chances the original file will survive without being modified.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on April 04, 2011, 12:31:57 pm
*sigh* I still don't think we really need a whole new format.  Then we won't need new tools.  Then we can put our efforts into other more important things.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on April 04, 2011, 12:59:53 pm
We really don't. A simple, standard zip or 7z file does all we need to do, including checksumming etc. Worrying about people modifying content is deeply in the realm of paranoia. After all, since we can get accurate checksums from these archives in a standard way, it's easy for us to compare those sums against reference sums mod creators give us.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on April 04, 2011, 02:49:57 pm

Fact is, even with VP being a not-out-of-the-box format, people still modify it. We still have user made tools for modifying them. And people STILL break things when they do so when they don't fully understand what they are doing.

These things will continue, regardless. OUR job is NOT in making that more difficult. Especially not for an "OPEN" code project that is driven by Community participation. The end results of a mod team (Or the MediaVPs) is that it should just WORK once completed. And the more shenanigans you put into place to prevent users fiddling with it, the more likely your are to introduce something that breaks that basic capability.

As The E has rightly said, we can checksum Official packages very easily (via Installer, engine, Multi, etc). That the tools far creating/modifying becomes a step towards better accessibility to being able to mod and distribute is a positive we've been waiting for and cannot pass up on.

Making it easier to be able to be stupid also means it makes it easier to do it right. What impacts one will always impact the other, so we need to focus on the benefits obtained by making it easier for everybody and let time and education take care of the mistakes.

That and we cannot deprecate .VP. That's against the essential tenant that we have to maintain RETAIL compatibility. But it opens the door for being able to get around other issues. We can expand file name handling with the new format to being greater than 32 char's without causing a potential negative impact on the basic Retail behaviour. (Especially since if we tried expanding that limitation WITHIN the VP format, we BREAK all the existing VP tools out there). This is less a concern if we just attribute the new format to handling that.

Further, with the new format, we can have the creation of .manifest files (in addition to the checksum process) to validate not only the package as a whole, but all the bit's in it. And being able to have (eventually) the Installer/Launcher/Whatever be able to merge Patching Data into Official archives (when from an Official Source) so that each new release doesn't mean an complete re-download of everything to stay current. This system would be much easier to implement with this new format without introducing potential complications in being able to load currently existing mods or Retail data. (Mind you, this is merely a -potential- usage scenario, not an immediate use qualification of the new format).

Anyway, running out of steam on this one, so I'll stop while I'm ahead.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Sushi on April 04, 2011, 04:39:09 pm
Thought I'd chimed in on this, but apparently not. I'm all for it.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: karajorma on April 04, 2011, 07:49:06 pm
I'll point out that while I was for making sure we use a different extension in order to make it less obvious that you just use 7zip or whatever I'm not in favour of making it any harder than that to edit a VP file.

Some people seem to have taken the ball I threw past the endzone and run out into traffic with it. :p
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Iss Mneur on April 04, 2011, 08:23:24 pm
I'll point out that while I was for making sure we use a different extension in order to make it less obvious that you just use 7zip or whatever I'm not in favour of making it any harder than that to edit a VP file.

Some people seem to have taken the ball I threw past the endzone and run out into traffic with it. :p
Other thing is we don't want to rummage through random zip or 7z files that a user may have left in the Freespace folder.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: mjn.mixael on April 04, 2011, 08:40:33 pm
Wasn't the suggestion for it to essentially be a 7z file but with a .cvp extension? Or is there some reason that isn't an option?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Iss Mneur on April 04, 2011, 09:02:22 pm
Wasn't the suggestion for it to essentially be a 7z file but with a .cvp extension? Or is there some reason that isn't an option?
No, that is exactly the original suggestion.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: ShivanSpS on April 04, 2011, 09:02:54 pm
Replace the extencion... i think its mandatory... some users may misunderstand what to do with a file that is linked to its compression program by his registry, thus showing the compress file icon, thus mistakenly uncompressing it.

Additionally i think the launcher should register the .vp and the .cvp extencions to show up a volition icon.

BTW, adding support for password protected files is out of the question? personally, i dont care, but it seems some people are worried about. not a lot of protection just support for unprotected files and a fixed password... like "scpfso" or something.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: mjn.mixael on April 04, 2011, 09:07:22 pm
Wasn't the suggestion for it to essentially be a 7z file but with a .cvp extension? Or is there some reason that isn't an option?
No, that is exactly the original suggestion.

Sorry, I meant to ask "wasn't the original suggestion..."
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Mongoose on April 04, 2011, 10:32:23 pm
This sounds like a fantastic idea, if it can be pulled off without too much agony. :yes:
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Iss Mneur on April 04, 2011, 11:25:51 pm
Replace the extencion... i think its mandatory... some users may misunderstand what to do with a file that is linked to its compression program by his registry, thus showing the compress file icon, thus mistakenly uncompressing it.
Another very valid reason for doing that.

Additionally i think the launcher should register the .vp and the .cvp extencions to show up a volition icon.
What about FSO's icon? FSO's icon in a vice?

BTW, adding support for password protected files is out of the question? personally, i dont care, but it seems some people are worried about. not a lot of protection just support for unprotected files and a fixed password... like "scpfso" or something.
Yes, it is out of the question. The point of .vps and .cvps is not to protect the game data but speed game loading by allowing the engine to only have to open a few files rather than thousands.  Even on a modern system, a single process (like FSO) holding open thousands of files is a very fast way to cause performance problems.

An a example of this was given earlier in this thread by Tomo.  Tomo's performance gains are also applicable to FSO though probably not a drastic as FSO doesn't open very many files after a level loads (mostly just sounds).

An encrypted archive (if the password doesn't cause the archive to be encrypted then the password protection is worthless) would normally be solid, which as already discussed is also worthless for our application.  This is also notwithstanding the increased processing and slow downs that encryption would cause. 

Also, see what Zacam wrote.

Wasn't the suggestion for it to essentially be a 7z file but with a .cvp extension? Or is there some reason that isn't an option?
No, that is exactly the original suggestion.

Sorry, I meant to ask "wasn't the original suggestion..."
Sorry, I am not sure why I started with "No" (probably in response to the second question), but nevertheless I meant to agree with you. So,

Yes, that was the original suggestion.  No, there is no issue with that as far as I can tell.  I think karajorma summed it up best to be honest. :D
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on April 05, 2011, 09:51:13 am
Nothing should register it.  The default behavior of "What program do you want to use to open this file?" should be more than enough to alert to people that this isn't a common file they should be tinkering with.  If I want to manually associate them with 7-zip, since I know better, then I'm even prompted with that option.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: CaptJosh on April 10, 2011, 09:25:01 am
I like this idea. Some campaigns are rather large. It would be nice to have them take up less space. I do agree that the extension should not be .7z for the new format. That's just asking for trouble. But no password protection or encryption. Especially no encryption. Encryption would slow things down.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 10, 2011, 06:35:07 pm
.VP = Volition Package
.7zP? 7zip Package?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on April 10, 2011, 10:52:04 pm

.VP = Volition Package, yes.
.CVP = Compressed Volition Package (because it would still be structured internally the same as a .VP is currently, it would just be compressed) and would be handled by 7z or any other application that can handle Streaming/Non-Solid Archives. And we still want to convey that it IS a package usable in game (vs just a standard VP in a .7z file).

.7zP isn't a bad idea, per-se. It does get the idea across and it's not an in use extension. And Google searching it immediately leads one to 7z site as the first result. But it's too close to the generic ".7z" extension for comfort if the Author of it wanted to take issue.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 11, 2011, 08:39:05 am
Yes, but it isn't really a compressed Volition Package... it is 7z format, not a VP compressed with 7zip; otherwise, you would be stuck with the same limits we currently have with the VP format... right?  CVP just seems to give the impression that's it's a compressed VP file, instead of an entirely different format.  *shrugs* it really doesn't matter, of course.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: karajorma on April 11, 2011, 09:09:19 am
Going with a name similar to .7z seems to ignore the entire point of not simply using .7z in the first place.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on April 11, 2011, 09:52:56 am
.CFP - Compressed FreeSpace Package :)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Sushi on April 11, 2011, 01:59:57 pm
.CFP - Compressed FreeSpace Package :)

+1

Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: bigchunk1 on April 11, 2011, 06:50:16 pm
A word of caution about this,

If this happens... whatever format you would like to replace .vps with... please PLEASE make it easy, even for the less technical among us, to understand and work with.

One of the biggest obstacles to getting into modding (at least for me) is file management. The easier it is, the more people are going to want to play.

So if you think you can shave off a few megs by adding some kind of crazy javascript compression software on everyone's computer (random 'sacrifice of ease for complexity' example) . I advise against it!

Formats like winzip, .7z or .rar are nice ideas since they are more widely used than the freespace community, and it is likely people will have had some familiarity with them before getting into modding here.

Lastly, just to be clear, making things as easy as possible gets my vote even if that means it has less favorable compression. 

 
 
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: mjn.mixael on April 11, 2011, 06:55:08 pm
A word of caution about this,

If this happens... whatever format you would like to replace .vps with... please PLEASE make it easy, even for the less technical among us, to understand and work with.

One of the biggest obstacles to getting into modding (at least for me) is file management. The easier it is, the more people are going to want to play.

So if you think you can shave off a few megs by adding some kind of crazy javascript compression software on everyone's computer (random 'sacrifice of ease for complexity' example) . I advise against it!

Formats like winzip, .7z or .rar are nice ideas since they are more widely used than the freespace community, and it is likely people will have had some familiarity with them before getting into modding here.

Lastly, just to be clear, making things as easy as possible gets my vote even if that means it has less favorable compression.

Did.. you... read... the thread?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: bigchunk1 on April 11, 2011, 07:14:09 pm
What?!

This is a valid concern with any file format change. I don't think I am being too ridiculous here.

I'm not saying you all are actually looking to make .vps more difficult, but I would like to bring attention to making ease a priority with format you do happen to select.

Overall, I support this.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: mjn.mixael on April 11, 2011, 07:19:53 pm
 :beamz:

Read the thread!

You said "Formats like winzip, .7z or .rar are nice ideas since they are more widely used than the freespace community"

This thread is basically ABOUT using 7z's archive method... recent discussion has been about using a different file extension for various reason..

So, I say again.. please read the thread.  :doubt:

Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: bigchunk1 on April 11, 2011, 07:36:08 pm
What the heck is with the 'who can read' argument?!

I think you understand my general point. Let's be friends.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Qent on April 11, 2011, 07:44:10 pm
What the heck is with the 'who can read' argument?!

I think you understand my general point. Let's be friends.
Hey, he's right. If you had even read the first post, you'd know that only common formats are on the table here.

EDIT: Or maybe you still wouldn't. But that is the case.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on April 11, 2011, 08:15:44 pm

The idea of use:
You have your uncompressed mod folder where you have worked everything out. You point 7z at the right location (the data dir, just like you would any VP builder).
You set 7z to do a non-solid LZMA archive and set your compression level. You then rename the ".7z" part at the end to either ".cvp" or ".cfp" or whatever the consensus extension is.

You put that in an MOD dir like you would a VP. You play. To open an existing one, you "Open With" or choose 7z (just as if you had a VP file that wasn't registered to a VP viewer) and you then browse or extract individual files from it. At some point, it might be possible to build a viewer that (like the current Viewer) does ANI playback and image preview, but that's for later and another project entirely.

Ignoring all the rest of everything else now, it has already been addressed, I hope. Final note: The original VP format isn't and cannot go anywhere. It just won't be as robust as the new format (filename limitations, etc that would break existing tools amongst other things).
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on April 11, 2011, 11:05:58 pm
Instead of discussing this thing round and round, I wish we could move towards actually implementing it already. It's a daunting task, but better start sooner than later. :nervous:
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: CaptJosh on April 12, 2011, 06:16:18 pm
Part of the reason you were being told to read the thread, bigchunk1, is that nobody was talking about replacing use of .vp files, yet one of your specific statements was, "whatever format you would like to replace .vps with..." Remember that the SCP's major requirement is maintaining retail compatibility. Therefore, .vp file support remains for as long as this project continues to be developed. The idea is to add support for a compressed format as well. This is specifically to decrease download sizes for large mods.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on April 15, 2011, 02:19:08 am
Not so much reduce download size, but to reduce install size.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: CaptJosh on April 24, 2011, 10:58:08 pm
That too. Thanks for catching that I forgot to mention that.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: WMCoolmon on April 25, 2011, 02:06:58 am
Taylor posted the spec for his idea for a CVP format on the private forum 4 years ago, but apparently it never got implemented. Here's the conversation:

I can't say that this isn't going to change a little bit before it actually hits CVS, but having played around with it for months last year, I think it's pretty solid.  It's largely the same as the current VP stuff, I wanted to keep it as close as possible to simplify the code.

(All values are little-endian.)

Header:
Sint8[4]  --  header id, "CPVP" for a CVP
Sint32    --  version #, initial version number for CVP is 1, and it needs to respect this (unlike the current standard VPs)
Sint32    --  offset to the file index (at end of VP/CVP)
Sint32    --  total uncompressed size of archive
Sint32    --  number of files in the archive
Uint32    --  CRC data (NOTE: this isn't a standard CRC32 value, FS2 has a code bug that we can't fix)

File Index (for each directory/file):
Sint32     --  archive offset of current file (NOTE: this is the real offset, to compressed data, not to uncompressed data)
Sint32     --  uncompressed size of the current file
Sint32     --  compressed size of the current file
Sint8[32]  --  file/directory name
Sint32     --  date/time of last file modification


Each individual file is compressed separately, NOT the entire archive.  The file index is also compressed, using level 9 compression.  Individual files can use any compression level so long as it's not above 6 (lower levels == faster, but less, compression).  Level 6 is recommended as the standard value though as it offers the best compromise between speed, size and memory usage for decompression.  The following file types should NOT be compressed:  WAV, OGG, MVE.  The reason is that those files are often streamed and streaming compressed files is extrememly slow (so much so that I'm not even going to code in support to do it).  Also, OGG files don't compress worth a crap anyway.

The only thing guaranteed to be compressed in a CVP is the file index.  The exclusion types listed above should never compressed.  Beyond that it should be user choice whether to actually compress any other data or not.

Thanks. :)

Sint32    --  total uncompressed size of archive

I assume this takes into account the finished size of the archive? (eg not just the files that make it up, but including the header and index as well) Seems like a dumb question but I want to be totally sure we mean the same thing by archive.


Uint32    --  CRC data (NOTE: this isn't a standard CRC32 value, FS2 has a code bug that we can't fix)

Dare I ask further? Since this is a new format I don't see why a standard value isn't possible, even if fs2_open has messed up functions right now. I guess if it's being used for network stuff in the future...but that would necessitate a change to the network code, anyway.


Sint32     --  uncompressed size of the current file
Sint32     --  compressed size of the current file

Does uncompressed==compressed for all noncompressed files? (I'm looking for a better/more reliable way to determine compression status than file extensions).

I assume this takes into account the finished size of the archive? (eg not just the files that make it up, but including the header and index as well) Seems like a dumb question but I want to be totally sure we mean the same thing by archive.
No, it's just the data.  Header offset and index size are not included.  It's more for informational purposes than a function of use for the game.  The primary purpose for this is for utilities, not the game itself, so that you can quickly tell how much HD space would be required if you wanted to extract the entire CVP.  It's generally computed by the archiver anyway, for basic info on overall compression success, and simply storing it in the CVP header makes things easier for extraction than manually computing the total size.

Quote
Dare I ask further? Since this is a new format I don't see why a standard value isn't possible, even if fs2_open has messed up functions right now. I guess if it's being used for network stuff in the future...but that would necessitate a change to the network code, anyway.
It's used by the current/retail networking code, so if we change it then it breaks compatibility will all previous versions.  It's not really a big deal though and you can quite easily code up your own CRC code which matches what the game uses now (it's basically just missing a XOR on the crc value).  Though, now that I think about it, I'm not 100% sure that the CRC table is computed properly either.  But, again, it's just minor stuff overall since there are multiple incarnations of CRC32 anyway.

Quote
Does uncompressed==compressed for all noncompressed files? (I'm looking for a better/more reliable way to determine compression status than file extensions).
Yes.  When writing an uncompressed file you do it just like with a normal VP, and only go through the bzip2 calls for compressed content.



Oh, for anyone else that is interested, here are the docs for the bzip2 API: http://www.bzip.org/1.0.3/html/index.html

Actually, one thing that I think might come in handy would be if the signed integers for position (both TOC and file data position) were changed to unsigned integers or, better yet, 64-bit integers. This would effectively eliminate a possible future problem of VPs growing too big for signed integer positions. The BTRL Demo release is, IIRC, 650-some MB, so technology is starting to get to the point where breaking the 2GB limit is a possibility.

I was actually going to originally move the 64-bit for the size and date issues, but then I decided that I just don't care.  OS support wise, it's not really worth the hassle to me.  Compression will help keep it under 2gig a bit longer, and it's not like it's that hard to just split a large VP into two smaller ones.  I just think that the coding effort required to do 64-bit size support properly greatly outweighs the general ability to avoid requiring it in the first place.

Oh, and it might be this weekend before I get you that test CVP.  I got busy doing the BtRL installers, and keeping the server running through the digg hit, and just haven't had a chance to get anything ready for you yet.  I'll try and take care of it Friday though, if possible.

My next VP tool release will support 64-bit stuff internally (it will of course check before it sticks it in the C/VP) so it shouldn't be too much of an issue when you do change it. I've just been eyeing that limit warily since I started work on the reading/writing backend. ;)

Crap.  I totally forgot about this.  :rolleyes:

I should have time to send you the file tomorrow, assuming that I actually get normal mapping 100% by then (and if I haven't killed myself in the process  :mad:).  I don't think it would be any easier for me to just see the output from you writer though, since I still haven't updated my VP extrator code for the final CVP spec, only the archiver.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on April 25, 2011, 02:14:16 am
Have you read the thread? Unlike you or taylor, we are not comfortable with the idea of using a proprietary archive format.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on April 25, 2011, 09:51:35 am
Yeah I'd imagine that was probably one of the reasons it was never implemented - no one had the time to sit down and write/maintain the code for the new format.  Of course, no one's sitting down to get LZMA added in yet either, but maybe we can work on that shortly after 3.6.14.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 25, 2011, 09:57:49 am
7zip is open source.  If you had to add something, you could modify .7z behavior.  It just wouldn't open with 7zip.  Unless you added support with a plugin.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on April 25, 2011, 10:04:07 am
7zip is open source.  If you had to add something, you could modify .7z behavior.  It just wouldn't open with 7zip.  Unless you added support with a plugin.

Read the thread. Using an archive format that is not editable via existing tools (be they the various VP editors, or dedicated archivers like 7zip) is not a good idea.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 25, 2011, 10:05:27 am
How many times?  I was merely pointing out the possibility if you really had to add some functionality.  What you coders do is up to you.  :P
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on April 25, 2011, 10:06:54 am
Well, reading the thread should have given you an idea of what we are thinking of in terms of archive support, and that your suggestion was already discarded a few pages back.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on April 25, 2011, 10:14:08 am
I just edited the OP, to hopefully cut down on discussion that's already been...discussed.  If there's nothing else to add, we could probably just lock this too, and get to work on implementing the LZMA support.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 25, 2011, 10:22:33 am
Well, reading the thread should have given you an idea of what we are thinking of in terms of archive support, and that your suggestion was already discarded a few pages back.

I realized that.  However I also realized that taylor knows things I don't as a non-coder.  As do you.  So I figured I'd chip in my (pretty worthless) two cents, in the off-chance that it would give someone who knows more than me an idea.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Goober5000 on April 25, 2011, 08:50:52 pm
Taylor's posts contain a few good points that haven't been addressed yet.  For example, he recommends that each file be compressed individually, instead of the whole thing as a solid block, because certain file types don't compress well (often because they're already compressed).  Another interesting point is that he says streaming compressed data is very slow, which would be a significant problem.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Iss Mneur on April 25, 2011, 10:07:13 pm
Taylor's posts contain a few good points that haven't been addressed yet.  For example, he recommends that each file be compressed individually, instead of the whole thing as a solid block, because certain file types don't compress well (often because they're already compressed).
Which is what a non-solid 7z archive is...

Another interesting point is that he says streaming compressed data is very slow, which would be a significant problem.
So don't compress the archive that you put the streaming media in (.7z or just a .vp).
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: WMCoolmon on April 26, 2011, 02:13:28 am
Have you read the thread? Unlike you or taylor, we are not comfortable with the idea of using a proprietary archive format.

Yes, I did.

Having spent a few years watching taylor seem to do as much coding as the rest of the team combined I'm willing to believe that his design would have been well-designed and well-thought-out with regards to its application to the FS2Open engine. I see the beginnings of an idea here, but I don't see any kind of in-depth plan. I don't see anybody addressing his comment that the FS2Open CRCs are different than normal CRCs and you'd have to break the networking code to fix it, or addressing what level of compression is adequate, or whether third-party utilities would only compress the files that we want compressed. In fact, I see very little discussion or understanding of how this will work in the FS2Open engine. Will decompression be streamed for certain filetypes and not others? Which filetypes? Will the new pack files be read with the same precedence as old files? Will loading a 7z file be internally compatible with the structures that FS2Open uses to store package filesystem data?

Maybe those aren't issues now. Maybe you've rewritten the network code and the packfile code so it bears no resemblance to the old stuff and the time taylor spent researching this stuff is completely irrelevant now. I don't pretend to know.

A lot of these are issues that using a custom archive based on VPs can mitigate, but a standard archive format does raise. Sure, it's easier for users, and that's great (except where it's been pointed out that people might take that as license to edit them like archives).

I've spent probably a half-hour now reading this thread, digging up that post, and now tonight, explaining exactly how I can see it being useful. This didn't need to be a confrontation, I was trying to be helpful because I figured most people had probably not known or forgotten about that thread since it was so long ago and nobody had brought it up.

I didn't even state that I disagreed, and you're already arguing with me.

Yeah I'd imagine that was probably one of the reasons it was never implemented - no one had the time to sit down and write/maintain the code for the new format.  Of course, no one's sitting down to get LZMA added in yet either, but maybe we can work on that shortly after 3.6.14.

This is the second needless assumption that pisses me off. Not only did I end up restructuring Maja in order to support compressed files, but I actually have a CVP handler in there with an 'import' function. An 'export' function is no big deal. I was considering doing that to ease the transition if that was what this discussion came to, but now I'm afraid to admit even thinking about volunteering for fear that you'll take it as further evidence that I think you're wrong and I'm trying to subvert your plans and fight you.

Trust me, if I seriously thought you should implement a proprietary format instead of 7-zip and I wanted to fight you on it, you would be looking at pages of writing explaining exactly how I thought your implementation was flawed, exactly why you shouldn't do it, how I could do better, and the plans I was already drawing up for my implementation. As it is, all I've done is repost (and now point out) a set of problems that somebody else spent time finding out, that now you (or whoever goes to do the implementation) doesn't have to spend time relearning or finding out when you make the change and the network code mysteriously quits working or something.

And where on earth did anybody get the impression that taylor endorses this or I even think taylor endorses this? The post was four years ago. A lot has changed since then in the computing world. I have no clue what taylor thinks and I am totally uncomfortable getting him involved in this now, for fear that somebody will think he has any opinion on this.

TL,DR: Don't assume that people are fighting you and accuse them of doing no work on the subject when they're spending free time trying to help you.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Zacam on April 26, 2011, 06:44:04 am

Maybe it's assumed that we already know that the FSO CRC's don't match other "real world" crc generation. I've even mentioned attempting to provide a way for FSO to actually generate/use CRC values like you would see any archiving program provide so that when we post the data from an archival tool it can then match what the game generates in the Debug log.

However, not only does the math currently escape me, I did also realize the complexity of the networking issue and it would have to be addressed at a point by saying "This point forward will not be compatible with prior versions" which we have already done a time or twelve, just not quite as significantly.

Further, in the discussions from 4 years ago, I'm curious to know why the 32 char file name limitation would have been proposed as kept. It should have been recognized as even then being utter ridiculous to keep, seeing as how Retail wouldn't be able to use said new format anyway.
(And even if nobody took into the consideration the increasing expansion of file names for such as adding "-normal" to them, it's still a silly notion to keep as there are hardly any filesystems that have that limitation themselves and any that do, well, I don't honestly know what to say to that scenario other than "That sucks, get something better")

Good to hear that you forward thought Maja enough to include the basic implementation idea. I love that app and use it regularly and exclusively. But now, how many people actually knew you did all that? Did you share with the team? Was there any indication that -anything- other than discussion took place? If you did, then that was then and this is now, and if not then who knew? So what is the point of being upset by it? Much less calling it a "Needless assumption".

As for addressing "what level of compression is adequate" I seem to remember reading in the first few posts a benchmarking indicating how each compression level worked out. And in various different compression types, hence why non-solid LZMA was selected and it can be up to the modders as to what level of compression they want with an eye towards the medium option as the one with the most flexibility.

And people are already taking license to edit VP's. We can either frustrate people by making it even more difficult to do so and require more "l33t" know how or we can make it easier to access and thus also easier to address/fix/troubleshoot and in general point out when they are being an idiot.

As for endorsements, I think it was just in general held as "there was an idea once, but so far nothing has happened on it. Maybe we can look at taking a stab at it ourselves". Doesn't in any way make the previous discussion obsolete in any way other than to potentially call for refactoring some of the implementation ideas. It's more about the endorsement of the Concept, not the implementation and that is only derived from the fact that the "Idea" happened and had enough behind it that a fairly well rounded technical conversation took place regarding it. If that's not an endorsement of some kind, I have no idea what is then. And again, it's on the basis of a concept or idea, not necessarily to a specific method or implementation. And it's also in reference to the past tense. We can say that either of you endorsed the idea as a concept then. That does not automagically translate into endorsing the concept/idea/implementation as it is today.

I have to admit that I'm at a total loss of understanding where or how the discussion in here has managed to take on any sort of hostile overtones or perceptions there of. Thank you for finding and sharing the information, some of the non-internal access people may find it valuable and useful. Can we all just get along now?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Goober5000 on April 26, 2011, 08:54:34 pm
I think WMC still has some battle scars from back when he and I used to argue about SCP features.  He and I had quite a few disagreements, and he has made a couple of commits that have caused me to nearly pull my hair out (the eight-stage Transcend warpout bug being one), but he is an excellent coder and he does have a mind for design.  The camera system and the scripting system both involved a lot of planning and long-range thinking, and those are things we really need to keep in mind when discussing a core feature like CVPs.  So WMC can offer a lot of insight on this topic, especially from his experience on Maja, which is about the closest anyone's ever come to working on this feature.

We should all take care not to be overly confrontational in our discussion (which I have had a tendency to do, and I think Zacam and The E do also).  As long as we remember to debate the topic and not the person, I think we can hammer out some good points in this thread. :yes:
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Tomo on April 27, 2011, 11:59:58 am
I suspect that the main reason Taylor was considering 'home-grown' compressed archives was simply down to a lack of open-source ones at the time.

There is also a tendency within any team to ignore externally-developed useful code in favour of writing it themselves. This "Not Invented Here" attitude is clearly seen to be foolish once you manage to step back, but that kind of perspective tends to be hard to maintain.

Given that the 7z libraries are freely available now, there really is no point in building a home-grown version - linking in the 7z library hands us a lot of well-tested stuff for free.

- Plus, if done right, it means that we can trivially add other packaging systems at a later date, should newer open-source BSD/L-GPL or other appropriately licensed stuff become available.
There's quite a lot of other stuff that wants doing to cfile.cpp anyway, to remove the requirement of short pathnames and write access to the installation folder.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on April 27, 2011, 12:41:40 pm
Heh, I started looking into some of the public formats used by other games just now.  .pk3 is just a zip file!  I mean, if that worked for Quake 3, Quake 4, and Doom 3, surely LZMA should work for us?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on April 27, 2011, 05:53:43 pm
If it's at all easy to do, why not implement it and do a test run using the new format to find any problems and compare?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Halleck on June 10, 2011, 05:09:08 am
An aside, the Ur-Quan Masters project uses zip in the same way as we use VP's. They were getting a lot of confused people in their support forum who downloaded one of their enhanced content modules, saw it was a zip, extracted it, and were confused as to why the content wasn't loading.

The solution they found was to rename the file extension to .uqm. That way, random people didn't just open them up, but they could be easily opened with any archive utility by people in the know. Just a thought in case we have the same issue down the line, we could use the extension .fs2 instead of .7z.

Edit: I didn't read the whole thread but I see above that this has already been brought up. In any case, this is a solution that is known to work well for other games (including quake, apparently!)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on June 10, 2011, 05:11:04 am
No, we can't use .fs2. Because that extension is already reserved for mission files :P

What we can use, and what we I think already agreed upon, is .cvp.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Halleck on June 10, 2011, 05:28:32 am
Oh- duh!

It's a good plan, and will prevent some needless confusion of hapless players.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: chief1983 on June 10, 2011, 10:58:31 am
I think at this point we're just waiting for someone to tackle the implementation.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Goober5000 on February 15, 2014, 07:17:18 pm
It hasn't been tackled in 2.5 years, so I'm unstickying this. :nervous:
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Phantom Hoover on February 15, 2014, 08:09:25 pm
Pity, it was a great idea.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 02:31:26 am
I am very close to completing my cfile system refactoring which includes support for reading 7-zip archives: https://github.com/asarium/fs2open.github.com/tree/feature/vfspp (https://github.com/asarium/fs2open.github.com/tree/feature/vfspp)
That branch currently does not have that feature but all I have to do is implement mod support and then enable searching for CVP files.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on February 16, 2014, 03:52:31 am
Is that branch compilable currently? Running cmake yields a variety of errors, including the vfspp directory being empty.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 16, 2014, 04:36:19 am
I should mention some later insights I've gained into this matter since original activity of this topic.

None of the common compressed archives have true random access. There are some less known alternate versions, such as razip, dictzip and idzip. Something to look out for is also xz container format.
http://tukaani.org/xz/
http://stephane.lesimple.fr/blog/2010-07-20/lzop-vs-compress-vs-gzip-vs-bzip2-vs-lzma-vs-lzma2xz-benchmark-reloaded.html
http://tukaani.org/xz/xz-javadoc/org/tukaani/xz/SeekableXZInputStream.html

Unfortunately xz is similar to gzip in that it only compresses single files. Meaning it needs a container to store all the individually compressed files into one big file. And there really does not seem to be decent alternatives to tar, which does not support indexes. I've read that there are some various methods to add indexes to tar files, but I haven't really checked them out.

So while I did specifically mention random-access in the very first post in this topic, it should have been more like "not needing to decompress entire archive to decompress one file". Decompressing tool still needs to read contents of the entire archive to check what is where, and that can add significant delay before it can start decompressing the files that are needed. This is where indexes would come handy, as then the tool would only need to read indexes and it knows what is where. Zip-files do have indexes albeit they are at end of the zip-file rather than in the beginning, but at least it does have indexes.

So what are the options?
- Use LZMA2 archives and live with the delay that comes from reading contents of the archive prior to decompressing.
- Use Zip-files.
- Use razip, dictzip or idzip.
- Compress individual files into Xz-archives (see the links above) with LZMA2 and then package them into an uncompressed Zip-archive. Should be fairly trivial to create a tool just to handle this process without repeated manual labor.
- Look into making tar viable by adding indexes.
- Look into tar alternatives like xar. https://code.google.com/p/xar/wiki/whyxar
- And now the bomb, think outside of the box and use Matroska as the container. It has random-access and streaming, technically it can handle anything and not just audio and video. http://www.matroska.org/technical/specs/index.html This would require most work from our part though I imagine, so it's probably out.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: niffiwan on February 16, 2014, 04:43:22 am
Just to add yet another option, here's something I found that would do most of the heavy lifting for us, it'd just need vanilla VP support added to it:
https://icculus.org/physfs/
https://icculus.org/physfs/docs/html/

(of course if m!m has almost completed his current work on .cvp, I really can't see this being useful right now...)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 05:19:17 am
Is that branch compilable currently? Running cmake yields a variety of errors, including the vfspp directory being empty.
I'm not entirely sure if the version I pushed to github is actually compiling but in any case you need to install and build boost and also initialize and update the submodules to clone the vfspp repository.
Boost: As we only need a few libraries you should be able to build it with the following command:
Code: [Select]
bootstrap && b2 --with-filesystem --with-system --with-iostreams --with-regex variant=debug,release link=static runtime-link=static define=_HAS_ITERATOR_DEBUGGING=0
VFSPP: According to the internet you should be able to clone the submodule with the following commands:
Code: [Select]
git submodule init
git submodule update

<snip>
I don't know much about how the LZMA SDK actually extract the entries but the archive index is only read once when it is initially and then the index of the file will be reused whenever it needs to be extracted. There is an overhead involved but I think that it is worth it.

Just to add yet another option, here's something I found that would do most of the heavy lifting for us, it'd just need vanilla VP support added to it:
https://icculus.org/physfs/
https://icculus.org/physfs/docs/html/

(of course if m!m has almost completed his current work on .cvp, I really can't see this being useful right now...)
:banghead: I didn't find this when I was searching for an existing solution but now it's sadly too late (if I have serious issues with my library then I can still switch to this one). Thanks for finding this niffiwan :)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 09:38:07 am
I now implemented 7-zip reading, I'm going to post a test build thread later but here are some test builds: http://www.mediafire.com/download/fjufhkytlv2lt79/CompressedVP.7z (http://www.mediafire.com/download/fjufhkytlv2lt79/CompressedVP.7z)
Everything should behave the same but now .cvp files placed in a root directory (either FS root or a mod directory) will be read and used for resource lookup.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Axem on February 16, 2014, 10:04:15 am
My immediate findings by 7z'ing Vassago's Dirge and renaming it .cvp.


That said, this is cool stuff!
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The Dagger on February 16, 2014, 10:08:14 am
I tried a simple mod that only adds one ship and uses Mediavps2014:
1- Long loading time confirmed.
2- It does load Mediavps, 'cause I do get the Mediavps splashscreen.
3- It does open cvp files, 'cause debug says I'm mising some subsystem in my ship (ups).
4- It crashes after the loading screen with this message:
Code: [Select]
    Assert: parentDir
    File: cfile.cpp
    Line: 538
     
    ntdll.dll! ZwWaitForSingleObject + 21 bytes
    kernel32.dll! WaitForSingleObjectEx + 67 bytes
    kernel32.dll! WaitForSingleObject + 18 bytes
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    kernel32.dll! BaseThreadInitThunk + 18 bytes
    ntdll.dll! RtlInitializeExceptionChain + 99 bytes
    ntdll.dll! RtlInitializeExceptionChain + 54 bytes

fs2_open.log
Code: [Select]
==========================================================================
DEBUG SPEW: No debug_filter.cfg found, so only general, error, and warning
categories can be shown and no debug_filter.cfg info will be saved.
==========================================================================
FreeSpace 2 Open version: 3.7.1
Passed cmdline options:
  -nosound
  -spec_exp 15
  -ogl_spec 20
  -spec_static 1.5
  -spec_point 1.2
  -spec_tube 1.5
  -ambient_factor 105
  -missile_lighting
  -no_emissive_light
  -3dshockwave
  -soft_particles
  -post_process
  -bloom_intensity 20
  -fxaa
  -fxaa_preset 9
  -cache_bitmaps
  -ballistic_gauge
  -dualscanlines
  -rearm_timer
  -3dwarp
  -ship_choice_3d
  -weapon_choice_3d
  -warp_flash
  -snd_preload
  -mod mymvp,mediavps_2014
Found root C:\Freespace2\mymvp...Found root C:\Freespace2\mediavps_2014...Found root C:\Freespace2...Searching root pack 'C:\Freespace2\mymvp\Hathor.cvp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_A-Glows.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_Advanced.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_Assets.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_CB_ANI_1.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_CB_ANI_2.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_Effects.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_Music.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_RadarIcons.vp' ... Found root pack 'C:\Freespace2\mediavps_2014\MV_Root.vp' ... Found root pack 'C:\Freespace2\Root_fs2.vp' ... Found root pack 'C:\Freespace2\smarty_fs2.vp' ... Found root pack 'C:\Freespace2\sparky_fs2.vp' ... Found root pack 'C:\Freespace2\sparky_hi_fs2.vp' ... Found root pack 'C:\Freespace2\stu_fs2.vp' ... Found root pack 'C:\Freespace2\tango1_fs2.vp' ... Found root pack 'C:\Freespace2\tango2_fs2.vp' ... Found root pack 'C:\Freespace2\tango3_fs2.vp' ... Found root pack 'C:\Freespace2\warble_fs2.vp' ... ERROR: Unknown Language Checksum: 589986744
Using default language settings...
TBM  =>  Starting parse of 'mv_root-lcl.tbm' ...
Setting language to English
TBM  =>  Starting parse of 'mv_root-lcl.tbm' ...
Game Settings Table: Using Standard Loops For SEXP Arguments
Game Settings Table: Using standard event chaining behavior
Game Settings Table: External shaders are DISABLED
Failed to init speech
Initializing OpenGL graphics device at 1024x768 with 32-bit color...
  Initializing WGL...
  Requested WGL Video values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1
  Actual WGL Video values    = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1
  OpenGL Vendor    : NVIDIA Corporation
  OpenGL Renderer  : GeForce GTX 460M/PCIe/SSE2
  OpenGL Version   : 4.4.0

  Using extension "GL_EXT_fog_coord".
  Using extension "GL_ARB_multitexture".
  Using extension "GL_ARB_texture_env_add".
  Using extension "GL_ARB_texture_compression".
  Using extension "GL_EXT_texture_compression_s3tc".
  Using extension "GL_EXT_texture_filter_anisotropic".
  Using extension "GL_ARB_texture_env_combine".
  Using extension "GL_EXT_compiled_vertex_array".
  Using extension "GL_EXT_draw_range_elements".
  Using extension "GL_ARB_texture_mirrored_repeat".
  Using extension "GL_ARB_texture_non_power_of_two".
  Using extension "GL_ARB_vertex_buffer_object".
  Using extension "GL_ARB_pixel_buffer_object".
  Using extension "GL_SGIS_generate_mipmap".
  Using extension "GL_EXT_framebuffer_object".
  Using extension "GL_ARB_texture_rectangle".
  Using extension "GL_EXT_bgra".
  Using extension "GL_ARB_texture_cube_map".
  Using extension "GL_EXT_texture_lod_bias".
  Using extension "GL_ARB_point_sprite".
  Using extension "GL_ARB_shading_language_100".
  Using extension "GL_ARB_shader_objects".
  Using extension "GL_ARB_vertex_shader".
  Using extension "GL_ARB_fragment_shader".
  Using extension "GL_ARB_shader_texture_lod".
  Using extension "GL_ARB_texture_float".
  Using extension "GL_ARB_draw_elements_base_vertex".
  Found special extension function "wglSwapIntervalEXT".

Compiling new shader:
   Loading built-in default shader for: soft-v.sdr
   Loading built-in default shader for: soft-f.sdr
Shader features:
   Depth-blended Particles
Compiling new shader:
   Loading built-in default shader for: soft-v.sdr
   Loading built-in default shader for: soft-f.sdr
Shader features:
   Distorted Particles

  Compiling post-processing shader 1 ...
   Loading built-in default shader for: post-v.sdr
   Loading built-in default shader for: post-f.sdr
  Compiling post-processing shader 2 ...
   Loading built-in default shader for: post-v.sdr
   Loading built-in default shader for: blur-f.sdr
  Compiling post-processing shader 3 ...
   Loading built-in default shader for: post-v.sdr
   Loading built-in default shader for: blur-f.sdr
  Compiling post-processing shader 4 ...
   Loading built-in default shader for: post-v.sdr
   Loading built-in default shader for: brightpass-f.sdr
  Compiling post-processing shader 5 ...
   Loading built-in default shader for: fxaa-v.sdr
   Loading built-in default shader for: fxaa-f.sdr
  Compiling post-processing shader 6 ...
   Loading built-in default shader for: post-v.sdr
   Loading built-in default shader for: fxaapre-f.sdr
  Compiling post-processing shader 7 ...
   Loading built-in default shader for: post-v.sdr
   Loading built-in default shader for: ls-f.sdr

  Max texture units: 4 (32)
  Max elements vertices: 1048576
  Max elements indices: 1048576
  Max texture size: 16384x16384
  Max render buffer size: 16384x16384
  Can use compressed textures: YES
  Texture compression available: YES
  Post-processing enabled: YES
  Using trilinear texture filter.
  OpenGL Shader Version: 4.40 NVIDIA via Cg compiler
... OpenGL init is complete!
Size of bitmap info = 742 KB
Size of bitmap extra info = 48 bytes
ANI cursorweb with size 24x24 (25.0% wasted)
GRAPHICS: Initializing default colors...
SCRIPTING: Beginning initialization sequence...
SCRIPTING: Beginning Lua initialization...
LUA: Opening LUA state...
LUA: Initializing base Lua libraries...
LUA: Beginning ADE initialization
ADE: Initializing enumeration constants...
ADE: Assigning Lua session...
SCRIPTING: Beginning main hook parse sequence....
Wokka!  Error opening file (scripting.tbl)!
TABLES: Unable to parse 'scripting.tbl'!  Error code = 5.
TBM  =>  Starting parse of 'mv_dbrs-sct.tbm' ...
TBM  =>  Starting parse of 'mv_exp-sct.tbm' ...
TBM  =>  Starting parse of 'mv_flak-sct.tbm' ...
SCRIPTING: Inititialization complete.
SCRIPTING: Splash screen overrides checked
SCRIPTING: Splash hook has been run
SCRIPTING: Splash screen conditional hook has been run
Using high memory settings...
Wokka!  Error opening file (interface.tbl)!
WMCGUI: Unable to parse 'interface.tbl'!  Error code = 5.
TBM  =>  Starting parse of 'mv_effects-sdf.tbm' ...
Dutifully ignoring the extra sound values for retail sound 36, 'l_hit.wav'...
Dutifully ignoring the extra sound values for retail sound 37, 'm_hit.wav'...
Windows reported 16 joysticks, we found 0
TABLES => Unable to find 'colors.tbl'. Initialising colors with default values.
TBM  =>  Starting parse of 'mv_effects-mfl.tbm' ...
Wokka!  Error opening file (armor.tbl)!
TABLES: Unable to parse 'armor.tbl'!  Error code = 5.
TBM  =>  Starting parse of 'mv_effects-amr.tbm' ...
TBM  =>  Starting parse of 'mv_assets-aip.tbm' ...
TBM  =>  Starting parse of 'mv_effects-wxp.tbm' ...
TBM  =>  Starting parse of 'mv_root-wxp.tbm' ...
BMPMAN: Found EFF (exp20.eff) with 75 frames at 20 fps.
BMPMAN: Found EFF (ExpMissileHit1.eff) with 92 frames at 30 fps.
BMPMAN: Found EFF (noeffect.eff) with 1 frames at 1 fps.
BMPMAN: Found EFF (exp04.eff) with 49 frames at 22 fps.
BMPMAN: Found EFF (exp05.eff) with 93 frames at 20 fps.
BMPMAN: Found EFF (exp06.eff) with 92 frames at 22 fps.
BMPMAN: Found EFF (capflash.eff) with 40 frames at 10 fps.
BMPMAN: Found EFF (Maxim_Impact.eff) with 23 frames at 30 fps.
ANI Lamprey_Impact with size 80x80 (37.5% wasted)
TBM  =>  Starting parse of 'mv_assets-wep.tbm' ...
TBM  =>  Starting parse of 'mv_effects-wep.tbm' ...
TBM  =>  Starting parse of 'mv_root-wep.tbm' ...
TBM  =>  Starting parse of 'mv_effects-obt.tbm' ...
TBM  =>  Starting parse of 'Hathor-shp.tbm' ...
TBM  =>  Starting parse of 'mv_assets-shp.tbm' ...
TBM  =>  Starting parse of 'mv_effects-shp.tbm' ...
TBM  =>  Starting parse of 'mv_root-shp.tbm' ...
TBM  =>  Starting parse of 'radar-shp.tbm' ...
TBM  =>  Starting parse of 'mv_root-hdg.tbm' ...
ANI support1 with size 108x24 (25.0% wasted)
ANI damage1 with size 148x25 (21.9% wasted)
ANI wingman1 with size 71x53 (17.2% wasted)
ANI wingman2 with size 35x53 (17.2% wasted)
ANI wingman3 with size 14x53 (17.2% wasted)
ANI toggle1 with size 57x20 (37.5% wasted)
ANI head1 with size 164x132 (48.4% wasted)
ANI weapons1 with size 126x20 (37.5% wasted)
ANI weapons1_b with size 150x20 (37.5% wasted)
ANI objective1 with size 149x21 (34.4% wasted)
ANI netlag1 with size 29x30 (6.3% wasted)
ANI targhit1 with size 31x21 (34.4% wasted)
ANI time1 with size 47x23 (28.1% wasted)
ANI targetview1 with size 137x156 (39.1% wasted)
ANI targetview2 with size 4x96 (25.0% wasted)
ANI targetview3 with size 7x20 (37.5% wasted)
ANI 2_energy2 with size 86x96 (25.0% wasted)
ANI 2_reticle1 with size 40x24 (25.0% wasted)
ANI 2_leftarc with size 103x252 (1.6% wasted)
ANI 2_rightarc1 with size 103x252 (1.6% wasted)
ANI 2_toparc2 with size 35x24 (25.0% wasted)
ANI 2_toparc3 with size 41x29 (9.4% wasted)
ANI 2_lead1 with size 26x26 (18.8% wasted)
ANI 2_lock1 with size 56x53 (17.2% wasted)
ANI 2_lockspin with size 100x100 (21.9% wasted)
ANI energy1 with size 12x41 (35.9% wasted)
ANI 2_radar1 with size 209x170 (33.6% wasted)
TBM  =>  Starting parse of 'mv_effects-str.tbm' ...
loading animated cursor "cursor"
ANI cursor with size 24x24 (25.0% wasted)
MediaVPs: Flaming debris script loaded!
MediaVPs: Explosions script loaded!
ASSERTION: "parentDir" at cfile.cpp:538
Int3(): From h:\code\github\fs2open.github.com\code\globalincs\windebug.cpp at line 966

EDIT: error message.
EDIT2: added log.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on February 16, 2014, 10:10:08 am
That message has nothing to do with cvp support, it should appear with normal executables too (since it's a warning about a weapons.tbl entry)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 16, 2014, 10:14:38 am
I am under the impression that m|m implemented LZMA SDK, in which case it should also support regular zip files. Can you folks try zips as well? Mostly curious if it reduces or increases loading times.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The Dagger on February 16, 2014, 10:15:31 am
That message has nothing to do with cvp support, it should appear with normal executables too (since it's a warning about a weapons.tbl entry)

Yeah, just saw that after posting. Corrected now.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 16, 2014, 10:32:06 am
Slow loading ended up being because people used solid blocks in their 7z-archives. There are two key settings you need to change when compressing 7z-archives for this purpose.
Method: LZMA2 (default is LZMA)
Solid-block: Non-solid (default is 2 GB)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 10:34:36 am
We will need to create a wiki article that covers this stuff.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 10:54:07 am
I tried a simple mod that only adds one ship and uses Mediavps2014:
1- Long loading time confirmed.
2- It does load Mediavps, 'cause I do get the Mediavps splashscreen.
3- It does open cvp files, 'cause debug says I'm mising some subsystem in my ship (ups).
4- It crashes after the loading screen with this message:
Code: [Select]
    Assert: parentDir
    File: cfile.cpp
    Line: 538
     
    ntdll.dll! ZwWaitForSingleObject + 21 bytes
    kernel32.dll! WaitForSingleObjectEx + 67 bytes
    kernel32.dll! WaitForSingleObject + 18 bytes
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    fs2_open_3_7_1_SSE2-DEBUG_CVP.exe! <no symbol>
    kernel32.dll! BaseThreadInitThunk + 18 bytes
    ntdll.dll! RtlInitializeExceptionChain + 99 bytes
    ntdll.dll! RtlInitializeExceptionChain + 54 bytes

fs2_open.log
Code: [Select]
<snip>

EDIT: error message.
EDIT2: added log.
Yeah, that assert was not necessary, I removed it and replaced it with a proper if but I'll wait until I upload new builds in case I can resolve more issues.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 11:37:04 am
New builds: http://www.mediafire.com/download/fjufhkytlv2lt79/CompressedVP.7z (http://www.mediafire.com/download/fjufhkytlv2lt79/CompressedVP.7z)
This version currently has issues with symlinks so keep that in mind when testing these builds.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 16, 2014, 12:20:01 pm
First impressions with mediavps converted to 7z using fastest and normal compression levels, both had LZMA2 and non-solid blocks.

FSO loads very snappily to pilot screen, there really is no difference to uncompressed. But when it comes to mission loading time, the story is very different. I used Bearbaiting to time loading times.
Uncompressed: 5 seconds
Fastest LZMA2: 32 seconds
Normal LZMA2: 27 seconds
I don't know why fastest compression ended up being slower than normal. I only timed these once, so perhaps there is large variance.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 16, 2014, 03:42:00 pm
It bothered me how it is that FSO loads snappily, yet chokes in mission loads. I decided to look at that a bit more.

So I made a 7z-archive with NO compression. Loading of Bearbaiting took 7 seconds. When running debug, it shows FSO spends most of the time loading pofs regardless of compression. This can be already reproduced in tech lab by selecting some of the higher detailed ships.

Compressed 7z-archive without cache or models directories. 32 seconds
Compressed 7z-archive without cache, models or maps directories: 9 seconds.
Compressed 7z-archive without maps only: 11 seconds.

There really was not much difference between fastest and normal compression levels. Only the "store" (uncompressed) was as fast as you'd expect from a vp-file.

I also had weird problems with cache generation, but I suspect it had nothing to do with m|m's builds. Some cache files got regenerated again and again, some were ten times the size they should be and some were 0 kb. Oh well, that got sorted out eventually and no weirdness since.

Uncompressed 7z-archives aren't going to do us much good beyond the fact that there is no need for other tools except archiver that can open 7z-files and more robust file corruption detection (vp's have none). Perhaps it would be prudent to investigate whether zip-files would fare better when compressed?

It should also be noted that 7z-archive with 2 GB solid block resulted in nearly 400 errors and missing campaign. So I guess FSO failed to read the file completely, well it's no wonder considering 7z-archives are roughly 1.5-1.8 GB large depending on compression level.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 16, 2014, 03:59:16 pm
I need to fix the location where the cache files are generated as that is probably broken right now.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 17, 2014, 09:29:39 am
It bothered me how it is that FSO loads snappily, yet chokes in mission loads. I decided to look at that a bit more.

So I made a 7z-archive with NO compression. Loading of Bearbaiting took 7 seconds. When running debug, it shows FSO spends most of the time loading pofs regardless of compression. This can be already reproduced in tech lab by selecting some of the higher detailed ships.

Compressed 7z-archive without cache or models directories. 32 seconds
Compressed 7z-archive without cache, models or maps directories: 9 seconds.
Compressed 7z-archive without maps only: 11 seconds.

There really was not much difference between fastest and normal compression levels. Only the "store" (uncompressed) was as fast as you'd expect from a vp-file.

I also had weird problems with cache generation, but I suspect it had nothing to do with m|m's builds. Some cache files got regenerated again and again, some were ten times the size they should be and some were 0 kb. Oh well, that got sorted out eventually and no weirdness since.

Uncompressed 7z-archives aren't going to do us much good beyond the fact that there is no need for other tools except archiver that can open 7z-files and more robust file corruption detection (vp's have none). Perhaps it would be prudent to investigate whether zip-files would fare better when compressed?

It should also be noted that 7z-archive with 2 GB solid block resulted in nearly 400 errors and missing campaign. So I guess FSO failed to read the file completely, well it's no wonder considering 7z-archives are roughly 1.5-1.8 GB large depending on compression level.
Thank you very much for doing these tests, I have looked at zip support and I might be able to add support for that.
For now I fixed the issues with symlinks (hopefully) so that should work fine now and I also renamed the file extension to .vp7 so we can add support for other archive formats later. Make sure to rename your .cvp files before testing :p
Here are the new builds: http://www.mediafire.com/download/jxqycidbt54dxq7/CompressedVP.7z (http://www.mediafire.com/download/jxqycidbt54dxq7/CompressedVP.7z)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Luis Dias on February 17, 2014, 09:41:53 am
Wait, these times are absolutely discouraging, if the idea to sacrifice 30 seconds every time we load a mission so that we can get some gigabytes back that we don't even (mostly) need anyway...
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: The E on February 17, 2014, 09:49:29 am
What these tests tell me is that there is some content that reacts neutrally to being stored in a compressed container, and other content that doesn't. It just means that this is a new tech that we will have to get used to before we can really use it well.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 18, 2014, 05:48:31 am
I have added support for using zip files which should have the extension .vpz. The files are currently decompressed entirely when opened to keep the implementation simple. If this causes issues then it might be possible to implement on-demand decompression.
New builds here: http://www.mediafire.com/download/jxqycidbt54dxq7/CompressedVP.7z (http://www.mediafire.com/download/jxqycidbt54dxq7/CompressedVP.7z)

EDIT: By files are decompressed completely I mean only the files that are opened by FSO inside the archive are decompressed.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 18, 2014, 11:11:45 am
Tested zip, loading Bearbaiting took about 13 seconds with fastest, normal and maximum compression levels. Compression level had no real impact on mission load speed. However, when using uncompressed zip, FSO wouldn't load. Process starts, system becomes very unresponsive for a little while but FSO never loads up to the pilot screen, or I ran out of patience first.

I also ran these tests on an SSD and observed no difference in loading speed compared to HDD. I should however note that I ran 7z and zip tests against source data directory, not a vp-file. That would be because I do not currently have anything that can package a vp-file and too lazy to find and get one. While doing these tests I noted that source data directory would nearly always load up in roughly 5 seconds, but at times it took about as long as zip did. This happened on both SSD and HDD.

Edit: This should be a good opportunity to profile the loading process and optimize it in the hopes of speeding up loading. If we can shave off some seconds off the zip loading, we have pretty decent potential replacement to vp.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 18, 2014, 11:42:28 am
I just tested uncompressed zip files and could not reproduce your issues. FSO starts fine so it might be related to your data. Which data did you test it with?
Also if you need a VP editor and you are on Windows Vista or later you can use this: http://www.hard-light.net/forums/index.php?topic=83920.0 (http://www.hard-light.net/forums/index.php?topic=83920.0) ;)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 18, 2014, 11:54:18 am
I suspect the problem is with file size. Original zip specification limits zip-file size to 4 GB. Support for higher file size limits depends on the library and I guess the library you used doesn't support zip files over 4 GB. The uncompressed zip file I used is 4.52 GB which contains most of the relevant FSU SVN data. Normal zip compression gets it to 1.81 GB.

As for packaging vp-files, I usually prefer command-line cfilearchiver.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 18, 2014, 12:00:49 pm
:eek2: With an archive that's bigger than 4GB you should probably break that up into multiple files just like you would do with a VP (which also has this 32-bit limitation).
A recent version of the commandline tools are also available here: http://scp.indiegames.us/builds/cfile.zip (http://scp.indiegames.us/builds/cfile.zip)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 18, 2014, 12:05:43 pm
It's not like I plan to distribute 4.5 GB uncompressed zip files. :p
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: niffiwan on February 18, 2014, 05:42:59 pm
It'd be nice to have FSO spit an error out if it can't process a 4GB+ file, rather than hanging.

(/captain obvious)
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 19, 2014, 02:04:28 am
I guess it's because I don't use the fopen64 variant to open the files, I'll see what I can do about it, maybe I can even get it to accept wide character strings...
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 22, 2014, 05:11:29 am
Did further tests on multiple smaller archives. Data directory was split into 8 zip archives using normal compression level. Bearbaiting loaded up in 12 seconds. Next I tried how long it takes when using 8 uncompressed zip archives, Bearbaiting loaded in 8 seconds.

I decided to see how does multiple smaller 7z archives compare, compressed using fastest compression level but with non-solid blocks. Bearbaiting too 36 seconds to load. With multiple uncompressed 7z archives, it took 8 seconds to load Bearbaiting.

And finally, I created vp-files from the same data directory as all the 7z and zip archives so far. Because maps directory was too large for one vp-file to hold (vp-file begins to crap out after it gets past 2GB in size), I split it into three. 10 vp-files in total. Bearbaiting loaded up in 5-6 seconds.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 22, 2014, 11:32:42 am
Double the load time seems reasonable, what's the compression ratio for your first test?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: Fury on February 22, 2014, 12:19:32 pm
This was replied to over at #scp, but copying for reference.

Code: [Select]
<Fury`> You want compression ratio of each individual archive, or just compression level? The latter was mentioned in the post.
<m|m> The overall size of the archive vs. the total size of the uncompressed files.
<m|m> I'm just curious if using zip files is actually worth the loading time decrease.
<Fury`> Uncompressed 4 860 299 240 bytes, 1 945 318 001 bytes using normal zip compression
<m|m> Yeah, I think it's worth it :P
<Fury`> vp-files 4 859 635 076 bytes
<Fury`> source data direcory(-ies) 4 859 402 640 bytes

Which basically means normal zip-compression achieves ~60% compression ratio over vp-files. This is pretty darn good, but it comes at the expense of doubling loading times, in the case of mediavps increase is from 6 seconds to 12 seconds. Even uncompressed archives seem to add 33% increase (2 seconds) in loading speed.

Considering how easily vp-files can become corrupted without end-user being none the wiser about it, I believe either uncompressed or compressed zip-archives should replace vp-files in future mod releases. Unless of course further testing reveals other problems.

Loading times will eventually decrease as coders get around to optimize it. But depending on how big a task that is, it may take a good while. Until then it's a debate between using uncompressed and compressed zip-archives.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 22, 2014, 12:55:33 pm
Just to keep everyone updated, I just addressed a few issues Fury reported which means that if an archive fails to load it will be a fatal error which is shown to the user and I also added a few checks to the VP reader to make sure it catches VP files which are too big for the loader.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: jr2 on February 23, 2014, 08:38:22 pm
Is .vp crapping out at 2GB a problem with the creator, archive type, or FSO?  If it's FSO, shouldn't that be fixed regardless?
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: karajorma on February 23, 2014, 09:19:30 pm
Given that tools like VPView have problems with a VP larger than 1GB, I've never really thought there was a good excuse for having a VP above that size anyway.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on February 24, 2014, 03:23:06 am
I could use an unsigned int for the fields which currently are ints but given that we will have formats which can handle those file sizes easily it should not be an issue anymore.
Title: Re: Alternative to VP-files - compressed archives (read before freaking out)
Post by: m!m on April 08, 2014, 05:56:28 am
I have uploaded new builds with some minor changes: http://www.mediafire.com/download/4hu7ys8du73qkqc/CompressedVP.7z

This build also include support for MD5 checksums but generating a checksum for big files is very slow (the MV_Advanced.vp file from 2014 MediaVPs takes at least 20 seconds to generate a checksum) so it is disabled by default and can be enabled by the -use_md5 commandline option.

EDIT: The source code should now compile on linux again but I am not sure if the builds actually work.