Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

Tree nodes (including the root node) are stored in an array of nodes.  "tree root node index" is an integer variable containing the index of the root node in said array.  Many array index based tree implementations have the root at the first element in the array (index zero), but in my implementation the root node can be any node in the array of nodes.

The reason I've implemented things this way is so that if the tree's bounds need to be expanded (voxel volume(s) need to be added to the tree outside of tree's current bounds [in C++ code]), the tree doesn't need to be rebuilt, but instead tree's bounds are expanded accordingly and a free/unused node in the array of nodes (which is a dynamic size data structure like a C++ std::vector of tree nodes) becomes the new root node and the old root node becomes one of new root node's children.