MTA:Eir/functions/engineStreamingSetFiberedLoadingEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ This function switches between original and fibered loading of the GTA:SA Streaming system. In original mode, most resources are loaded i...")
 
(Renamed template)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{MTA:Eir/Client_function}}
__NOTOC__  
__NOTOC__  
This function switches between original and fibered loading of the [[GTA:SA_Resource_Streaming|GTA:SA Streaming system]]. In original mode, most resources are loaded in one go, but big ones (exceeding slicer buffer size) are loaded exclusively and in two pulses. In fibered mode, the Streaming system can only take a user-defined percentage of the game frame time, meaning that resources can take an arbitrary amount of pulses depending on the complexity of said resources.
This function switches between original and fibered loading of the [[GTA:SA_Resource_Streaming|GTA:SA Streaming system]]. In original mode, most resources are loaded in one go, but big ones (exceeding slicer buffer size) are loaded exclusively and in two pulses. In fibered mode, the Streaming system can only take a user-defined percentage of the game frame time, meaning that resources can take an arbitrary amount of pulses depending on the complexity of said resources.

Latest revision as of 08:21, 28 September 2023

This function switches between original and fibered loading of the GTA:SA Streaming system. In original mode, most resources are loaded in one go, but big ones (exceeding slicer buffer size) are loaded exclusively and in two pulses. In fibered mode, the Streaming system can only take a user-defined percentage of the game frame time, meaning that resources can take an arbitrary amount of pulses depending on the complexity of said resources.

By default, fibered loading is enabled.

Syntax

bool engineStreamingSetFiberedLoadingEnabled ( bool enabled )

Returns

Returns true if enabled is passed as valid boolean, false otherwise.

Example

Click to collapse [-]
Client

This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.

engineStreamingSetFiberedLoadingEnabled( false );

local lastBusyTime = false;
local fiberedDuration = 5000;

addEventHandler( "onClientRender", root,
    function()
        local isBusy = engineGetStreamingInfo().isBusy;

        if ( isBusy ) then
            local now = getTickCount();

            if not ( lastBusyTime ) then
                lastBusyTime = now;

                engineSetFiberedLoadingEnabled( true );
            end
        elseif ( lastBusyTime ) then
            if ( now - lastBusyTime > fiberedDuration ) then
                engineSetFiberedLoadingEnabled( false );
            end
        end
    end
);