CN106155658A - The behavior tree editing machine realized based on U3D Plugin Mechanism - Google Patents

The behavior tree editing machine realized based on U3D Plugin Mechanism Download PDF

Info

Publication number
CN106155658A
CN106155658A CN201510164927.3A CN201510164927A CN106155658A CN 106155658 A CN106155658 A CN 106155658A CN 201510164927 A CN201510164927 A CN 201510164927A CN 106155658 A CN106155658 A CN 106155658A
Authority
CN
China
Prior art keywords
node
behavior tree
behavior
button
tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510164927.3A
Other languages
Chinese (zh)
Other versions
CN106155658B (en
Inventor
伍耀全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Sisanjiujiu Information Technology Co Ltd
Original Assignee
Guangzhou Sisanjiujiu Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Sisanjiujiu Information Technology Co Ltd filed Critical Guangzhou Sisanjiujiu Information Technology Co Ltd
Priority to CN201510164927.3A priority Critical patent/CN106155658B/en
Publication of CN106155658A publication Critical patent/CN106155658A/en
Application granted granted Critical
Publication of CN106155658B publication Critical patent/CN106155658B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a kind of behavior tree editing machine realized based on U3D Plugin Mechanism, and including behavior tree editor module, behavior tree previewing module, behavior tree derives module and behavior tree imports module;Behavior tree editor module provides behavior tree editor's panel, obtains a behavior tree for editor;Behavior tree previewing module is for being input to the behavior tree that behavior tree editor module editor obtains in certain game role in pre-stored scene of game, the action of game role is controlled by behavior tree, and play the behavior tree control process to game role, it is achieved the preview to the behavior tree running that editor obtains;Behavior tree is derived module and is used for deriving successful for preview behavior tree with specific data structure, calls during for game running.Offer behavior tree preview function, it is possible to the behavior tree effect that obtains of editor carries out preview easily and fast, convenient modifies debugging to editing the behavior tree obtained, thus improves behavior tree editorial efficiency comprehensively.

Description

The behavior tree editing machine realized based on U3D Plugin Mechanism
Technical field
The invention belongs to development of games technical field, be specifically related to a kind of row realized based on U3D Plugin Mechanism For tree editing machine.
Background technology
In game artificial intelligence AI programming field, the extensive application of behavior tree (Behavior-Tree) has been opened Beginning gradually to instead of the state machine (State Machine) that design is complicated and huge, more and more game use row Structure is realized as AI for tree.
In prior art, it is common to use Brainiac Designer instrument edit action tree, use this instrument editor During behavior tree, needing first to write out each tree node, the tree node then each write out generates dll and moves State chained library, and import in Brainiac Designer as plug-in unit.Although Brainiac Designer provides Source code, but, user is very difficult at Brainiac Designer instrument definition some trees meeting specific demand Node;Additionally, after being edited into a behavior tree, owing to behavior tree relates to large number of node, therefore, What programming personnel was difficult to prediction behavior tree realizes effect, causes inconvenient debugging behavior tree.
Summary of the invention
The defect existed for prior art, the present invention provides a kind of behavior realized based on U3D Plugin Mechanism Tree editing machine, can effectively solve the problems referred to above.
The technical solution used in the present invention is as follows:
The present invention provides a kind of behavior tree editing machine realized based on U3D Plugin Mechanism, edits including behavior tree Module, behavior tree previewing module, behavior tree derive module and behavior tree importing module;
Described behavior tree editor module provides behavior tree editor's panel, obtains a behavior tree for editor;
Described behavior tree previewing module is for being input to the behavior tree that described behavior tree editor module editor obtains In certain game role in pre-stored scene of game, control the dynamic of described game role by described behavior tree Make, and play the described behavior tree control process to described game role, it is achieved the behavior tree that editor is obtained The preview of running;
Described behavior tree is derived module and is used for deriving successful for preview described behavior tree with specific data structure, Call during for game running;
Described behavior tree imports module and compiles for the described behavior tree derived imports to described behavior tree again Collect module, by described behavior tree editor module, described behavior tree is improved.
Preferably, described behavior tree editor module includes behavior tree editor's panel and event sniffer;
Described behavior tree editor's panel provides behavior tree drawing area;
Described event sniffer is for monitoring described behavior tree drawing area, and concrete snoop procedure includes:
Step 1: when listening to described behavior tree drawing area and clicking event by mouse right button, to clicked Region ejection operation panel, wherein, described guidance panel includes: add node button, deletion of node button, Upper shifting present node button and move down present node button;
Step 2: then, each button in described guidance panel monitored by described event sniffer, and Differentiation following four situation:
1) when listening to described interpolation node button generation button and clicking on event, joint is ejected to clicked region Vertex type panel, described node type panel comprises the sub-button of behavior node, conditional sections idea button, sequentially The sub-button of node and the selection sub-button of node;Then, described event sniffer is in described node type panel Each sub-button monitor, if listen to described behavior node button generation button click on event, Behavior node is added to clicked region;If listening to described conditional sections idea button generation button to click on thing During part, to clicked region adding conditional node;If listening to described sequential node button generation button During click event, to clicked region order of addition node;If listening to the described sub-button of selection node send out When event clicked on by raw button, add to clicked region and select node;Then, described event sniffer is to Add the behavior node of described behavior tree drawing area, condition node, sequential node to or select node to carry out Monitor, when listening to described behavior node generation node double click event, ejected bag to double-clicking node location Selection Floater containing the configured concrete behavior instruction for controlling game role;Then, when receiving During the concrete behavior instruction that described Selection Floater returns, described event sniffer preserves node identification and particular row Corresponding relation for instruction;
When listening to described condition node, described sequential node or described selection node generation node double click event Time, ejected nodal community amendment panel to double-clicking node location, repaiied by described nodal community when receiving When changing the nodal community that panel sends, described event sniffer preserves the corresponding pass of node identification and nodal community System;
2) when listening to described deletion of node button generation button and clicking on event, described event sniffer will be by The knot removal that click on area is corresponding;
3) when listening to described upper shifting present node button generation button and clicking on event, described event sniffer The child node of clicked current button is moved up one successively;
4) when moving down present node button generation button described in listening to and clicking on event, described event sniffer The child node of clicked current button is moved down one successively.
Preferably, described behavior tree previewing module carries out preview to the running of described behavior tree, specifically wraps Include following steps:
S1, described behavior tree previewing module arranges the node in behavior tree and has 4 states, the most initial shape State, suspension status, the state that runs succeeded and execution status of fail;
Wherein, described original state refers to: before performing root node the most for the first time, all in behavior tree Node is original state;
Described suspension status refers to: when certain node the most when executed, or, any when certain node When one child node is being performed and is being not carried out complete, this node is the node of suspension status;
S2, if the total n-layer of the behavior tree that need to perform, by order from top to bottom, is designated as successively: the 1st layer, the 2nd Layer ... n-th layer;Wherein, n is natural number;1st layer is root node;N-th layer is leaf node, described Leaf node is behavior node;Described nonleaf node, it may be assumed that the 1st node layer, to the (n-1)th node layer, is control Node processed;
S3, every prefixed time interval, i.e. performs a root node, and execution method is:
S3.1, at current time, described behavior tree previewing module performs the 1st node layer, it may be assumed that read the described 1st The state of node layer, it is judged that the most described 1st node layer is suspension status, if it is, perform S3.2-S3.5;If it is not, then perform S3.6;
S3.2, described behavior tree previewing module reads each described 2nd node layer, finds current for hanging like 2nd node layer of state, is designated as: node 2.x;Wherein, when described 1st node layer is suspension status, its youngster Child node has and only a node is suspension status;
S3.3, described behavior tree previewing module performs the suspension function of node 2.x, judges described node 2.x simultaneously Whether it is leaf node, if it is not, then perform S3.4;Otherwise, S3.5 is directly performed;
S3.4, described behavior tree previewing module continues the suspension function that recurrence performs the descendant nodes of node 2.x, Until going to leaf node, then perform S3.5;Wherein, whole behavior tree has and an only branch each Node is in suspension status;
S3.5, described behavior tree previewing module performs the suspension function of leaf node;The suspension of described leaf node Function directly results in the behavior of game object and changes;
S3.6, when described 1st node layer is not suspension status, described behavior tree previewing module is according to the 1st layer of joint The type of point, traversal performs each the 2nd node layer,
If certain the 2nd node layer is behavior node, the most directly performs behavior node, and execution result is returned Back to described 1st node layer;Described 1st node layer, according to received execution result, changes oneself state;
If certain the 2nd node layer is for selecting node, then this selection node iteration performs each of this selection node Child node, if certain child node returns after performing performs failed notification message, then continues iteration and performs it His child node;Return, after performing simply by the presence of a child node, the notification message run succeeded, i.e. stop iteration, This selection node returns, to the father node of self, the notification message that runs succeeded, and then, described father node will be from Body state is arranged to carry out success status;Otherwise, perform unsuccessfully if all child nodes all return after performing Notification message, then: oneself state is arranged to carry out status of fail by described father node;
If certain the 2nd node layer is sequential node, then this sequential node iteration performs each of this sequential node Child node, only exists after a child node performs and returns the notification message that execution is failed, i.e. stop iteration, This sequential node returns to the father node of self and performs failed notification message, and, described father node will be from Body state is arranged to carry out status of fail;Otherwise, only after all child nodes perform, all returns run succeeded Notification message after, this sequential node just returns the notification message run succeeded to the father node of self, then, Oneself state is arranged to carry out success status by described father node.
Beneficial effects of the present invention is as follows:
The behavior tree editing machine realized based on U3D Plugin Mechanism that the present invention provides, having the advantage that can Directly to design AI behavior tree in U3D, without editing each tree node in advance, thus simplify row For tree editing process;Additionally, behavior tree editing machine provides behavior tree preview function, it is possible to easily and fast The behavior tree effect that obtains of editor is carried out preview, convenient modifies debugging to editing the behavior tree obtained, Thus improve behavior tree editorial efficiency comprehensively.
Accompanying drawing explanation
The structure principle chart of the behavior tree editing machine realized based on U3D Plugin Mechanism that Fig. 1 provides for the present invention;
Fig. 2 performs the schematic flow sheet of behavior tree for the behavior tree previewing module that the present invention provides.
Detailed description of the invention
Below in conjunction with accompanying drawing, the present invention is described in detail:
The present invention provides a kind of behavior tree editing machine realized based on U3D Plugin Mechanism, is at U3D Plugin Mechanism On the basis of, the instrument of the visual edit behavior tree write inside U3D.This instrument can directly exist In U3D design AI behavior tree, add various actions tree tree node, such as, selection node, sequential node, Behavior node or condition node etc., and the behavior tree of corresponding json file format can be derived.When actual motion is swum During play, reading record has the json file of AI behavior tree, thus to game object, such as leading role, little monster, boss In the corresponding AI behavior tree of appointment, it is achieved the Based Intelligent Control to game object, there is high configurability and high extension Property advantage, be beneficial to planning configuration and program expansible.
Concrete, in conjunction with Fig. 1, behavior tree editing machine include behavior tree editor module, behavior tree previewing module, Behavior tree derives module and behavior tree imports module.This four functional modules are discussed in detail individually below:
(1) behavior tree editor module
Behavior tree editor module provides behavior tree editor's panel, obtains a behavior tree for editor;That is: exist U3D edits the behavior tree being conceived, it is achieved to the interpolation of various tree nodes, delete, revise Parameter and check the function of all nodes, it is achieved the editting function of behavior tree.
Behavior tree editor module specifically includes behavior tree editor's panel and event sniffer;Described behavior tree is compiled Collect panel and behavior tree drawing area is provided;
Described event sniffer is for monitoring described behavior tree drawing area, and concrete snoop procedure includes:
Step 1: when listening to described behavior tree drawing area and clicking event by mouse right button, to clicked Region ejection operation panel, wherein, described guidance panel includes: add node button, deletion of node button, Upper shifting present node button and move down present node button;Wherein, by upper shifting present node button and moving down Present node button, it is achieved to the regulation moving on present node and moving down, by adjusting the position of present node, Finally have adjusted present node priority execution sequence in behavior tree node, more upwards near the joint of root node Point, is the most first performed.
Additionally, add after node button when selecting, can eject behavior node, condition node, sequential node and Select node panel.Here each behavior node and condition node are to need concrete code to realize, The object in game can be made to produce corresponding behavior.Belong to concrete service logic part
Step 2: then, each button in described guidance panel monitored by described event sniffer, its In, each button in guidance panel needs concrete code to realize, it is possible to make the object in game produce phase The behavior answered, belongs to concrete service logic part, on implementing, can make the behavior that the present invention provides Tree editing machine docking business logic modules, by the concrete controlling behavior of can producing needed for business logic modules Code is transmitted directly to behavior tree editing machine, the convenient editor to concrete behavior tree.
To each button snoop procedure, following four situation can be distinguished:
1) when listening to described interpolation node button generation button and clicking on event, joint is ejected to clicked region Vertex type panel, described node type panel comprises the sub-button of behavior node, conditional sections idea button, sequentially The sub-button of node and the selection sub-button of node;Then, described event sniffer is in described node type panel Each sub-button monitor, if listen to described behavior node button generation button click on event, Behavior node is added to clicked region;If listening to described conditional sections idea button generation button to click on thing During part, to clicked region adding conditional node;If listening to described sequential node button generation button During click event, to clicked region order of addition node;If listening to the described sub-button of selection node send out When event clicked on by raw button, add to clicked region and select node;Then, described event sniffer is to Add the behavior node of described behavior tree drawing area, condition node, sequential node to or select node to carry out Monitor, when listening to described behavior node generation node double click event, ejected bag to double-clicking node location Selection Floater containing the configured concrete behavior instruction for controlling game role;Then, when receiving During the concrete behavior instruction that described Selection Floater returns, described event sniffer preserves node identification and particular row Corresponding relation for instruction;
When listening to described condition node, described sequential node or described selection node generation node double click event Time, ejected nodal community amendment panel to double-clicking node location, repaiied by described nodal community when receiving When changing the nodal community that panel sends, described event sniffer preserves the corresponding pass of node identification and nodal community System;
2) when listening to described deletion of node button generation button and clicking on event, described event sniffer will be by The knot removal that click on area is corresponding;
3) when listening to described upper shifting present node button generation button and clicking on event, described event sniffer The child node of clicked current button is moved up one successively;
4) when moving down present node button generation button described in listening to and clicking on event, described event sniffer The child node of clicked current button is moved down one successively.
(2) behavior tree previewing module
For convenience of the execution principle of understanding behavior tree previewing module, the behavior tree first provided the present invention is correlated with Knowledge is introduced:
Behavior tree node includes four classes, sequential node, selection node, condition node and behavior node.Sequentially Node, selection node and condition node can be collectively referred to as combined joint or control node.
Wherein, when sequential node performs this node, iteration performs the child node of oneself, as long as running into a son Node returns, after performing, the message performing unsuccessfully False, then stop iteration, and also return to the father node of oneself Perform the message of unsuccessfully False;Otherwise, only when all child nodes all return the message of the True that runs succeeded, This node just returns True to the father node of oneself.Be equivalent to logic and operation.
When selecting node to perform this node, iteration performs oneself all of child node.As run into a child node Return True after execution, then stop iteration, and also return to True to the father node of oneself;Otherwise, the most all Child node all return False, this node just returns False to the father node of oneself.Be equivalent to logic or computing.
In whole behavior tree, only behavior node just can become leaf node, and also only have child node to be only and need Wanting particularly customized node, program realizes needing to write the subclass implemented according to logic and inherits it;Group Closing node and cannot function as leaf node, Main Function is the decision-making trend in controlling behavior tree.
After any node is performed, it is necessary to perform result to his father's node report, run succeeded (True) or hold Go unsuccessfully (False).This simple success unsuccessfully reports principle by the most dexterously for controlling the decision-making of whole tree Direction.
Flow process is moved towards, it is stipulated that all nodes have 4 shapes in order to what program facilitated the decision-making each time of controlling behavior tree State.Be respectively original state Init (i.e. this behavior tree iteration at the beginning time all nodes state), Perform suspension status Pending (i.e. this node or wherein some child node be performed and do not holding Row is complete), run succeeded state Finish, performs status of fail Fail.As long as having a child node is Pending State, including all grandchild node, then this node must be just Pending state.Child node runs succeeded With need after failure to father node return result.
In said process, child node is not limited to the child of certain node, also includes grandchild node etc., It is all descendent node of certain node.
Based on above-mentioned design principle, behavior tree previewing module specifically performs process and is:
Sequential node, selection node and condition node can be collectively referred to as combined joint or control node, is a class tool There is a kind of node of child node, and behavior node belongs to leaf node, is a kind of node not having child node.
Described behavior tree previewing module is for being input to the behavior tree that described behavior tree editor module editor obtains In certain game role in pre-stored scene of game, control the dynamic of described game role by described behavior tree Make, and play the described behavior tree control process to described game role, it is achieved the behavior tree that editor is obtained The preview of running;
Behavior tree previewing module carries out preview to the running of described behavior tree, specifically includes following steps:
S1, described behavior tree previewing module arranges the node in behavior tree and has 4 states, the most initial shape State, suspension status, the state that runs succeeded and execution status of fail;
Wherein, described original state refers to: before performing root node the most for the first time, all in behavior tree Node is original state;
Described suspension status refers to: when certain node the most when executed, or, any when certain node When one child node is being performed and is being not carried out complete, this node is the node of suspension status;
S2, if the total n-layer of the behavior tree that need to perform, by order from top to bottom, is designated as successively: the 1st layer, the 2nd Layer ... n-th layer;Wherein, n is natural number;1st layer is root node;N-th layer is leaf node, described Leaf node is behavior node;Described nonleaf node, it may be assumed that the 1st node layer, to the (n-1)th node layer, is control Node processed;
S3, every prefixed time interval, i.e. perform a root node, execution method as in figure 2 it is shown, include with Lower step:
S3.1, at current time, described behavior tree previewing module performs the 1st node layer, it may be assumed that read the described 1st The state of node layer, it is judged that the most described 1st node layer is suspension status, if it is, perform S3.2-S3.5;If it is not, then perform S3.6;
S3.2, described behavior tree previewing module reads each described 2nd node layer, finds current for hanging like 2nd node layer of state, is designated as: node 2.x;Wherein, when described 1st node layer is suspension status, its youngster Child node has and only a node is suspension status;
S3.3, described behavior tree previewing module performs the suspension function of node 2.x, judges described node 2.x simultaneously Whether it is leaf node, if it is not, then perform S3.4;Otherwise, S3.5 is directly performed;
S3.4, described behavior tree previewing module continues the suspension function that recurrence performs the descendant nodes of node 2.x, Until going to leaf node, then perform S3.5;Wherein, whole behavior tree has and an only branch each Node is in suspension status;
S3.5, described behavior tree previewing module performs the suspension function of leaf node;The suspension of described leaf node Function directly results in the behavior of game object and changes;
S3.6, when described 1st node layer is not suspension status, described behavior tree previewing module is according to the 1st layer of joint The type of point, traversal performs each the 2nd node layer,
If certain the 2nd node layer is behavior node, the most directly performs behavior node, and execution result is returned Back to described 1st node layer;Described 1st node layer, according to received execution result, changes oneself state;
If certain the 2nd node layer is for selecting node, then this selection node iteration performs each of this selection node Child node, if certain child node returns after performing performs failed notification message, then continues iteration and performs it His child node;Return, after performing simply by the presence of a child node, the notification message run succeeded, i.e. stop iteration, This selection node returns, to the father node of self, the notification message that runs succeeded, and then, described father node will be from Body state is arranged to carry out success status;Otherwise, perform unsuccessfully if all child nodes all return after performing Notification message, then: oneself state is arranged to carry out status of fail by described father node;
If certain the 2nd node layer is sequential node, then this sequential node iteration performs each of this sequential node Child node, only exists after a child node performs and returns the notification message that execution is failed, i.e. stop iteration, This sequential node returns to the father node of self and performs failed notification message, and, described father node will be from Body state is arranged to carry out status of fail;Otherwise, only after all child nodes perform, all returns run succeeded Notification message after, this sequential node just returns the notification message run succeeded to the father node of self, then, Oneself state is arranged to carry out success status by described father node.
In the present invention, every the time of setting, such as about 10 frames, i.e. perform a root node, constantly to certain The behavior role of individual game angle is controlled, according to iterations according to preview demand depending on, thus realize Preview function to behavior tree implementation effect.
(3) behavior tree derives module
Described behavior tree is derived module and is used for deriving successful for preview described behavior tree with specific data structure, Call during for game running;
Concrete, after behavior tree editor, derive behavior tree with suitable data structure.Such as, Json is used Data form derives behavior tree, when game running, reads the behavior tree file derived, by resolving this article Part obtains the behavior tree of correspondence, then behavior tree is assigned to game object, controls its corresponding behavior.
Implement, MiniJSON unserializing character string and serializing Json can be used, thus by json Export to character string and be stored in file, and json can be become by the character string parsing from file, it is achieved behavior Tree is derived or import feature.
(4) behavior tree imports module
Described behavior tree imports module and compiles for the described behavior tree derived imports to described behavior tree again Collect module, by described behavior tree editor module, described behavior tree is improved.Certainly, for front once The behavior tree not yet edited, it is also possible to import module by behavior tree and import to behavior tree editor module, Continue this behavior tree do not edited is carried out edit operation.
The behavior tree editing machine that the present invention provides, is to realize drawing boundary in the OnGUI function of EditorWindow The module of surface function.Including drawing button area, drafting behavior tree region.Draw button area and derivation is provided Button, importing button and preview button, the drafting of button has only to call GUILayout.Button and can realize. The data structure of storage behavior tree can be self-defining TreeNode with each item of the Queue, Queue of C# Class, the base attribute of TreeNode class includes child nodes and the degree of depth of present node.In addition it is also necessary to have The click of behavior tree node processes readjustment, ejects including right button node and adds deletion of node small panel, double-clicks joint Point flyout panel amendment nodal community.The Core Feature of editing machine editor module is at the outer structure of editing machine by user The tree thinking intactly edits out in Unity3d, and exports to required form, and a key composes trip On play object, it is achieved the preview to the behavior tree implementation effect that editor obtains, thus conveniently editor is obtained Behavior tree is modified debugging, thus improves behavior tree editorial efficiency comprehensively.
In sum, the present invention provide based on U3D Plugin Mechanism realize behavior tree editing machine, have with Lower advantage: can directly design AI behavior tree in U3D, without editing each tree node in advance, from And simplify behavior tree editing process;Additionally, behavior tree editing machine provides behavior tree preview function, it is possible to The behavior tree effect obtained editor easily and fast carries out preview, and the convenient behavior tree obtaining editor is carried out Amendment debugging, thus improve behavior tree editorial efficiency comprehensively.
The above is only the preferred embodiment of the present invention, it is noted that common for the art For technical staff, under the premise without departing from the principles of the invention, it is also possible to make some improvements and modifications, These improvements and modifications also should regard protection scope of the present invention.

