I need a custom data structure (a tree) so that I can run some path finding logic in my game. I was able to come up with a basic C++ implementation but there are still some open points. If you can answer or provide good documentation references it would help a lot.
So this is what I’m going for:
#pragma once
#include <vector>
#include "TreeNode.h"
template <class T>
using TTreePath = std::vector<TTreeNode<T> *>;
template <class T>
class TTree
{
private:
TTreeNode<T> *Root;
public:
TTree();
~TTree();
TTreeNode<T> *GetRoot();
TTreeNode<T> *SetRoot(T Data, int Weight = 0);
TTreePath<T> FindLightestPath(T TargetData);
};
Questions:
- Is this bare C++ implementation the way to go, or should I be using Unreal’s API (maybe UStructs or UObjects)?
- What are the concerns regarding memory management of such approach?
- Can I unit test this outside of Unreal, directly in Visual Studio?
Thank you