Jump to content
LSValmont

Find out what is causing interface/GUI lag in mission.

Recommended Posts

Guys, I need some help here.

 

I am doing a pretty complex mission that has several custom GUI elements. 

 

Lastly I've been experiencing that after several minutes of game play the GUI interfaces begin to take longer and longer to load.

 

AddActions, holdActions, cutText, Inventory EH, Custom Menus etc... all begins to lag and fall behind.

 

Server and client FPSs are fine it is just the GUI elements that lag (Like a memory leak of some sort).

 

Any idea how could I find out what script could be causing the issue or track down the cause somehow other than removing scripts one by one and then testing the mission for hours each time...

Share this post


Link to post
Share on other sites
3 minutes ago, LSValmont said:

begin to take longer and longer to load.

 

It might be that you keep accidentally spawning more than one time the same code.

If yes , you can add a check with a Variable.

Else check also :

https://community.bistudio.com/wiki/Initialization_Order

  • Thanks 1

Share this post


Link to post
Share on other sites

enable debug console (if not) and:

count diag_activeSqfScripts   in watch line

then, run:

copytoclipboard str diag_activeSqfScripts

 

If you wrote the codes, you can see how much time they are repeated and if it's OK (not saying it's wrong, but many spawned codes on many units are resource consuming and must terminate).

Chase for:

- while {true} loops. Is it necessary, If yes, can you group some codes?

- endless waitUntil conditions . Example: waitUntil {!alive someDisableDamageUnit};

- repetitive codes for nuts! Classic: While {true} do { {<add some EHs> } forEach allUnits };

   Should be:  While {true} do { {<add some EHs>; _x setVariable ["checkVarHere",true] } forEach (allUnits select {isNil {_x getVariable "checkVarHere"} });

etc...

 

In scenario:

Do not spawn too much units for nuts. Use BI dynamic simulation and corpse/wreck management. You can script your own spawn/despawn especially for ambient/civilian life without tactical context.

 

And the best for the end.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you both George and Pier

 

Quick question, what would be the best way to prevent duplicate scripts from running on the same unit?

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, LSValmont said:

Thank you both George and Pier

 

Quick question, what would be the best way to prevent duplicate scripts from running on the same unit?

As I wrote above. Add a variable on the unit (here checKVarHere in my example) and run the code only when the variable is nil:

like this:   isNil {_x (or your unit) getVariable "checkVarHere"}  // pay attention for the syntax: isNil { someThing getVariable stringedVariable }

So, define it by any value inside your code:

_x (or your unit) setVariable ["checkVarHere", someValue];

  • Thanks 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

×