Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Help Wanted Save and restore state of AI planner?

Discussion in 'AI & Navigation Previews' started by Noxalus, Jul 14, 2020.

  1. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    76
    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?
     
  2. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    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.
     
  3. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    76
    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 :/

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