Hi,
client side prediction is not working as intended :(
the other players char is still not walking fluently.
heres the code:
every 10 seconds, thread 1
//gets position of players from server
//user.isUpToDate is being set to true by server
WorldPlayers = (Data.CharacterObjects.CPlayerInstance[])NetworkComms.SendReceiveObject<Data.CharacterObjects.CPlayerInstance[]>("RequestUWP", "192.168.1.113", 999, "UWPReply", 5000, "");
at every frame, called from main loop:^
user is the player character from WorldPlayers
(CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).newPosition is the current ppsition in the data structure
((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).m_Node.Position is the physical position of the entity
if (!user.isUpToDate)
{
//extrapolate new position if position is not up to date
((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).newPosition = ((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).m_Node.Position(((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).m_Node.Position - ((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).oldPosition);
user.isUpToDate = true;
}
IrrlichtLime.Core.Vector3Df v = new IrrlichtLime.Core.Vector3Df();
//interpolate between current position and new position
v = v.Interpolate(((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).m_Node.Position, ((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).newPosition, getTime() - ((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).lastUpdate);
((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).m_Node.Position = v;
((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).lastUpdate = getTime()
//if current position==new positin, start extrapolation
if (v == ((CCharacter)CScene.Characters.m_CCharacterWorldPlayers[user.ID]).newPosition)
{
user.isUpToDate = false;
}