Jump to content

Client/Server muzzleVector/Point mismatch.


LoLJester

Recommended Posts

What you're seeing is a blue line, drawn from the muzzlePoint (getRenderMuzzlePoint ) along a Vector (getRenderMuzzleVector) called on the Client, and a red line - same as the blue line - but called on the Server:

 

//---------------------------------------------------------------
void LaserBeam::ProcessTick(const Move *move)
{
 ...
   _drawDebug();
 ...
}

//--------------------------------------------
void LaserBeam::renderObject(...)   
{
   _drawDebug();
}

//-----------------------------------------------------------------------------------
void LaserBeam::_drawDebug()
{
...
VectorF _muzzleVec;
Point3F _muzzlePoint, _endPosition ;
mSourceObject->getRenderMuzzleVector(mSourceObjectSlot, &_muzzleVec);
mSourceObject->getRenderMuzzlePoint(mSourceObjectSlot, &_muzzlePoint);

_endPosition = _muzzleVec* 50;   
_endPosition += _muzzlePoint;

ColorF clientCol (0, 0, 1); //On Client: Draw line in Blue.
    if(isServerObject())
clientCol.set(1, 0, 0); //On Server: Draw line in Red.

DebugDrawer::get()->drawLine(_muzzlePoint, _endPosition, clientCol);
		DebugDrawer::get()->setLastTTL(TickMs);
....
}

Edited by LoLJester
Link to comment
Share on other sites

Well there are different kinds of muzzle points and vectors, for example there are

correctMuzzleVector = true;
correctMuzzleVectorTP = true;

 

In the weapon datablock, so you have a first person and a third person muzzle vector, additionally they can be corrected, depending if you want to use the true muzzle vector of the weapon or not and your debug function may use a different kind of vector.

Link to comment
Share on other sites

Thanks Duion, but the correctMuzzleVector(s) for first and third person work fine. The problem originates somewhere deeper than that.There seems to be a muzzleNode position packUpdate/unpackUpdate discrepancy somewhere in the Player class or one of the parent classes. I first thought that the nodes don't get animated on the server, but they do. The image I posted shows exactly what I mean. On the Server (the Red line), the muzzleNode position is lower from the Client (the blue line) by somewhere around 0.1f for some reason. Any other ideas why?

Link to comment
Share on other sites

They are the same vector. Imagine the lines are like raycasts, but only the red line (Server) can detect and call the onCollision function in script: see how the red line is bent downwards and does not collide where the blue line does?

Has anybody else had this problem and may have a fix?

Link to comment
Share on other sites

What happens when you fire from 3rd person?


My hypothesis is that the server doesn't actually use the 1st person model, and so bases its muzzle vector on the weapon's position in your 3rd person model animation.


If that's true then the vectors should line up when you fire in 3rd person. If they still don't then I'm wrong and it's.. something else, and I have no clue.

Link to comment
Share on other sites

Despite all the views... nobody else?

 

Sorry, my best just adds a list of questions to your own, which track does the projectile use, does it follow a different track on *your* local than it does on another player local.


My first guess would mesh somewhat with your hypothesis in that client and server is using different perspectives, my 2nd guess would be time lag difference between client and server, tho i do only have the single image as a reference so that could be a wild stab.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...