Packet spamming

Hey.

This is confusing me:
The client should not “block” the user from sending packets rapidly (the user can send those themselfs).
So, how the server sort out all those packets (from the same sender)? If someone sends 26 movement packets, how do I avoid moving them 26 times?
Handling only one packet per player, per cycle is bad right?
???

You need to define your problem better. Or even just what the “networking” is doing. That will probably produce the solution for you.

If i have guessed right, you are trying to defend against a “replay” attack. What I do is number every packet. If I have received the packet before then i drop it. If the packet is too “old” i drop it. My packet window is 64 packets. (ie i can receive packets within 64 of the highest packet seen so far). This deals with things getting out of order. With TCP you don’t even need to do that.

If you are using UDP (to start with i would use TCP and only change if you need to), you will need some form of flow control. You cannot get around that. Quake3 etc use a very simple form of flow control. They send a fixed amount of packets per second. If your network can’t handle it your connection effectively times out. Anything more complicated than that, and again i would just stick with TCP.

There are also libs you can use and there are quite a few threads here on the topic that go into quite a bit of detail.

looks like delt0r covered everything pretty good. i just have one thing to add. every now and then, send packets to update EVERYTHING in case some of the packets don’t get through.

Unnecessary with TCP.

sorry. forgot to specify. it is unnecessary with TCP. might need it for UDP, though.