For players to see your server's custom content such as models, textures, sounds or maps, they have to download it. With FastDL players download these files over HTTP from your webspace when they join. To set it up, you enter the address of the webspace in the server.cfg and use Lua to define which files should be downloaded.
Requirements for FastDL
For FastDL you need your own web server or webspace that is publicly reachable via http:// or https://. Your Garry's Mod server itself is not a web server and cannot deliver the files over HTTP.
Provide the content on the game server
The files players should download also have to be on your game server. If a file is missing on the server, it is not added to the download list.
-
Stop the server
Stop your server via the dashboard. -
Connect via SFTP
Connect to your server via SFTP. -
Upload the content
Upload your content as an addon into its own subfolder, for example:/garrysmod/addons/myserver-content/It contains subfolders such as
materials/,models/orsound/. Custom maps go into/garrysmod/maps/as a.bspfile.
Upload the files to the webspace
Players request every file from your webspace address using the same path it has relative to the garrysmod/ folder. The folder structure on the webspace therefore has to match the structure in the game exactly.
-
Create the folder structure
In the root directory of your webspace, create the same folders your content uses, for examplemaps/,materials/,models/andsound/. -
Upload the files
Upload the files into the matching folders. Leave out the addon folder itself:/garrysmod/addons/myserver-content/materials/myserver/logo.vmton the game server becomesmaterials/myserver/logo.vmton the webspace. -
Optionally compress the files
You can additionally compress the files in the bzip2 format to make the downloads smaller. The compressed file gets the extension.bz2appended to the full file name, for examplelogo.vmt.bz2. Players request the.bz2file first. If there is no compressed version, they download the uncompressed file.
Enter the download URL
-
Open the file
Open the following file via SFTP:/garrysmod/cfg/server.cfg -
Enter the URL
The file already contains the linesv_downloadurl "". Enter the address of your webspace between the quotation marks:sv_downloadurl "https://fastdl.example.com"The address has to point to the directory that contains the
materials/,models/etc. folders. -
Disable downloads from the game server
Add the following line below the line// Add custom lines under here:sv_allowdownload 0This way players do not download any files directly from the game server. You can find out why this matters in Download directly from the game server.
-
Save the file
Save the file.
Mark files for download
For players to download the files, you have to mark them for download in a server-side Lua file. There are two functions for this:
| Function | Description |
|---|---|
resource.AddFile |
Marks the file and all related files. For a .vmt file the .vtf file with the same name is added automatically, for a .mdl file the .vvd, .ani, .dx80.vtx, .dx90.vtx and .phy files with the same name are added automatically. |
resource.AddSingleFile |
Marks only exactly the specified file. |
-
Create a Lua file
Create a new file via SFTP, for example:/garrysmod/lua/autorun/server/fastdl.lua -
Add the files
Add one line per file. The path is relative to thegarrysmod/folder – withoutaddons/<addonname>/in front and without the.bz2extension:resource.AddFile( "materials/myserver/logo.vmt" ) resource.AddFile( "models/myserver/chair.mdl" ) resource.AddFile( "sound/myserver/music.wav" ) resource.AddFile( "maps/rp_examplecity.bsp" ) -
Start the server
Save the file and start your server. The next time they join, players download the marked files from your webspace.
Limitations of FastDL
Download directly from the game server
With the ConVar sv_allowdownload, players can also download files directly from the game server. You should not use this method: at around 64 KB/s it is very slow.
