When we are writing a networking algorithm, we need to decide on the various objects or states that need updating to or from the server. The higher the number of objects, the more time it will take to serialize and send the data across. Therefore, there is a need to prioritize what needs to be updated every frame and which objects can wait for a few more cycles to be updated.
In this recipe, we will see how easy it is to create area of interest filtering:
Create a list of all objects in the scene.
Add a parameter to each object denoting their priority.
Based on that priority number, pass it on to the update logic of the game.