Late Downloads Manager
Download files to players while in-game.
This is mostly a proof of concept release to see how well it works and if there's large interest in such a thing.
Late downloads download in the background while players are in-game, at about 128Kbps. This means a 1MB file will take about 1 minute to download. For comparison, sprays and jingles are each limited to 512KB, for a total of 1MB.
Features:
Associate files with servers, maps, and players to be downloaded to players while in-game. Remembers which players have which files to avoid resending.
CVARS:
sm_latedlman_servername "default"
The name to use for this server. Files owned by the named server will be late downloaded to clients.
Player commands:
ClearDownloadCache
Clears the player's download cache and begins resending files. On a 5 second cooldown.
Admin commands:
RefreshLateDownloads
Re-reads the downloads list and starts sending files out to players. Does not reload the database. If this command actually does anything, it means my code is bugged.
Server commands:
ShowLateDownloadCounts
Debug information showing the counts of various objects.
Example output:
Code:
g_DownloadListServer = 1
g_DownloadListMap = 1
g_DownloadListPlayers[1] = 2
g_DownloadCache[1] = 3
Requirements:
Late Downloads extension
MySQL Database
Optional dependencies:
PHP for using LateDownloadsManagerApi.php
Plugin design note:
This plugin will immediately unload itself if it encounters any detected errors, typically database errors.
Planned features:
Blacklists
Arbitrary comma-delimited modes cvar?
Integration for other plugins to determine if a player has a file
Installation:
Install the Late Downloads extension
Import latedlman.sql into your database
Add an entry for "latedlman" to databases.cfg
Load the plugin
Add late downloads using LateDownloadManagerApi.php or manually
LateDownloadManagerApi.php usage example:
PHP Code:
$api = new LateDownloadManagerApi('/home/tf2/.steam/steamcmd/game/tf', 'latedlman', '127.0.0.1', 'user', 'password');
$api->SetValidatePath(false); // Do this if this script is not running on the game sever with access to the game directory
// Won't be replaced/duplicated if they already exist
$api->AddServer('neatplace');
$api->AddPlayer('STEAM_0:1:37936200');
$api->AddMap('cp_process_final');
$api->AddFileOwnedByServer('test/test.txt', 'neatplace');
$api->AddFileOwnedByPlayer('test/hartmann.txt', 'STEAM_0:1:37936200');
$api->AddFileOwnedByMap('test/process.txt', 'cp_process_final');
// The same file can be owned by multiple things
$api->AddFileOwnedByPlayer('test/test.txt', 'STEAM_0:1:37936200');
Changelog:
1.1.1:
Player command added: ClearDownloadCache, on a 5 second cooldown.
1.1.0:
All queries are now threaded.
1.0.55:
Race condition between OnClientAuthorized and OnClientPutInServer preventing files from being sent fixed
Small performance improvement in SQL row fetch loops
Code rearrangement