Open arthuro555 opened 2 years ago
Library to remember when implementing this: https://github.com/mourner/flatbush
Allows to get the objects that are within the camera boundaries in a very fast manner (without iterating on all objects), should be faster with bigger amount of objects within the boundaries (most games)
Cameras are client side for multiple reasons (they are client specific, they are rendering related, they need to be updated on each frame when interpolating and not on each server tick...), but that leaves room for cheating by seeing things one is not supposed to. An example would be the game "Among us": If a cheater could see everything everywhere, they could see the imposter make their kill, and that would ruin the game.
The solution to this is adding camera boundaries. This would define a window of objects that the client is able to see, and only those objects would be synced with the client. That way, even if a hacker changes its camera to see everything, the other objects won't even be sent to the client and the hacker won't be able to see anything 😎
There should be multiple camera boundaries, to allow seeing two places but not what is in between. Taking again "Among Us" as an example, when watching through the cameras, the zone of those cameras should be synchronized & made visible to the player, but without making a giant camera boundary that covers both the field of sight of the player and of each cameras. Instead, each camera should add an additional camera boundary that allows the client to see what's at their position when they are active.