I finally found the perfect tick rate for our gameserver. 20Hz. [Example Gif] Entity interpolation seems so smooth but I am curious/worried about some things.
Right now, a way to "kind of" validate X, Y values being sent are checking the differences between a players current pos and their intended pos. (They are given x, y server value when entering the map) -- so checking from the get go they can only move so far/so fast. Otherwise they will get re-synced, or kicked.
I have clientside physics as well. So, for example when a player moves towards a block he will either not send any position (player let go of the key) or if colliding, send the position the character is in. This works great because then I don't have to run a physics server.
The problem is, this requires the server to receive data at a rate of 20Hz instead of just sending "up,left,right,down" keys. The trade off is... I don't need to run a movement timer at 20Hz on the server. (Sure, the occasional naughty player will send weird x, y positions to make the player move 20 more pixels so they can enter inside a collision area, but that's not really a big deal to me right now)
With all this said:
- A) - I could either run a basic fixed timer on the server at 20Hz and only receive the input from the client and then send the new x,y values to all the other players
- B) - Or, do what I am doing now and send the 20Hz of x,y values only when a player is moving that notifies all other players in that game
I feel like option B is ideal because I don't have to check for all the collision areas in the map. I let the clientside physics do that work, and send the appropriate X, Y values. The downside is, a lot more data needs to be sent to the server. But, you could also give the argument that if a player is spamming 'W, A, S, D' keys, that's a lot of packets being sent too... so if the player is actually moving like a wild billy goat, you could argue that the 20Hz of data being sent could be less.
Option B also has a downside of less responsiveness of player movement since it's being interpolated. For example, strafing left and right real fast will not necessarily be as fast as what you see on the client. I believe that could be fixed by increasing the 20Hz?
Also to add, option A's responsiveness factor to B would also be the same. Since the server is sending data 20Hz as well. I'm just not sure if I can get away with the client sending data at 20Hz. I've read that 30Hz, 60Hz is even common. But you have to remember, I'm using nodejs :rolleyes: Anyways, I just laid out a lot of stuff so please critique if necessary, thanks!