GitHub | Documentation | Become a Patron

Is there any way to implement Area of Interest?



  • So far, it looks like the entire state is sent over to the client. Is there any way to implement some sort of area of interest algorithm so only a portion of the state is sent over? Possible split the state up into arrays for portions of the map and only send patches from a certain portion to the player?

    I'm sure I could disconnect all the data from the state itself and send it when need be with client.send, but that seems like it defeats the purpose of Colyseus hahaha


  • administrators

    (pasting our discussion via private chat)

    Yeah, unfortunately, Colyseus doesn't provide this feature out of the box. :(

    There's one issue open about it here: https://github.com/gamestdio/colyseus/issues/59

    (I'm afraid the whole patch system would need to change in some way to allow filtering data like it's described in the issue.)

    What you could do is keep using "broadcast", and handle it manually, but then you wouldn't benefit from using the state patches.



  • @endel I just finished an implementation of AI that puts players into "Regions". The server will broadcast a global state for messages, trades, etc. and then only broadcasts data from that region.

    I have to work on sending the unseen state of a new region to a player when they first get into it and making the change more user friendly, but I'll try to upload my code soon!