Claims (3)

1. the behavior tree editing machine realized based on U3D Plugin Mechanism, it is characterised in that include behavior tree Editor module, behavior tree previewing module, behavior tree derive module and behavior tree importing module;
Described behavior tree editor module provides behavior tree editor's panel, obtains a behavior tree for editor;
Described behavior tree previewing module is for being input to the behavior tree that described behavior tree editor module editor obtains In certain game role in pre-stored scene of game, control the dynamic of described game role by described behavior tree Make, and play the described behavior tree control process to described game role, it is achieved the behavior tree that editor is obtained The preview of running;
Described behavior tree is derived module and is used for deriving successful for preview described behavior tree with specific data structure, Call during for game running;
Described behavior tree imports module and compiles for the described behavior tree derived imports to described behavior tree again Collect module, by described behavior tree editor module, described behavior tree is improved.
The behavior tree editing machine realized based on U3D Plugin Mechanism the most according to claim 1, its feature Being, described behavior tree editor module includes behavior tree editor's panel and event sniffer;
Described behavior tree editor's panel provides behavior tree drawing area;
Described event sniffer is for monitoring described behavior tree drawing area, and concrete snoop procedure includes:
Step 1: when listening to described behavior tree drawing area and clicking event by mouse right button, to clicked Region ejection operation panel, wherein, described guidance panel includes: add node button, deletion of node button, Upper shifting present node button and move down present node button;
Step 2: then, each button in described guidance panel monitored by described event sniffer, and Differentiation following four situation:
1) when listening to described interpolation node button generation button and clicking on event, joint is ejected to clicked region Vertex type panel, described node type panel comprises the sub-button of behavior node, conditional sections idea button, sequentially The sub-button of node and the selection sub-button of node;Then, described event sniffer is in described node type panel Each sub-button monitor, if listen to described behavior node button generation button click on event, Behavior node is added to clicked region;If listening to described conditional sections idea button generation button to click on thing During part, to clicked region adding conditional node;If listening to described sequential node button generation button During click event, to clicked region order of addition node;If listening to the described sub-button of selection node send out When event clicked on by raw button, add to clicked region and select node;Then, described event sniffer is to Add the behavior node of described behavior tree drawing area, condition node, sequential node to or select node to carry out Monitor, when listening to described behavior node generation node double click event, ejected bag to double-clicking node location Selection Floater containing the configured concrete behavior instruction for controlling game role;Then, when receiving During the concrete behavior instruction that described Selection Floater returns, described event sniffer preserves node identification and particular row Corresponding relation for instruction;
When listening to described condition node, described sequential node or described selection node generation node double click event Time, ejected nodal community amendment panel to double-clicking node location, repaiied by described nodal community when receiving When changing the nodal community that panel sends, described event sniffer preserves the corresponding pass of node identification and nodal community System;
2) when listening to described deletion of node button generation button and clicking on event, described event sniffer will be by The knot removal that click on area is corresponding;
3) when listening to described upper shifting present node button generation button and clicking on event, described event sniffer The child node of clicked current button is moved up one successively;
4) when moving down present node button generation button described in listening to and clicking on event, described event sniffer The child node of clicked current button is moved down one successively.
The behavior tree editing machine realized based on U3D Plugin Mechanism the most according to claim 1, its feature Being, described behavior tree previewing module carries out preview to the running of described behavior tree, specifically includes following Step:
S1, described behavior tree previewing module arranges the node in behavior tree and has 4 states, the most initial shape State, suspension status, the state that runs succeeded and execution status of fail;
Wherein, described original state refers to: before performing root node the most for the first time, all in behavior tree Node is original state;
Described suspension status refers to: when certain node the most when executed, or, any when certain node When one child node is being performed and is being not carried out complete, this node is the node of suspension status;
S2, if the total n-layer of the behavior tree that need to perform, by order from top to bottom, is designated as successively: the 1st layer, the 2nd Layer ... n-th layer;Wherein, n is natural number;1st layer is root node;N-th layer is leaf node, described Leaf node is behavior node;Described nonleaf node, it may be assumed that the 1st node layer, to the (n-1)th node layer, is control Node processed;
S3, every prefixed time interval, i.e. performs a root node, and execution method is:
S3.1, at current time, described behavior tree previewing module performs the 1st node layer, it may be assumed that read the described 1st The state of node layer, it is judged that the most described 1st node layer is suspension status, if it is, perform S3.2-S3.5;If it is not, then perform S3.6;
S3.2, described behavior tree previewing module reads each described 2nd node layer, finds current for hanging like 2nd node layer of state, is designated as: node 2.x;Wherein, when described 1st node layer is suspension status, its youngster Child node has and only a node is suspension status;
S3.3, described behavior tree previewing module performs the suspension function of node 2.x, judges described node 2.x simultaneously Whether it is leaf node, if it is not, then perform S3.4;Otherwise, S3.5 is directly performed;
S3.4, described behavior tree previewing module continues the suspension function that recurrence performs the descendant nodes of node 2.x, Until going to leaf node, then perform S3.5;Wherein, whole behavior tree has and an only branch each Node is in suspension status;
S3.5, described behavior tree previewing module performs the suspension function of leaf node;The suspension of described leaf node Function directly results in the behavior of game object and changes;
S3.6, when described 1st node layer is not suspension status, described behavior tree previewing module is according to the 1st layer of joint The type of point, traversal performs each the 2nd node layer,
If certain the 2nd node layer is behavior node, the most directly performs behavior node, and execution result is returned Back to described 1st node layer;Described 1st node layer, according to received execution result, changes oneself state;
If certain the 2nd node layer is for selecting node, then this selection node iteration performs each of this selection node Child node, if certain child node returns after performing performs failed notification message, then continues iteration and performs it His child node;Return, after performing simply by the presence of a child node, the notification message run succeeded, i.e. stop iteration, This selection node returns, to the father node of self, the notification message that runs succeeded, and then, described father node will be from Body state is arranged to carry out success status;Otherwise, perform unsuccessfully if all child nodes all return after performing Notification message, then: oneself state is arranged to carry out status of fail by described father node;
If certain the 2nd node layer is sequential node, then this sequential node iteration performs each of this sequential node Child node, only exists after a child node performs and returns the notification message that execution is failed, i.e. stop iteration, This sequential node returns to the father node of self and performs failed notification message, and, described father node will be from Body state is arranged to carry out status of fail;Otherwise, only after all child nodes perform, all returns run succeeded Notification message after, this sequential node just returns the notification message run succeeded to the father node of self, then, Oneself state is arranged to carry out success status by described father node.
CN201510164927.3A 2015-04-08 2015-04-08 The behavior tree editing machine realized based on U3D Plugin Mechanism Expired - Fee Related CN106155658B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510164927.3A CN106155658B (en) 2015-04-08 2015-04-08 The behavior tree editing machine realized based on U3D Plugin Mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510164927.3A CN106155658B (en) 2015-04-08 2015-04-08 The behavior tree editing machine realized based on U3D Plugin Mechanism

