Jump to content
dlegion

syncing object position on dedicated [SOLVED]

Recommended Posts

hello guys, i've an apparently simple problem that i cannot overcome...
on dedicated server,
i have a object (  Land_Bunker_01_tall_F  )  named      B1    that i need to move at some point, but being a building players can be inside, 
so...because i really have to move that specific object, and i dont want players to see it disappear in theyr screen,  i imagined some sort of "replace"....
so i placed a second object equal to B1, (lets call it B2), gived it the same rotation and position of B1  with 
this setDir (getDir B1); this setpos (getpos B1);
and before move B1 i scripted on server this command:

init.sqf:
B1move = {
   B2 setpos (getpos B1);
};

//////////////////////////////////////////////////////////////

moveB1 script (relevant part):
null = [] remoteExec ["B1move",0,true];
uiSleep 9;
B1 setpos _NEWposition;

i would expect that   B2   is placed exactly at same place as B1...for all clients too being it remoteexec !
but sadly it seems there is a sync problem, because sometimes B1 is moved before B2 is in place (and it have a delay of 9 seconds!!!), sometimes B2 is placed before move B1 but its not in same place, causing horrible glitches... i really dont know what else to do.
i just need to exactly match the B1 and B2 position (and orientation, inclination ecc...) and make B2 move in position before B1 is moved away!
thanks for any help guys !
 

Share this post


Link to post
Share on other sites

have you tried creating b2 somewhere well away from the players, hiding it with hideobjectglobal, then moving and rotating it to b1 then unhiding it

 

You will save yourself some heartache if you can live with B1 being north orientated, because thats the way b2 will face when it is spawned.

  • Thanks 1

Share this post


Link to post
Share on other sites

First of all, don't remoteExec anything for nuts. It's not a magic solution for MP script. The setPos command is arguments_global.gifeffects_global.gif.

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

heh....i perfectly agree with the logic of your words, pierre, the problem is the sync.
for the server the setpos is immediate, while clients take times up to 40 seconds ...and in the meantime clients are de-sync, people see the building, others dont , other see some AI floating in the air (while they are at the top floor of the building) ecc...
the problem is apparently simple, but its a problem and must be solved somehow, cant remain as it is now !

  • Like 1

Share this post


Link to post
Share on other sites

good idea man!

2 hours ago, Tankbuster said:

have you tried creating b2 somewhere well away from the players, hiding it with hideobjectglobal, then moving and rotating it to b1 then unhiding it

in fact its how actually works, except it dont hide.
but your idea....may work ! if hide command has not sync problems, can be a solution! really thanks i'm going to test this !

Share this post


Link to post
Share on other sites

@Tankbuster really thanks man! 
your idea worked perfectly , its synced!
thanks again guys, problem solved !

  • Like 1

Share this post


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

heh....i perfectly agree with the logic of your words, pierre, the problem is the sync.
for the server the setpos is immediate, while clients take times up to 40 seconds ...and in the meantime clients are de-sync, people see the building, others dont , other see some AI floating in the air (while they are at the top floor of the building) ecc...
the problem is apparently simple, but its a problem and must be solved somehow, cant remain as it is now !

 

wow! I never saw such desync except in crowed servers and too heavy scenarios. Is it at mission start (locally)?

I hope yes because with such desync in game, I guess you can't do any animation on units (that's the most important sync, imho). Not saying, you do have some problem driving vehicles (air airplanes).

So, if I can say that, don't confuse the "disease" and the "symptoms", applying a workaround more (hide object), not curing the problem (general desync).

Share this post


Link to post
Share on other sites

@pierremgi :
yep, you are right again....but this case seems quite strange...because server runs perfectly (average 47fps) and even with 10 players in it has no problems...people, Ai, vehicles, even planes are apparently sync.
we played with many players killing AI, driving vehicles (helicopters/planes too) and i saw very rare rubber-banding (and still limited to maybe 2 seconds in worst cases),
while in contrast it seems to be a problem just with that object (it has default attributes), that even if i'm alone on server has an apparently random delay of average 30 to 40 seconds. if there are more players the delay dont increase,
and apparently all clients are synced with other clients , because everyone says to have seen it moving more or less at the same time!
in my opinion (its just a guess based on osservations) its like arma3 sync very often some objects types (like vehicles) and not very often some other objects types (like buildings) , even if setpos is applied.

i did a test for my curiosity....on dedicated server, using a script, spawn a building (a random enterable house is ok) and rotate it, then try setpos it 30 meters from its creating position instead of rotation.
on my dedicated server i notice the same delay both in rotating and setpos, even in an empty virtual map. its get created for the client as soon as it is on server, but for some reason the rotation and setpos are not updated frequently!
mah ! its still a mystery for me....for now my problem is fixed with a "trick", but would be nice find a better solution.
thanks for your interest!

  • 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

×