MTA Eir/Functions/engineStreamingSetProperty and RU/engineStreamingSetProperty: Difference between pages

From Multi Theft Auto: Wiki
(Difference between pages)
Jump to navigation Jump to search
No edit summary
 
(Renamed template)
Tag: Redirect target changed
 
Line 1: Line 1:
{{*Client_function}}
#REDIRECT [[MTA:Eir/functions/engineStreamingSetProperty]]
__NOTOC__
This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Changes in these properties affect the gameplay quality of the entire server.
 
==Syntax==
<syntaxhighlight lang="lua">
bool engineStreamingSetProperty ( string propertyName, var propValue )
</syntaxhighlight>
 
===Arguments===
*'''propertyName:''' the name of the streaming property you want to change
*'''propValue:''' value to pass to the property
 
===Valid Properties===
{{:MTA:Eir/functions/engineStreamingSetProperty/validProps_ru}}
 
===Useful Media===
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/streaming_opt.zip - streaming debugging resource
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/streaming_test.zip - streaming mode example resource
* http://youtu.be/sk8WsHwPgsU - showcase video
 
===Returns===
Returns ''true'' if valid arguments have been passed, ''false'' otherwise.
 
==Examples==
<section name="Client" class="client" show="true">
This snippet ultimatively fixes the world flickering.
<syntaxhighlight lang="lua">
engineStreamingSetProperty( "strictNodeDistrib", false );
engineStreamingSetProperty( "infiniteStreaming", true );
</syntaxhighlight>
</section>
 
<section name="Client" class="client" show="true">
This snippet sets the Streaming GC system to sparse mode. In this mode only the preallocated amount of Streaming GC nodes is allowed. Keeping a low amount of Streaming nodes is interesting for performance optimizations.
<syntaxhighlight lang="lua">
engineStreamingSetProperty( "gcOnDemand", true );
engineStreamingSetProperty( "infiniteStreaming", false );
engineStreamingSetProperty( "strictNodeDistrib", true );
</syntaxhighlight>
</section>
 
<section name="Client" class="client" show="true">
This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.
<syntaxhighlight lang="lua">
engineStreamingSetProperty( "isFibered", 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;
 
                engineStreamingSetProperty( "isFibered", true );
            end
        elseif ( lastBusyTime ) then
            if ( now - lastBusyTime > fiberedDuration ) then
                engineStreamingSetProperty( "isFibered", false );
            end
        end
    end
);
</syntaxhighlight>
</section>
 
<section name="Client" class="client" show="true">
This snippet makes the world load very slow. Lag spikes cannot occur due to Streaming loading anymore.
<syntaxhighlight lang="lua">
engineStreamingSetProperty( "isFibered", true );
engineStreamingSetProperty( "fiberedPerfMult", 0 );
</syntaxhighlight>
</section>

Latest revision as of 08:25, 28 September 2023