CN106155658B - 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 PDFInfo
- Publication number
- CN106155658B CN106155658B CN201510164927.3A CN201510164927A CN106155658B CN 106155658 B CN106155658 B CN 106155658B CN 201510164927 A CN201510164927 A CN 201510164927A CN 106155658 B CN106155658 B CN 106155658B
- 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.)
- Expired - Fee Related
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, including behavior tree editor module, behavior tree previewing module, behavior tree export module and behavior tree import modul;Behavior tree editor module provides behavior tree and edits panel, obtains a behavior tree for editing;In some game role that behavior tree previewing module is used to for the behavior tree that behavior tree editor module editor obtains being input in pre-stored scene of game, the movement of game role is controlled by behavior tree, and behavior tree is played to the control process of game role, realize the preview of the behavior tree operational process obtained to editor;Behavior tree export module is for exporting the successful behavior tree of preview with specific data structure, for calling when game running.Offer behavior tree preview function can carry out preview to the obtained behavior tree effect of editor easily and fast, convenient to modify debugging to editing obtained behavior tree, to improve behavior tree editorial efficiency comprehensively.
Description
Technical field
The invention belongs to development of games technical fields, and in particular to a kind of behavior tree volume realized based on U3D Plugin Mechanism
Collect device.
Background technique
In game artificial intelligence AI programming field, the extensive use of behavior tree (Behavior-Tree) have begun by
The gradually state machine (State Machine) complicated and huge instead of design, more and more game usage behavior trees are as AI's
Realize structure.
In the prior art, it is common to use Brainiac Designer tool edit action tree uses the tool edit action
It when tree, needs to write out each tree node first, each tree node write out is then generated into dll dynamic link library, and make
It is imported into Brainiac Designer for plug-in unit.Although Brainiac Designer provides source code, user is very
It is difficult in some tree nodes for meeting specific demand of Brainiac Designer instrument definition;In addition, when being edited into a behavior
After tree, since behavior tree is related to large number of node, programming personnel is difficult to predict the realization effect of behavior tree, causes
Inconvenience debugs behavior tree.
Summary of the invention
In view of the defects existing in the prior art, the present invention provides a kind of behavior tree editor realized based on U3D Plugin Mechanism
Device can effectively solve the above problems.
The technical solution adopted by the invention is as follows:
The present invention provides a kind of behavior tree editing machine realized based on U3D Plugin Mechanism, including behavior tree editor module, row
For tree previewing module, behavior tree export module and behavior tree import modul;
The behavior tree editor module provides behavior tree and edits panel, obtains a behavior tree for editing;
The behavior tree previewing module is prestored for the behavior tree that the behavior tree editor module editor obtains to be input to
It stores up in some game role in scene of game, the movement of the game role is controlled by the behavior tree, and described in broadcasting
Behavior tree realizes the preview of the behavior tree operational process obtained to editor to the control process of the game role;
The behavior tree export module is used for that successfully the behavior tree to be exported with specific data structure by preview, for game
Run time call;
The behavior tree import modul, which is used to the derived behavior tree importeding into the behavior tree again, edits mould
Block improves the behavior tree by the behavior tree editor module.
Preferably, the behavior tree editor module includes behavior tree editor's panel and event sniffer;
The behavior tree editor panel provides behavior tree drawing area;
For monitoring the behavior tree drawing area, specific snoop procedure includes: the event sniffer
Step 1: when listening to the behavior tree drawing area and clicking event by mouse right button, to being clicked region bullet
Operation panel out, wherein the operation panel include: addition node button, deletion of node button, move up present node button and
Move down present node button;
Step 2: then, the event sniffer monitors each button in the operation panel, and distinguish with
Lower four kinds of situations:
1) when listening to the addition node button generation button click event, node type is popped up to region is clicked
Panel, the node type panel include the sub- button of behavior node, conditional sections idea button, the sub- button of sequential node and selection section
Idea button;Then, the event sniffer monitors each sub- button in the node type panel, if monitored
When button click event occurs to the sub- button of the behavior node, behavior node is added to region is clicked;If listening to institute
When stating conditional sections idea button and button occurs click event, to being clicked region adding conditional node;If listened to described suitable
Button occurs for sequence node button when clicking event, to being clicked region order of addition node;If listening to the selection section
When button click event occurs for idea button, node is selected to region addition is clicked;Then, the event sniffer is to having added
It is added to the behavior node of the behavior tree drawing area, condition node, sequential node or selection node to be monitored, when listening to
It include configured for controlling game to being popped up by double-click node location when node double click event occurs for the behavior node
The Selection Floater of the concrete behavior instruction of role;Then, when receiving the concrete behavior instruction that the Selection Floater returns, institute
State the corresponding relationship that event sniffer saves node identification and concrete behavior instruction;
When listening to the condition node, the sequential node or selection node generation node double click event, to
Panel is modified by double-click node location pop-up nodal community, the node that panel is sent is modified by the nodal community when receiving
When attribute, the event sniffer saves the corresponding relationship of node identification and nodal community;
2) when listening to the deletion of node button generation button click event, the event sniffer will be clicked area
The corresponding knot removal in domain;
3) when listen to it is described move up present node button and button occurs click event when, the event sniffer will be by point
The child node of the current button hit moves one upwards in turn;
4) when listen to it is described move down present node button and button occurs click event when, the event sniffer will be by point
The child node of the current button hit successively moves down one.
Preferably, the behavior tree previewing module carries out preview to the operational process of the behavior tree, specifically includes following
Step:
S1, the node in behavior tree previewing module setting behavior tree have 4 states, respectively original state, hang
Extension state, the state that runs succeeded and execution status of fail;
Wherein, the original state refers to: before the initial root node of execution for the first time, all nodes are in behavior tree
Original state;
The suspension status refers to: when some node just when executed, alternatively, work as some node any one height section
Point is being performed and is being not carried out when finishing, which is the node of suspension status;
S2, by sequence from top to bottom, is successively denoted as: the 1st layer, the 2nd layer ... n-th if the behavior tree that need to be executed shares n-layer
Layer;Wherein, n is natural number;1st layer is root node;N-th layer is leaf node, and the leaf node is behavior node;
The nonleaf node, it may be assumed that the 1st node layer to the (n-1)th node layer is control node;
S3 executes a root node every prefixed time interval, execute method are as follows:
S3.1, at current time, the behavior tree previewing module executes the 1st node layer, it may be assumed that reads the 1st node layer
State, whether judge the 1st node layer currently is suspension status, if it is, execute S3.2-S3.5;If it is not, then holding
Row S3.6;
S3.2, the behavior tree previewing module read each 2nd node layer, and finding current is the of suspension status
2 node layers, are denoted as: node 2.x;Wherein, when the 1st node layer is suspension status, have in child and only one
A node is suspension status;
S3.3, the behavior tree previewing module execute the suspension function of node 2.x, while whether judging the node 2.x
For leaf node, if it is not, then executing S3.4;Otherwise, S3.5 is directly executed;
S3.4, the behavior tree previewing module continues the suspension function that recurrence executes the descendant nodes of node 2.x, until holding
Row arrives leaf node, then executes S3.5;Wherein, whole behavior tree has and each node of only one branch is in hanging like
State;
S3.5, the behavior tree previewing module execute the suspension function of leaf node;The suspension function of the leaf node
The behavior for directly resulting in game object changes;
S3.6, when the 1st node layer is not suspension status, the behavior tree previewing module is according to the 1st node layer
Type, traversal execute each 2nd node layer,
If some the 2nd node layer is behavior node, behavior node is directly executed, and implementing result is returned into institute
State the 1st node layer;1st node layer implementing result based on the received changes oneself state;
If some the 2nd node layer is selection node, which executes each height section of the selection node
Point continues iteration and executes other child nodes if some child node returns to the notification message for executing failure after executing;As long as depositing
The notification message to run succeeded is returned to after a child node executes, i.e. stopping iteration, father node of the selection node to itself
The notification message to run succeeded is returned to, then, oneself state is arranged to carry out success status by the father node;Otherwise, if
All child nodes return to the notification message for executing failure after executing, then: oneself state is arranged to carry out mistake by the father node
Lose state;
If some the 2nd node layer is sequential node, which executes each height section of the sequential node
Point only exists after child node executes and returns to the notification message for executing failure, is i.e. stopping iteration, the sequential node to itself
Father node return to the notification message for executing failure, also, oneself state is arranged to carry out status of fail by the father node;It is no
Then, after only returning to the notification message to run succeeded after all child nodes execute, which is just saved to the father of itself
Point returns to the notification message to run succeeded, and then, oneself state is arranged to carry out success status by the father node.
Beneficial effects of the present invention are as follows:
The behavior tree editing machine provided by the invention realized based on U3D Plugin Mechanism, having the advantage that can be in U3D
In directly design AI behavior tree, without editing each tree node in advance, to simplify behavior tree editing process;In addition,
Behavior tree editing machine provides behavior tree preview function, can carry out easily and fast to the behavior tree effect that editor obtains pre-
It lookes at, the convenient behavior tree obtained to editor is modified debugging, to improve behavior tree editorial efficiency comprehensively.
Detailed description of the invention
Fig. 1 is the structure principle chart of the behavior tree editing machine provided by the invention realized based on U3D Plugin Mechanism;
Fig. 2 is the flow diagram of behavior tree previewing module process performing tree provided by the invention.
Specific embodiment
Below in conjunction with attached 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 on the basis of U3D Plugin Mechanism
On, the tool for the visual edit behavior tree write inside U3D.The tool can design AI behavior tree directly in U3D,
The tree node of various actions tree is added, for example, selection node, sequential node, behavior node or condition node etc., and phase can be exported
The behavior tree for the json file format answered.When actual motion game, the json file that record has AI behavior tree is read, thus to
Game object, such as leading role, small monster, the specified corresponding AI behavior tree of boss realize the intelligent control to game object, have height
The advantage of configurability and high scalability is configured expansible with program conducive to planning.
Specifically, in conjunction with Fig. 1, behavior tree editing machine includes that behavior tree editor module, behavior tree previewing module, behavior tree are led
Module and behavior tree import modul out.This four functional modules are discussed in detail individually below:
(1) behavior tree editor module
Behavior tree editor module provides behavior tree and edits panel, obtains a behavior tree for editing;That is: it is compiled in U3D
Conceived good behavior tree is collected, it realizes to the addition of various tree nodes, deletion, modify parameter and check all sections
The function of point realizes the editting function of behavior tree.
Behavior tree editor module specifically includes behavior tree editor's panel and event sniffer;The behavior tree edits panel
Offer behavior tree drawing area;
For monitoring the behavior tree drawing area, specific snoop procedure includes: the event sniffer
Step 1: when listening to the behavior tree drawing area and clicking event by mouse right button, to being clicked region bullet
Operation panel out, wherein the operation panel include: addition node button, deletion of node button, move up present node button and
Move down present node button;Wherein, it by moving up present node button and moving down present node button, realizes on present node
The adjusting for moving and moving down, by adjusting the position of present node, final adjustment present node is successive in behavior tree node
Sequence is executed, the node of more upward close root node is more first performed.
In addition, will pop up behavior node, condition node, sequential node and selection node after node button is added in selection
Panel.Here each behavior node and condition node is that specific code is needed to realize, can make the object in game
Generate corresponding behavior.Belong to specific service logic part
Step 2: then, the event sniffer monitors each button in the operation panel, wherein operation
Each button in panel needs specific code to realize, the object in game can be made to generate corresponding behavior, belongs to specific
Service logic part can make behavior tree editing machine provided by the invention docking business logic modules, by industry in specific implementation
The code that specific controlling behavior can be generated needed for business logic module is transmitted directly to behavior tree editing machine, convenient to particular row
For the editor of tree.
To each button snoop procedure, following four situation can be distinguished:
1) when listening to the addition node button generation button click event, node type is popped up to region is clicked
Panel, the node type panel include the sub- button of behavior node, conditional sections idea button, the sub- button of sequential node and selection section
Idea button;Then, the event sniffer monitors each sub- button in the node type panel, if monitored
When button click event occurs to the sub- button of the behavior node, behavior node is added to region is clicked;If listening to institute
When stating conditional sections idea button and button occurs click event, to being clicked region adding conditional node;If listened to described suitable
Button occurs for sequence node button when clicking event, to being clicked region order of addition node;If listening to the selection section
When button click event occurs for idea button, node is selected to region addition is clicked;Then, the event sniffer is to having added
It is added to the behavior node of the behavior tree drawing area, condition node, sequential node or selection node to be monitored, when listening to
It include configured for controlling game to being popped up by double-click node location when node double click event occurs for the behavior node
The Selection Floater of the concrete behavior instruction of role;Then, when receiving the concrete behavior instruction that the Selection Floater returns, institute
State the corresponding relationship that event sniffer saves node identification and concrete behavior instruction;
When listening to the condition node, the sequential node or selection node generation node double click event, to
Panel is modified by double-click node location pop-up nodal community, the node that panel is sent is modified by the nodal community when receiving
When attribute, the event sniffer saves the corresponding relationship of node identification and nodal community;
2) when listening to the deletion of node button generation button click event, the event sniffer will be clicked area
The corresponding knot removal in domain;
3) when listen to it is described move up present node button and button occurs click event when, the event sniffer will be by point
The child node of the current button hit moves one upwards in turn;
4) when listen to it is described move down present node button and button occurs click event when, the event sniffer will be by point
The child node of the current button hit successively moves down one.
(2) behavior tree previewing module
For convenience of understand behavior tree previewing module implementation principle, first to behavior tree relevant knowledge provided by the invention into
Row is introduced:
Behavior tree node includes four classes, sequential node, selection node, condition node and behavior node.Sequential node, selection
Node and condition node can be collectively referred to as combined joint or control node.
Wherein, when sequential node executes this node, iteration executes the child node of oneself, executes as long as encountering a child node
The message for executing failure False is returned afterwards, then stops iteration, and also return to the father node of oneself and execute disappearing for failure False
Breath;Otherwise, only when all child nodes return to the message for the True that runs succeeded, this node is just returned to the father node of oneself
True.It is equivalent to logic and operation.
When selection node executes this node, iteration executes oneself all child node.After such as encountering a child node execution
True is returned, then stops iteration, and also return to True to the father node of oneself;Otherwise, only all child nodes return
False, this node just return to False to the father node of oneself.It is equivalent to logic or operation.
In whole behavior tree, only behavior node could become leaf node, and it is special also to only have child node to be only needs
The node of customization, program, which is realized, needs the subclass for writing specific implementation according to logic to inherit it;Combined joint cannot function as leaf
Child node, main function are for the decision trend in controlling behavior tree.
After any node is performed, it is necessary to its father node report executing as a result, running succeeded (True) or executing failure
(False).This simply successfully unsuccessfully reports principle by very dexterously for controlling the decision direction of whole tree.
In order to program facilitate controlling behavior tree each time decision move towards process, it is specified that all nodes have 4 states.Point
Be not original state Init (i.e. this behavior tree iteration at the beginning when all nodes state), the suspension status being carrying out
Pending (i.e. the node or wherein some child node be performed and be not carried out finish), run succeeded state
Finish executes status of fail Fail.As long as a child node is Pending state, including all grandchild nodes, then should
Node must be just Pending state.Child node runs succeeded and needs to return the result to father node after failing.
In the above process, child node is not limited to the child of some node, is some also including grandchild node etc.
All descendent nodes of node.
Based on above-mentioned design principle, the specific implementation procedure of behavior tree previewing module are as follows:
Sequential node, selection node and condition node can be collectively referred to as combined joint or control node, be a kind of with son section
A kind of node of point, and behavior node belongs to leaf node, is a kind of node of not child node.
The behavior tree previewing module is prestored for the behavior tree that the behavior tree editor module editor obtains to be input to
It stores up in some game role in scene of game, the movement of the game role is controlled by the behavior tree, and described in broadcasting
Behavior tree realizes the preview of the behavior tree operational process obtained to editor to the control process of the game role;
Behavior tree previewing module carries out preview to the operational process of the behavior tree, specifically includes the following steps:
S1, the node in behavior tree previewing module setting behavior tree have 4 states, respectively original state, hang
Extension state, the state that runs succeeded and execution status of fail;
Wherein, the original state refers to: before the initial root node of execution for the first time, all nodes are in behavior tree
Original state;
The suspension status refers to: when some node just when executed, alternatively, work as some node any one height section
Point is being performed and is being not carried out when finishing, which is the node of suspension status;
S2, by sequence from top to bottom, is successively denoted as: the 1st layer, the 2nd layer ... n-th if the behavior tree that need to be executed shares n-layer
Layer;Wherein, n is natural number;1st layer is root node;N-th layer is leaf node, and the leaf node is behavior node;
The nonleaf node, it may be assumed that the 1st node layer to the (n-1)th node layer is control node;
S3 executes a root node every prefixed time interval, it is as shown in Figure 2 to execute method, comprising the following steps:
S3.1, at current time, the behavior tree previewing module executes the 1st node layer, it may be assumed that reads the 1st node layer
State, whether judge the 1st node layer currently is suspension status, if it is, execute S3.2-S3.5;If it is not, then holding
Row S3.6;
S3.2, the behavior tree previewing module read each 2nd node layer, and finding current is the of suspension status
2 node layers, are denoted as: node 2.x;Wherein, when the 1st node layer is suspension status, have in child and only one
A node is suspension status;
S3.3, the behavior tree previewing module execute the suspension function of node 2.x, while whether judging the node 2.x
For leaf node, if it is not, then executing S3.4;Otherwise, S3.5 is directly executed;
S3.4, the behavior tree previewing module continues the suspension function that recurrence executes the descendant nodes of node 2.x, until holding
Row arrives leaf node, then executes S3.5;Wherein, whole behavior tree has and each node of only one branch is in hanging like
State;
S3.5, the behavior tree previewing module execute the suspension function of leaf node;The suspension function of the leaf node
The behavior for directly resulting in game object changes;
S3.6, when the 1st node layer is not suspension status, the behavior tree previewing module is according to the 1st node layer
Type, traversal execute each 2nd node layer,
If some the 2nd node layer is behavior node, behavior node is directly executed, and implementing result is returned into institute
State the 1st node layer;1st node layer implementing result based on the received changes oneself state;
If some the 2nd node layer is selection node, which executes each height section of the selection node
Point continues iteration and executes other child nodes if some child node returns to the notification message for executing failure after executing;As long as depositing
The notification message to run succeeded is returned to after a child node executes, i.e. stopping iteration, father node of the selection node to itself
The notification message to run succeeded is returned to, then, oneself state is arranged to carry out success status by the father node;Otherwise, if
All child nodes return to the notification message for executing failure after executing, then: oneself state is arranged to carry out mistake by the father node
Lose state;
If some the 2nd node layer is sequential node, which executes each height section of the sequential node
Point only exists after child node executes and returns to the notification message for executing failure, is i.e. stopping iteration, the sequential node to itself
Father node return to the notification message for executing failure, also, oneself state is arranged to carry out status of fail by the father node;It is no
Then, after only returning to the notification message to run succeeded after all child nodes execute, which is just saved to the father of itself
Point returns to the notification message to run succeeded, and then, oneself state is arranged to carry out success status by the father node.
In the present invention, every setting time, such as 10 frames or so, that is, a root node is executed, constantly to some game angle
The behavior role of degree controls, according to the number of iterations depending on preview demand, to realize to behavior tree implementation effect
Preview function.
(3) behavior tree export module
The behavior tree export module is used for that successfully the behavior tree to be exported with specific data structure by preview, for game
Run time call;
Specifically, exporting behavior tree after behavior tree editor with suitable data structure.For example, using Json data format
Export behavior tree reads derived behavior tree file, obtains corresponding behavior tree by parsing this document in game running,
Then behavior tree is assigned to game object, controls its corresponding behavior.
It, can be using MiniJSON unserializing character string and serializing Json, so that json be exported in specific implementation
It at character string and is stored in file, and can realize the export of behavior tree from the character string parsing in file at json or import
Function.
(4) behavior tree import modul
The behavior tree import modul, which is used to the derived behavior tree importeding into the behavior tree again, edits mould
Block improves the behavior tree by the behavior tree editor module.Certainly, for the preceding row for once not yet editing completion
For tree, it can also imported into behavior tree editor module by behavior tree import modul, continue the behavior tree for not editing completion to this
Carry out edit operation.
Behavior tree editing machine provided by the invention is to realize to draw interfactial work in the OnGUI function of EditorWindow
The module of energy.Including drawing button area, drawing behavior tree region.Draw button area provide export button, import button and
Preview button, the drafting of button only need that GUILayout.Button is called to can be realized.The data structure of storage behavior tree can
To be customized TreeNode class with each single item of the Queue of C#, Queue, the essential attribute of TreeNode class includes current
The child nodes and depth of node.In addition it is also necessary to have the click processing readjustment of behavior tree node, including the pop-up of right button node adds
Add deletion of node small panel, double-clicks node flyout panel and modify nodal community.The core function of editing machine editor module is will to use
The tree that family visualizes outside editing machine, which completely edits out in Unity3d, to come, and exports to required format, and a key is assigned
Onto game object, the preview of the behavior tree implementation effect obtained to editor is realized, thus the convenient behavior tree obtained to editor
It modifies debugging, to improve behavior tree editorial efficiency comprehensively.
In conclusion the behavior tree editing machine provided by the invention realized based on U3D Plugin Mechanism, is had the advantage that
AI behavior tree can be directly designed in U3D, without editing each tree node in advance, so that the behavior tree of simplifying was edited
Journey;In addition, behavior tree editing machine provides behavior tree preview function, the behavior tree effect that editor can be obtained easily and fast
Carry out preview, the convenient behavior tree obtained to editor is modified debugging, to improve behavior tree editorial efficiency comprehensively.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
Depending on protection scope of the present invention.
Claims (2)
1. a kind of behavior tree editing machine realized based on U3D Plugin Mechanism, which is characterized in that including behavior tree editor module, row
For tree previewing module, behavior tree export module and behavior tree import modul;
The behavior tree editor module provides behavior tree and edits panel, obtains a behavior tree for editing;
The behavior tree previewing module is used to the behavior tree that the behavior tree editor module editor obtains being input to pre-stored trip
In some game role in scene of playing, the movement of the game role is controlled by the behavior tree, and plays the behavior
The control process to the game role is set, realizes the preview of the behavior tree operational process obtained to editor;
The behavior tree export module is used for that successfully the behavior tree to be exported with specific data structure by preview, for game running
When call;
The behavior tree import modul is used to the derived behavior tree importeding into the behavior tree editor module again, leads to
The behavior tree editor module is crossed to improve the behavior tree;
Wherein, the behavior tree editor module includes behavior tree editor's panel and event sniffer;
The behavior tree editor panel provides behavior tree drawing area;
For monitoring the behavior tree drawing area, specific snoop procedure includes: the event sniffer
Step 1: when listening to the behavior tree drawing area and clicking event by mouse right button, to being clicked region pop-up behaviour
Make panel, wherein the operation panel includes: addition node button, deletion of node button, moves up present node button and move down
Present node button;
Step 2: then, the event sniffer monitors each button in the operation panel, and distinguishes following four
Kind situation:
1) when listening to the addition node button generation button click event, node type face is popped up to region is clicked
Plate, the node type panel include the sub- button of behavior node, conditional sections idea button, the sub- button of sequential node and selection node
Sub- button;Then, the event sniffer monitors each sub- button in the node type panel, if listened to
When button click event occurs for the behavior node button, behavior node is added to region is clicked;If listened to described
Button occurs for conditional sections idea button when clicking event, to being clicked region adding conditional node;If listening to the sequence
Button occurs for node button when clicking event, to being clicked region order of addition node;If listening to the selection node
When button click event occurs for sub- button, node is selected to region addition is clicked;Then, the event sniffer is to having added
It is monitored to the behavior node of the behavior tree drawing area, condition node, sequential node or selection node, when listening to
It include configured for controlling game angle to being popped up by double-click node location when stating behavior node generation node double click event
The Selection Floater of the concrete behavior instruction of color;Then, described when receiving the concrete behavior instruction that the Selection Floater returns
Event sniffer saves the corresponding relationship of node identification and concrete behavior instruction;
When listening to the condition node, the sequential node or selection node generation node double click event, Xiang Beishuan
Node location pop-up nodal community modification panel is hit, the nodal community that panel is sent is modified by the nodal community when receiving
When, the event sniffer saves the corresponding relationship of node identification and nodal community;
2) when listening to the deletion of node button generation button click event, the event sniffer will be clicked region pair
The knot removal answered;
3) when listen to it is described move up present node button and button occurs click event when, the event sniffer will be clicked
The child node of current button moves one upwards in turn;
4) when listen to it is described move down present node button and button occurs click event when, the event sniffer will be clicked
The child node of current button successively moves down one.
2. the behavior tree editing machine according to claim 1 realized based on U3D Plugin Mechanism, which is characterized in that the row
Preview is carried out for operational process of the tree previewing module to the behavior tree, specifically includes the following steps:
S1, the node in behavior tree, which is arranged, in the behavior tree previewing module has 4 states, respectively original state, hanging like
State, the state that runs succeeded and execution status of fail;
Wherein, the original state refers to: before the initial root node of execution for the first time, all nodes are initial in behavior tree
State;
The suspension status refers to: when some node just when executed, alternatively, when some node any one child node just
Be performed and be not carried out finish when, which is the node of suspension status;
S2, by sequence from top to bottom, is successively denoted as: the 1st layer, the 2nd layer ... n-th layer if the behavior tree that need to be executed shares n-layer;Its
In, n is natural number;1st layer is root node;N-th layer is leaf node, and the leaf node is behavior node;N omicronn-leaf
Node, it may be assumed that the 1st node layer to the (n-1)th node layer is control node;
S3 executes a root node every prefixed time interval, execute method are as follows:
S3.1, at current time, the behavior tree previewing module executes the 1st node layer, it may be assumed that reads the shape of the 1st node layer
Whether state, judging the 1st node layer currently is suspension status, if it is, executing S3.2-S3.5;If it is not, then executing
S3.6;
S3.2, the behavior tree previewing module read each 2nd node layer, find current the 2nd layer for suspension status
Node is denoted as: node 2.x;Wherein, when the 1st node layer is suspension status, one and only one section in child
Point is suspension status;
S3.3, the behavior tree previewing module execute the suspension function of node 2.x, while judging whether the node 2.x is leaf
Child node, if it is not, then executing S3.4;Otherwise, S3.5 is directly executed;
S3.4, the behavior tree previewing module continues the suspension function that recurrence executes the descendant nodes of node 2.x, until going to
Then leaf node executes S3.5;Wherein, whole behavior tree has and each node of only one branch is in suspension status;
S3.5, the behavior tree previewing module execute the suspension function of leaf node;The suspension function of the leaf node is direct
The behavior of game object is caused to change;
S3.6, when the 1st node layer is not suspension status, the behavior tree previewing module according to the type of the 1st node layer,
Traversal executes each 2nd node layer,
If some the 2nd node layer is behavior node, behavior node is directly executed, and implementing result is returned to described the
1 node layer;1st node layer implementing result based on the received changes oneself state;
If some the 2nd node layer is selection node, which executes each child node of the selection node, such as
Some child node of fruit returns to the notification message for executing failure after executing, then continues iteration and execute other child nodes;Simply by the presence of one
A child node returns to the notification message to run succeeded after executing, i.e., stopping iteration, the selection node are returned to the father node of itself
Oneself state is arranged to carry out success status by the notification message to run succeeded, then, the father node;Otherwise, if it is all
Child node returns to the notification message for executing failure after executing, then: oneself state is arranged to carry out unsuccessfully shape by the father node
State;
If some the 2nd node layer is sequential node, which executes each child node of the sequential node, only
There are the notification message for returning after executing there are a child node and executing failure, i.e. stopping iteration, father of the sequential node to itself
Node returns to the notification message for executing failure, also, oneself state is arranged to carry out status of fail by the father node;Otherwise,
After only returning to the notification message to run succeeded after all child nodes execute, which is just returned to the father node of itself
The successful notification message of receipt row, then, oneself state is arranged to carry out success status by the father node.
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 CN106155658A (en) | 2016-11-23 |
CN106155658B true 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) |
Families Citing this family (18)
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 |
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 |
CN106933744A (en) * | 2017-03-21 | 2017-07-07 | 网易(杭州)网络有限公司 | Node revision status indication method and device, electronic equipment and storage medium |
WO2018204494A1 (en) * | 2017-05-04 | 2018-11-08 | Mz Ip Holdings, Llc | System and method for managing the presentation of content in a multiplayer online game |
CN107085519B (en) * | 2017-05-04 | 2020-09-11 | 网易(杭州)网络有限公司 | Behavior tree debugging processing method, device and system, storage medium and processor |
CN108563437B (en) * | 2018-04-19 | 2021-08-20 | 图灵人工智能研究院(南京)有限公司 | Network function development method, system, computer device and storage medium |
CN108614691B (en) * | 2018-04-19 | 2021-08-24 | 交叉信息核心技术研究院(西安)有限公司 | Network function development method, system, computer device and storage medium |
CN109189504B (en) * | 2018-09-20 | 2020-04-28 | 腾讯科技(深圳)有限公司 | Behavior execution method, behavior tree generation device and computer equipment |
CN109925712B (en) * | 2019-03-18 | 2022-11-08 | 网易(杭州)网络有限公司 | Virtual object control system |
CN110008304A (en) * | 2019-04-03 | 2019-07-12 | 网易(杭州)网络有限公司 | The difference visible processing method and device of behavior tree |
CN110134375B (en) * | 2019-05-14 | 2023-11-21 | 网易(杭州)网络有限公司 | Game character behavior control method and device and readable storage medium |
CN112748912A (en) * | 2019-10-30 | 2021-05-04 | 上海莉莉丝科技股份有限公司 | Visualized logic execution method, system, device and medium |
CN111111202B (en) * | 2019-12-26 | 2023-08-29 | 北京像素软件科技股份有限公司 | Game AI behavior logic control method and system |
CN111135559B (en) * | 2019-12-27 | 2023-06-27 | 北京像素软件科技股份有限公司 | Game data processing method and device, electronic equipment and storage medium |
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 |
CN116764231A (en) * | 2022-03-08 | 2023-09-19 | 腾讯科技(深圳)有限公司 | Information display method, system, device, computer equipment and storage medium |
Citations (4)
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 |
-
2015
- 2015-04-08 CN CN201510164927.3A patent/CN106155658B/en not_active Expired - Fee Related
Patent Citations (4)
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 |
Also Published As
Publication number | Publication date |
---|---|
CN106155658A (en) | 2016-11-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106155658B (en) | The behavior tree editing machine realized based on U3D Plugin Mechanism | |
CN103441900B (en) | Centralized cross-platform automatization test system and control method thereof | |
CN106547689B (en) | A kind of automatic test cases development system and method based on web | |
CN103197929B (en) | A kind of graphic programming system and method for children-oriented | |
CN104991763A (en) | Universal game interface behavior control system | |
US20070157173A1 (en) | Method and system for multi-version digital authoring | |
CN102479079B (en) | Method and device for generating application | |
CN105183445A (en) | Visual design system of artificial intelligence of game on the basis of XML (Extensive Markup Language) | |
CN107875632B (en) | Method and system for realizing artificial intelligence behavior and artificial intelligence behavior editor | |
CN111079244B (en) | Distributed simulation platform based on behavior tree | |
CN102866886A (en) | Web-based visual algorithm animation development system | |
CN100555219C (en) | Atom manipulation encapsulation apparatus and method | |
CN108536470A (en) | A kind of development approach and system of resource file | |
CN103530898A (en) | Animation processing method and system based on 3D real-time rendering | |
TWI751387B (en) | Software defined driven ict service provider system based on end to end orchestration | |
CN111611679B (en) | Modeling method of sensor scheduling behavior tree model | |
CN106250134A (en) | The code automatic generation method of unicity language | |
CN110354503A (en) | Event triggering method, device and terminal | |
CN105512046B (en) | Android automated testing methods based on particle swarm optimization algorithm | |
CN104793927A (en) | Interface editing method and device | |
CN112860965B (en) | Network simulation visual simulation platform based on log | |
Awouda et al. | IoT-Based Framework for Digital Twins in the industry 5.0 era | |
CN108919672A (en) | A kind of implementation method of complex industrial control system | |
CN111445382B (en) | MAYA-based three-dimensional software scene resource optimization method | |
CN102393820A (en) | Logical implementation method for controlling building monitoring system |
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 |