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 ?
Filter data
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 .