Raised This Month: $32 Target: $400
 8% 

Download Preferences


Post New Thread Reply   
 
Thread Tools Display Modes
Author
nosoop
Veteran Member
Join Date: Aug 2014
Plugin ID:
4552
Plugin Version:
0.8.0
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    Pick and choose downloads.
    Old 03-15-2015 , 04:11   Download Preferences
    Reply With Quote #1

    Note: This is an alpha.

    Allows plugin developers and server administrators to categorize files and make them optional downloads.

    I originally wrote this to work with a server that had tons of optional sound downloads (specifically music during humiliation, weighing in at ~2.5MB per map change at the worst case), but it can be useful to make any downloads opt-in (like gee, what am I supposed to do with all these Quake Sounds).

    There's still a bit more to improve on to make it easily accessible to non-developers, and there's a few improvements for efficiency and stability (have to do a query for every preference instead of caching it meaning no equivalent to OnClientCookiesCached(), eugh), but I think it's in a relatively good enough state to do an alpha for. I mean, it doesn't burst into flames. Much.

    Requirements:
    • SourceMod's SQLite Driver, preferably. It might work with SQL; not really sure if there's any incompatibilities with the queries.
    • A PHP installation, SQLite3 support, and a web server with the ability to use rewrite rules. (This does not necessarily have to be the same as your fast download server.)
    Current shortcomings:
    • No proper caching mode yet (it is in a separate branch for testing). A proper privilege setup has been added, though!
    • TF2 says that the file is "downloading", though it'll keep chugging along and files actually won't be downloaded as appropriate. Something I can't really fix. (Unless someone's figured out how to modify stringtables before transmission, in which case we can just take out the PHP bit entirely.)
    • Precaching non-existent files prevents the client from using it after downloading the file. This is also an annoying thing to deal with, and unfortunately, I've had no luck trying to fix this yet.
    • It's written for 1.6, and you have to compile it yourself. Gasp. I have no idea how to transitional syntax yet.
    Latest notable updates:
    • 0.8.0: Added support to set visibility of categories, similar to CookieAccess in clientprefs.
    • 0.7.1: Fixed unsanitized string usage when registering a category. Proper fix combined with raw access sometime soon. Added support for non-developers to add files using the downloadprefs_loader plugin.
    • 0.7.0: Abstracted away category identification values

    Server running the plugin: pikatf2.serverpit.com (homepage)

    13 sound files that are on the download list are blocked by default. To enable downloads for a specific category of files, type `/downloads` in chat, toggle a setting with the supplied menu, and reconnect.

    Installation instructions in the project's GitHub repository.

    Source code (ZIP) | Include | Full Commit Logs

    Last edited by nosoop; 03-18-2016 at 19:21. Reason: Major (?) bug note.
    nosoop is offline
    DJPlaya
    Senior Member
    Join Date: Nov 2014
    Location: Germany
    Old 08-02-2016 , 09:13   Re: Download Preferences
    Reply With Quote #2

    I dont get it, does this let Users download optional Files from Mapchange to Mapchange so they dont load everything at the same Time? U wrote about that the Plugin uses their Acc ID to detect if they are allowed to download smt? Or has it something todo with the loaded Map (because some Map Makers are to stupid to pack the Stuff into the bsp)?
    Please explain
    __________________
    My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux

    Last edited by DJPlaya; 08-02-2016 at 09:30.
    DJPlaya is offline
    Send a message via Skype™ to DJPlaya
    nosoop
    Veteran Member
    Join Date: Aug 2014
    Old 08-02-2016 , 11:55   Re: Download Preferences
    Reply With Quote #3

    Quote:
    Originally Posted by DJPlaya View Post
    I dont get it, does this let Users download optional Files from Mapchange to Mapchange so they dont load everything at the same Time? U wrote about that the Plugin uses their Acc ID to detect if they are allowed to download smt? Or has it something todo with the loaded Map (because some Map Makers are to stupid to pack the Stuff into the bsp)?
    Please explain
    This library / web server script combination is a little weird; I'll try to explain it via an example.

    Let's say I have a lot of silly custom sound effects that can play whenever a player is killed with specific weapons. I add it to the server's download table so the player has to download the file before joining the server so they can hear it.

    But maybe for some reason, the player doesn't want to hear the sounds. Sure, the plugin might be configurable to prevent them from hearing it (with Client Preferences, for example), but even if they don't care about the sounds at all, they still have to download it before joining my server.

    It ends up being a waste, and from talking with a few people from my old community (which had this same feature), one reason some people hesitated from joining is the sheer amount of custom extra sounds that end up requiring a download.

    So, the problem I ended up having is that I needed some way for players to not download stuff that they might not actually need, while still giving players the option of having it. I could just drop it altogether, but I personally loved the feature as it made the server stand out.

    One solution I've thought about was to just not have them present in the server's download table at all, but instead to put them up as a content pack online. It ends up being clunky. You have to depend on the players to keep track of updates. If you have a lot of this sort of content and update it, it really just ends up going to waste since nobody's willing to put up with that.

    Another way is to use the FileNetMessages-related extension to download optional content in the background while connected. I never looked into it much, as a comment posted mentions it only works with stuff in downloadables, in which case the client might've already picked it up while connecting.

    This is the other solution I ended up working with.
    1. While adding files to the server's download table, a plugin can also associate the file to a download category, and set whether or not the category is enabled / disabled by default.
    2. When the client connects, the server sends them a user-specific download URL. When the client notices they're missing something, they make a request to the fast download server with that URL.
    3. The server checks whether or not the user wants the file based on its category, then either redirects them to the actual file to download (in which case it's just like a normal download) or sends back an HTTP 404 (Not Found).
    4. If the client receives the Not Found response, they continue connecting without downloading the content, which is what we want in this case.
    5. If the client wants to change whether or not a specific category of content is accessible to them, they can do it easily while connected to the server.
    It's a cheap trick, but as far as I can tell, it seems to work (the precache-related shortcomings may or may not be outdated). If there are any cleaner solutions with similar client ease-of-use, I'd like to hear them.

    tl;dr: Players can have the best of both options: They can have extra content served to them if they want it, or have the server keep them from downloading it if they don't.
    __________________
    I do TF2, TF2 servers, and TF2 plugins.
    I don't do DMs over Discord -- PM me on the forums regarding inquiries.
    AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

    Last edited by nosoop; 08-02-2016 at 12:01.
    nosoop is offline
    DJPlaya
    Senior Member
    Join Date: Nov 2014
    Location: Germany
    Old 08-02-2016 , 17:56   Re: Download Preferences
    Reply With Quote #4

    Ye, now I understand.
    I testet the Extension - Working fine, without the Files in the downloadables. Im currently working on an Plugin for it but I im not very skilled in SourcePawn, could you try making a simple plugin for this?
    The Natives work quite pretty, but the Forwards are rly tricky.

    Here is an test Plugin that sends the "gameinfo.txt" File from the Server to the Clients download Folder
    Code:
    #include <sourcemod>
    #include <sdktools>
    #include <filenetmessages>
    #include <profiler>
    
    #pragma    semicolon 1
    
    Handle g_hProf;
    
    public void OnPluginStart()
    {
        RegConsoleCmd ( "sm_test"                    , CmdTest, "");
        g_hProf = CreateProfiler();
    }
    
    public Action CmdTest(int client, int args)
    {
        StartProfiling(g_hProf);
        PrintToChatAll("FNM_SendFile ID %i", FNM_SendFile(client, "gameinfo.txt", 0));
        {
            StopProfiling(g_hProf);
            float fProfilerTime = GetProfilerTime(g_hProf);
            PrintToServer("Benchmark took: %f seconds, %f milliseconds", fProfilerTime, fProfilerTime * 1000);
        }
        return Plugin_Handled;
    }
    
    public FNM_OnFileSent(client, file[], 0);
    {
        PrintToServer("OnFileSend Notifier for %s", client);
    }
    public FNM_OnFileReceived(client, file[], 0);
    {
        PrintToServer("OnFileReceived Notifier for %s", client);
    }
    public FNM_OnFileRequested(client, file[], 0);
    {
        PrintToServer("OnFileRequested Notifier for %s", client);
    }
    public FNM_OnFileDenied(client, file[], 0);
    {
        PrintToServer("OnFileDenied Notifier for %s", client);
    }
    __________________
    My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux

    Last edited by DJPlaya; 08-04-2016 at 19:59.
    DJPlaya is offline
    Send a message via Skype™ to DJPlaya
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 08:34.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode