How can I use the TNManager.serverTime to know when Player A triggered his skill for Player B?
[RFC(NET_ID.SkillTrigger)]
public void Net_SkillTriggered(SkillType skill, long timestamp)
{
DateTime forhumaneyes
= new DateTime
(timestamp
); Debug.Log("Skill " + skill.ToString() + " triggered at " + forhumaneyes.ToString());
}
public void CastFireball()
{
tno.Send((byte)NET_ID.SkillTrigger, Target.All, SkillType.Fireball, TNManager.serverTime);
}
It's been a while since I've wrote any code but you get the idea ^.^
I think you're approaching it the wrong way though. You shouldn't be designing your game around a 500ms ping. That is incredibly high even for players on opposite sides of the planet, and adding a timestamp to the packet isn't going to do much because you can't travel back in time. Not to mention a timestamp can only be so precise.
My head is loopy right now so maybe Aren can provide some design advice. If not then you could look up deterministic lockstep. I don't think your problem would require such a solution, but the principle could be helpful. Some interesting words thrown together: "playout delay buffer". As summarized by Glenn Fiedler at
this page, "[I]n short, what you want to do is buffer packets for a short amount of time so they appear to be arriving at a steady rate even though in reality they arrive somewhat jittered".
Note: Not sure if links to external sites are allowed. My apologies if they are not. I felt the need to cite the author of the quote for moral reasons.