FPS UDP guide ?

Started by
4 comments, last by hplus0603 12 years, 6 months ago
Hello,

I am currently making an fps, I have set up my UDP connection and it working fine.
I would like to handle ping, lag and jitter on both client and server side.
(ie. I would like to have a smooth movement client side and if the player hits an enemy, the server is aware of the smoothing and validates the shot)
Is there any tutorial for that kind of stuff ?

Thank you very much.

Taz.
Advertisement
Have you read the Networking and Multiplayer Forum FAQ? In particular, Q12, Q16 and Q27 seem particularly relevant.
Yes I have, there are some aspects that I do not understand and I would like to find a book or a website which contains a step by step guide.
There are no step by step guides to writing complex software. If you cannot digest the articles pointed at by the FAQ, you aren't quite ready to write a multiplayer FPS yet.

One option is to scale back your current ambition, and just focus on writing a FPS (there is a lot of work in that). Anther option is to start builing smaller networked projects, to get some understanding in this area.

If you have any specific questions we can help.
Thank you very much rip-off.<br><br>I have read <a href="http://gafferongames.com/game-physics/networked-physics/" class="bbc_url" title="External link" rel="nofollow external">http://gafferongames...worked-physics/</a> and I understood mostly everything. The only part that I did not get is this one :<br><br><font class="Apple-style-span" size="2"><font color="#111111"><font face="Verdana, sans-serif"> void receiveInput(float time, Input input)&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( time &lt; currentTime )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const float deltaTime = currentTime - time;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; updatePhysics( currentTime, deltaTime, input );&nbsp;&nbsp;&nbsp;&nbsp;}</font></font><span class="Apple-style-span" style="color: rgb(17, 17, 17); font-family: Verdana, sans-serif; "></span></font><div><br></div><div>I don't understand what is setting the time value, server or client ?<br>If it is the server at packet reception it means that time will always be &lt; currentTime.<br>If it is the client then cheat is possible.<br>Or maybe the current time is something like (real current time - 100 ms) ?<br><br>Thank you very much.

</div>
Thank you very much rip-off.

I have read http://gafferongames...worked-physics/ and I understood mostly everything. The only part that I did not get is this one :

void receiveInput(float time, Input input)
{
if ( time < currentTime )
return;

const float deltaTime = currentTime - time;

updatePhysics( currentTime, deltaTime, input );
}

I don't understand what is setting the time value, server or client ?
If it is the server at packet reception it means that time will always be < currentTime.
If it is the client then cheat is possible.
Or maybe the current time is something like (real current time - 100 ms) ?

Thanks for your answer.

Edit : It appears to be the client that sends the time. So what happens if the server and the client do not have the same time ?

Edit : It appears to be the client that sends the time. So what happens if the server and the client do not have the same time ?


Time should be measured in "seconds since start of game," or perhaps "ticks since start of game" with a known tick rate.

If the clocks have significant skew (different speeds) then the client will have to either simulate more than one timestep once in a while (if it's slow), or not wait for simulation until it actually has data for a timestep from the server (if it's fast).
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement