Sign in to follow this  
Tazadar

FPS UDP guide ?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Hidden
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"> [code]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; ">[/code]</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>

Share this post


Link to post
[size="2"]Thank you very much rip-off.[/size]

[size="2"]I have read [/size][url="http://gafferongames.com/game-physics/networked-physics/"]http://gafferongames...worked-physics/[/url][size="2"] and I understood mostly everything. The only part that I did not get is this one :[/size]

[size="2"]void receiveInput(float time, Input input)[/size]
[size="2"]{[/size]
[size="2"] if ( time < currentTime )[/size]
[size="2"] return;[/size]

[size="2"] const float deltaTime = currentTime - time;[/size]

[size="2"] updatePhysics( currentTime, deltaTime, input );[/size]
[size="2"]}[/size]

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

[size="2"]Thanks for your answer.[/size]

[size="2"]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 ?[/size]

Share this post


Link to post
Share on other sites
[quote name='Tazadar' timestamp='1318949781' post='4873936']
[size="2"]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 ?[/size]
[/quote]

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).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this