[ENet-discuss] fps networking

Martin Sherburn spacedude at konggame.co.uk
Fri Mar 14 15:57:53 PDT 2008


1. You can put it on a timer with a default value of say 20 or 30 times 
a second. Then you can try varying it to see what gives best results. 
You may want to set the rate depending on the connection, e.g. low rate 
for 56 kbps modem users and high rate for LAN games. So you can leave 
this up to the client to adjust.

2. The server should just assume the input has not changed until it 
receives a new update from the client. If there are some connection 
problems between the client and the server and no input is transmited 
for 1 second (lag spike) and the player was running forward, the server 
will just assume the client continued to run forwards during that one 
second. You may want to handle jump and fire differently, these can be 
transmitted as one-shot events. I.e. you send 1 reliable packet each 
time the player presses a jump or fire key, rather than continously 
sending whether or not the player is jumping or shooting. So you have 
two ways of transmitting input: 1) continuous stream 2) one-shot events. 
You need to decide which input is suitable for each action. Events where 
the user quickly taps a key can be lost when sent as a continuous stream 
because the key tap may last less time than the time between two pack sends.

Hope that helps,

Martin.

Jacky J wrote:
> I'm having a hard time getting my head around some concepts used in 
> first person shooter style games, namely sending user input.  I 
> understand pretty much everything else: client side prediction, object 
> replication, etc.
>
> So here are my questions and thoughts:
>
> 1. The client continuously sends its input to the server.  This is a 
> packet that might have a bit field for each button or key. For example 
> WASD might take 4 bits, and another few for jump or fire.
> So how often do i send these packets? Is it on a timer or do i send it 
> as much as the clients presses those buttons?
>
> 2.  My biggest concern: What if the client is bogged down to 5 fps, 
> meaning in the best case, the server is receiving those inputs every 200 
> ms.  Surely the server needs to update the client based on the client's 
> own framerate, because if you're moving the player 1 unit per input, the 
> player will move a lot slower if it's updating less per unit time.
>
> My initial thought was to send some sort of lastsendtime to scale the 
> player's input, but then it seems like you could cheat and just send 
> really large values to make it seem like you're running at a low fps.
>
> What all should i be sending to the server, and what actions should the 
> server be taking based on those inputs?
>
> I have a simple techdemo/game setup using enet called godmode.  
> Everything is pretty much set up except for sending client inputs 
> correctly.
>
> http://code.google.com/p/godmode/
>
> Thanks
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>   



More information about the ENet-discuss mailing list