FastDL
Learn what FastDL is, what it does and how you can use it to improve your player's experience
What is FastDL?
FastDL is a lightning fast way to serve assets to players on your server. It is often the fastest way to serve textures, models, sounds and more from your server. All Midas Group Source Servers come with a FastDL service by default that automatically syncs files.
Why should I use it?
Many Source Engine gameservers serve files to players with transfer speed restrictions of roughly 20-30Kb/s, this is a limitation of the source engine. FastDL avoids this limitation by using HTTP, the same technology used to serve this article to you. FastDL allows players to download at their full internet speed without putting additional stress on your server. This means that players will load in significantly faster when downloading from FastDL which can be even further sped up using addons such as gluapack to compress clientside Lua files.
Games such as Team Fortress 2 require FastDL to serve custom map files so if you plan on running a custom map such as koth_trainsawlazer you need FastDL in order to join.
How do I use it?
When your server is installed the fastdl link is automatically set in your server.cfg all you have to do is tell your garry's mod server what files the player's game must request, This can be done manually or via an automated script.
Garry's Mod
Manual
Create a file in (garrysmod/lua/autorun/server/) This file can be named however you want but for the purposes of this guide we will title it fastdl.lua, the contents of the file follow this pattern. This is a slow process but is reliable
if (SERVER) then
resource.AddFile("maps/gm_construct.bsp")
resource.AddFile("maps/gm_flatgrass.bsp")
resource.AddFile("maps/rp_downtown_v4c.bsp")
resource.AddFile("resources/fonts/papyrus.ttf")
...
end
Automatic (Recommended)
Follow the first step of the manual method by creating the file mentioned but instead of manually populating the list just paste this script in.
-- Configuration
local folders_to_scan = { "models", "materials", "sound", "resource", "particles" }
local ignored_extensions = { ".db", ".txt", ".ztmp", ".json", ".properties" }
local function IsIgnored( path )
path = path:lower()
for _, ext in ipairs( ignored_extensions ) do
if path:sub(-#ext) == ext then return true end
end
return false
end
local function ScanPhysicalDirectory( full_path, resource_path )
local files, folders = file.Find( full_path .. "/*", "BASE_PATH" )
for _, filename in ipairs( files ) do
if not IsIgnored( filename ) then
local res_path = resource_path .. "/" .. filename
resource.AddFile( res_path )
print( "[FastDL] Added: " .. res_path )
end
end
for _, foldername in ipairs( folders ) do
ScanPhysicalDirectory( full_path .. "/" .. foldername, resource_path .. "/" .. foldername )
end
end
MsgC( Color( 0, 255, 0 ), "[FastDL] Starting strict physical scan...\n" )
for _, folder in ipairs( folders_to_scan ) do
ScanPhysicalDirectory( "garrysmod/" .. folder, folder )
end
local _, addon_folders = file.Find( "garrysmod/addons/*", "BASE_PATH" )
for _, addon in ipairs( addon_folders ) do
for _, folder in ipairs( folders_to_scan ) do
local path = "garrysmod/".. folder
if file.IsDir( path, "BASE_PATH" ) then
ScanPhysicalDirectory( path, folder )
end
end
end
MsgC( Color( 0, 255, 0 ), "[FastDL] Strict population complete.\n" )
Team Fortress 2
Heres a great guide posted by Wazman to AlliedMods that covers everything you need to know. https://forums.alliedmods.net/showthread.php?t=214276 Note : You can ignore step 6 as files are automatically synced, due to the way that files are synced the use of bzp2 differs from the guide slightly, Instead of uploading bzip files to FastDL you can place them next to the original file, for example : if you are trying to serve 2fort (tf/maps/ctf_2fort.bsp) you can place ctf_2fort.bsp.bzp2 in tf/maps/ and the server will serve the compressed file and ignore the normal .bsp file.
Limitations of FastDL
The engine has a limit of 8,192 files that can be requested via resource.AddFile if you have more files than this it is best to use workshopDL. If a connecting player has an existing file of the same name, it will not be overwritten. The download file will be skipped. Certain game-crtical and/or dangerous files cannot be downloaded (ie: *.exe, *.vbs, *.src script dll etc) (Source)