My game mode always crashes (Workshop overload) when I move a player directly from one team to another. But if I move the player to spectators first and then to a different team, then it’s all fine. How come?
Most excessive Workshop script load is caused by a large amount of actions running at the same time. You should check your code to make sure this isn’t the case. Disable all the rules and enable and test each rule one by one. If the server crashes when you move a player then the last rule you enabled is causing it.
I’m fairly certain this happens because the server reevaluates every condition in the player’s ongoing each player rules when their team is switched. The server also does this when players join the game for the first time, but it seems to have special handling that reduces the server cost. The special handling isn’t applied to regular team switching, but switching someone to spectator and back is functionally causing them to leave and quickly rejoin. The server handles it like it would any other player joining the game, so it doesn’t crash.
The only way to fix it is to have fewer conditions in ongoing each player rules. There’s not really an easy way to just have less conditions, but the if actions can be used in place of conditions sometimes if the logic still works. If you have any startup rules with lots of actions that trigger immediately when a player joins you can also add a short wait before those start, so the server doesn’t try to reevaluate the conditions and do all the actions at the same time. Normally I don’t really worry about it, though. Switching people to spectator is much easier than optimizing enough to keep regular team switching working in a large mode.
So the ongoing-player event actions are not really to blame here. It seems like something is “building up” and “clogging” the game when moving players directly, because the server load doesn’t “calm” down after several player team change moves. Detailed description here in my latest post: Issues when moving player to another team directly
I believe these are still separate issues. In the case mentioned here the server immediately closes on the first team switch due to server load from all the conditions reevaluating. Your case seems more like the server is continuing to evaluate something from before the team switch that it shouldn’t be. Both are still issues, but a server resource leak caused by team switching shouldn’t be affecting anything until after the first team switch. The case described here never actually succeeds in switching a player’s team, so I don’t believe it’s the same issue.
Separate issues, but still somewhat tied together. If anything, it’s clear now that a simple team switch action “pollutes” the game instance no matter the game mode complexity. It’s just that if the game mode is more complex the “pollution” is more severe on each switch, and if it’s big enough, all it takes is just 1 team switch to crash the server. And because we don’t exactly what’s going on there it’s hard to say what is the main problem.
Another thing that I have noticed is that, for example, if you have 2 players on Team 1 and one on Team 2 and you have a rule that tells to not show a Team 1 event player’s outlines to a player on Team 2, it stops working if you move the other player from Team 1 to the Team 2. The moved player can see the outlines of the player on Team 1. When player just joins the game naturally or through spectator switch, everything is fine. Seems like the player is somehow both on Team 1 and 2 (in some sense) when you switch directly.
Outlines don’t reevaluate their Conditions.
You’d need to 'overwrite the old Start Forcing Player Outlines to get the new Condition to work.
But again… Everything works fine when player joins the game naturally or gets moved through spectator first. Nothing needs to be overwritten then.
Probably because the ‘Event Player’ Value still has the same ID when normally switching a players Team since the game needs to do so for Attack / Defense side switches in Round based game modes like Competitive.
The Players Statistics transfer Player owned Entities would be deleted by then, since the Workshop is just another add on it has to work around what the game was built to do for other Stuff.
If you remove a player from the Game it is like you’re a entirely New Player even though you just reconnected to the game.
But the “Rejoin” feature is only available in Competitive so only there you would get your old Variable set which you don’t otherwise.
The Workshop acts wonky when moving a players Team since it could be because it’s a Round based game mode that’s being played and it doesn’t know what to keep and what to throw away during Team transitions.
I see, I think you’re right. It’s just a shame that it makes “Move player to Team” action kinda unusable… It could be solved if devs added another action “Move player to spectators” or somehow “move to spectators” in the background while moving player to a Team.