Heres a picture of 100k Barbers spawned, still with 5 objects per cell, and the graphical representation of that.
Oh and memory usage for the game server at this stage is 36mb.
Edit: Just brought the number up to 300k (thats a third of the map covered now), the client reports between 70 - 300 ping, teleporting to an empty map and the client shows a ping of around 30, this leads me to beleive that the ping being shown on the busy map is entirely down to the client, since no data is sent after the initial spawn. Server memory is now 65mb, which isnt bad since im pretty sure ill never have more than 300k objects in the entire server at one time.
Edit2: Just decided to spawn an extra 700k barbers, memory usage is now 151mb, perfectly acceptable for 1 million npcs in my oppinion, im not atually able to get a graphical represenation for this, i had it setup to update ever 250ms and it just doesnt like it lol. It would just be pure green anyway.
if you get more people than [max allowed per cell] stacked in one spot, does the server crash trying to split it?
if you get more people than [max allowed per cell] stacked in one spot, does the server crash trying to split it?
On the same Cordinate?
No, for starters the players do not move through the QuadTree in the same manner as npcs, as a result they dont atually directly effect the trees layout, not yet anyway. Im not sure im going to bother having Players or Monsters split the tree when they navigate through it.
However if i were to do that then i would have it so that if it cant find a more suitable location then they will remain within the same section. Also i could add a maximum number of layers for the tree, so that it bottoms out at say 5 layers, so in the case that your describing it would branch out to its maximum lowest layer and all entitys would reside there. Not exactly efficient however i dont really intend to go down this route.
Quadtrees are designed primarily to hold static objects which do not move, because of the way the entitys are designed, once they are in the quadtree, they move around, however they are contained in their original entry point (obviously a flaw), when their cordinates change, they move within the overall quadtree, but they are still contained in their entry point. This doesnt cause any problems, so i may just modify the quadtree to have an object store in it where dynamic entitys are stored, and then they will just move around the tree like normal.
So to sum up, no it doesnt crash the server because of the way the entitys interact with the tree. However this quadtree is by no means finshed, if i were ever to release a .dll with this functionality i would definately implement the neccassery checks to ensure this could never happen.
Jack I thought since the way a quad tree was designed that once full , it was supposed to over flow in to the next cell which then would take over that job as well. The way you layout was 4 blocks in a dark black circle. So once A was full B would pick up and so forth and on? Was looking into it and was testing some things with it correct me if im wrong tho?
Jack I thought since the way a quad tree was designed that once full , it was supposed to over flow in to the next cell which then would take over that job as well. The way you layout was 4 blocks in a dark black circle. So once A was full B would pick up and so forth and on? Was looking into it and was testing some things with it correct me if im wrong tho?
The quadtree should subdivide once its full, so if you have a limit of 10 and you reach it, the tree subdivides untill you can place the next object which would put you over the limit, in a different branch, but it should be within the existing branch, not an adjacent branch.