How to create a proper loading screen when streaming is enabled

im trying to create a proper loading screen for a game that has streaming enabled

reason is my game lets you play before all the terrain even loaded in making you see gaps,
its also lagging all the time because when moving around you are loading in more objects

ive tried using content provider, didnt work
ive tried using player:RequestStreamAroundAsync(), didnt work (it went way too fast and didnt load anything)
ive tried some other random methods, didnt work

my streaming settings

1 Like

Loading Screens and a lot of YouTube videos go over this well. I’m pretty sure whether it’s streaming or not isn’t really a concern.

2 Likes

on the docs for game:IsLoaded()
" Unless they are parented to ReplicatedFirst, LocalScripts do not run until the game has loaded."

but my script which is running in starter player scripts is running before the game has loaded, so just checking game:IsLoaded() doesnt work it returns true before the game is actually loaded

I kind of gave up on that being totally right, even if there is a way. I use it more as a pause.
I set up a loaded bool in the local script within replicatedfirst. I also run a black screen GUI in the background under the loading screen GUI effect. The end of the loading screen and the fade out of the black screen are triggered by the loaded bool. That is set from a main game setup script when ready.

I guess you don’t need the black screen, it’s more of a double fade out effect from the loading screen. Basically, I’m using that bool to set the exit timing of the loading screen. Like what you’re doing, I need that to last longer than just loading the game. If the game is already loaded, that player’s bool will be true faster than when the game first loaded up.

It works well … later I tried this in other games.

if not game:IsLoaded() then
	game.Loaded:Wait()
end task.wait(1) --as/if needed

local plr = game:GetService("Players").LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()

Try setting the ReplicationFocus.

Perhaps using ContentProvider.RequestQueueSize would be a potential solution?

i need a system that waits until the loading is finished, changing the replication focus just moves where streaming loads parts in, doesnt wait

i tried using content provider but since streaming is on it doesnt work that well because if you try loading a folder of parts at the start of the game, there is a 99% chance that theres no parts in that folder on the client when the script runs

ill look into this more tomorrow, but everytime i used game:IsLoaded() in a loading screen it never really did anything, including in games without streaming on

Ya, I had problems with it also. Using the one explained for a terrain generator.

The closest you can get to this is Player:RequestStreamAroundAsync()
but, you’ve tried this and said that it did not work for you.

From the document post linked: “The effect of this call will be temporary and there are no guarantees of what will be streamed in around the specified location…”

There is no definitive way to wait until the scene loads.

i have models level of detail set to streaming mesh so you can see them from a distance, when the player joins they spawn in a box above the map (since there will be a main menu) and this loads the game pretty quick and you see all the low poly models

but then when i start moving to one of the spawns those models start loading in and lag happens, i cant just use RequestStreamAroundAsync() because the player will drive around the map and start loading in the city which is big and causes the game to slow down a lot

this didnt work because its finished when the game is loaded, since streaming is on it says the game is loaded when no more models/parts are being streamed to the client. but as soon as a new section begins to load everything slows down

Although not ideal, perhaps you may need to create your own asset streaming system? For example, distance rendering and loading / unloading scenes based off of location.

update: i did a slightly hacky method
i reduced my streaming settings to
min radius: 64
target radius: 400
out behavior: low memory

doing that reduces the amount of lag spikes when loading areas (there is still very small ones when loading new areas, but those areas stay loaded now)

then for the loading screen, i set the camera to a certain spot then placed a bunch of parts aroudn that camera to use RequestStreamAroundAsync() to preload them so the player can actually see them. the camera location is where i also put the replication focus

doing just that didnt solve it (it said loading was finished when models were still in their low poly form) so my hacky method was to wait 0.3 seconds between each RequestStreamAroundAsync() which solved it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.