Decreasing the requests count
Previously, in Chapter 10, Debugging and Profiling the Network, we saw that there was a disproportional and unnecessary number of requests being made to the Weapon2D
node’s fire()
RPC method, and we even came up with what could be a solution for this issue. We also saw that we can decrease the Asteroid
node’s sync problem by only updating it once a given player requests a synchronization using the World
node’s sync_world()
RPC method.
In this section, we are going to implement these optimization methods and improve the overall performance of our network. Let’s start with the Weapon2D
node issue.
Reducing the weapon fire count
Sometimes we may need to make changes in the core code of a feature in order to improve its network performance, even when its local performance stays the same, or may even drop. When talking about optimization, we are always trying to balance things out and figure out how to use the available...