Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

The Minifier

Malware edited this page Apr 14, 2023 · 8 revisions

The purpose of the minifier is to rename and compact your code in a way that allows you to fit more code into the limited space allowed by the game. Rest assured that this is perfectly fine, as the reason for the script limit is due to network transfer, not code performance or anything like that. What you write is more important than how much you write.

The minifier is split into two separate functions. The first and simplest one is a method to remove types you are not using in your code. Simply enable the "Type Trimming" checkbox in the new MDK script wizard or in the script options dialog.

The second function is the full-blown minifier that removes all formatting, eliminates unnecessary whitespace, and renames all symbols it can to the smallest symbol name possible.

Unminified Section

Sometimes there's code you don't want to be minified for any reason. The unminified section system works by code regions. Simply add the code or comments you wish to preserve within such a region to have the minifier skip over it. Be aware, though, that it might not be entirely untouched. Some minor adjustments could be made, but naming will remain unchanged, and formatting will most probably be preserved.

#region mdk preserve
// Stuff I don't want the minifier to touch
#endregion

But the minifier is slow...

One significant issue with the minifier is that it's rather slow. So, you'll want to wait with minifying until you have a release-ready script. However, the problem with this is that the game won't fit your script, so you can't test it without minifying your script. Rexxar and Equinox came up with a solution for this: a plugin you can use on your game locally (won't work when you're on a server) to override the character limit of the programmable block. This way, you can write and test your script without minifying until you're ready.

A version of this plugin, written by Avaness (I think?), is available through the Plugin Loader. https://github.com/sepluginloader/SpaceEngineersLauncher

You're looking for the UnlimitedScriptLength plugin.

WARNING: Plugins are inherently dangerous, as they are not limited the way mods are. They can do practically anything, including nefarious actions. Trust your plugin source. Don't install plugins carelessly.

Again, since scripts run on the server, this will only work for local games.

Clone this wiki locally