Hello everyone,
I’m currently developing a 2D game and transitioning from single-player to multiplayer using Mirror Networking. I’ve already built a large portion of my game in single-player, and I’m progressively adding multiplayer features.
My issue is related to synchronizing shooting in my game. To give you some context, my shooting system is “physics based”: each projectile is a prefab (a bullet) that has a Rigidbody2D and a Collider, and the projectile is spawned from a ShootPoint attached to the player’s weapon.
In multiplayer mode, here’s what I’m experiencing during tests:
- When a client fires, it sends a request to the server to spawn the bullet prefab.
- The server then creates the projectile and sends the information to all clients.
- However, if the player is moving while shooting, the projectiles appear misaligned from the weapon’s ShootPoint (see attached image).
I suspect this misalignment is due to the latency between the client’s request and the server’s generation of the projectile, especially if the player is moving quickly.
I’m basicaly using : NetworkServer.Spawn(projectileInstance); as a way to create my projectile.
And as you can see as a client, It makes the overall experience very unconfortable to play.
Am I doing something wrong ?
I would also appreciate any advice on how modern games with physics based projectiles (such as Battlefield or Call of Duty, for example) tackle their projectile synchronization.
I’m still relatively new to multiplayer development, so I would greatly appreciate any explanations, advice, or references to tutorials/documentation that could help improve this part of my game.
Thank you in advance for your help!
Best regards