Publications (2)

Publication Number Publication Date
CN106155658A true CN106155658A (en) 2016-11-23
CN106155658B CN106155658B (en) 2019-03-05

Family

ID=57336684

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510164927.3A Expired - Fee Related CN106155658B (en) 2015-04-08 2015-04-08 The behavior tree editing machine realized based on U3D Plugin Mechanism

Country Status (1)

Country Link
CN (1) CN106155658B (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815009A (en) * 2016-12-05 2017-06-09 上海时年信息科技有限公司 The method and system of the multiple movable body behaviors of simulation
CN106899441A (en) * 2017-03-16 2017-06-27 网易(杭州)网络有限公司 Malfunctioning node localization method and device
CN106933744A (en) * 2017-03-21 2017-07-07 网易(杭州)网络有限公司 Node revision status indication method and device, electronic equipment and storage medium
CN106959850A (en) * 2017-03-02 2017-07-18 上海时年信息科技有限公司 Automatically generate the method and system of behavior tree code
CN107085519A (en) * 2017-05-04 2017-08-22 网易(杭州)网络有限公司 Behavior tree debugging processing method, device, system, storage medium and processor
CN108563437A (en) * 2018-04-19 2018-09-21 清华大学 Development approach, system, computer equipment and the storage medium of network function
CN108614691A (en) * 2018-04-19 2018-10-02 清华大学 Development approach, system, computer equipment and the storage medium of network function
CN109189504A (en) * 2018-09-20 2019-01-11 腾讯科技(深圳)有限公司 Behavior executes method, behavior tree generation method, device and computer equipment
CN109925712A (en) * 2019-03-18 2019-06-25 网易(杭州)网络有限公司 A kind of virtual objects controlled system
CN110008304A (en) * 2019-04-03 2019-07-12 网易(杭州)网络有限公司 The difference visible processing method and device of behavior tree
CN110134375A (en) * 2019-05-14 2019-08-16 网易(杭州)网络有限公司 Control method, device and the readable storage medium storing program for executing of game role behavior
CN110831677A (en) * 2017-05-04 2020-02-21 Mz知识产权控股有限责任公司 System and method for managing content presentation in a multiplayer online game
CN111111202A (en) * 2019-12-26 2020-05-08 北京像素软件科技股份有限公司 Game AI behavior logic control method and system
CN111135559A (en) * 2019-12-27 2020-05-12 北京像素软件科技股份有限公司 Game data processing method and device, electronic equipment and storage medium
CN111249733A (en) * 2020-01-09 2020-06-09 完美世界(北京)软件科技发展有限公司 Method and device for creating virtual object
WO2021082759A1 (en) * 2019-10-30 2021-05-06 上海莉莉丝科技股份有限公司 Visualized logic execution method, system and device, and medium
CN113515272A (en) * 2020-04-09 2021-10-19 深圳轩科华智能科技有限公司 Visual programming method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073816A (en) * 2010-12-31 2011-05-25 兰雨晴 Behavior-based software trusted measurement system and method
CN102495751A (en) * 2011-11-29 2012-06-13 北京像素软件科技股份有限公司 Method and device for realizing simulation scene
CN103440199A (en) * 2013-08-27 2013-12-11 百度在线网络技术(北京)有限公司 Method and device for guiding test
CN103761108A (en) * 2014-02-14 2014-04-30 杭州朗和科技有限公司 Method and device for achieving behavior tree

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073816A (en) * 2010-12-31 2011-05-25 兰雨晴 Behavior-based software trusted measurement system and method
CN102495751A (en) * 2011-11-29 2012-06-13 北京像素软件科技股份有限公司 Method and device for realizing simulation scene
CN103440199A (en) * 2013-08-27 2013-12-11 百度在线网络技术(北京)有限公司 Method and device for guiding test
CN103761108A (en) * 2014-02-14 2014-04-30 杭州朗和科技有限公司 Method and device for achieving behavior tree

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815009A (en) * 2016-12-05 2017-06-09 上海时年信息科技有限公司 The method and system of the multiple movable body behaviors of simulation
WO2018103493A1 (en) * 2016-12-05 2018-06-14 上海时年信息科技有限公司 Method and system for simulating behaviours of multiple moving bodies
CN106959850A (en) * 2017-03-02 2017-07-18 上海时年信息科技有限公司 Automatically generate the method and system of behavior tree code
CN106899441B (en) * 2017-03-16 2019-09-03 网易(杭州)网络有限公司 Malfunctioning node localization method and system
CN106899441A (en) * 2017-03-16 2017-06-27 网易(杭州)网络有限公司 Malfunctioning node localization method and device
CN106933744A (en) * 2017-03-21 2017-07-07 网易(杭州)网络有限公司 Node revision status indication method and device, electronic equipment and storage medium
CN107085519B (en) * 2017-05-04 2020-09-11 网易(杭州)网络有限公司 Behavior tree debugging processing method, device and system, storage medium and processor
CN110831677A (en) * 2017-05-04 2020-02-21 Mz知识产权控股有限责任公司 System and method for managing content presentation in a multiplayer online game
CN107085519A (en) * 2017-05-04 2017-08-22 网易(杭州)网络有限公司 Behavior tree debugging processing method, device, system, storage medium and processor
CN108563437B (en) * 2018-04-19 2021-08-20 图灵人工智能研究院(南京)有限公司 Network function development method, system, computer device and storage medium
CN108563437A (en) * 2018-04-19 2018-09-21 清华大学 Development approach, system, computer equipment and the storage medium of network function
CN108614691B (en) * 2018-04-19 2021-08-24 交叉信息核心技术研究院(西安)有限公司 Network function development method, system, computer device and storage medium
CN108614691A (en) * 2018-04-19 2018-10-02 清华大学 Development approach, system, computer equipment and the storage medium of network function
CN109189504A (en) * 2018-09-20 2019-01-11 腾讯科技(深圳)有限公司 Behavior executes method, behavior tree generation method, device and computer equipment
CN109189504B (en) * 2018-09-20 2020-04-28 腾讯科技(深圳)有限公司 Behavior execution method, behavior tree generation device and computer equipment
CN109925712A (en) * 2019-03-18 2019-06-25 网易(杭州)网络有限公司 A kind of virtual objects controlled system
CN110008304A (en) * 2019-04-03 2019-07-12 网易(杭州)网络有限公司 The difference visible processing method and device of behavior tree
CN110134375A (en) * 2019-05-14 2019-08-16 网易(杭州)网络有限公司 Control method, device and the readable storage medium storing program for executing of game role behavior
CN110134375B (en) * 2019-05-14 2023-11-21 网易(杭州)网络有限公司 Game character behavior control method and device and readable storage medium
WO2021082759A1 (en) * 2019-10-30 2021-05-06 上海莉莉丝科技股份有限公司 Visualized logic execution method, system and device, and medium
CN111111202B (en) * 2019-12-26 2023-08-29 北京像素软件科技股份有限公司 Game AI behavior logic control method and system
CN111111202A (en) * 2019-12-26 2020-05-08 北京像素软件科技股份有限公司 Game AI behavior logic control method and system
CN111135559A (en) * 2019-12-27 2020-05-12 北京像素软件科技股份有限公司 Game data processing method and device, electronic equipment and storage medium
CN111135559B (en) * 2019-12-27 2023-06-27 北京像素软件科技股份有限公司 Game data processing method and device, electronic equipment and storage medium
CN111249733A (en) * 2020-01-09 2020-06-09 完美世界(北京)软件科技发展有限公司 Method and device for creating virtual object
CN111249733B (en) * 2020-01-09 2023-10-13 完美世界(北京)软件科技发展有限公司 Method and device for creating virtual object
CN113515272A (en) * 2020-04-09 2021-10-19 深圳轩科华智能科技有限公司 Visual programming method and system

Also Published As

Publication number Publication date
CN106155658B (en) 2019-03-05

Similar Documents

Publication Publication Date Title
CN106155658A (en) The behavior tree editing machine realized based on U3D Plugin Mechanism
CN105739983B (en) Shell script editing device and its implementation
CN103197929B (en) A kind of graphic programming system and method for children-oriented
CN106293664A (en) Code generating method and device
CN110287088B (en) Automatic testing method based on dynamic UI model
CN102508654A (en) Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)
CN105631925A (en) Three-dimensional scene generation method based on OSG three-dimensional rendering engine preprocessing and device thereof
Braberman et al. Controller synthesis: From modelling to enactment
CN109189469A (en) Android application micro services method and system based on reflection
CN110471670A (en) A kind of compiler, Compilation Method and method for tracing and DCS controller
CN108804630A (en) A kind of big data intellectual analysis service system of Industry-oriented application
CN102479079A (en) Method and device for generating application
CN102314349A (en) Spatial information functional plug-in workflow construction method
CN107875632A (en) Realize the method, system and artificial intelligence behavior editing machine of artificial intelligence behavior
CN110413277A (en) A kind of generation method and system at the interface UI
CN106096159B (en) A kind of implementation method of distributed system behavior simulation analysis system under cloud platform
CN102929853A (en) DCS (Data Communication System) project data generating system and method based on Excel sheet association
CN104462329B (en) A kind of operation flow method for digging suitable for diverse environments
CN114239237A (en) Power distribution network simulation scene generation system and method supporting digital twinning
CN107391136A (en) A kind of programing system and method based on streaming
CN103955368B (en) A kind of adaptive support system of software obfuscation and development approach
CN111445382B (en) MAYA-based three-dimensional software scene resource optimization method
Iqbal et al. Meta-simulation of large WSN on multi-core computers
CN111611679B (en) Modeling method of sensor scheduling behavior tree model
CN106227036B (en) A kind of symmetrical discrete event system On-line Control rule reconstructing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190305

Termination date: 20200408

CF01 Termination of patent right due to non-payment of annual fee