Currently, the :Preload(id) method of the ContentProvider service only works on images - it would be nice if it worked on sound assets also. Currently, if you play a sound that is longer than x seconds in length, the game briefly freezes before the sound plays. If the sound is played again later on, there is no freezing.
For whatever reason playing a sound at the start of a game no longer preloads it either, maybe it’s to save memory.
Interesting; I’m still hoping we can get a fix for the lag before playing though.
:Preload() works on every kind of asset for me.
I’m using preload on all the sound assets, and notice how it freezes up the first time you play a song.
Below is a video of the problem - notice how it freezes up the first time I play it, but the second time I play it, it runs smoothly.
[video width=425 height=344 type=youtube]D1xyviFnJ1k
It does not work on sounds.
You probably have lightning fast internet.
It does not work on sounds.
You probably have lightning fast internet.[/quote]
Not really; only 16Mb download and 19Mb upload.
Do you get any lag with 2 minute long sounds?
It does not work on sounds.
You probably have lightning fast internet.[/quote]
Not really; only 16Mb download and 19Mb upload.[/quote]
Did you downgrade? I remember you boasting about your 100+ download speed.
Edit: that’s still pretty bloody fast. You can download 5 MB in a third of a second according to that.
[quote] make an identical sound with a volume of 0 and play it.
boom, sound preloaded. [/quote]
I use a lot of sounds in some demos I make and a game I am making so this would honestly be a wonderful addition.
Since the time of this post it has been changed back.
The problem I get with preloading is the lag spike
I’d like it to ease in/ get downloaded in small packets at once over an X time course
This. That lag spike is so irritating, it’s a shame we can’t have temporary assets that download to the client at the start of each game and are later removed and replaced when joining a new game rather than being stored in the Memory (I believe this happens.)
Documentation - Roblox Creator Hub is your friend
ids = {353,53,53,53,25,23,523,523,523,534343} -- blah blah
ContentProvider = game:GetService("ContentProvider");
for _,v in pairs(ids) do
ContentProvider.Preload(ContentProvider,"http://roblox.com/asset?id="..v);
end
while ContentProvider.RequestQueueSize > 0 do
wait();
print'Stuffs still preloading';
end
print'Finished Preloading hurray';
In my gcc entry I combine this + playing the sounds at the very beginning(as an instanced copy with volume 0) after preloading them, and it has worked out pretty well.
[quote] Documentation - Roblox Creator Hub is your friend
ids = {353,53,53,53,25,23,523,523,523,534343} -- blah blah
ContentProvider = game:GetService("ContentProvider");
for _,v in pairs(ids) do
ContentProvider.Preload(ContentProvider,"http://roblox.com/asset?id="..v);
end
while ContentProvider.RequestQueueSize > 0 do
wait();
print'Stuffs still preloading';
end
print'Finished Preloading hurray';
In my gcc entry I combine this + playing the sounds at the very beginning(as an instanced copy with volume 0) after preloading them, and it has worked out pretty well. [/quote]
With thanks to info gotten from Ripull (hurr durr).
But rather than adding the Ids manually, you’d should use recursion to loop through local objects and get all the asset Ids.
[quote] Documentation - Roblox Creator Hub is your friend
ids = {353,53,53,53,25,23,523,523,523,534343} -- blah blah
ContentProvider = game:GetService("ContentProvider");
for _,v in pairs(ids) do
ContentProvider.Preload(ContentProvider,"http://roblox.com/asset?id="..v);
end
while ContentProvider.RequestQueueSize > 0 do
wait();
print'Stuffs still preloading';
end
print'Finished Preloading hurray';
In my gcc entry I combine this + playing the sounds at the very beginning(as an instanced copy with volume 0) after preloading them, and it has worked out pretty well. [/quote]
With thanks to info gotten from Ripull (hurr durr).
But rather than adding the Ids manually, you’d should use recursion to loop through local objects and get all the asset Ids.[/quote]
That entirely depends. I prefer manually writing the ids, mainly because instead of instancing 50 sounds into the game for 50 different voice dialog lines(example), i’d much rather just add the ids into an array, preload them, then set a single sound object’s sound id to the id I want when the time comes.
Preloading is just DANDY, but the lag spike… That lag spike really feels like the game crashing when loading 10+ songs that are over 2 minutes.