How multiplayer shooters work?

Hello. I have a question regarding network programming.
I’m trying to create a simple fps shooter. I am using babylonjs and socket.io .
Now my client each frame takes input information from the keyboard and mouse, forms a packet (time delta + rotation angles + direction of movement + action), then transfers this data to the client and to the server, where this data will be played back step by step. This works, it seems to be not bad, but the number of generated input packets depends on the number of client FPS, that is, the higher the FPS, the more packets are sent to the server.
I think to use something like Tickrate - sum the time deltas, and if the sum of the time deltas is greater than or equal to the tickrate, then tick+=1 and data on this tick is transmitted to the client and server, but most likely in this case there will be large delays.
The question is how to make it FPS independent, and how best to implement the network part. Perhaps someone knows, or have ideas.
I looked at many projects on github, but most of them do not use prediction, but simply the server takes the position and passes it to the rest, some also use delta, but I think they have the same problems as me.
sorry for bad English
Thanks.

To make it FPS independent you have to use the tickrates. I think you can play around the rate to reduce delay, and even if you went with another approach, there still will be delays because the packets have network travel time anyway. For prediction, the library I’m aware of is GGPO GGPO | Rollback Networking SDK for Peer-to-Peer Games, it’s used on a lot of fighting games, but it may work for a FPS too?

This question as a whole is outside the scope of Babylon but a lot of people on the forum love games so hopefully they’ll weigh in too :slight_smile:

2 Likes

This thread may put some light on this subject - Looking for help with smooth multiplayer interpolated movement

2 Likes