Reply To: A suggestion for imporve instantiate performance

NodeCanvas Forums Support A suggestion for imporve instantiate performance Reply To: A suggestion for imporve instantiate performance

#16544
liunliun
Participant

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 .