Author Topic: Reset a server's resource.AddWorkshop list?  (Read 4271 times)

0 Members and 2 Guests are viewing this topic.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Reset a server's resource.AddWorkshop list?
« on: January 11, 2015, 05:56:52 PM »
Anyone know if it's possible to dynamically reset a server's list of client-delivered addons built through calls to resource.AddWorkshop without having to restart the server/map?  I'm looking to spread addon delivery via the Workshop across days of the week to shorten connection times for new players, but this hinges on my ability to clear and rebuild the addon list every so often.  I didn't see anything in the GMod api, but thought I'd throw the question out on Facepunch and here.

Thanks.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Reset a server's resource.AddWorkshop list?
« Reply #1 on: January 11, 2015, 07:57:24 PM »
Look into the steamworks library, it seems you can do it there, though it may require forcing clients to rejoin.
Experiencing God's grace one day at a time.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Reset a server's resource.AddWorkshop list?
« Reply #2 on: January 12, 2015, 07:30:57 AM »
Thanks. I did look through it briefly.  It seems to be more about accessing and manipulating Steam-side information rather than making changes to a dedicated server's operational status.  Do you see something there that speaks to server configuration that I might have missed?  I'll dig deeper.   

Thanks again.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Reset a server's resource.AddWorkshop list?
« Reply #3 on: January 12, 2015, 09:02:37 AM »
Bah, never mind.  It's moot.  By skipping AddWorkshop calls for addons it creates mounting problems for the client even though they've already downloaded the addon previously (it never mounts).  It was a semi-interesting idea that ran off the cliff quickly.  :)  Thanks though.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Reset a server's resource.AddWorkshop list?
« Reply #4 on: January 12, 2015, 11:58:56 AM »
Why are you trying to remove it?
When a client joins they only download addons from the workshop that they don't have or have been updated.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Reset a server's resource.AddWorkshop list?
« Reply #5 on: January 12, 2015, 12:14:02 PM »
Well, it's just an experiment -- I'm playing with alternative ways of delivering the rather large # of addons I run.  Pushing them all down at once on first join creates some pretty long wait times for users, especially those with slower connections or situations where Steam is experiencing a slowdown.  Alternatively, splitting the addons up between critical ones (pushed down with AddWorkshop) and other ones placed in a collection that users need to manually subscribe to creates a bit of chaos among some of my userbase.

So I thought if I could split up the forced downloads into chunks (changing them every few hours or so), then users would eventually get all the addons, wouldn't be burdened with a single massive download and wouldn't need to worry about manual subscriptions.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Reset a server's resource.AddWorkshop list?
« Reply #6 on: January 12, 2015, 02:30:58 PM »
Neat idea.
It has to store that information somewhere on the server so maybe try and sort through the global table.
If you can find where it's storing it, you could conceivably delete the data from the table and just run resource.AddWorkshop with the new files.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Reset a server's resource.AddWorkshop list?
« Reply #7 on: January 12, 2015, 03:33:15 PM »
If it's similar to file downloads, it's stored in a string table -- which isn't accessible to Lua (or at least, didn't used to be).
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Reset a server's resource.AddWorkshop list?
« Reply #8 on: January 12, 2015, 03:54:59 PM »
Split some into Addworkshop, some into fastDL perhaps?
I'd guess some of the more static/non changing content would be hosted FastDL, stuff likely to change be on Workshop.
Then, yes, you have to be concerned with FastDL hosting cost/speed/usage/etc.

Yours really is of neat idea though.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Reset a server's resource.AddWorkshop list?
« Reply #9 on: January 12, 2015, 05:50:59 PM »
Thanks guys.  I guess there are really two hurdles..

1) Being able to manipulate the list itself.  Feedback I got from Facepunch is pointing me at the "downloadables" string table.  Looking at the dump does show me the gma's I expect to see. Assuming I can edit this list on the fly (the stringtables module was mentioned, but that looks like its read only) then that's a potential solution to this.
2) I still may run into mounting issues on the client side. AddWorkshop() doesn't just instruct the client to download the addon, AFAICT. It also instructs the client to mount it. If I reduce my AddWorkshop() calls, those addons I don't call do not get mounted, even if the client already has them.  Manipulating the downloadables stringtable may very well create the same issue.

In theory I suppose its possible that I could call AddWorkshop() with all my addons at server startup, and then trim down the list with stringtable manipulation **without** breaking the mounting functionality for the client.  But this assumes that the mounting list ultimately gets separated from the downloadables list, and that's a big... big... BIG assumption. Not something I can test until I understand if actually changing the downloadables stringtable is even a possibility.  Is there something other than "gm_stringtables" (https://github.com/gmodcoders/gm_stringtable) that might be considered the "stringtables module"?  I haven't discovered anything else similar, and certainly nothing that seems to allow write access to the stringtable.

Thanks again.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Reset a server's resource.AddWorkshop list?
« Reply #10 on: January 12, 2015, 10:19:48 PM »
Yes, you are quite correct.

resource.AddWorkshop does indeed instruct the client to mount the addon.