Excessive workshop scriptload

Hi, any workaround for this?
What does it exactly mean?

My “Server Load” isnt high, so it must be crashing for other reasons?
Server load between 40-90 when crash happends.

1 Like

I’m in a similar situation.
My “Server Load” sits around a gentle 29-31 and still randomly crashes saying “Server shut down due to excessive Workshop script load”
Like what? That’s no where near 100. I’m very confused and unsure what to do because the numbers tell me it’s not an optimization issue whilst the error does. What is going on?

What kind of actions do you have running in your script ? I’ve had my game hit 150%+ average and it still never crashed.

1 Like

This is interesting. I’ve done a lot of modifying and testing with one of my game modes to make sure server load peak doesn’t exceed 100 for any complex action. On top of that, average server load never was higher than 80. Yet the game still keeps crashing, seemingly out of nowhere even with just one human player in team 2.

Another thing that I found interesting is that the longer the game has been running, the higher server load peaks will go, for the exact same actions.

In general, I found it surprising that even when playing a game against 6 bots that had just 1 rule in the script to keep track of moments when the server load peak was over a certain value, the server load was still pretty high.

In my case i might have discovered something that have fixed the problem. Just until i add more than 5 players, by anyways.

1-having arrays big size. (Example: create effect stored to A1, position of effect A10, hud text to tell effect is created A100.)
Basically 1, 10 and 100 is used, but the array consists of 100 entries even though i use only 3.
100 entries with zeroes.
What i found on google is that this causes high memory usage, which i belive is not shown in the performance, which is cpu only?.

Now having this with many arrays caused me trouble.

I shortened all arrays and used linear 1,2,3,4 etc. No huge leaps.

2-if you need to move an effect or entity, dont delete it, and create a new one in a new value in array!.
Move it instead to a new vector.
Set global variable at index 5, vector.

Instead of, destroy effect 10, create effect 11.

This also saves memory.

These two things was the main cause of problems for me, i managed to fix all this and got it running fine.
I however need to clean my stuff better as i still get crashes if i go above 6+ players.
Anyways, i had crashes at 2+ players before i did this.

Hope it helps.

Still need help myself though lom

1 Like

Thanks, that’s interesting. I had actually done some tests where I created arrays that had values stored in super high indices (for example index 1000) but were otherwise empty and that didn’t seem to make a difference in server load for me. Maybe I missed something. Need to test that again.

What did make quite a difference in my testing though is how many values I stored in an array. I made another series of tests where I filled up all player variables (a-z) of 12 players with vector data (111.111/222.222/333.333) up to index 15/31/49 (it crashed before I could do higher numbers :)). This had a noticable impact on server load values for me.

In any case, I always try to use the lowest free indices as well, as you suggested :slight_smile:

Most likely because the zeros that are used to fill up the empty slots in an array when it only gets set at a high index are just ints or maybe reals, but the vectors are objects, wich are way bigger.

Hm, thanks for the info. I guess it was a really bad idea of me then to save 3 int or float values in a vector to use up fewer index positions ><

Edit: I did another test where I set player variables a-j for all 12 players at index 10000 to value 1. This had a huge impact on the server load values. Not sure how I missed that the first time, my apologies.

im starting to understand why my game crash when i go above 3 players. each player creates and destroy about 2 effects every second and in some cases creates, destroys and plays about 20 (each) effects in under half of a second storing and removing all effects IDs and positions in arrays. oopsie :upside_down_face:

