by dpJudas » Wed Dec 26, 2018 8:41 am
It currently uses 16 bytes per linedef (AABBTreeLine). The tree nodes use 32 bytes per node (AABBTreeNode). There is one node per linedef, plus the additional ones needed to build the tree. For a perfectly balanced tree and 10,000 lines it would be about 160,000 bytes of line data and 1,048,000 bytes of node data.
The lines are currently organized in the same order as in level.lines. The nodes depends on how they end up sorted into AABB groups. I need to check the code, but I think it should be possible to store the polyobjs at the end for both lists.
Only catch is, we can only do this for polyobjs. For closed doors we have no idea which sectors may open or close, right?
Edit: fixed my broken binary tree size math.
It currently uses 16 bytes per linedef (AABBTreeLine). The tree nodes use 32 bytes per node (AABBTreeNode). There is one node per linedef, plus the additional ones needed to build the tree. For a perfectly balanced tree and 10,000 lines it would be about 160,000 bytes of line data and 1,048,000 bytes of node data.
The lines are currently organized in the same order as in level.lines. The nodes depends on how they end up sorted into AABB groups. I need to check the code, but I think it should be possible to store the polyobjs at the end for both lists.
Only catch is, we can only do this for polyobjs. For closed doors we have no idea which sectors may open or close, right?
Edit: fixed my broken binary tree size math.