hello guys!
I have a question regarding cleaning objects:
I'm working on a networked game where the server send each client states of objects that are nearby that player on each tick, which the client interpolates and visualizes said objects.
I want to clean (hide) objects that are not in the client's update radius.
I came up with 2 possible solutions:
1. Create a "cleaning" task which receives a `CancelationTokenSource` and will wait for a timeout (100 MS top) and then call the cleaning action. if the task is canceled - (meaning an update for that object had arrived) then the task will be recreated and restarted.
(Will performance be an issue for such a mechanism where I might end up with dozens or hundreds of tasks running at the same time?)
2. Whenever an object leaves the update radius raise an event which go over all of the nearby objects (can be taxing, it depends on how many objects are clustered nearby), and on every tick send (Reliably) a packet which contains the “renderObjects” (only ids) and “”hideObjects" (only ids)
If you guys have another suggestion, or you could recommend between the 2 approaches I've listed it would be very helpful