Skip to main content
GameDev.net gamedev.net
🔒 Locked

FPS UDP guide ?

Started by Tazadar Oct 18, 2011 at 12:11 PM 4 replies 2.8k views
Original Post
Tazadar
Tazadar
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.
Tazadar
Tazadar
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.
rip-off
rip-off
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.
Tazadar
Tazadar
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 ?
hplus0603
hplus0603

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 };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.