Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do people keep track of the game's loading?

Asked by 9 years ago

I'm talking about games like Hex and Terror Town.

When you join the game, there's a loading screen that doesn't start the game until the game has loaded.

How do the creators KNOW when all assets have loaded, and how do they keep track of them?

1 answer

Log in to vote
2
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

I'm pretty sure all they're doing is checking that RequestQueueSize (amount or number of items that need to be loaded) property of ContentProvider is greater than zero. The introduction is displayed as long as the previously stated condition is true, and is changed as soon as RequestQueueSize == 0.

In order to add in to the queue, all you would have to do is call the Preload function with an argument for the assetId you wish to add.

local ContentProvider = game:GetService('ContentProvider')

ContentProvider:Preload(1243)

--would add the *Asset* associated with *assetId 1243* into the queue of items to load 

I haven't played those games before but the developers most-likely created custom load screens and have the animations run until the queue is empty.

local ContentProvider = game:GetService('ContentProvider')

ContentProvider:Preload(1243)

while wait(1) do
    if (ContentProvider.RequestQueueSize > 0) then
        print('introduction')
    else
        break
    end
end
Ad

Answer this question