Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于behaviac节点复用的疑问 #34

Open
rooong opened this issue Apr 22, 2018 · 3 comments
Open

关于behaviac节点复用的疑问 #34

rooong opened this issue Apr 22, 2018 · 3 comments

Comments

@rooong
Copy link

rooong commented Apr 22, 2018

behaviac是否支持自定义节点?譬如说,我想加一个动作节点,它的功能不是当前树对应类型的成员函数,而是另外的一个类型支持的功能(目前看好像只能通过子树的概念实现)

因为这个涉及到节点的复用,如果一个动作节点定义好了,它在任意的一棵树上,可以随时被创建调用。
目前看使用子树的概念可以达到类似的效果,但是本身概念上感觉被复杂化了,我的理解,动作节点就只做动作行为,条件节点就只做条件行为(这里说的是原子化的动作节点和条件节点),而子树,本身是树,它是一系列节点的组合,当它只做一个节点的事情的时候,它的效果是相当于原子节点,但是毕竟变复杂了。

@zhenmu
Copy link

zhenmu commented Apr 28, 2018

一个类型调用另外一个类型的功能?
感觉不太支持,子树也不能支持吧?(不知道新版本改了没。)

我们目前遇到这种情况:
方案1. 注册一个全局实例,参考:http://www.behaviac.com/tutorial_3_agent_instance/
方案2. 行为树这边只维护一个类型 比如叫 ObjAgent, 所有怪物、npc、角色用到的AI接口都在这里实现,具体实现逻辑根据类型不同实现(有些接口逻辑是一样的。)。 具体实例化对象时,怪物、npc、角色类里面创建一个ObjAgent对象,赋给它不同的行为树,然后run里定时调用 objAgent的exec()

@rooong
Copy link
Author

rooong commented May 8, 2018

@zhenmu 大概就只能这么处理了

@kecookier
Copy link
Contributor

Agent可以添加自定义类型成员,可以调用成员的接口。效果和自定义节点是一样的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants