- Home /
Setting slow projectile's moving direction in a networked fps style game (on server, owner client and proxy clients)
I've been working on a networked multiplayer fps-like game with a 'over-the-shoulder' camera view and characters' main attack skills are mostly slow moving projectiles like RPG. You can think of Brawl Stars with 1st person view. My problem is that I can't find a good solution to set (or fix or calculate) the initial moving vector of a projectile when a player A triggered it towards player B, which should be applied to server and all clients. I've searched many Q&As and articles of 'projectiles in network game' (some of them are link text, link text, link text, link text)
However, I can't find mentions about a projectile's direction or trajectory (not the speed) that is easily out of sync in networked play under this situation : authoritative server, owner player's position is predicted in its own device, other players are interpolated (like 100ms), no entity extrapolation is used. For better understanding, I drew a kind of diagram. In above situation, if I take the projectile's direction in Client A (favor of the shooter) and apply it to Server, and Client B, player B in Client B will have hard time dodging this projectile because of the wrong direction.
Can anyone help me out what a projectiles moving direction should be? Is trying to sync it something that I don't have to care? Or the direction can be different on Server, Client A and Client B? Any help would be greatly appreciated.
Answer by Insok · Jun 17, 2021 at 07:42 PM
Disclaimer: I haven't personally worked on multiplayer games, but I can tell you (just from experience in playing games) that FPS games for example are VERY prone to network and ping delays. And as far as I know, they always interpret the player's positions from the server's perspective. This is also the most convenient way to program the game because it ensures that player A, player B and the server are synced.
In the worst scenario, where both player A and player B have high, noticeable network delays, player A will notice that when he shoots the projectile, it doesn't fire immediately and not at the exact position he is at. For player B, he could've barely dodged the bullet on his client, but still get hit. The reason this is the best solution is because the disadvantage for player A is ONLY dependent on player A his ping. At the same time, the disadvantage for player B is ONLY dependent on player B his ping. If you would try to favor player A, then the higher his ping is, the higher his favor. The same goes for if you would favor player B.
And lastly, you shouldn't try to solve it to realtime for each player, because it is actually impossible.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
RPC and Command Calls OR Network messages for syncing variables across Server and Client? 0 Answers
When to process input in networked multiplayer game? 0 Answers
Does anyone know how to connect outside the LAN network using MLAPI? 0 Answers
Unet: Discern between user disconnection and connection lost 1 Answer