because current way to instantiate will create huge garbage
when i instantiate 10 agent once,each one have a big state graph more than 30 states,it will not stuck game in async way,but will create almost 3mb garbage,and the gc collect will called soon.
btw my game cannot pre instantiate the agent.
so i hope a solution that called GraphManager,and it will deserialize all graph and save in dictionary<string,graph>
once you want to get a new graph ,you can call GraphManager.Get(string key),then it will give you a deep copy graph instance .
i have already achieve it in a sample fsm project of my own,here is some code.
1.graph manager,it is so easy that you can get a clone from pre deserialized graph
2.clone graph,and do clone state,transition
3.for example,here is a logstate,as you can see how it clone works
for some reason I m trying to use nodeCanvas for my new solution,because it is so good except instantiate,so hope for the api that people can override and write clone code .
hope you can consider this suggestion,because in my impl,it will have more than 20 times fast than nodecanvas,i m not here to say nodecanvas is not good blabla… i just want it to be better.and I m working with a large project so really need performance.
Thank you for your suggestions. I am glad you like NodeCanvas and no offense taken at all! Hm. There is already a “clone” method (called “Duplicate”) in nodes, transitions, and tasks (and variables) code that returns a deep copy of the Task. However these copies are made using the json serializer so that all nodes, transitions, and tasks can be cloned without manual clone code within EACH one of them of course. If I understand correctly, your suggestion requires that clone/duplicate method is made virtual and the clone is implemented manually for every node, transition, and task independently. Is that correct?