ID:2648436
 
Resolved
A new proc called load_resource() has been added, to make it possible to preload an icon/sound asset and change how long to it stays loaded.
Applies to:DM Language
Status: Resolved (514.1543)

This issue has been resolved.
This request stemmed from a discussion in discord today inspired by Kuro about how resources are loaded on the client.

This syntax is still in flux, and is open to suggestions.


Reasoning:

Some resources are large and take Dream Seeker time to load, and as Dream Seeker only loads resources on demand, this can cause stuttering on the client. It would be nice if we could have control over when some of this happens by demanding that Dream Seeker load something, and so that we could clue it into how long it should hang on to specific resources.

//tell a list of clients to load specific resourcess for a specific duration
users << preload_resource(resource1[,resource2...,],duration=0)
users << preload_resource(resource_list,duration=0)

//tell a list of clients that they can unload resources
users << unload_resource(resource1[,resource2...])
users << unload_resource(resource_list)


By default, BYOND keeps resources loaded for 5 minutes so long as they are not currently in use. preloading them with a set time frame would change this behavior by allowing items to be left preloaded for longer than normal (passing a specific number of minutes), the normal duration (passing 0), or indefinitely (passing -1).

Telling the client to unload resources would not instantly unload them. Instead, it would trigger a check for whether the resources were currently in use, and clear any longer than normal loading times that had been applied. If not currently in use, the resources would then be unloaded.

It would also be nice to move resource loading to a background worker, so that it doesn't cause stuttering, and it would also be nice to be able to query the loading progress of the client for demanded resources so that users could build their own loading screens/animations, but that'd just be a nicety.
+1
Thanks for doing the heavy work and submitting the request.
To clarify, is this talking about the actual loading of icon/sounds/etc into dreamSeeker's memory from disk, and not the networking side of fetching it from dreamdaemon?
In response to MrStonedOne
MrStonedOne wrote:
To clarify, is this talking about the actual loading of icon/sounds/etc into dreamSeeker's memory from disk, and not the networking side of fetching it from dreamdaemon?

Yes. This is about preloading so for example a big icon doesn't hit performance badly when it loads, or a large sound/music file plays right on cue without a load delay.
Implemented for 514.
Would be even +1'er if
list << Function()
called that function on everything inside of list
In response to Kozuma3
Kozuma3 wrote:
Would be even +1'er if
list << Function()
called that function on everything inside of list

That's too weird a syntax for a list iterator; what you're describing is not output, which would make the << output operator inappropriate. I don't really see a value in a built-in foreach with a proc as an argument, though, because proc call overhead is a thing. Anyway it's pretty simple to do a for loop through a list that does the same thing.
What I'd like is

list << output()


That works just like

list << "Text"


Except you can control where the hell it outputs to. Not all projects want to use BYOND's terrible output control.

(But I'd much rather be able to control output in general so I can handle where things that default to a default output control go, but that's another request, that's been posted multiple times)
Lummox JR resolved issue with message:
A new proc called load_resource() has been added, to make it possible to preload an icon/sound asset and change how long to it stays loaded.