Filter data

Hello everyone , i have a question about the filter decorator , i want to filter the state only when the client send a move event to the room and not when he joins the room or when he sends other events any idea please ?
0_1656409114423_88594484-e0c9-429a-9f5e-40d32fe2669f-image.png

Hi @chaimae, can you describe your real-world scenario on why you need filters?

The filters are experimental and currently consume way too much CPU, I wouldn't recommend for production scenario with many clients.

See docs: https://docs.colyseus.io/colyseus/state/schema/#filtering-data-per-client

I'll explain the use case, I'm currently working on a project to put 1000 avatars in a 3D world, for that I put a test in place: a viewer that will launch 1000 clients (10 rooms with 100 clients each ) and which will at the same time send move events to the server to move the 1000 clients, on the other side we have a client which is a threejs client , this client listens to the state once a new client is created on the server side it adds it to a 'players entities' list and it receives the change of position of these clients, when I did my test I noticed that I have a problem for example if I have I launch 150 clients it's good it works, when I increase the number of clients I have some of the cubes(simulation of 3D avatars) that move and some that don't move, when I try to change the sending frequency of the move event to the server I notice an improvement of results that's why I thought as a solution to limit the sending of messages and to send the messages according to the distance between the cubes (the avatars) that's why I thought about using filter .
0_1656420936600_220e5a4e-f0fc-4fbb-96e1-d8609560db15-image.png

@endel any help please ?

Thank you for nice post