ID:93716
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
1.)

RscPackage() proc


Format:
client << RscPackage(url)

This will download the resource package located at the specified url.
The url can only be a web address, listing to any media file supported by BYOND,
(.png, .jpg, .bmp, .ogg, .mid, .wav, .zip)
Where the zip contains the files which will be extracted into the recipients cache for the specified game.
BYOND/cache/Author/GameName/File.ext
When prompted to download the file again, it will check to see if the new file is different from the old.
If not, then it will skip downloading.

Why would this be a good idea?
Authors who want to provide a higher-sound quality for players can do so by using .ogg files.
However, with the increased quality comes increased file size. Which will scare away the dial-up or low bandwidth users.
I have tested this: http://www.byond.com/developer/forum/?id=744098
But did not get it to work, so I am asking for something similar to this be implemented.

2.) On top of this new suggestion. I would like to see
Code.dm:1:error: 'file.ext': cannot find file
be set to run-time, just in case it is included in a resource package which will not be compiled with the actual game.
mob
var/quality=null
Login()
if(!quality)
switch(input("Would you like High Quality or Low Quality sounds?\nLow Quality is recommended for dial-up users.\nHQ: 49.6 MB\nLQ: 412 KB") in list("High Quality","Low Quality"))
if("High Quality")
src<<"This will take some time to download."
client<<RscPackage("http://www.example.com/HQ.zip")
//Contains files: musicname.ogg, superawesome.png
quality="High"
if("Low Quality")
src<<"This will take some time to download."
client<<RscPackage("http://www.example.com/LQ.zip")
//contains files: musicname.mid, superawesome.jpg
quality="Low"
if(quality=="High")
src<<sound('musicname.ogg')
if(quality=="Low")
src<<sound('musicname.mid')
</<>
The second part of your request is impossible. We do however need to have something similar to file() that allows the ability to load a cache file either by name or by its checksum, which is in another request.
What about the first part? I want it to always preload resources so there wont be any delay in game, however I'd like the choice to have .ogg and .mid resources in different files so dial-up users won't have to worry about waiting 2 hours before getting in.
By all appearances preload_rsc can be changed at runtime, but I do think there's good sense to having a proc handle this stuff and perhaps queuing up a bunch of items.

However one issue that needs resolving relates to the second part of your request. Because preload_rsc was never meant for delivering merely a partial set of resources (leaving the rest undelivered), but for offloading resource-delivery duties to a webserver, we'll need some good way of loading files for you at runtime from the cache so that you don't have to use hard single-quote references.
Maybe an additional parameter to file?
file(Path,Source)
file("awesome.mid","cache")//from the folder cache/Author/Game/

Of course there would be security issues from this if it's accessing client information like...
file("../../../key.txt","cache")//leur//cache//BYOND/key.txt
which would have to be fixed.