In this tutorial, I will cover how to properly setup a working FastDL mirror for your game server. It is important that you read everything here, as FastDL's are very fragile
As I stated earlier, FastDL's are very, VERY fragile. One step wrong and you will notice that it won't work. Note: You can still use Workshop Content on your server while having a FastDL, with
+host_workshop_collection_id
and all.
This tool generates
resource.AddFile()
lines for our files.To the tutorial! The player will only look for certain file-types in certain folders on the FastDL mirror, which are:
Note that this is how your FastDL folder structure should look like. No addons folder, no lua folder, no other folder at all! This is where most people makes a mistake, by having their files in an addons folder like they do on their server. Read this block below and you'll understand why:
As the title says, the addons folder is emulated on your server. Everything inside of it is "mounted" on your server, as if their files were in the root of your server. And as so, your server doesn't tell your players this when they join. If you would have a file inside addons/someaddon/models/model.mdl, the server would tell the player to download models/model.mdl, and that's why you have to upload the model directly to the models directory and NOT into addons/someaddon/models on your FastDL. You can keep the model inside the addons directory on the server though.
Download the addon you want from Workshop, both to your server and to your computer. If the addon is purely lua, close this tutorial as lua is distributed directly to the client through the server. After you've done that, open up GMAD Extractor GUI that you downloaded earlier and click on Open. If you can't see your addon in the list there, click Browse and head to your Garry's Mod addons folder and select the addon from there. Click the addon you want, and then press the Select button. After that click the Extract all button and choose where you want your content to be extracted to, let's say your desktop. Now you should have a legacy addon folder on your desktop, go ahead and open it up. You should see a set of folders that I listed further up in this tutorial and an addons.txt file.
Next up is using Fox-Warrior's Resource Generator. Open it up, click on File>Select a directory and go to your desktop and select the legacy addon folder. You should see now that it generates a list of files. If it doesn't, you've done something wrong. After that, click on File>Generate lua file>File>AddFile and a box will come up with where you want to save your lua file, so just save it on the desktop. The file should have lines like this:
if (SERVER) then
resource.AddFile("materials/models/material.vmt")
resource.AddFile("models/player/model.mdl")
resource.AddFile("sound/sound.mp3")
end
Upload this file to your lua/autorun directory on your server.
Now we want to compress the files using bzip. Hold down CTRL and select any of the folders that you see in the list above; maps, materials, models, sound, particles or resource. This will select all those folders. Hit CTRL+X and open up the compress folder inside the bzip folder. In there, hit CTRL+V and it will paste the folders in there. Now go up on directory and launch the bzip.bat, not the bzip2.exe as it does nothing without the arguments supplied by the batch file. You will see a CMD window popup telling you that it compresses the files. Once it's done, press any key on your keyboard and the window will disappear.
Connect to your FastDL via FTP or whatever you use. Upload the folders in the compress folder to your FastDL. Your FastDL should have the folders in the list I've been speaking so much about. So it should ONLY contain these directories:
Next up is editing your server.cfg file. Add these lines to it (change the domain to whatever yours is and the trailing fastdl to whichever folder you uploaded everything to):
sv_downloadurl "http://domain.com/fastdl"
sv_allowdownload 0 // This disables ServerDL
sv_allowupload 0 // This is a security measure
Reload your cfg with
exec server.cfg
in server console or restart your server. Done!
This is how my FastDL ended up looking like:
And in my case, this is how my server.cfg looks like:
sv_downloadurl "http://domain.com/fastdl/ttt1"
Here is a bit of information you really should read!
ServerDL is REALLY slow. It has a speed limit that is very low, doesn't support file compression and uses the servers networking CPU core. It also has a file size limit which is 64MB! This applies to LAN servers aswell. Do I even have to explain further why you shouldn't go with this?
WorkshopDL is the method to use unless you don't have the option to use FastDL. FastDL is superior to WorkshopDL in many ways.
FastDL is by far the ultimate, most superior way of distributing your server content.