Variable Tree



If you see a code like:  

VariableTree tree = new VariableTree();

tree[10] = 2;

tree[150] = tree[10]+2;


It may look strange, like we are missing something, and this code would create an error, but it’s ok 👌 actually. Those are special tree 🌲 classes which stand in the center of new Just Add Story asset I’m working on. Instead of binary trees it uses trees with larger branches. Which means that to store a value of a single array element number 300, it will create a tree with depth of 3 with branches which can contain 8 branches inside (8*8*8 = 512). Custom serialization only stores values and their indexes, so one element turns into 2 integers when level or game progress is saved. Plus, since story-telling-tools are build around dynamic content loading, you'll never need process many of those structures at any given time. And finally, and the most important: a limitless nature of this method - unlike binary trees, number of elements in it will not affect the performance. And add a fact that for story triggers it uses 2 dimensional array (Story Group Index, Trigger Index), and Story Groups only loaded/initialized when they are used, there is really no limit to how big a story can become, and how large of a save file a character can have. 

Please reload

Facebook icon
Instagram icon
GitHub icon
Discord icon