How to improve the network perfs of my game ?

Options
Hi,

I have developed a Proof of Concept of a multiplayer online game. It is a 2 players game which mix VS fighting and shoot'em up games. Each player controls a space ship and the goal is to destroy the other player.

You can download a video of this project here : https://we.tl/t-UDcYCooMOW

It works, however I don't have good network perfs enough (there are too much lags). The game must be competitive and very fast and paced. The current version is acceptable for casual gamers but not for pro-gamers.

I use Photon PUN with RPC and PhotonView, and I don't know how to improve the network perfs of the game (this is my first online multiplayer game).

Below is how I handle the network functionalities:

- Matchmaking is done with "CreateOrJoinRandomRoom". The first client created the room is the MasterClient.

- On each Spaceship, there is a PhotonView component with 3 ObservedComponents:
- a PhotonTransformView with only "Rotation" checked
- a PhotonRigidBodyView with "Enable teleport for large distances" and "synchronize velocity" checked.
- my custom SpaceShipPhotonView which has 2 purposes : at the init step, it sends some informations about its datas in order the other player know it and apply it on its side. Then, in "OnPhotonSerializeView" it sends the angle of the spaceship around its forward axis if stream.IsWriting, else it applies this angle to the spaceShip model. Note that this angle is applied to a model which is a child of the GameObject on which there is the PhotonView, that is why I can't use PhotonTransformView rotation for this.

- Concerning the projectiles (shoots), I don't use PhotonView because their movements are predictables. I send a RPC message when a player starts shooting and a RPC when he stops shooting, then on the other side, I instantiate the projectile and compute the distance he has reached during the time travel of the network message. The projectiles are synchronized on both clients. When a projectile hurts an object (asteroid or player or other projectile), a RPC message is send (no matter if it is on master client or other client side) with informations about the target it hit.

- The asteroids are spawned only by the MasterClient with PhotonNetwork.Instantiate. They have a PhotonView component with 2 observed components : PhotonRigidbodyView (with enable teleport and synchro velocity) and PhotonTransformView (with only rotation checked). Only the MasterClient use PhotonNetwork.Destroy on this when an asteroid explodes. But they can be about 20 or more asteroids at the same time.

- Only the MasterClient compute health loss and send to the other client the health value when it has been modified, using RPC message.


So here are my questions:

- Are there too many network messages ?
- For the asteroids, should I create only one component with a PhotonView and a custom observedComponent, keeping a list of all instanciated asteroids and sending rigidbody/transform infos for all of them in "OnPhotonSerializeView" method, instead of having a PhotonView on each asteroid ?
- Should I use Bolt instead of PUN ?

For the proof of concept, we didn't need an authoritative server, but for the final game, it will be better if we can use an authoritative server because the game is competitive, but we don't have a lot of time to spend for the development of this game. Is it possible using PUN and what is the best compromise between low cost, fast and easy development, and good results and minimum cheating/hacking from players ?

Thanks in advance for your reading.