Client-side objects out of position
by Justin Tolchin · in RTS Starter Kit · 06/23/2005 (12:12 pm) · 2 replies
Hi all,
I'm using the RTS kit and I'm seeing something strange. After units move, their client-side objects sometimes end up in positions that are not quite where the server-side object says they should be. I'm printing out the position of both client and server objects and sometimes they'll vary by a meter or so. I can also see the problem by pressing F11. The "dot" that indicates where the server-side object is in the editor is sometimes outside the actual object being drawn. If I click on the dot then the object jumps to the correct position.
I know it's a rather vague question, but what could explain this behavior? I've made many modifications to the RTSUnit::ProcessTick code so it's almost definitely something I did but I'm not sure where to look. I don't think I ever touched the code that's in charge of sync'ing the positions. I'm referring the section of code that starts:
What code do I need to make sure I call in order to keep things in sync?
Thanks!
I'm using the RTS kit and I'm seeing something strange. After units move, their client-side objects sometimes end up in positions that are not quite where the server-side object says they should be. I'm printing out the position of both client and server objects and sometimes they'll vary by a meter or so. I can also see the problem by pressing F11. The "dot" that indicates where the server-side object is in the editor is sometimes outside the actual object being drawn. If I click on the dot then the object jumps to the correct position.
I know it's a rather vague question, but what could explain this behavior? I've made many modifications to the RTSUnit::ProcessTick code so it's almost definitely something I did but I'm not sure where to look. I don't think I ever touched the code that's in charge of sync'ing the positions. I'm referring the section of code that starts:
// Warp to catch up to server
if (delta.warpTicks > 0)
{
...
...What code do I need to make sure I call in order to keep things in sync?
Thanks!
#2
I have definitely altered the movement code a great deal. I'll take a look at it and see if I can figure out what dumb thing I did. But what does the warping code do? It seems to set the position and rendering position, so that's why I wondered if somehow it was related.
06/23/2005 (12:56 pm)
Unfortunately it's causing our units to overlap on occasion, which we don't want, but in one particular case it seems to be causing a unit to get so far out of sync when he tries to "enter" a building (really just going inside another .dts shape and disappearing) that the server side object makes it to the center of the building while on the client it looks like he's still standing outside the building (so it's a good 4 or 5 meters out of sync). :-( When the server object leaves the building the client object eventually "catches up" but it looks really bad.I have definitely altered the movement code a great deal. I'll take a look at it and see if I can figure out what dumb thing I did. But what does the warping code do? It seems to set the position and rendering position, so that's why I wondered if somehow it was related.
Associate Kyle Carter
I would suggest using WinMerge or Beyond Compare 2 and reverting code back to the original, bit by bit, till you get rid of the odd behavior... then adding it back in again till you find the source of the problem!