Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is the client sending to the client exactly? "I pushed down W" and "I released W" or send "I am holding down W" every X ms?

If the latter, how would you prevent the client from spamming it more than every X allowed ms? I'm thinking it would build up a queue if commands came in too fast but not sure how that would be handled exactly. Also, even with a queue someone spamming would gain an advantage since it would bridge the latency.

Example: If the client sends "move 1px to the right" every 20 ms and someone manually started sending it in every 5 ms instead, it would still only move every 20 ms on the server. However, wouldn't this still be better than sending it every 20 ms from the client since latency and other things (slow processor?) could mean the real interval is more than 20 ms?



And there you have it: speedhack :)

This is a topic of where to process commands (client vs server), what data to send, which restrictions to impose, what rules to enforce, etc. Give client too much say in the simulation and it can ruin the experience of others, leave it all on server and enjoy your lack of speed.


The details vary, of course. Typically it's any gameplay-related commands the player gives.

You avoid the timing problem by having the client timestamp the packets. Time on the server side is quantized into "ticks", which are basically frames of game state that are independent from the clients' framerate.

Or at least, this is how Source engine does it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: