Save and restore state of AI planner?

Hello everyone!

I’m starting to use AI planner for my agents and I would like to keep the current action of every agents when I save the game to restore it when the save is loaded.

Do you know if I can do that with the version 0.2.3? How could you do if it’s possible?

Technically, you can grab the current action from the DecisionController then save/serialize it however you’d like. That said, interrupting and saving the current execution of the action to be resumed later will be more difficult. Also, we don’t currently ship with any utilities for serializing the complete plan to be reloaded later. The easiest method of resuming will be to finish the action, query the world for a new state, then replan.

Thank you for the answer @TrevorUnity !

The main problem for me is that in a coroutine specified in an action’s callback, it’s possible to alter object data, and if we save the game state whereas this method has only executed half of its operations, it will cause several issues…

So yeah, like you said, it would be much more easier if the current action is finished before to save the game state, even if with +100 agents it could be a little be complex to make sure no one is currently executing an action :confused:

Anyway, thank you again for your feedback, I will try to find a solution for that.