Atavisms Quadtree is a very advanced solution.
First, it is taking geometry size with 1mln x 1mln meters and checks if the number of objects within that quad is higher than the parameter atavism.quad_tree_node_max_objects value. If the value is higher than This quad will be divided and each smaller quad chunk will be checked separately until one of the two conditions will be met
- The maximum depth of such division will be reached (the parameter responsible for this value is atavism.quad_tree_max_depth and it’s set by default to 20)
- The number of entities within the quad chunk will be lower than the atavism.quad_tree_node_max_objects parameter (default value of this parameter is 30)
These parameters can be set per server basis in the atavism_server/bin/world.properties file.
The best part is that these chunks can also be rectangles not only perfect squares, so we can end up with chunks with sizes 2×1 meters.
When the map/instance will be divided into chunks, the main role will play one additional parameter: World.perceiverRadius which is responsible for loading all quad chunks within that range, you can set this value in the atavism_server/bin/wmgr_local1.py file, and by the default value of this parameter is set to 100 meters.
How does it work in practice?
It’s best to explain it based on the image
So, the developer has full control over how far the player can see through the PLAYER_PERCEPTION_RADIUS parameter that can be set in the game settings in the Atavism Standalone Editor. Based on this parameter and other quadtree conditions you can set, quadtree will be dynamically divided into chunks and only information within some of them will be streamed to the player, like only quadtree leaves that are within the perception range will be streamed to the player. This has a significant impact on the client’s side performance but also it’s preventing from cheating where the player could get information about objects that are farther from him.
As you may notice, the right top corner is not divided as the rest of the map, because Quadtree is being divided based on mentioned conditions, so in our scenario, we had only one entity in the quad leave, so advanced Quadtree didn’t divide it further, and because of this, the whole chunk will be streamed as the corner of it is within our player’s perception range.