Jump to content

  • Log In with Google      Sign In   
  • Create Account

Decision Tree Delays


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 UraniumSlug   Members   -  Reputation: 157

Like
0Likes
Like

Posted 05 June 2014 - 02:32 PM

I've graduated from using a cluttered FSM for my AI to a Decision Tree of my own creation. I'm using Unity3d and C# for this pet project. I've structured my tree in the following manner without pointer capabilities. However my question, could apply to any decision tree which might implement coroutines.

	protected virtual void Update()
	{
		StartCoroutine(TriggerTree());
	}

	IEnumerator TriggerTree()
	{
		yield return rootDecisionNode.StartCoroutine(rootDecisionNode.TriggerPath());
	}

Currently every Update() call a run through of the tree's branches is triggered and it checks branch logic paths to see what leaf should be reached. The last Action leaves at the end of each branch return new WaitForSeconds.

 

I'm interested in learning the best way to halt the decision tree or perform an animation but still be able to run the tree and check if another leaf has been reached. So if my character is idling, wait for the idle animation to finish before playing another idle animation but if the character is damaged then trigger the damage animation. Is my code design for a decision tree without pointers sound enough as it is?



Sponsor:

#2 UraniumSlug   Members   -  Reputation: 157

Like
0Likes
Like

Posted 09 June 2014 - 03:36 AM

Upon further thought, a structure could be returned with the Action type that was run and the amount of seconds to wait. Store the last Action type, if the new Action type is the same as the last Action type do nothing, if it's a different action type then trigger it.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS