Store data in a Quadtree

Hello! I would like to know if anyone here managed to store Colyseus data into the state via a Quadtree.

Thank you in advance,

Hi !

I have done HashMaps but not Quadtree, however I think this is possible as you can nest objects into custom structure, I did not tested but recursivity may not be a problem.

Something like (not tested, just a draft) :

import { Schema, type } from "@colyseus/schema";

class Node extends Schema {
    nodes = new ArraySchema<Node>();
    entities = new ArraySchema<Entity>();

class MyState extends Schema {
    node: Node = new Node();

On each Node you may have 4 child Nodes, each nodes can have 0 to many Entity. It may be a good idea to write a NodeManager attached to the State for building and update the tree !