bad ideas that wont work:

  1. adding a text/icon/effect on the exact position of the player name
  2. making everybody invisible ( :

edit: why did i comment this? i think i was replying to a different topic

I also belive my game crashes cause im using like 40 “Distance Between event player”

I tried to figure out if i could fix this by using a Global instead, and use “Players within radius TEAM1”

I want to know whats worse to use, a distance between or players within radius.

And, for effects that are created ONCE, visible to all players, does it matter if its global or each player since it doesnt have a condition.

Starting to wounder if i just should change some global rules to each player, and vice versa, for certain rules.

I have a shop, that creates 25 effects, Global, but inside the effects i set it to Visible Only TEAM2.

Having this just set to “Each player Team2” instead of global, would it really impact any differently, since half of these effects are triggered by a variable later on to have them spawn.

That’s weird. My PVE mode makes the server load surpass 100%, the highest I’ve gone is 103% and it never crashed. I even average over 60% most of the time (depends on the number of players).

I have a PVE mode that literally averages at 180% and peaks at 230% regularly without ever crashing. I seriously don’t understand how the server doesn’t die from it.

How do I see the Server Load?

It’s not a “setting”, but rather a value that text ids can display.

The simplest solution is to create some HUD UI where the header is equal to the “Server Load” value.

Posting my experience here on what has caused server crashes/problems for me:

  1. By far the biggest problem for me was using too many arrays in global and player variables. Once the variables take up a certain amount of resources, crashes WILL happen, no matter what the displayed server load values are. This is something to keep in mind when making workshop modes that require a lot of variables like RPG modes, anything with an inventory system, lots of entities whose positions need to be saved, etc. When player variables use up a lot of resources, the number of players in the game seems not to matter (so there might be a player variables resource limit per player).
  2. Using a lot of wait actions greatly increases server load. I always use wait actions with caution now and only add when them when there’s no way around it. Loops with wait times (especially short wait times), in my opinion, should be avoided whenever possible and their number kept very low.
  3. Short server load peaks that go above 100 are something the server can handle, if they don’t happen too often and aren’t too extreme. Average server load values that continuously stay above 80-90 are something the server cannot handle.
  4. Chase global/player variable actions should be avoided whenever possible. Even chasing one variable per player can be too much for the server to handle, in a longer script.
  5. Start camera consumes a lot of resources.
  6. Apply impulse when used very often leads to very high server load values.
  7. Ray Cast events when run continuously (for example as part of the definition for a position in a start camera action), consume a lot of resources.
  • The following points are not directly related to crashes, but may be useful to anyone who’s just started making workshop scripts.
  1. Skip actions will always skip at least one action.
  2. A lot of Skip if actions are the most likely cause when you get the “Error: Action list is too complex” error message. Abort if is a lot less complex than Skip if so I recommend using it instead of Skip if whenever possible. Alternatively, you can use a regular Skip action in some cases, with a number of actions skipped equal to: ( variable x multiplied with a certain number ) + 1.
    For example:
  • Skip ( global variable A * 2 ) + 1
  • Abort [this action is always skipped]
  • Action run if global variable A is 0
  • Abort / Skip (3)
  • Action run if global variable A is 1
  • Abort / Skip (1)
  • Action run if global variable A is 2
  • Abort / here the action list would continue if option 2 was chosen [Skip actions instead of abort]
  1. The script size limit will not be a problem anymore for most projects, but it can still be reached if you are not aware of that limitation. Here are some examples of how many times you could use different types of actions in a script before the script size limit would be exceeded (this was tested by using each of these actions 200 times per rule and then removing actions until the script size was not exceeded anymore):
  • Type of action: How many times it can be used:
    Abort 18600+
    Skip (1) 6655
    Small Message to event player (player variable A) 3996
    Set player variable at INDEX to player variable 2855
    Small Message to event player (“Hello”) 1817
    Set player variable to value in array (player variable) 1817
    Set global variable at INDEX to value in array (global variable) 1817
    Set player variable at INDEX to value in array (player variable) 1537
    Skip If: Skip 1 if value in array (player variable) > 0 949 (14 per rule)
    Skip (1 + 2 * compare if player variable A >0) 799
    Set player variable to value in array (player variable) + value in array (player variable) 799
    Set player variable to round value in array (player variable) * 0.1 down to integer + modulo 10 of value in array (player variable) 540
    A very complex string that I’m actually using in one of my game modes 30
  1. The three most common mistakes I made at the beginning that sometimes took me far longer to find than they should have:
    • I accidentally used global variable instead of player variable (or vice versa; in a long list of actions this can be surprisingly easy to overlook).
    • I used event player instead of current array element in a filtered array (really shouldn’t happen, but I still made that mistake a few times in ongoing each player rules :slight_smile: ).
    • I removed or added actions and did not update the number of actions that needed to be skipped in preceding skip actions (I always check now if there’s a preceding skip action when I make any modification to a complex rule; it can take some time to count if all skip actions skip the right amount of actions, but better than inexplicable bugs :slight_smile: ).
4 Likes

here is random fact: i dont think the server load and these stuff can go above 255, in my game mode it always stops there (and doesnt immediatly crush or do something special)

I think the main point here is that server load and excessive script are two different errors.

Thank you. I think reading this helped! I replaced chase variable elements with work-arounds and it doesn’t crash anymore.

An tip: Add an hud text with this: Custom String("{0}%", (Server Load / 255) * 100) will give how many power the server is processing the rules. If this value gives you 100% almost of time or greater than this, you should use workshop inspector to fix these rules.

Also another things can cause server crash such as:

  • Repeating rules/whiles/for loops with minimum wait time (0.016 = 16ms) with many actions in that context .
  • How many spawned dummy bots (depending on context).
  • Expression/Statement complexity in a single rule (eg. Hud text with a huge calculations inside Text params that will make reevaluate for each player define and rescheduled to run at server fixed tick, to fix this, split the expressions, store in variables then use they in hud/inworld/progressbar texts)