Garry's Mod

Garry's Mod

101 ratings
Easy addon compression
By [FG] Shark_vil
This is a guide to using the app to compress heavy addons quickly and easily.
2
   
Award
Favorite
Favorited
Unfavorite
1. Introduction
I think many of you were sighing when you saw another cool, but heavy addon. It's bearable when there's one or two of them. But when there are a lot of them, the game content can reach five gigabytes or more. This is especially unpleasant when developing content for a game server, when the loading speed is more important than textures at 8k resolution.

I have developed a simple application which uses primitive compression methods internally, but which can recursively compress all files in a folder you specify.

Third-party video tutorial:
2. Installing
2.1. Installing package Net 6
You must install the "Net 6" package in order for the application to work. Download it from this link:
https://dotnet.microsoft.com/en-us/download/dotnet/6.0/runtime

Choose a category that allows you to run desktop applications:




2.2. Installing the application
After you install the package, you can download the application. You can do this by following this link:
https://github.com/Shark-vil/GmodAddonCompressor/releases/latest

Choose a version for your system:



I recommend putting the startup file in a separate folder, as it will create additional files. Example:



3. How to use
3.1. Interface
The application looks like this:



3.1.1. Folder selection block


Here you can select the folder to compress. Once you have decided on the settings, you must click the "Compress" button to start.

You can also start the developer console, but this must be done immediately after starting the application, otherwise nothing will be displayed thereafter.

3.1.2. Audio selection block
Here you can select the settings for compressing audio files. At the moment, only the "WAV" format is supported.



I do not recommend putting "16000". The quality deteriorates noticeably. It is better to use the first two options.

3.1.3. Textures selection block
Here you can choose settings for compressing textures in almost all formats.



This option is responsible for the degree of compression of the image from its original size. For example 2, this is width and height divided by 2.



Here you can set limits. The resolution of the images will not be less than the limits you set.



Here you can set the settings for skipping. Any images with the specified restrictions will be skipped.



If you check this box, all images will be compressed exactly to the specified limits.



This option is needed to keep the original proportions of the images. I don't recommend that you turn it off.



By default, "VTF" textures are compressed via "VTFCmd". If you enable this option, the "ImageMagick" library will be used as a priority. It gives better compression and preserves the quality of the textures.



UPD 07.08.2022: The function has changed its name and was marked as demo because of errors found in the compression of some textures. I recommend using it selectively and not on a large folder with content.



3.1.4. LUA selection block
This option minimizes the LUA code by making it a single line and also removes all comments.



UPD 08.08.2022:
An optional setting that uses the Prometheus[github.com] library to minimize code. However, it also changes the source code, making variables shorter.



Example of how the source code changes:

4. Demonstration
I'll take the "MW19 Tactical Infiltration" mod as an example.



Original addon size:



For demonstration purposes, let's try these settings:



You can watch the progress here:



You can see the result for yourself:

5. Problems
Known problems
  • Some audio files are not compressed and are skipped
  • There is a small chance of the application freezing when processing files
  • There is a chance of breaking LUA scripts after minimization if they have been obfuscated or compiled

The main recommendation when working with this application is to make backups. Do not use compression on the original files. Make a copy of the addon, and experiment with compression settings on the duplicate.

In the future, I plan to add a button to quickly undo changes made, so that you can adjust the settings for one folder several times.
6. Conclusion
I hope this will be useful to someone. If you find bugs in the app, you can report them in the comments. But better do it on GitHub[github.com] or my Discord server[discord.gg], you can open tickets there.

You can also suggest ideas in the comments. Good luck!

57 Comments
ArMer 7 hours ago 
when i compress materials with this thing, they are looking like a really huge amount of small copies of texture
stevensky 3 Sep @ 8:19am 
easy to use and works fine, from 772mb to 573mb (-199mb) with the default (2x) settings, great addon Shark
Abubucasis 30 Jul @ 1:33pm 
haha i made it work on mac i can share how
[FG] Shark_vil  [author] 30 Jul @ 1:24pm 
@AliBabaHajjHasan, no. On Mac OS, probably only running in a VirtualBox environment will work.
Abubucasis 30 Jul @ 12:44pm 
is there mac version
[FG] Shark_vil  [author] 27 Mar @ 4:01am 
@Ecst4sya, it not work with archive file. Only extacted filrs.
jxlly 27 Mar @ 1:51am 
Is this only for developers? I can't seem to compress any of my subcribed addons because most of them are compiled into a .gma file or .temp
2plus2isfive 19 Jan @ 11:46am 
yo shark this baumilha guy speaks portuguese, not russian.
[FG] Shark_vil  [author] 18 Jan @ 11:09pm 
@Baumilha , удачи найти вирус, код программы открытый. Гений нахуй.
Baumilha 18 Jan @ 5:14pm 
Virus alert