ValveSoftware / Source-1-Games

Source 1 based games such as TF2 and Counter-Strike: Source
635 stars 74 forks source link

[All] Please compress assets, your games could be several times smaller #1790

Open ghost opened 10 years ago

ghost commented 10 years ago

Yes, yes, disk space is cheap, but uncompressed files are slow to read, and we all hate excessive loading times. More importantly, though, smaller files use up less bandwidth.

Your bandwidth.

So go compress your games and save yourselves some money.

Most files can just be gzipped (or xz'd). The typical compression ratio here is 2x, although it's lower for audio, higher for maps, and even higher for raw text.

For audio, use opus with a bitrate between 48 and 96 kbps. That's over 7x smaller than the uncompressed wavs (705 kbps) currently being used.

Unfortunately, there is no One True Format for textures, so just gzipping the VTF files is a valid choice here. However, here are some tips for better compressing textures:

BreakinBenny commented 10 years ago

Another idea would be for the game assets, because there are so many duplicate sound files for the Survivors in Left 4 Dead 2's DLCs. The amount of uncompressed WAVs is just crazy, especially when the Quarantine tracks are not even different and may as well just re-use the "L4D1" sound files from The Passing, moved over to the base game's directory.

powerlord commented 10 years ago

@BreakinBenny That's a great idea... for the PC and OSX versions.

However, there's a good chance someone was being lazy and they're duplicated due to the Xbox 360 versions being paid DLC and having one installed doesn't guarantee that the other is installed.

BreakinBenny commented 10 years ago

@powerlord Then technically, the less important things'd have to be delivered into the base game's area for safety reasons if it was possible...unless they could've gotten around to doing what they were doing, but only for the X360 so we could avoid this trouble on computers. It is rather funny, though, that we could almost predict L4D1 would be ported into L4D2 with the leftover/legacy content...

powerlord commented 10 years ago

@BreakinBenny The implication was (which I meant to explicitly state but apparently forgot) that someone was being lazy and not packing them differently based on the OS.

BreakinBenny commented 10 years ago

@powerlord Ah, I was about to say that too... Yes, Valve has clearly proven their laziness when it comes to making things for X360, but not much for PC. There should be an update that cleans up duplicate content in the VPKs, with all the stuff I mentioned here. https://github.com/ValveSoftware/Source-1-Games/issues/1158

Well now, if only someone could assign themselves here.

BreakinBenny commented 10 years ago

I have to admit, that the Quarantine songs (which are differently named but duplicated as well) don't even sound different. L4D2 simply has "quarantine" and they are used about anywhere, no duplicates whatsoever!... Another proof of Valve's laziness.

nefelim4ag commented 10 years ago

@knthzh sure with you, but i think if we hate loading time lz4 compression looks more pretty.

BreakinBenny commented 10 years ago

All the things mentioned here'll probably be included in Source 2, though it's likely to still support WAVs as legacy content like how the HPL Engine mostly uses Ogg Vorbis for the sound and music files...and man, Valve really needs to push their Source Multiplayer games into a Half-Life Multiplayer directory like how HL2 Singleplayer does with its episodes, to save some flippin' space caused by all the duplicated base content in them.

FirstRoboticsGuy999 commented 9 years ago

Assets should not be compressed for everyone. Everything will take up space on a disk; maybe you just need to accept that. Almost any sort of software compression algorithm will cause unwanted visual artifacts in-game that nobody wants.

We already have VPKs, isn't that enough for you? You will have much better luck if you look into the client side engine commands relating to budget and asset compression

2xsaiko commented 9 years ago

@FirstRoboticsGuy999 that is not true. MP3 files compared to WAV definitely loses some quality, same as PNG vs JPEG. But algorithms like XZ or GZIP or whatever do not.