Jump to content
Sign in to follow this  
cameroon

addAction join on a dedicated server causes desync?

Recommended Posts

I've been going crazy trying to figure out why my testing of a co-op mission on a dedicated server would silently desync. In this mission, a player needs to have a couple AI units join the player's group.

This works fine in single player, but as soon as I put it on a dedicated server I'd end up returning to base only to see that everything had come to a stand-still.

As far as I understand it, the "join" and "joinSilent" commands are global actions with global effects, so I wasn't expecting this to be a problem.

This portion of code (_crew is the vehicle crew group) runs on every client at init, the addAction shows up just fine

{
      _x addAction [ "Secure Crew", { _target = _this select 0; _caller = _this select 1; missionData setVariable ["CrewSecured",true,true]; (units (group _target)) joinSilent (group _caller); }, nil, 0, true, true, "", "!(missionData getVariable [""CrewSecured"",false])" ];
} forEach (units _crew);

However, when the action executes the two AI units in question join my group and then a few seconds later the server AI units (or at least those on the WEST side) come to a stop. I can tell exactly when it happens, because the traffic from #monitor will go from ~100Kbps out to ~10-7Kbps.

If I take out the (units (group _target)) joinSilent (group _caller);, then there's no problems but of course joining is kind of needed. I also tried setting the group of the caller in a missionData (a Game Logic) variable and then executing the join command from the machine where the group leader was local, but that didn't help any (I didn't think it would, but I'd hoped!).

I've been searching the forums and Google for hours, so I apologize if this is something that actually is covered somewhere. I'm really hoping someone has some insight to this.

Share this post


Link to post
Share on other sites

I was able to figure out what was happening.

When I created the crew to be secured, I stored a reference to the unit objects themselves. A pair of triggers was checking whether they were dead or had been returned to base. Turns out, that if the units change locality, then what I was doing is bad and seems to break whichever side the units were on (other sides seem to keep going, but I haven't tested that exhaustively).

What I ended up doing instead was to use setVariable on the unit objects for the crew and then use something like { alive _x && _x getVariable["myvar",false] } count allUnits in order to count the number of crew that are alive.

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
Sign in to follow this  

×