CN110721470B - Control method and device for virtual object movement behavior and electronic equipment - Google Patents
Control method and device for virtual object movement behavior and electronic equipment Download PDFInfo
- Publication number
- CN110721470B CN110721470B CN201911027894.2A CN201911027894A CN110721470B CN 110721470 B CN110721470 B CN 110721470B CN 201911027894 A CN201911027894 A CN 201911027894A CN 110721470 B CN110721470 B CN 110721470B
- Authority
- CN
- China
- Prior art keywords
- virtual object
- state vector
- movement
- virtual
- result
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 239000013598 vector Substances 0.000 claims abstract description 240
- 238000003062 neural network model Methods 0.000 claims abstract description 61
- 238000012549 training Methods 0.000 claims abstract description 29
- 230000006399 behavior Effects 0.000 claims description 81
- 238000004422 calculation algorithm Methods 0.000 claims description 35
- 230000015654 memory Effects 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 5
- 238000013507 mapping Methods 0.000 claims description 4
- 230000002452 interceptive effect Effects 0.000 claims description 3
- 230000003993 interaction Effects 0.000 abstract description 20
- 230000000694 effects Effects 0.000 abstract description 10
- 238000010586 diagram Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 4
- 239000007787 solid Substances 0.000 description 4
- 230000008566 social perception Effects 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 101100134058 Caenorhabditis elegans nth-1 gene Proteins 0.000 description 2
- 238000013459 approach Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000149 penetrating effect Effects 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 230000006403 short-term memory Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/80—Special adaptations for executing a specific game genre or game mode
- A63F13/822—Strategy games; Role-playing games
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Processing Or Creating Images (AREA)
- Feedback Control In General (AREA)
Abstract
The invention provides a method and a device for controlling the movement behavior of a virtual object and electronic equipment, which relate to the technical field of human-computer interaction and comprise the following steps: acquiring a second virtual object having an interference relationship with the first virtual object; acquiring a first state vector of a first virtual object and a second state vector of a second virtual object; predicting a target moving result of the first virtual object based on the first state vector, the second state vector and a neural network model obtained through pre-training, wherein the target moving result comprises a target moving direction angle and a target moving speed corresponding to the target moving direction angle; and controlling the first virtual object to move according to the predicted target movement result. The method and the device can improve the naturalness of the movement interaction between the virtual objects and effectively improve the expression effects of the first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like.
Description
Technical Field
The invention relates to the technical field of human-computer interaction, in particular to a method and a device for controlling the movement behavior of a virtual object and electronic equipment.
Background
When virtual objects such as game characters and game vehicles on the market are in mobile interaction, the moving method is mostly defined by rules such as behavior trees. In the specific implementation of the method, a collision avoidance algorithm is usually adopted to avoid collision of virtual objects in the mobile interaction process; typically, in an RTS (Real-Time Strategy Game) Game, for example, a Game character moving at a certain speed bypasses the block of the friend to achieve Collision Avoidance using an ORCA (Optimal mutual Collision Avoidance) based correlation algorithm.
However, since a plurality of collision avoidance algorithms are required to meet the requirement that no collision occurs between virtual objects, contradictions may occur between the algorithms, resulting in poor expression effect of the collision avoidance algorithms in the process of moving interaction of the virtual objects, and unnatural situations such as jittering, stiffness, non-compliance with social rules, and the like in the movement of the virtual objects.
Disclosure of Invention
The invention aims to provide a method and a device for controlling the movement behavior of a virtual object and electronic equipment, which can effectively solve the problem of unnatural motion state of the virtual object.
The invention provides a control method of a virtual object movement behavior, which comprises the following steps: acquiring a second virtual object having an interference relationship with the first virtual object; acquiring a first state vector of a first virtual object and a second state vector of a second virtual object; the first state vector is a parameter for representing the current movement behavior of the first virtual object, and the second state vector is a parameter for representing the current movement behavior of the second virtual object; predicting a target movement result of the first virtual object based on the first state vector, the second state vector and a pre-trained neural network model, wherein the target movement result comprises a target movement direction angle and a target movement speed corresponding to the target movement direction angle; the neural network model comprises a long-short term memory network (LSTM) and at least two full connection layers FC; and controlling the first virtual object to move according to the predicted target movement result.
Further, the step of obtaining a second virtual object having an interference relationship with the first virtual object comprises one of: determining a virtual object other than a first virtual object as a second virtual object having an interference relationship with the first virtual object; determining a virtual object which is a preset distance away from a first virtual object as a second virtual object which has an interference relationship with the first virtual object.
Further, the step of obtaining a second virtual object having an interference relationship with the first virtual object includes: counting the total number of other virtual objects in the area where the first virtual object is located; wherein the other virtual objects are virtual objects within the region other than the first virtual object; if the total number is larger than a preset value, calculating the distance between a first virtual object and the other virtual objects, and determining a second virtual object having an interference relationship with the first virtual object according to the calculated distance; and if the total number is not larger than a preset value, determining the other virtual objects as second virtual objects having interference relationship with the first virtual object.
Further, the step of determining a second virtual object having an interference relationship with the first virtual object according to the calculated distance includes: sorting the other virtual objects according to the calculated distance, and selecting a preset number of other virtual objects as second virtual objects having an interference relationship with the first virtual object from the other virtual objects with the minimum distance; or, determining the other virtual objects with the calculated distance smaller than a preset distance threshold as second virtual objects having interference relationship with the first virtual object.
Further, the area where the first virtual object is located includes: a display area of the graphical user interface, or a circular area which is away from the current position of the first virtual object by a preset radius, or an area which meets a specified condition with the current position of the first virtual object.
Further, the step of predicting the target movement result of the first virtual object based on the first state vector, the second state vector and a neural network model obtained by pre-training includes: inputting the first state vector and the second state vector to the LSTM; processing the first state vector and the second state vector through the LSTM to obtain a merged state vector, and inputting the merged state vector to the FC connected with the LSTM; carrying out nonlinear mapping processing on the merged state vector through at least two FCs to obtain probability distribution vectors of a plurality of motion direction angles of the first virtual object and motion speeds corresponding to the probability distribution vectors of the motion direction angles; determining a probability distribution vector of a maximum motion direction angle as a target moving direction angle, and determining a motion velocity corresponding to the probability distribution vector of the maximum motion direction angle as a target moving velocity.
Further, the step of processing the first state vector and the second state vector through the LSTM to obtain a merged state vector includes: coding the second state vector through the LSTM to obtain a hidden state vector; and splicing the hidden state vector and the first state vector to obtain a merged state vector.
Further, the step of inputting the second state vector to the LSTM includes: acquiring a first distance between each second virtual object and the first virtual object; sorting the obtained first distances from big to small to obtain a descending sorting result; and sequentially inputting the second state vectors of the second virtual objects to the LSTM according to the descending sorting result.
Further, the first state vector comprises: a second distance between the first virtual object and a preset end position, a first radius of the first virtual object, a current moving direction angle of the first virtual object, and a first current moving speed of the first virtual object; the second state vector comprises: a current position coordinate of the second virtual object, a second current movement speed of the second virtual object, a second radius of the second virtual object, a third distance between the second virtual object and the first virtual object, and a sum of the first radius and the second radius.
Further, the step of controlling the movement of the first virtual object according to the predicted target movement result includes: controlling the first virtual object to move according to the predicted target moving result and a preset global routing algorithm; the global routing algorithm comprises an A star algorithm.
Further, the training process of the neural network model comprises: inputting a specified number of motion state samples to an initial neural network model; wherein the motion state sample comprises a third state vector of a third virtual object for training, a fourth state vector of a fourth virtual object having an interference relationship with the third virtual object, and a reference movement result of the third virtual object; predicting the movement behavior of the third virtual object based on the third state vector and the fourth state vector through the initial neural network model to obtain a predicted movement result of the third virtual object; feeding back an award value to the initial neural network model according to the reference movement result and the predicted movement result; and adjusting the parameters of the initial neural network model according to the feedback reward value, and repeating the training process until the feedback reward value converges to a preset value, and finishing the training.
Further, the step of feeding back a reward value to the initial neural network model according to the reference movement result and the predicted movement result includes:
wherein R (S) jn ) For the value of the reward to be fed back,s represents the third state vector and is,represents the fourth state vector, X represents a first preset value, Y represents a second preset value, lambda represents a preset reward coefficient, p represents the current position of the third virtual object g Representing the end position of the movement of the third virtual object, d min Is the minimum value of the distance between the third virtual object and the fourth virtual object, d 0 The preset safety distance threshold value between the third virtual object and the fourth virtual object is set.
The invention provides a control device for a virtual object movement behavior, which comprises: the object acquisition module is used for acquiring a second virtual object which has an interference relationship with the first virtual object; the state vector acquisition module is used for acquiring a first state vector of a first virtual object and a second state vector of a second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object; a movement result prediction module, configured to predict a target movement result of the first virtual object based on the first state vector, the second state vector, and a pre-trained neural network model, where the target movement result includes a target movement direction angle and a target movement speed corresponding to the target movement direction angle; the neural network model comprises an LSTM and at least two full connection layers FC; and the movement behavior control module is used for controlling the first virtual object to move according to the predicted target movement result.
The invention provides an electronic device, comprising: a processor and a storage device; the storage device stores thereon a computer program that executes the control method of the movement behavior of the virtual object described in any one of the above when being moved by the processor.
The invention provides a computer readable storage medium, which stores a computer program, wherein the computer program executes the steps of the method for controlling the movement behavior of the virtual object when being moved by a processor.
According to the control method, the control device and the electronic equipment for the movement behavior of the virtual object, provided by the embodiment of the invention, the second virtual object having an interference relationship with the first virtual object is obtained at first, and the first state vector of the first virtual object and the second state vector of the second virtual object are obtained; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object; then, predicting a target moving result of the first virtual object based on the first state vector, the second state vector and a neural network model obtained by pre-training, wherein the target moving result comprises a target moving direction angle and a target moving speed corresponding to the target moving direction angle; and finally, controlling the first virtual object to move according to the predicted target movement result. Compared with the problem of unnatural mobile interaction caused by contradiction among algorithms in the existing mobile interaction mode based on multiple collision avoidance algorithms, the control mode of the mobile behavior of the virtual object provided by the embodiment predicts the mobile behavior of the first virtual object through the first state vector of the first virtual object, the second state vector of the second virtual object which has an interference relationship with the first virtual object and the neural network model, can predict the mobile behavior of the virtual object without any collision avoidance algorithm, avoids mutual influence among the algorithms, and can improve the naturalness of the mobile interaction among the virtual objects; furthermore, the expression effect of the first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like can be effectively improved based on the movement result obtained by prediction.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a method for controlling a movement behavior of a virtual object according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a neural network model according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an LSTM provided in an embodiment of the present invention;
fig. 4 is a schematic view of a scene in which a virtual object moves in opposite directions according to an embodiment of the present invention;
fig. 5 is a schematic view of a scene in which a virtual object moves around a circle center according to an embodiment of the present invention;
fig. 6 is a schematic view of a scene in which a virtual object simulates movement of a crossroad according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a scene with a stationary obstacle according to an embodiment of the present invention;
fig. 8 is a block diagram of a structure of a control apparatus for a movement behavior of a virtual object according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, and it should be understood that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In consideration of the unnatural situations of movement jitter, inflexibility, non-compliance with social rules and the like in the conventional virtual object movement interaction realized based on the collision avoidance algorithm, embodiments of the present invention provide a method, an apparatus and an electronic device for controlling the movement behavior of a virtual object, which can improve the naturalness of the movement interaction between virtual objects and effectively improve the expression effects of a first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like. The technology can be applied to virtual game scenes such as tactical competitions, games of RTS and the like which need to control the movement of game characters; for example, in one possible application, the techniques may be applied to a game scene that controls movement of virtual objects from a graphical user interface; the graphical user interface may be an interface presented on a gaming terminal such as a cell phone, gaming machine, or iPad.
To facilitate understanding of the present embodiment, a detailed description will be first given of a control method for a virtual object movement behavior disclosed in the embodiment of the present invention.
Referring to the flowchart of the control method for the movement behavior of the virtual object shown in fig. 1, the method mainly includes the following steps S102 to S108:
step S102, a second virtual object having an interference relationship with the first virtual object is obtained.
In this embodiment, a first virtual object and a second virtual object having an interference relationship with the first virtual object in the game are acquired, or alternatively, a second virtual object having an interference relationship with the first virtual object on the graphical user interface is acquired. The first virtual object and the second virtual object are virtual objects in a game scene, and the virtual objects comprise non-player character virtual objects which are not controlled by a user and character virtual objects which are controlled by the user. When there are a plurality of virtual objects, any one of the virtual objects may be a first virtual object, and for the current first virtual object, at least one virtual object may be selected from other virtual objects except the current first virtual object as a second virtual object having an interference relationship therewith. The interference relationship can be understood as: and the relationship of interaction and mutual perception and influence determined based on the moving behavior characteristics of the first virtual object and the second virtual object.
Step S104, acquiring a first state vector of the first virtual object and a second state vector of the second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object.
In practical applications, the first state vector may represent the current movement behavior of the first virtual object through parameters such as the current movement direction angle of the first virtual object and the first current movement speed of the first virtual object; the second state vector includes: the second state vector may characterize the current movement behavior of the second virtual object by parameters such as the current position coordinates of the second virtual object, the second current movement speed of the second virtual object, and the distance between the second virtual object and the first virtual object.
And S106, predicting a target movement result of the first virtual object based on the first state vector, the second state vector and a neural network model obtained through pre-training, wherein the target movement result comprises a target movement direction angle and a target movement speed corresponding to the target movement direction angle.
In one possible implementation, reference may be made to a schematic structural diagram of a neural network model as shown in fig. 2, where the neural network model includes an LSTM (Long Short-Term Memory network) and at least two FCs (full Connected layer). Wherein the input of the LSTM is a first state vector S and a second state vector SLSTM deliveryOutput as a merged state vector S e (ii) a The inputs of at least two FCs are a merged state vector S e The outputs of at least two FCs are the movement results. A plurality of movement direction angles pi(s) in the movement result indicate the probability of movement along each direction angle s, and a plurality of movement speeds V(s) indicate the magnitude of movement along each direction angle s; the direction angle s may be set in a plurality of angular ranges of 0 to 180 ° and 0 to 360 °, and each direction angle s corresponds to one moving direction angle pi(s) and one moving speed V(s). In practical applications, the moving direction angle pi(s) with the highest probability value is generally determined as the target moving direction angle, and the moving speed V(s) corresponding to the target moving direction angle is determined as the target moving speed.
Step S108, controlling the first virtual object to move according to the predicted target movement result. In an actual game scene, the first virtual object is controlled to move towards the destination according to the target moving direction angle and the target moving speed.
The method for controlling the movement behavior of the virtual object, provided by the embodiment of the invention, comprises the steps of firstly obtaining a second virtual object which has an interference relationship with a first virtual object, and obtaining a first state vector of the first virtual object and a second state vector of the second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object; then, predicting a target moving result of the first virtual object based on the first state vector, the second state vector and a neural network model obtained by pre-training, wherein the target moving result comprises a target moving direction angle and a target moving speed corresponding to the target moving direction angle; and finally, controlling the first virtual object to move according to the predicted target moving result. Compared with the problem of unnatural mobile interaction caused by contradiction among algorithms in the existing mobile interaction mode based on multiple collision avoidance algorithms, the control mode of the mobile behavior of the virtual object provided by the embodiment predicts the mobile behavior of the first virtual object through the first state vector of the first virtual object, the second state vector of the second virtual object which has interference relationship with the first virtual object and the neural network model, can predict the mobile behavior of the virtual object without any collision avoidance algorithm, avoids mutual influence among algorithms, and can improve the naturalness of the mobile interaction among the virtual objects; furthermore, the expression effect of the first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like can be effectively improved based on the movement result obtained by prediction.
In executing the above step S102, one of the following two ways may be referred to obtain the second virtual object having an interference relationship with the first virtual object:
the first method is as follows: and determining the virtual object except the first virtual object as a second virtual object having an interference relationship with the first virtual object. This approach is applicable to a scenario with a small number of virtual objects, such as a current game scenario in which the number of virtual objects is less than a preset number (e.g., 10), and virtual objects other than the first virtual object can be directly determined as the second virtual object, which is a relatively simple approach to determine the second virtual object.
The second method comprises the following steps: and determining a virtual object which is away from the first virtual object by a preset distance as a second virtual object which has an interference relationship with the first virtual object. When the number of virtual objects is more than the preset number, such as in the current game scene, if the virtual objects except the first virtual object are determined as the second virtual object, a larger operation burden is caused, and the influence of the movement interaction of the first virtual object by other virtual objects far away from the first virtual object is smaller, which can be ignored in practical application; in this case, a virtual object whose distance from the first virtual object is less than or equal to a preset distance may be determined as the second virtual object. According to the method, the second virtual object which has a large influence on the first virtual object is determined, so that the calculation amount of subsequent movement behavior prediction can be reduced, and the accuracy of movement result prediction is improved.
It is understood that, in addition to the above two ways of acquiring the second virtual object, another implementation manner shown below may be adopted in practical applications, with reference to the following steps 1) to 3):
1) Counting the total number of other virtual objects in the area where the first virtual object is located; wherein the other virtual objects are virtual objects in the region except the first virtual object. The area where the first virtual object is located includes: and the display area of the graphical user interface is a circular area which is away from the current position of the first virtual object by a preset radius, or an area which meets a specified condition with the current position of the first virtual object. For a scene in which the area where the first virtual object is located is a circular area, the first virtual object may be used as a center point, the circular area may be determined based on the center point and a preset radius, and the determined circular area may be used as the area. In practical applications, the area where the first virtual object is located may also take other forms, which are not limited herein, such as: and determining a rectangular area based on the vertex and the preset length and width by taking the first virtual object as the vertex, and taking the determined rectangular area as the area.
2) And if the total number is larger than a preset value, calculating the distance between the first virtual object and other virtual objects, and determining a second virtual object having an interference relationship with the first virtual object according to the calculated distance.
In this embodiment, the position coordinates of the first virtual object and the other virtual objects may be first obtained, and then the distance between the first virtual object and the other virtual objects may be calculated according to the obtained position coordinates.
When the second virtual object is determined according to the calculated distance, the other virtual objects can be sorted according to the calculated distance, and a preset number of other virtual objects are selected as the second virtual object having an interference relationship with the first virtual object from the other virtual object with the minimum distance; such as selecting the first ten virtual objects closest to the first virtual object and using the selected first ten virtual objects as the second virtual object.
Alternatively, other virtual objects whose calculated distance is smaller than the preset distance threshold may also be determined as the second virtual object having an interference relationship with the first virtual object. For the specific implementation, reference may be made to the above-mentioned second method, which is not described herein again.
3) And if the total number is not more than the preset value, determining other virtual objects as second virtual objects having interference relationship with the first virtual object.
Based on the obtained second virtual object having an interference relationship with the first virtual object, a first state vector of the first virtual object and a second state vector of the second virtual object may be further obtained. In this embodiment, the first state vector may be represented asWherein d is g A second distance between the first virtual object and a preset end position, r a first radius of the first virtual object,Representing a current direction angle of movement of the first virtual object and V pref Representing a first current movement speed of the first virtual object; the second state vector may be represented asWherein,a current position coordinate representing the second virtual object,A second current moving speed representing a second virtual object,A second radius representing a second virtual object,Representing a third distance between the second virtual object and the first virtual object andrepresenting the sum of the first radius and the second radius. Compared with the prior art that the cross-mode problem caused by the virtual object volume is not considered, the embodiment considers the first radius r of the first virtual object in the first state vector and considers the second radius of the second virtual object in the second state vectorAnd the sum of the first radius and the second radiusThe die penetrating phenomenon of the virtual object in the moving process can be effectively avoided.
The method for controlling the movement behavior of the virtual object provided in the above embodiment is a recursive process, that is, after the step S108 is used to control the movement of the first virtual object to the nth-1 (n > 1), the steps S102 to S108 are continuously used to control the movement of the first virtual object to the nth step. Based on this, in the process of controlling the virtual object to move the nth step, each parameter in the first state vector and the second state vector can be determined according to the predicted target movement result when the virtual object moves the nth-1 step. For example, in the process of controlling the virtual object to move the nth step, the moving direction angle pi(s) with the maximum probability value predicted by the first virtual object in the process of moving the (n-1) th step is determined as the current moving direction angle of the first virtual object
Based on the first state vector, the second state vector and the pre-trained neural network model, this embodiment provides a method for predicting a target movement result of the first virtual object, and with reference to fig. 2, the method may refer to the following steps (1) to (4):
(1) The first state vector and the second state vector are input to the LSTM.
In this embodiment, the LSTM may be considered to include an LSTM portion and a vector splice portion; in a specific implementation, the second state vector is input to the LSTM portion and the first state vector is input to the vector stitching portion.
Considering that in practical applications, the number of the second state vectors is multiple, and the second virtual objects closer to the first virtual object have larger influence on the movement behavior of the first virtual object, based on this, in order to enhance the interactivity between the first virtual object and the second virtual object to improve the accuracy of the movement behavior prediction result, when the step of inputting the second state vectors to the LSTM portion is executed, the present embodiment may first obtain the second distance between each second virtual object and the first virtual object; then, sorting the obtained second distances from big to small to obtain a descending sorting result; and finally, sequentially inputting the second state vectors of the second virtual objects to the LSTM according to the descending sorting result.
(2) And processing the first state vector and the second state vector through the LSTM to obtain a combined state vector, and inputting the combined state vector to the FC connected with the LSTM. Referring to the schematic structural diagram of the LSTM shown in fig. 3, the second state vector of the second virtual object is sorted according to the second distance from large to smallSequentially, the cells were introduced into each layer of the LSTM. And coding the second state vector through the LSTM to obtain a hidden state vector. In particular, the cells are introduced on the basis of the layer by the first layerObtaining a hidden vector h 1 By the first layer of cells being infused on the basis of the layerObtaining a hidden vector h 2 By analogy with this, h n Is based on the second state vector of the cell input of the layerAnd hidden state h of the previous layer n-1 And (4) obtaining the product. Hidden state vector h obtained based on a plurality of second state vector codes n Can be provided withThe characteristics of each second virtual object are sorted from large to small to enable the second virtual object closest to the first virtual object to hide the state vector h n The maximum influence is generated, thereby being helpful for improving the accuracy of the prediction of the movement result.
In this embodiment, since the second virtual object is an object having an interference relationship with the first virtual object, and can embody the social perception feature between the first virtual object and the second virtual object, the finally obtained hidden state vector can be referred to as a social perception vector.
In the vector splicing part, a hidden state vector h is generated n Splicing with the first state vector S to obtain a merged state vector S e . In particular, the hidden state vector h may be transformed n End-to-end stitching with a first state vector S, such as assuming a hidden state vector h n Is a five-dimensional vector, the first state vector S is a three-dimensional vector, and an eight-dimensional merged state vector S can be obtained by head-to-tail splicing e 。
(3) And carrying out nonlinear mapping processing on the combined state vector through at least two FCs to obtain probability distribution vectors pi(s) of a plurality of motion direction angles of the first virtual object and motion speeds V(s) corresponding to the probability distribution vectors of the motion direction angles. Considering that the deeper the number of layers of the neural network model or the larger the output dimension, the stronger the fitting ability of the neural network model, in order to make the FC better solve the non-linear problem, so as to have the stronger fitting ability, the FC includes at least two layers and the dimension of each layer of FC may be 256.
(4) The probability distribution vector of the largest motion direction angle is determined as a target moving direction angle, and the motion velocity corresponding to the probability distribution vector of the largest motion direction angle is determined as a target moving velocity.
According to the target movement result predicted by the foregoing embodiments, the present embodiment may provide an implementation manner for controlling movement of the first virtual object, so that the first virtual object can adapt to a wider range of moving scenes, including: controlling the first virtual object to move according to the predicted target moving result and a preset global routing algorithm; the global routing algorithm comprises an A star algorithm.
In practical applications, the first virtual object may be controlled to move according to the following steps 1 to 4:
And 3, calculating to obtain a plurality of intermediate positions in the road finding area range by adopting an A star algorithm according to the current position of the first virtual object and a preset end position.
And 4, dividing a moving path determined by the current position and the preset end position of the first virtual object into a plurality of segmented paths by the intermediate initial position, and adopting the steps in the control method for the moving behavior of the virtual object provided by the embodiment for each segmented path to predict and obtain the target moving result. It can be understood that each of the segmented paths starting from the current position of the first virtual object may control the first virtual object to move according to the predicted target movement result until the first virtual object moves to the preset end position.
Collision among a plurality of virtual objects can be avoided based on the target moving result, the length of a path finding path can be reduced based on an A star algorithm, and the calculated amount is effectively reduced; furthermore, the expression effects of the first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like can be effectively improved in a mode of combining the target movement result with a preset global routing algorithm.
In order to enable the neural network model to be directly applied to predicting a target movement result, the neural network model needs to be trained in advance, parameters of the neural network model need to be obtained through training, and the purpose of training the neural network model is to finally determine the parameters which can meet requirements. The neural network model can obtain an expected target movement result by using the trained parameters. The embodiment provides a training method of a neural network model, which comprises the following steps A to D:
step A, inputting a specified number of motion state samples into an initial neural network model; the motion state sample comprises a third state vector of a third virtual object used for training, a fourth state vector of a fourth virtual object having an interference relationship with the third virtual object and a reference movement result of the third virtual object. In the actual training, a small number (e.g. 4) of motion state samples can be adopted, so that the neural network model based on the training can be suitable for a prediction scene with few virtual objects; then, the number of the motion state samples is increased, for example, to 10 motion state samples, so that the neural network model trained based on the motion state samples can be applied to a prediction scene with more virtual objects.
And B, predicting the movement behavior of the third virtual object based on the third state vector and the fourth state vector through the initial neural network model to obtain a predicted movement result of the third virtual object.
And C, feeding back an award value to the initial neural network model according to the reference movement result and the predicted movement result.
Wherein the feedback prize value is as follows:
wherein R (S) jn ) For the value of the reward to be fed back,s represents a third state vector of the first state vector,represents a fourth state vector, X represents a first preset value, Y represents a second preset value, lambda represents a preset reward coefficient, p represents the current position of a third virtual object, p represents a third virtual object g Indicating the end position of the movement of the third virtual object, d min As a third virtual pairMinimum distance between the image and the fourth virtual object, d 0 Is a preset safety distance threshold value between the third virtual object and the fourth virtual object.
In practical application, when the specific value of X is 0.25, the specific value of Y is 0.1, and the specific value of λ is 0.05 in the above reward values, the training effect of the neural network model is better, referring to the following expression:
and D, adjusting the parameters of the initial neural network model according to the feedback reward value, and repeating the training process until the feedback reward value converges to a preset value, and finishing the training.
By the control method for the movement behavior of the virtual object provided by the embodiment, the processes of social perception and movement behavior prediction of the virtual object can be realized. After the current position and the target position (namely the end position) of each virtual object are obtained, the moving behaviors of the virtual objects are simulated by adopting the control method of the moving behaviors of the virtual objects, so that the virtual objects can sense and reasonably move to avoid collision and finally reach the target position.
For convenience of understanding, the following four actual scenes in which the virtual object is controlled to move by simulation by applying the above method are provided in the embodiments of the present invention.
Scene one: referring to a scene schematic diagram of the virtual object opposite movement shown in fig. 4, which includes a plurality of virtual object movement tracks changing with time, an image of 3 frames of the movement tracks is selected; the solid circles are used to indicate the position of the virtual object of the current frame, and the arrows indicate the direction of movement. Taking the virtual object 1 and the virtual object 2 as an example, the virtual object 1 and the virtual object 2 are virtual objects having an interference relationship with each other, and on one hand, an initial movement result of the virtual object 1 is predicted based on a first state vector of the virtual object 1, a second state vector of the virtual object 2 and a neural network model; on the other hand, the initial movement result of the virtual object 2 is predicted based on the first state vector of the virtual object 2, the second state vector of the virtual object 1, and the neural network model. The final movement result of the virtual object 1 and the virtual object 2 under mutual interference shows that the virtual object 1 and the virtual object 2 mutually sense to change the movement direction in advance, return to the original direction after the movement, and finally reach respective target positions.
Taking the virtual object 1 and the virtual object 3 as an example, the virtual object 3 is affected by the virtual object 1 from above and the virtual object 4 from below at the same time, and the effects of the virtual object 1 and the virtual object 4 on the virtual object 3 cancel each other to some extent, based on which it can be shown by the movement trajectory that the virtual object 1 changes the movement direction earlier than the virtual object 3.
Scene two: referring to the scene diagram of the virtual object moving around the center of the circle as shown in fig. 5, the scene diagram includes a plurality of virtual objects uniformly distributed on a circular ring; it can be understood that the scene is an ideal scene, in practical applications, the virtual objects may be non-uniformly distributed, and the distribution positions may also be irregular shapes close to a circular ring, and the movement behavior shown in fig. 5 can be simulated.
Fig. 5 shows the movement behavior of 20 virtual objects of the selected 9 frames with time, and the solid circles are used to indicate the positions of the virtual objects of the current frame. The initial positions of the 20 virtual objects are uniformly distributed on a circular ring with the radius of 10 and the origin as the center of a circle, and the end positions are symmetrical positions of the initial coordinates relative to the center of the circle.
The movement behavior of a virtual object can be divided into 3 phases. The frames 1 to 4 are a first time period, which indicates that the virtual object moves approximately linearly in the direction of the end position, specifically: for any virtual object, predicting a first movement result of the current virtual object based on a first state vector of the current virtual object, a second state vector of a second virtual object having an interactive relation with the current virtual object and a neural network model; the first movement result includes a first movement direction angle directed from the start position to the end position and a first movement speed corresponding to the first movement direction angle.
The frames 5 to 8 are the second time period, which represents the virtual objects sensing the surrounding virtual objects, and in order to avoid collision and change their respective directions at the same time, a scene is formed that automatically makes a circular motion around the origin in the same direction of the detour (e.g. clockwise) at the same time. Specifically, the method comprises the following steps: when the current virtual object moves to a preset circumference inside the circular ring based on the first movement result, correspondingly updating the first state vector and the second state vector into a fifth state vector and a sixth state vector respectively; predicting a second movement result of the current virtual object based on the fifth state vector, the sixth state vector and the neural network model; the second movement result includes a second movement direction angle along a preset detour direction of a preset circumference and a second movement speed corresponding to the second movement direction angle.
The frames 9 to 12 are the third time period, which represents that the virtual object moves to the target position in an approximate straight line. Specifically, when the current virtual object moves to a preset key position of a preset circumference based on the second movement result, the fifth state vector and the sixth state vector are respectively and correspondingly updated to be a seventh state vector and an eighth state vector; predicting a third movement result of the current virtual object based on the seventh state vector, the eighth state vector and the neural network model; the third movement result includes a third movement direction angle pointing from the preset key position to the end position and a third movement speed corresponding to the third movement direction angle. The preset key position may be a tangent point formed on the preset circumference when a tangent is drawn from the virtual object to the preset circumference.
Scene three: a schematic view of a scene simulating movement of a crossroad with reference to a virtual object as shown in fig. 6. Including the movement of a plurality of virtual objects from four directions toward the opposite surface. Fig. 6 picks the movement behavior of 12 virtual objects over time for 9 frames. The solid circles are used to represent the position of the virtual object of the current frame. In each of the four directions of up, down, left and right, 3 virtual objects move towards the opposite surface respectively; for an implementation manner of controlling the movement of the virtual object in any direction (such as an upward direction), reference may be made to the above-mentioned scenario one, which is not described herein again. And finally, displaying the movement behaviors in the complex movement scene, wherein each virtual object can sense the surrounding conditions to finely adjust the movement behaviors of the virtual objects so as to avoid collision.
Scene four: referring to a schematic view of a scene with a stationary obstacle as shown in fig. 7, frames 1 to 3 represent moving behaviors of two virtual objects varying with time. The larger black solid circle represents a preset static obstacle in the current scene, and a space which can allow a single virtual object to pass through is reserved in the middle. Two line segments with arrows in the picture of the frame 1 indicate that two virtual objects move linearly relatively, the picture of the frame 2 indicates that the virtual object moving upwards senses the obstacle and the virtual object moving downwards, moves leftwards to avoid the virtual object moving downwards, and the picture of the frame 3 indicates that the virtual object moving upwards passes through the static obstacle again after the virtual object to be moved downwards passes through the static obstacle.
In summary, in the control method for the movement behavior of the virtual object provided in the above embodiment, the movement behavior of the first virtual object is predicted through the first state vector of the first virtual object, the second state vector of the second virtual object having an interference relationship with the first virtual object, and the neural network model, and the movement behavior of the virtual object can be predicted without any collision avoidance algorithm, so that mutual influence between algorithms is avoided, and thus the naturalness of movement interaction between virtual objects can be improved; furthermore, the expression effect of the first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like can be effectively improved based on the movement result obtained by prediction.
Based on the control method for the movement behavior of the virtual object provided in the foregoing embodiment, an embodiment of the present invention provides a control device for the movement behavior of the virtual object, referring to the control device for the movement behavior of the virtual object shown in fig. 8, including:
an object obtaining module 802, configured to obtain a second virtual object having an interference relationship with the first virtual object;
a state vector obtaining module 804, configured to obtain a first state vector of the first virtual object and a second state vector of the second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object;
a movement result prediction module 806, configured to predict a target movement result of the first virtual object based on the first state vector, the second state vector, and a pre-trained neural network model, where the target movement result includes a target movement direction angle and a target movement speed corresponding to the target movement direction angle; the neural network model comprises an LSTM and at least two full connection layers FC;
and a moving behavior control module 808, configured to control the first virtual object to move according to the predicted target movement result.
The control device for the movement behavior of the virtual object, provided by the embodiment of the invention, first obtains the second virtual object which has an interference relationship with the first virtual object, and obtains the first state vector of the first virtual object and the second state vector of the second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object; then predicting a target moving result of the first virtual object based on the first state vector, the second state vector and a neural network model obtained by pre-training, wherein the target moving result comprises a target moving direction angle and a target moving speed corresponding to the target moving direction angle; and finally, controlling the first virtual object to move according to the predicted target movement result. Compared with the problem of unnatural mobile interaction caused by contradiction among algorithms in the existing mobile interaction mode based on multiple collision avoidance algorithms, the control mode of the mobile behavior of the virtual object provided by the embodiment predicts the mobile behavior of the first virtual object through the first state vector of the first virtual object, the second state vector of the second virtual object which has an interference relationship with the first virtual object and the neural network model, can predict the mobile behavior of the virtual object without any collision avoidance algorithm, avoids mutual influence among the algorithms, and can improve the naturalness of the mobile interaction among the virtual objects; furthermore, the expression effect of the first virtual object in the aspects of movement smoothness, social rule consistency, naturalness and the like can be effectively improved based on the movement result obtained by prediction.
In some embodiments, the object acquisition module 802 is configured to one of: determining a virtual object other than the first virtual object as a second virtual object having an interference relationship with the first virtual object; and determining a virtual object which is away from the first virtual object by a preset distance as a second virtual object which has an interference relationship with the first virtual object.
In some embodiments, the object acquisition module 802 is configured to: counting the total number of other virtual objects in the area where the first virtual object is located; wherein, the other virtual objects are the virtual objects except the first virtual object in the area; if the total number is larger than a preset value, calculating the distance between the first virtual object and other virtual objects, and determining a second virtual object having an interference relationship with the first virtual object according to the calculated distance; and if the total number is not more than the preset value, determining other virtual objects as second virtual objects having interference relationship with the first virtual object.
In some embodiments, the object obtaining module 802 is specifically configured to: sequencing other virtual objects according to the calculated distance, and selecting a preset number of other virtual objects as second virtual objects having interference relation with the first virtual object from the other virtual objects with the minimum distance; or, determining other virtual objects with the calculated distance smaller than the preset distance threshold value as second virtual objects having interference relationship with the first virtual object.
In some embodiments, the area in which the first virtual object is located includes: and the display area of the graphical user interface is a circular area which is away from the current position of the first virtual object by a preset radius, or an area which meets a specified condition with the current position of the first virtual object.
In some embodiments, the movement result prediction module 806 is configured to: inputting the first state vector and the second state vector to the LSTM; processing the first state vector and the second state vector through the LSTM to obtain a merged state vector, and inputting the merged state vector to an FC (fiber channel) connected with the LSTM; carrying out nonlinear mapping processing on the combined state vector through at least two FCs to obtain probability distribution vectors of a plurality of motion direction angles of the first virtual object and motion speeds corresponding to the probability distribution vectors of the motion direction angles; the probability distribution vector of the largest motion direction angle is determined as a target moving direction angle, and the motion velocity corresponding to the probability distribution vector of the largest motion direction angle is determined as a target moving velocity.
In some embodiments, the movement result prediction module 806 is specifically configured to: coding the second state vector through the LSTM to obtain a hidden state vector; and splicing the hidden state vector and the first state vector to obtain a merged state vector.
In some embodiments, the movement result prediction module 806 is specifically configured to: acquiring a second distance between each second virtual object and the first virtual object; sorting the obtained second distances from big to small to obtain a descending sorting result; and sequentially inputting the second state vectors of the second virtual objects to the LSTM according to the descending sorting result.
In some embodiments, the first state vector comprises: a third distance between the first virtual object and a preset end position, a first radius of the first virtual object, a current moving direction angle of the first virtual object, and a first current moving speed of the first virtual object; the second state vector includes: a current position coordinate of the second virtual object, a second current moving speed of the second virtual object, a second radius of the second virtual object, a second distance between the second virtual object and the first virtual object, and a sum of the first radius and the second radius.
In some embodiments, the movement behavior control module 808 is configured to: controlling the first virtual object to move according to the predicted target moving result and a preset global routing algorithm; the global routing algorithm comprises an A star algorithm.
In some embodiments, the apparatus for controlling the movement behavior of the virtual object further includes a model training module (not shown in the figure), and the model training module is configured to: inputting a specified number of motion state samples to an initial neural network model; the motion state sample comprises a third state vector of a third virtual object used for training, a fourth state vector of a fourth virtual object having an interference relationship with the third virtual object and a reference movement result of the third virtual object; predicting the movement behavior of the third virtual object based on the third state vector and the fourth state vector through the initial neural network model to obtain a predicted movement result of the third virtual object; feeding back an award value to the initial neural network model according to the reference movement result and the predicted movement result; and adjusting the parameters of the initial neural network model according to the feedback reward value, and repeating the training process until the feedback reward value converges to a preset value, and finishing the training.
In some embodiments, the model training module comprises: the feedback reward value is as follows:
wherein R (S) jn ) For the value of the reward to be fed back,s represents a third state vector and the second state vector,represents a fourth state vector, X represents a first preset value, Y represents a second preset value, lambda represents a preset reward coefficient, p represents the current position of a third virtual object, p represents a third virtual object g Indicating the end position of the movement of the third virtual object, d min Is the minimum value of the distance between the third virtual object and the fourth virtual object, d 0 Is a preset safety distance threshold value between the third virtual object and the fourth virtual object.
Based on the foregoing embodiments, an embodiment of the present invention provides an electronic device, which includes a processor and a memory, where the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the steps of the control method for the movement behavior of the virtual object in the foregoing embodiments.
Specifically, referring to the structural schematic diagram of the electronic device shown in fig. 9, the electronic device further includes a bus 903 and a communication interface 904, and the processor 902, the communication interface 904, and the memory 901 are connected through the bus 903.
The Memory 901 may include a Random Access Memory (RAM) and a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 904 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. Bus 903 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 6, but this does not indicate only one bus or one type of bus.
The processor 902 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 902. The Processor 902 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 901, and the processor 902 reads the information in the memory 901, and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
Further, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions, which when invoked and executed by a processor, cause the processor to implement the steps of the method for controlling the movement behavior of a virtual object in the above-described embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (15)
1. A method for controlling the movement behavior of a virtual object, the method comprising:
acquiring a second virtual object having an interference relationship with the first virtual object;
acquiring a first state vector of a first virtual object and a second state vector of a second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object;
predicting a target movement result of the first virtual object based on the first state vector, the second state vector and a pre-trained neural network model, wherein the target movement result comprises a target movement direction angle and a target movement speed corresponding to the target movement direction angle; the neural network model comprises a long-short term memory network (LSTM) and at least two full connection layers FC;
and controlling the first virtual object to move according to the predicted target movement result.
2. The method of claim 1, wherein the step of obtaining a second virtual object having an interfering relationship with the first virtual object comprises one of:
determining a virtual object other than a first virtual object as a second virtual object having an interference relationship with the first virtual object;
determining a virtual object which is a preset distance away from a first virtual object as a second virtual object which has an interference relationship with the first virtual object.
3. The method of claim 1, wherein the step of obtaining a second virtual object having an interfering relationship with the first virtual object comprises:
counting the total number of other virtual objects in the area where the first virtual object is located; wherein the other virtual objects are virtual objects in the region except the first virtual object;
if the total number is larger than a preset value, calculating the distance between the first virtual object and the other virtual objects, and determining a second virtual object having an interference relationship with the first virtual object according to the calculated distance;
and if the total number is not larger than a preset value, determining the other virtual objects as second virtual objects having interference relationship with the first virtual object.
4. The method of claim 3, wherein the step of determining a second virtual object having an interference relationship with the first virtual object based on the calculated distance comprises:
sorting the other virtual objects according to the calculated distance, and selecting a preset number of other virtual objects as second virtual objects having an interference relationship with the first virtual object from the other virtual objects with the minimum distance; or,
determining the other virtual objects of which the calculated distance is smaller than a preset distance threshold value as second virtual objects having interference relationship with the first virtual object.
5. The method of claim 3, wherein the area in which the first virtual object is located comprises: a display area of the graphical user interface, or a circular area having a preset radius from the current position of the first virtual object, or an area satisfying a specified condition from the current position of the first virtual object.
6. The method of claim 1, wherein the step of predicting the target movement result of the first virtual object based on the first state vector, the second state vector and a pre-trained neural network model comprises:
inputting the first state vector and the second state vector to the LSTM;
processing the first state vector and the second state vector through the LSTM to obtain a merged state vector, and inputting the merged state vector to the FC connected with the LSTM;
carrying out nonlinear mapping processing on the merged state vector through at least two FCs to obtain probability distribution vectors of a plurality of motion direction angles of the first virtual object and motion speeds corresponding to the probability distribution vectors of the motion direction angles;
determining a probability distribution vector of a maximum motion direction angle as a target moving direction angle, and determining a motion velocity corresponding to the probability distribution vector of the maximum motion direction angle as a target moving velocity.
7. The method of claim 6, wherein the step of processing the first state vector and the second state vector by the LSTM to obtain a merged state vector comprises:
coding the second state vector through the LSTM to obtain a hidden state vector;
and splicing the hidden state vector and the first state vector to obtain a merged state vector.
8. The method of claim 6, wherein the step of inputting the second state vector to the LSTM comprises:
acquiring a first distance between each second virtual object and the first virtual object;
sorting the obtained first distances from big to small to obtain a descending sorting result;
and sequentially inputting the second state vectors of the second virtual objects to the LSTM according to the descending sorting result.
9. The method of claim 1, wherein the first state vector comprises: a second distance between the first virtual object and a preset end position, a first radius of the first virtual object, a current moving direction angle of the first virtual object, and a first current moving speed of the first virtual object;
the second state vector comprises: a current position coordinate of the second virtual object, a second current movement speed of the second virtual object, a second radius of the second virtual object, a third distance between the second virtual object and the first virtual object, and a sum of the first radius and the second radius.
10. The method of claim 1, wherein the step of controlling the movement of the first virtual object based on the predicted target movement result comprises:
controlling the first virtual object to move according to the predicted target moving result and a preset global routing algorithm; wherein the global routing algorithm comprises an A-star algorithm.
11. The method of claim 1, wherein the training process of the neural network model comprises:
inputting a specified number of motion state samples to an initial neural network model; wherein the motion state sample comprises a third state vector of a third virtual object for training, a fourth state vector of a fourth virtual object having an interference relationship with the third virtual object, and a reference movement result of the third virtual object;
predicting the movement behavior of the third virtual object based on the third state vector and the fourth state vector through the initial neural network model to obtain a predicted movement result of the third virtual object;
feeding back an award value to the initial neural network model according to the reference movement result and the predicted movement result;
and adjusting the parameters of the initial neural network model according to the feedback reward value, and repeating the training process until the feedback reward value converges to a preset value, and finishing the training.
12. The method of claim 11, wherein the step of feeding back a reward value to the initial neural network model based on the baseline movement outcome and the predicted movement outcome comprises:
wherein R (S) jn ) For the value of the reward to be fed back,s represents the third state vector and the second state vector,represents the fourth state vector, X represents a first predetermined value, Y represents a second predetermined value, and λ represents a predetermined bonus systemNumber, p represents the current position of the third virtual object, p g Representing the end position of the movement of the third virtual object, d min Is the minimum value of the distance between the third virtual object and the fourth virtual object, d 0 The preset safety distance threshold value between the third virtual object and the fourth virtual object is set.
13. An apparatus for controlling movement behavior of a virtual object, the apparatus comprising:
the object acquisition module is used for acquiring a second virtual object which has an interference relationship with the first virtual object;
the state vector acquisition module is used for acquiring a first state vector of a first virtual object and a second state vector of a second virtual object; the first state vector is a parameter representing the current movement behavior of the first virtual object, and the second state vector is a parameter representing the current movement behavior of the second virtual object;
a movement result prediction module, configured to predict a target movement result of the first virtual object based on the first state vector, the second state vector, and a pre-trained neural network model, where the target movement result includes a target movement direction angle and a target movement speed corresponding to the target movement direction angle; the neural network model comprises an LSTM and at least two full connectivity layers FC;
and the movement behavior control module is used for controlling the first virtual object to move according to the predicted target movement result.
14. An electronic device, comprising: a processor and a storage device;
the storage device has stored thereon a computer program which, when being moved by the processor, performs the method of any one of claims 1 to 12.
15. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of the preceding claims 1 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911027894.2A CN110721470B (en) | 2019-10-25 | 2019-10-25 | Control method and device for virtual object movement behavior and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911027894.2A CN110721470B (en) | 2019-10-25 | 2019-10-25 | Control method and device for virtual object movement behavior and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110721470A CN110721470A (en) | 2020-01-24 |
CN110721470B true CN110721470B (en) | 2022-11-11 |
Family
ID=69222159
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911027894.2A Active CN110721470B (en) | 2019-10-25 | 2019-10-25 | Control method and device for virtual object movement behavior and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110721470B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111282279B (en) * | 2020-02-05 | 2021-05-07 | 腾讯科技(深圳)有限公司 | Model training method, and object control method and device based on interactive application |
CN112973123B (en) * | 2021-04-08 | 2024-05-28 | 网易(杭州)网络有限公司 | Path finding method and device in game, computer storage medium and electronic equipment |
CN114011071B (en) * | 2021-11-05 | 2024-11-08 | 腾讯科技(深圳)有限公司 | Virtual character control method and device, storage medium and electronic equipment |
CN114146420B (en) * | 2022-02-10 | 2022-04-22 | 中国科学院自动化研究所 | Resource allocation method, device and equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018053246A1 (en) * | 2016-09-15 | 2018-03-22 | Google Llc | Control policies for robotic agents |
CN108537818A (en) * | 2018-03-07 | 2018-09-14 | 上海交通大学 | Crowd's trajectory predictions method based on cluster pressure LSTM |
WO2018211144A1 (en) * | 2017-05-19 | 2018-11-22 | Deepmind Technologies Limited | Making object-level predictions of the future state of a physical system |
CN109529338A (en) * | 2018-11-15 | 2019-03-29 | 腾讯科技(深圳)有限公司 | Object control method, apparatus, Electronic Design and computer-readable medium |
CN109663359A (en) * | 2018-12-06 | 2019-04-23 | 广州多益网络股份有限公司 | Optimization method, device, terminal device and the storage medium of game intelligence body training |
CN109893857A (en) * | 2019-03-14 | 2019-06-18 | 腾讯科技(深圳)有限公司 | A kind of method, the method for model training and the relevant apparatus of operation information prediction |
CN110251942A (en) * | 2019-06-04 | 2019-09-20 | 腾讯科技(成都)有限公司 | Control the method and device of virtual role in scene of game |
-
2019
- 2019-10-25 CN CN201911027894.2A patent/CN110721470B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018053246A1 (en) * | 2016-09-15 | 2018-03-22 | Google Llc | Control policies for robotic agents |
WO2018211144A1 (en) * | 2017-05-19 | 2018-11-22 | Deepmind Technologies Limited | Making object-level predictions of the future state of a physical system |
CN108537818A (en) * | 2018-03-07 | 2018-09-14 | 上海交通大学 | Crowd's trajectory predictions method based on cluster pressure LSTM |
CN109529338A (en) * | 2018-11-15 | 2019-03-29 | 腾讯科技(深圳)有限公司 | Object control method, apparatus, Electronic Design and computer-readable medium |
CN109663359A (en) * | 2018-12-06 | 2019-04-23 | 广州多益网络股份有限公司 | Optimization method, device, terminal device and the storage medium of game intelligence body training |
CN109893857A (en) * | 2019-03-14 | 2019-06-18 | 腾讯科技(深圳)有限公司 | A kind of method, the method for model training and the relevant apparatus of operation information prediction |
CN110251942A (en) * | 2019-06-04 | 2019-09-20 | 腾讯科技(成都)有限公司 | Control the method and device of virtual role in scene of game |
Also Published As
Publication number | Publication date |
---|---|
CN110721470A (en) | 2020-01-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110721470B (en) | Control method and device for virtual object movement behavior and electronic equipment | |
KR102236046B1 (en) | Face detection training method, device and electronic device | |
Lee et al. | Crowd simulation by deep reinforcement learning | |
US9858496B2 (en) | Object detection and classification in images | |
CN110998663B (en) | Image generation method of simulation scene, electronic equipment and storage medium | |
JP5303068B2 (en) | Image processing apparatus, image processing method, and image processing program | |
US20220226728A1 (en) | Route navigation system within a game application environment | |
WO2017206400A1 (en) | Image processing method, apparatus, and electronic device | |
KR102216749B1 (en) | Method, apparatus and computer program for coloring of a target image | |
CN109583509B (en) | Data generation method and device and electronic equipment | |
KR20220081261A (en) | Method and apparatus for object pose estimation | |
CN110141862A (en) | The method and device of mobile control, electronic equipment, storage medium in game | |
Barnett et al. | Coordinated crowd simulation with topological scene analysis | |
CN113694528A (en) | Data processing method and device, electronic equipment and storage medium | |
Kremer et al. | Modelling distracted agents in crowd simulations | |
CN113052253A (en) | Hyper-parameter determination method, device, deep reinforcement learning framework, medium and equipment | |
CN109783769B (en) | Matrix decomposition method and device based on user project scoring | |
KR102063408B1 (en) | Method and apparatus for interaction with virtual objects | |
CN117197767A (en) | Vehicle track prediction method, device, electronic equipment and storage medium | |
CN117011856A (en) | Handwriting skeleton refining method, system, equipment and medium based on deep reinforcement learning | |
CN113808192B (en) | House pattern generation method, device, equipment and storage medium | |
CN113413601B (en) | Road searching method and device | |
CN112883947B (en) | Image processing method, image processing device, computer equipment and storage medium | |
US12039670B2 (en) | Strand simulation in multiple levels | |
CN114063761A (en) | Gaze point display method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |