I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that: Let's say we have a gun that can shoot 10 times per second (when left mouse button is held).
- When user presses LMB game sends TCP packet telling that shooting has started. When user releases LMB game send TCP packet telling that shooting has stopped.
- When LMB is held game send UDP packet every (1/10) sec telling about one shot.
- When LMB is held game send TCP packet every (1/10) sec telling about one shot.
I think that the last one is the best because it allows to check hits on the server side, not on the client side (cause this way it can be easily hacked). But I am not sure if TCP can handle 10 packets per second. What do you suggest?