Jump to content
Nicoman35

Sleep failsafe at high loads

Recommended Posts

Hi there people.

I made a mod for a vehicle parachute. Players are able to attach paracutes to vehicles, then slingload and drop them.

I made a loop with a 'sleep' command to simulate braking of the load from free fall speed to parachute glide speed.

Works well in test surroundings. But as soon as server load gets higher, vehicles begin to get destoryed on account of high speed impacts in ground.

I suspect the sleep command is the culprit. Any idea of a failsafe solution when server is at high load?

Share this post


Link to post
Share on other sites

Show ur script and its usage is my advise.

  • Like 1

Share this post


Link to post
Share on other sites

My script is here.

I think line 72 is where problems could come from.

 

Show usage? Do you mean upload a video?

Share this post


Link to post
Share on other sites

I didn't read into it to find out if sleep is the culprit but sleep 0.01 basically suspends execution until the next frame (in ideal conditions). A step up from that would be to use an event like EachFrame or any other event applicable to your situation. Event handler code is guaranteed to run without delay (unscheduled context).

Share this post


Link to post
Share on other sites
15 hours ago, Nicoman35 said:

Hi there people.

I made a mod for a vehicle parachute. Players are able to attach paracutes to vehicles, then slingload and drop them.

I made a loop with a 'sleep' command to simulate braking of the load from free fall speed to parachute glide speed.

Works well in test surroundings. But as soon as server load gets higher, vehicles begin to get destoryed on account of high speed impacts in ground.

I suspect the sleep command is the culprit. Any idea of a failsafe solution when server is at high load?

Test surroundings means 3den preview?

Your problem could be linked to the vehicle and/or parachute locality, if player(s) can spawn something. You probably apply some command with the wrong locality for argument. For example, see allowDamage warning. That could be also the case for any other AL command. The point is: Who is the owner of the vehicle, the chute, til when?

 

Other track: If you think your scenario/mod is so complex the "sleep fails" (the scheduler in fact), you could try:

if (isMultiplayer) then {uiSleep xx} else {sleep xx};

Not a miracle, just a way to be uiTime consistent locally.

If too many lags, re-think your mod and scenario.

  • Like 1

Share this post


Link to post
Share on other sites

All your remoteExec's are wrong. They should be your function's STRING name, not the actual var, which is interpreted as CODE.

So nothing happens if the vehicle is not local, as it exits with, and you should be seeing errors from remoteExec.

 

Should read...

if !(local _vehicle) exitWith {_this remoteExec ["NIC_GRP_fnc_VehParaDeployControl", _vehicle]};

I noticed they're all like this throughout your project, well those functions I looked at under GRParadrop/functions

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×