CN111544888A - Virtual group unit moving method and device, storage medium and electronic equipment - Google Patents

Virtual group unit moving method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111544888A
CN111544888A CN202010323309.XA CN202010323309A CN111544888A CN 111544888 A CN111544888 A CN 111544888A CN 202010323309 A CN202010323309 A CN 202010323309A CN 111544888 A CN111544888 A CN 111544888A
Authority
CN
China
Prior art keywords
group
virtual
unit
potential energy
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010323309.XA
Other languages
Chinese (zh)
Other versions
CN111544888B (en
Inventor
汤炎中
沈于晴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010323309.XA priority Critical patent/CN111544888B/en
Publication of CN111544888A publication Critical patent/CN111544888A/en
Application granted granted Critical
Publication of CN111544888B publication Critical patent/CN111544888B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding

Abstract

The invention discloses a method and a device for moving a virtual group unit, a storage medium and electronic equipment. Wherein, the method comprises the following steps: determining a first potential energy parameter of the virtual map according to a lattice where a first type of virtual unit on the virtual map is located, acquiring a first group of potential energy values corresponding to a first lattice in the first potential energy parameter under the condition that a virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy value which is greater than 0 in the first group of potential energy values. The invention solves the technical problems that the moving mode determining process of the virtual group is complex, and the efficiency of determining the moving mode is low due to overlarge calculated amount.

Description

Virtual group unit moving method and device, storage medium and electronic equipment
Technical Field
The invention relates to the field of computers, in particular to a method and a device for moving a virtual group unit, a storage medium and electronic equipment.
Background
In the prior art, when a developer configures parameters of an AI route-finding of a related virtual group unit, classical cohesion, equidirectional force and mutual repulsion are needed to be used, and in the AI route-finding process related to computing peripheral units, operation is generally performed through a physical system built in an engine to further obtain the moving direction and moving speed of the AI.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a moving method and device of a virtual group unit, a storage medium and electronic equipment, which at least solve the technical problems that the moving mode determining process of a virtual group is complex and the efficiency of determining the moving mode is low due to overlarge calculated amount.
According to an aspect of an embodiment of the present invention, there is provided a method for moving a virtual group unit, including: determining a first potential energy parameter of a virtual map according to a grid in which a first type of virtual unit is located on the virtual map, wherein the virtual map is divided into a plurality of grids, the first potential energy parameter comprises a potential energy value on each grid in the plurality of grids, the first potential energy parameter is generated by overlapping a first value and a second value, the potential energy value generated on the grid in which each first type of virtual unit is located is the first value, the potential energy value generated on the grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is larger than the second value; acquiring a first group of potential energy values corresponding to a first grid in the first potential energy parameter under the condition that virtual units adjacent to the first group unit in the first type of virtual units need to be determined, wherein the first grid has the first group unit thereon, and the first group of potential energy values comprises potential energy values on a first group of adjacent grids adjacent to the first grid in the first potential energy parameter; determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to potential energy values greater than 0 in the first set of potential energy values.
Optionally, the determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the first group of potential energy values includes: determining a directional weight value of a first group of cells in the first group of adjacent cells, wherein the directional weight value of the first group of cells is smaller when the potential energy value of the first group of cells is larger than 0, and the directional weight value of the first group of cells is used for representing the weight value of the first group unit moving from the first cell to the cell in the first group of cells; determining a moving direction of each virtual unit in the first group unit according to the direction weight values of the first group of grids; and/or determining a velocity weight value of the first group of cells having potential values greater than 0 in the first group of adjacent cells based on potential values greater than 0 in the first group of potential values, wherein the velocity weight value of the first group of cells is smaller the greater the potential values on the first group of cells, and the velocity weight value of the first group of cells is used to determine the velocity at which the first group of cells moves from the first cell to a cell in the first group of cells; determining a moving speed of each virtual unit in the first group unit according to the speed weight values of the first group of cells.
Optionally, before obtaining the first set of potential energy values corresponding to the first lattice in the first potential energy parameter, the method further includes one of: determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined under the condition that the first group unit is in a free forward movement state, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a challenge and freely moves forward; determining that a virtual unit adjacent to the first group unit in the first type of virtual units needs to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy; determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined under the condition that the first group unit is in a skill release state, wherein the skill release state indicates that an enemy exists in an attack range, attack is started, and skills are released; and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the first type of virtual units needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
Optionally, comprising: determining a second potential energy parameter of the virtual map according to a grid in which a second type of virtual unit is located on the virtual map, wherein the second potential energy parameter includes a potential energy value on each grid in the multiple grids, the second potential energy parameter is generated by overlapping a third value and a fourth value, the potential energy value generated on the grid in which each second type of virtual unit is located is the third value, the potential energy value generated on the grid adjacent to the grid in which the second type of virtual unit is located is the fourth value, and the third value is greater than the fourth value; acquiring a second set of potential energy values corresponding to the first grid in the second potential energy parameter if virtual units adjacent to the first group unit in the second type of virtual unit need to be determined, wherein the second set of potential energy values comprises potential energy values on the first set of adjacent grids in the second potential energy parameter; and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy values which are larger than 0 in the second group of potential energy values.
Optionally, the determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the second set of potential energy values includes: determining a directional weight value of a second group of cells in the first group of adjacent cells, wherein the directional weight value of the second group of cells is larger according to a potential energy value larger than 0 in the second group of potential energy values, and the directional weight value of the second group of cells is larger according to the larger potential energy value in the second group of potential energy values, and the directional weight value of the second group of cells is used for representing the weight value of the first group unit moving from the second cell to the cell in the second group of cells; determining a moving direction of each virtual unit in the second group of units according to the direction weight values of the second group of grids; and/or determining a velocity weight value of the second group of cells having potential values greater than 0 in the first group of adjacent cells based on potential values greater than 0 in the second group of potential values, wherein the velocity weight value of the second group of cells is greater the potential values on the second group of cells, the velocity weight value of the second group of cells being used to determine the velocity at which the first group of units moves from the second cell to a cell in the second group of cells; determining a moving speed of each virtual unit in the second group unit according to the speed weight values of the second group of grids.
Optionally, before obtaining the second set of potential energy values corresponding to the first lattice in the second potential energy parameter, the method further includes one of: determining a virtual unit adjacent to the first group unit in the second type of virtual unit to be determined under the condition that the first group unit is in a free forward movement state, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a challenge and freely moves forward; determining that a virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy; and determining the virtual units adjacent to the first group unit in the second type of virtual units to be determined under the condition that the first group unit is in a skill release state, wherein the skill release state represents that enemies exist in an attack range, and attack is started, and the release skill determines the virtual units adjacent to the first group unit in the second type of virtual units to be determined under the condition that the first group unit is in a blocking state, wherein the blocking state represents that the group units are blocked in the moving process.
Optionally, comprising: under the condition that grids where other types of virtual units different from the first type are located need to be determined, acquiring a group of grids where the other types of virtual units are located in the plurality of grids; determining an edge lattice in the set of lattices; determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the edge lattice.
Optionally, the determining an edge lattice in the group of lattices includes: configuring a single color corresponding to one type for a first type lattice having only a virtual unit of the one type of the other types in the first type lattice, in a case where the first type lattice exists in the group of lattices; configuring a mixed color corresponding to a plurality of types for a second type lattice having virtual units of the plurality of types in the other types in the second type lattice, in a case where the second type lattice exists in the group of lattices; determining a first edge lattice in the group of lattices, wherein the first edge lattice is configured with the single color and the first edge lattice and an adjacent lattice are configured with different colors; determining a second edge lattice in the set of lattices, wherein the second edge lattice is configured with the mixed color; determining the edge lattice to include the first edge lattice and the second edge lattice.
Optionally, the determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the edge grid includes: determining N grids which are nearest to the first grid in the edge grids, wherein N is a natural number; determining a moving direction and a moving speed of each of the first group unit according to the other types of virtual units in the N lattices.
Optionally, the determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other type of virtual unit in the N lattices includes: determining a distance between each virtual unit in the first population unit to the other types of virtual units in the N lattices; and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the distance.
Optionally, before obtaining a group of grids in which the other types of virtual units are located in the plurality of grids, the method further includes: under the condition that the first group unit is in a trend target object state, determining grids where other types of virtual units different from the first type need to be determined, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy; under the condition that the first group unit is in a skill release state, determining grids where other types of virtual units different from the first type are needed to be determined, wherein the skill release state indicates that enemies exist in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining a grid where other types of virtual units different from the first type need to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
According to another aspect of the embodiments of the present invention, there is also provided a mobile device for a virtual group unit, including:
a first determining module, configured to determine a first potential energy parameter of a virtual map according to a grid in which a first type of virtual unit is located on the virtual map, where the virtual map is divided into multiple grids, the first potential energy parameter includes a potential energy value on each grid in the multiple grids, the first potential energy parameter is generated by superimposing a first value and a second value, a potential energy value generated on the grid in which each first type of virtual unit is located is the first value, a potential energy value generated on a grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is greater than the second value;
an obtaining module, configured to obtain, in a case that a virtual unit adjacent to a first group unit in the first type of virtual unit needs to be determined, a first group of potential energy values corresponding to a first lattice in the first potential energy parameter, where the first lattice has the first group unit thereon, and the first group of potential energy values includes potential energy values on a first group of adjacent lattices adjacent to the first lattice in the first potential energy parameter;
a second determining module, configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to a potential energy value greater than 0 in the first group of potential energy values.
Optionally, the second determining module is configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to a potential energy value greater than 0 in the first group of potential energy values by: determining a directional weight value of a first group of cells in the first group of adjacent cells, wherein the directional weight value of the first group of cells is smaller when the potential energy value of the first group of cells is larger than 0, and the directional weight value of the first group of cells is used for representing the weight value of the first group unit moving from the first cell to the cell in the first group of cells; determining a moving direction of each virtual unit in the first group unit according to the direction weight values of the first group of grids; and/or determining a velocity weight value of the first group of cells having potential values greater than 0 in the first group of adjacent cells based on potential values greater than 0 in the first group of potential values, wherein the velocity weight value of the first group of cells is smaller the greater the potential values on the first group of cells, and the velocity weight value of the first group of cells is used to determine the velocity at which the first group of cells moves from the first cell to a cell in the first group of cells; determining a moving speed of each virtual unit in the first group unit according to the speed weight values of the first group of cells.
Optionally, the apparatus is further configured to perform an operation of one of: before a first group of potential energy values corresponding to a first grid are obtained from the first potential energy parameter, under the condition that the first group unit is in a free forward movement state, determining that a virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a cable enemy, and the group unit freely moves forward; determining that a virtual unit adjacent to the first group unit in the first type of virtual units needs to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy; determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined under the condition that the first group unit is in a skill release state, wherein the skill release state indicates that an enemy exists in an attack range, attack is started, and skills are released; and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the first type of virtual units needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
Optionally, the apparatus is further configured to: determining a second potential energy parameter of the virtual map according to a grid in which a second type of virtual unit is located on the virtual map, wherein the second potential energy parameter includes a potential energy value on each grid in the multiple grids, the second potential energy parameter is generated by overlapping a third value and a fourth value, the potential energy value generated on the grid in which each second type of virtual unit is located is the third value, the potential energy value generated on the grid adjacent to the grid in which the second type of virtual unit is located is the fourth value, and the third value is greater than the fourth value; acquiring a second set of potential energy values corresponding to the first grid in the second potential energy parameter if virtual units adjacent to the first group unit in the second type of virtual unit need to be determined, wherein the second set of potential energy values comprises potential energy values on the first set of adjacent grids in the second potential energy parameter; and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy values which are larger than 0 in the second group of potential energy values.
Optionally, the apparatus is configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to a potential energy value greater than 0 in the second set of potential energy values by: determining a directional weight value of a second group of cells in the first group of adjacent cells, wherein the directional weight value of the second group of cells is larger according to a potential energy value larger than 0 in the second group of potential energy values, and the directional weight value of the second group of cells is larger according to the larger potential energy value in the second group of potential energy values, and the directional weight value of the second group of cells is used for representing the weight value of the first group unit moving from the second cell to the cell in the second group of cells; determining a moving direction of each virtual unit in the second group of units according to the direction weight values of the second group of grids; and/or determining a velocity weight value of the second group of cells having potential values greater than 0 in the first group of adjacent cells based on potential values greater than 0 in the second group of potential values, wherein the velocity weight value of the second group of cells is greater the potential values on the second group of cells, the velocity weight value of the second group of cells being used to determine the velocity at which the first group of units moves from the second cell to a cell in the second group of cells; determining a moving speed of each virtual unit in the second group unit according to the speed weight values of the second group of grids.
Optionally, the apparatus is further configured to perform an operation of one of: before a second group of potential energy values corresponding to the first grid are obtained from the second potential energy parameter, determining that a virtual unit adjacent to the first group unit in the second type of virtual unit needs to be determined under the condition that the first group unit is in a free forward movement state, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a cable enemy, and the group unit freely moves forward; determining that a virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy; determining a virtual unit adjacent to the first group unit in the second type of virtual unit to be determined under the condition that the first group unit is in a skill release state, wherein the skill release state indicates that an enemy exists in an attack range, attack is started, and skills are released; and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
Optionally, the second determining module includes: an obtaining unit, configured to obtain, when it is necessary to determine a lattice in which a virtual unit of another type different from the first type is located, a group of lattices in which the virtual unit of the other type is located from among the multiple lattices; a first determination unit configured to determine an edge lattice in the group of lattices; a second determining unit configured to determine a moving direction and/or a moving speed of each of the virtual units in the first group unit according to the other types of virtual units in the edge lattice.
Optionally, the first determining unit is configured to determine an edge lattice in the group of lattices by: configuring a single color corresponding to one type for a first type lattice having only a virtual unit of the one type of the other types in the first type lattice, in a case where the first type lattice exists in the group of lattices; configuring a mixed color corresponding to a plurality of types for a second type lattice having virtual units of the plurality of types in the other types in the second type lattice, in a case where the second type lattice exists in the group of lattices; determining a first edge lattice in the group of lattices, wherein the first edge lattice is configured with the single color and the first edge lattice and an adjacent lattice are configured with different colors; determining a second edge lattice in the set of lattices, wherein the second edge lattice is configured with the mixed color; determining the edge lattice to include the first edge lattice and the second edge lattice.
Optionally, the second determining unit is configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the edge grid by: determining N grids which are nearest to the first grid in the edge grids, wherein N is a natural number; determining a moving direction and a moving speed of each of the first group unit according to the other types of virtual units in the N lattices.
Optionally, the second determining unit is configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the N lattices by: determining a distance between each virtual unit in the first population unit to the other types of virtual units in the N lattices; and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the distance.
Optionally, before obtaining a group of grids in which the other types of virtual units are located in the plurality of grids, the method further includes: under the condition that the first group unit is in a trend target object state, determining grids where other types of virtual units different from the first type need to be determined, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy; under the condition that the first group unit is in a skill release state, determining grids where other types of virtual units different from the first type are needed to be determined, wherein the skill release state indicates that enemies exist in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining a grid where other types of virtual units different from the first type need to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
According to still another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned moving method of the virtual group unit when running.
According to still another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored, and a processor configured to execute the above-mentioned moving method of the virtual group unit by the computer program.
In the embodiment of the invention, a first potential energy parameter of a virtual map is determined according to a grid where a first type of virtual unit on the virtual map is located, under the condition that a virtual unit adjacent to a first group unit in the first type of virtual unit needs to be determined, a first group of potential energy values corresponding to the first grid are obtained from the first potential energy parameter, the moving direction and/or the moving speed of each virtual unit in the first group unit is determined according to a potential energy value which is greater than 0 in the first group of potential energy values, the moving direction and/or the moving speed of each virtual unit is further determined by determining the corresponding potential energy value of the grid where the virtual unit is located in the virtual map, and the mode that the potential energy values are calculated based on each virtual unit when the moving direction and/or the moving speed of each virtual unit are determined in the prior art is replaced, the method achieves the purpose of reducing the calculation amount, thereby achieving the technical effects of improving the efficiency of determining the moving mode of the virtual group, reducing the calculation cost and saving the calculation resources, and further solving the technical problems that the determining process of the moving mode of the virtual group is complex and the determining efficiency of the moving mode is low due to overlarge calculation amount.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic diagram of an application environment of an alternative method for moving a virtual group unit according to an embodiment of the invention;
FIG. 2 is a flow chart of a method for moving a virtual group unit according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a method for moving a virtual group unit according to an embodiment of the invention;
FIG. 4 is a flow chart of another method for moving a virtual group unit according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of another method for moving a virtual group unit according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of another method for moving a virtual group unit according to an embodiment of the present invention;
FIG. 7 is a flowchart illustrating a method for moving a virtual group unit according to another embodiment of the present invention;
FIG. 8 is a schematic structural diagram of an alternative mobile device for virtual group units according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of another alternative virtual swarm unit mobile device according to an embodiment of the invention;
fig. 10 is a schematic structural diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, partial nouns or terms referred to in the embodiments of the present application will be described:
group movement: a large number of clustered units, to a process that specifies discovery moves.
AI path finding: the process of finding a proper path to reach a destination in a 2D or 3D world is simulated by the virtual unit through an artificial intelligence algorithm.
The invention is illustrated below with reference to examples:
according to an aspect of the embodiments of the present invention, a method for moving a virtual group unit is provided, and optionally, in the present embodiment, the method for moving based on a virtual group unit may be applied to a hardware environment formed by a server 101 and a user terminal 103 as shown in fig. 1. As shown in fig. 1, a server 101 is connected to a terminal 103 through a network, and may be configured to provide services (such as application services, conference services, game services, and the like) for a user terminal or a client installed on the user terminal, and a database 105 may be provided on the server or separately from the server, and is configured to provide a data storage service for the server 101, where the server 101 may be a single server, or a server cluster composed of multiple servers, or a cloud server, and the user terminal 103 may be a terminal device configured with a target client, and may include but is not limited to at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), notebook computers, tablet computers, palm computers, MID (mobile internet Devices), PAD, desktop computers, smart televisions, etc. The target client may be a video client, an instant messaging client, a browser client, an educational client, etc. Such networks may include, but are not limited to: a wired network, a wireless network, wherein the wired network comprises: a local area network, a metropolitan area network, and a wide area network, the wireless network comprising: bluetooth, WIFI, and other networks implementing wireless communication may use the mobile services of the virtual group unit through the portal of the target application 107 configured on the terminal. The above is merely an example, and this is not limited in this embodiment.
Optionally, as an optional implementation manner, as shown in fig. 2, the moving method of the virtual group unit includes:
s202, determining a first potential energy parameter of a virtual map according to a grid in which a first type of virtual unit is located on the virtual map, wherein the virtual map is divided into a plurality of grids, the first potential energy parameter comprises a potential energy value on each grid in the plurality of grids, the first potential energy parameter is generated by overlapping a first value and a second value, the potential energy value generated on the grid in which each first type of virtual unit is located is the first value, the potential energy value generated on a grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is larger than the second value;
s204, under the condition that a virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, acquiring a first group of potential energy values corresponding to the first grid in the first potential energy parameter, wherein the first grid is provided with the first group unit in the first type of virtual unit, and the first group of potential energy values comprise potential energy values on a first group of adjacent grids adjacent to the first grid in the first potential energy parameter;
and S206, determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy value which is greater than 0 in the first group of potential energy values.
Optionally, in this embodiment, the virtual map may include, but is not limited to, a virtual map that can be used for AI route finding and is issued by a system or a server to a terminal, and may also include, but is not limited to, a virtual map that can be used for AI route finding in a terminal that is stored in advance, the virtual map may include, but is not limited to, a virtual map that is drawn based on a real scene, for example, a virtual map that is set for an application scene in virtual reality or augmented reality, taking the virtual map in an electronic game as an example, by dividing the virtual map into a plurality of grids, a virtual unit moving path in the electronic game is determined based on the grids, and movement from one grid to other grids in the virtual map is completed based on the determined moving path, and the types of the virtual map may include, but are not limited to, the above, the invention is not limited in this regard.
Alternatively, in this embodiment, the first type of virtual units may include, but are not limited to, virtual units having the same attributes and parameters in a game, and may also include, but is not limited to, virtual units capable of performing the same movement operation in a virtual scene, where the grid of the virtual map is a virtual map obtained by dividing a virtual map into a plurality of virtual grids according to a preset manner, for example, a block of the virtual map may be divided into virtual maps of various specifications such as 3x3, 5x5, 9x9, and where 3x3 denotes that the virtual map is divided into nine virtual grids and arranged according to 3x 3. The manner of dividing the virtual map into a plurality of virtual grids may include, but is not limited to, one or more combinations of the above, and the present invention is not limited in this respect.
Alternatively, in this embodiment, the first potential energy parameter may be set by a system or a server, and may also be set by a target application for editing the moving method of the virtual group unit, where the first potential energy parameter is used to represent a potential energy value of each virtual grid in a plurality of virtual grids, fig. 3 is a schematic diagram of another moving method of the virtual group unit according to an embodiment of the present invention, as shown in fig. 3, where fig. 3 is a virtual map arranged according to 5 × 5, a numerical value in each grid represents a potential energy parameter of its corresponding grid, 0 represents that a potential energy of a current grid is 0, that is, no virtual unit exists in the current grid, 1 and 2 respectively correspond to potential energy parameters of its corresponding virtual grid, that is, an influence capability of its corresponding virtual grid on an adjacent grid, and by taking AI routing in an electronic game as an example, a grid 304 in fig. 3 is configured as an initial position of a virtual unit 302 that needs to be subjected to AI routing, the path of the AI routing algorithm, that is, the moving path 308 from the grid 304 to the grid 306 in fig. 3, is determined based on the potential energy value of each virtual grid in the plurality of virtual grids, and the virtual unit 310 is the final position of the virtual unit 302 after the virtual unit moves through the AI routing. The above is merely an example, and the present invention is not limited in any particular way.
Optionally, in this embodiment, fig. 4 is a schematic flowchart of another moving method of a virtual group unit according to an embodiment of the present invention, and as shown in fig. 4, the flowchart may include the following steps:
s402, dividing a potential energy grid (corresponding to the virtual grid);
s404, pre-calculating a putting unit, and calculating the potential energy of the peripheral grid (corresponding to the first potential energy parameter);
s406, calculating potential energy values (corresponding to the first group of potential energy values) around the first grid according to the potential energy;
s408, calculating the influence of the peripheral unit;
in step S410, the moving manner (corresponding to the moving direction and/or moving distance of each virtual unit) of each virtual unit in the first group unit is calculated.
Alternatively, in this embodiment, fig. 5 is a schematic diagram of another moving method of virtual group units according to an embodiment of the present invention, as shown in fig. 5, which represents a potential energy value distribution generated by a virtual map for a virtual unit of a first type, where the first value is a grid 502 located at the center of the potential energy value distribution (the virtual grid where the virtual unit is located), and the second value is a numerical value 504 located in a grid adjacent to the grid where the virtual unit is located, that is, the potential energy value of the virtual unit in the grid where the virtual unit is located is higher, and the farther away from the grid, the potential energy value is lower.
Alternatively, in this embodiment, the step of superimposing the potential energy values generated by each virtual unit of the first type on the grid in which the virtual unit is located and the grid adjacent to the grid in which the virtual unit is located to generate the first potential energy parameter is to superimpose the potential energy values of the plurality of virtual grids according to the position of the virtual grid, for example, fig. 6 is a schematic diagram of a moving method of a virtual group unit according to another embodiment of the present invention, as shown in fig. 6, the value represented by the grid 602 is the potential energy value generated by superimposing the grid 604 and the grid 606, the potential energy distribution 608 represents the potential energy distribution of the corresponding grid, and 610 represents the corresponding potential energy distribution in the entire virtual map. By the mode, potential energy value distribution corresponding to the grids can be calculated based on different potential energy grids divided in the virtual map, and when the potential energy value distribution is subsequently used for determining the moving direction and/or the moving distance of each virtual unit, the potential energy values of the grids can be directly used instead of the potential energy values of all the virtual units in the grids, so that the calculation amount is reduced, and the calculation efficiency is improved.
Optionally, in this embodiment, a potential energy value greater than 0 in the first group of potential energy values indicates that the potential energy value greater than 0 can be applied to the surrounding grid.
By the embodiment, the method comprises the steps of determining a first potential energy parameter of the virtual map according to a grid where a first type of virtual unit on the virtual map is located, acquiring a first group of potential energy values corresponding to a first grid in the first potential energy parameter under the condition that a virtual unit adjacent to a first group unit in the first type of virtual unit needs to be determined, determining the moving direction and/or moving speed of each virtual unit in the first group unit according to the potential energy value which is greater than 0 in the first group of potential energy values, determining the moving direction and/or moving speed of each virtual unit by determining the corresponding potential energy value of the grid where the virtual unit is located in the virtual map, replacing the prior art that the potential energy values are respectively calculated based on each virtual unit when the moving direction and/or moving speed of each virtual unit is determined, and achieving the purpose of reducing the calculation amount, therefore, the technical effects of improving the efficiency of determining the moving mode of the virtual group, reducing the calculation cost and saving the calculation resources are achieved, and the technical problems that the determining process of the moving mode of the virtual group is complex and the determining efficiency of the moving mode is low due to overlarge calculation amount are solved.
In an alternative embodiment, determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the first group of potential energy values comprises: determining a directional weight value of a first group of lattices with potential energy values larger than 0 in the first group of adjacent lattices according to the potential energy value larger than 0 in the first group of potential energy values, wherein the larger the potential energy value on the first group of lattices is, the smaller the directional weight value of the first group of lattices is, and the directional weight value of the first group of lattices is used for representing the weight value of the first group unit moving from the first lattice to the lattices in the first group of lattices; determining a moving direction of each virtual unit in the first group unit according to the direction weight values of the first group of grids; and/or determining a velocity weight value of a first group of cells having potential energy values greater than 0 in the first group of adjacent cells according to potential energy values greater than 0 in the first group of potential energy values, wherein the velocity weight value of the first group of cells is smaller the greater the potential energy value in the first group of cells is, and the velocity weight value of the first group of cells is used to determine the velocity at which the first group of cells moves from the first cell to a cell in the first group of cells; the moving speed of each virtual unit in the first group unit is determined according to the speed weight values of the first group of grids.
Optionally, in this embodiment, the direction weight value and the speed weight value are used for subsequently determining the moving direction and speed of each virtual unit in the first group unit.
Optionally, in this embodiment, the larger the potential energy value of the first group of lattices is, the smaller the directional weight value of the first group of lattices is, that is, the larger the potential energy value of the first group of lattices is, the larger the influence exerted on the adjacent lattices is, and for example, in the game field, when a plurality of virtual units of the same type perform group movement, in order to make the plurality of virtual units perform mutual exclusion dispersion movement, by calculating the directional weight value and the speed weight value, when the potential energy value of the first group of lattices is larger, the more obvious the mutual exclusion effect is, so that the weight for making the virtual unit in the adjacent lattices move to the lattices with large potential energy values is smaller, that is, when the virtual unit moves, the lattices with large potential energy values will generate adverse effects on the adjacent lattices, and guide the virtual unit to move away from the lattices with large potential values as far as possible.
By the embodiment, the speed weight value and the direction weight value are determined based on the potential energy value, so that the subsequent virtual group movement calculation is facilitated, the unit in the lattice with the small potential energy value can move towards the lattice with the smaller potential energy value, the congestion of the virtual unit in a single virtual lattice is avoided, and the virtual unit can be dispersed.
In an optional embodiment, before obtaining the first set of potential energy values corresponding to the first lattice in the first potential energy parameter, the method further includes one of: under the condition that the first group unit is in a free forward movement state, determining a virtual unit which is adjacent to the first group unit and needs to be determined in the first type of virtual unit, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a natural enemy, and the group unit freely moves forward; under the condition that the first group unit is in a trend target object state, determining a virtual unit which is adjacent to the first group unit and needs to be determined in the first type of virtual unit, wherein the trend target object state indicates that an enemy exists in a range of a enemy and moves to the enemy; under the condition that the first group unit is in a skill release state, determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined, wherein the skill release state indicates that an enemy exists in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
Optionally, in this embodiment, the determining that it is necessary to determine the state of the virtual unit adjacent to the first group unit in the first type of virtual unit may include, but is not limited to, a free advance state, a trend target object state, a skill release state, a blocking state, and the like.
Through the embodiment, the virtual unit adjacent to the first group unit in the first type of virtual unit can be determined based on different motion states of the virtual group, and then mutual exclusion in the moving process of the same type of virtual unit group can be realized, so that group motion is more vivid, and the use experience of a user is optimized.
In an alternative embodiment, the method comprises: determining a second potential energy parameter of the virtual map according to a grid in which a second type of virtual unit on the virtual map is located, wherein the second potential energy parameter comprises a potential energy value on each grid in the multiple grids, the second potential energy parameter is generated by overlapping a third value and a fourth value, the potential energy value generated on the grid in which each second type of virtual unit is located is the third value, the potential energy value generated on the grid adjacent to the grid in which the second type of virtual unit is located is the fourth value, and the third value is larger than the fourth value; under the condition that virtual units adjacent to the first group unit in the second type of virtual units need to be determined, acquiring a second group of potential energy values corresponding to the first grid in a second potential energy parameter, wherein the second group of potential energy values comprise potential energy values on the first group of adjacent grids in the second potential energy parameter; and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy values which are larger than 0 in the second group of potential energy values.
Optionally, in this embodiment, the second type is different from the first type, for example, the first type of virtual unit and the second type of virtual unit are enemy virtual units, and the second type of virtual unit may include, but is not limited to, the target object or the enemy.
Alternatively, in this embodiment, since the first type of virtual unit and the second type of virtual unit are enemy virtual units, when calculating the movement path during the game, it is necessary to control each virtual unit in the first group unit to move closer to the second type of virtual unit when finding the second type of virtual unit during the movement, for example, as shown in fig. 6.
Through the embodiment, different moving modes can be set based on different types of virtual units, so that the plurality of first type virtual units can move to the second type virtual units as much as possible, and the use experience of a user is improved.
In an alternative embodiment, determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the second set of potential energy values comprises: determining a directional weight value of a second group of lattices with potential energy values larger than 0 in the first group of adjacent lattices according to the potential energy value larger than 0 in the second group of potential energy values, wherein the larger the potential energy value on the second group of lattices is, the larger the directional weight value of the second group of lattices is, and the directional weight value of the second group of lattices is used for representing the weight value of the first group unit moving from the second lattice to the lattices in the second group of lattices; determining the moving direction of each virtual unit in the second group unit according to the direction weight value of the second group of grids; and/or determining a velocity weight value of a second group of lattices with potential energy values larger than 0 in the first group of adjacent lattices according to the potential energy value larger than 0 in the second group of potential energy values, wherein the velocity weight value of the second group of lattices is larger when the potential energy value on the second group of lattices is larger, and the velocity weight value of the second group of lattices is used for determining the velocity of the first group of unit bodies moving from the second lattice to the lattices in the second group of lattices; the moving speed of each virtual unit in the second group unit is determined according to the speed weight values of the second group of grids.
Optionally, in this embodiment, the direction weight value and the speed weight value are used for subsequently determining the moving direction and speed of each virtual unit in the second group unit.
Alternatively, in this embodiment, the larger the potential energy value of the second lattice, the larger the directional weight value of the second lattice, that is, the larger the potential energy value of the second lattice, the greater its influence on the adjacent grid, in the field of games, for example, when a plurality of virtual units of the same type are subject to group movement, in order to simultaneously move the plurality of virtual units toward the second type of virtual unit after encountering other types of virtual units, by calculating the direction weight value and the velocity weight value, when the potential energy value of the grid in the second group is larger, the same-direction effect is more obvious, so that the weight of the virtual unit in the adjacent grid moving to the grid with the larger potential energy value is larger, that is, when the virtual unit moves, the lattices with large potential energy values can generate positive action on the adjacent lattices, and the virtual unit is guided to move towards the lattices with large potential energy values as far as possible.
Through the embodiment, the speed weight value and the direction weight value are determined based on the potential energy value, so that the subsequent virtual group movement calculation is facilitated, the first type of virtual unit in the lattice with the small potential energy value can move towards the second type of virtual unit in the lattice with the large potential energy value, the use experience of a user is optimized, and the moving process is more intelligent.
In an optional embodiment, before obtaining the second set of potential energy values corresponding to the first lattice in the second potential energy parameter, the method further includes one of: under the condition that the first group unit is in a free forward movement state, determining a virtual unit adjacent to the first group unit in a second type of virtual unit to be determined, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a natural enemy, and the group unit freely moves forward; under the condition that the first group unit is in a trend target object state, determining a virtual unit which is adjacent to the first group unit and needs to be determined in the second type of virtual unit, wherein the trend target object state indicates that an enemy exists in a range of a enemy and moves to the enemy; and under the condition that the first group unit is in a skill release state, determining that a virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined, wherein the skill release state represents that an enemy exists in an attack range, starting attack, and under the condition that the first group unit is in a blocking state, determining that a virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined, wherein the blocking state represents that the group units are blocked in the moving process.
Optionally, in this embodiment, the determining that it is necessary to determine the state of the virtual unit adjacent to the first group unit in the first type of virtual unit may include, but is not limited to, a free advance state, a trend target object state, a skill release state, a blocking state, and the like.
By the embodiment, the virtual unit adjacent to the first group unit in the second type of virtual unit can be determined based on different motion states of the virtual group, so that all the second type of virtual units can be moved towards the second type of virtual unit after the second type of virtual units are found in the moving process of the first type of virtual unit group, group motion is more intelligent and automatic, and user experience is optimized.
In an alternative embodiment, the method comprises: under the condition that grids where other types of virtual units different from the first type are located need to be determined, obtaining a group of grids where other types of virtual units are located in the plurality of grids; determining an edge grid in a group of grids; the moving direction and/or moving speed of each virtual unit in the first group unit is determined according to other types of virtual units in the edge grid.
Optionally, in this embodiment, the other types of virtual units are other types different from the first type, and in the process of moving the virtual group, the general target enemies are all distributed at the edge of the virtual group, so that the general target enemies are distributed at the edge of the virtual group. By the embodiment, when the potential energy of the lattices in which the virtual units of other types are located needs to be calculated, only the edge lattices are calculated, the potential energy of the lattices in which most of the virtual units of other types are located can be represented, the potential energy of the lattices in which the virtual units of other types are located does not need to be calculated, and the technical effects of simplifying the operation process, reducing the calculation amount, optimizing the calculation flow and reducing the calculation cost can be achieved.
In an alternative embodiment, determining the edge lattice in a set of lattices comprises: configuring a single color corresponding to one type for a first type lattice in a case where the first type lattice exists in a group of lattices, wherein the first type lattice has only a virtual unit of one type among the other types; configuring a mixed color corresponding to a plurality of types for a second type lattice in which virtual units of a plurality of types among other types exist, in a case where the second type lattice exists in a group of lattices; determining a first edge lattice in a set of lattices, wherein the first edge lattice is configured with a single color and the first edge lattice and an adjacent lattice are configured with different colors; determining a second edge lattice in the group of lattices, wherein the second edge lattice is configured with mixed colors; the edge lattice is determined to include a first edge lattice and a second edge lattice.
Optionally, in this embodiment, the color-mixed grid indicates that a plurality of virtual units of different types exist in the current grid, and the configuring of the colors for the grid may include, but is not limited to, dividing the virtual map into M × N grids, where each grid may include a plurality of units, accumulating team color values of the current grid when the units are placed in the grid, and each grid may have a team color after accumulation, and when the team color is a solid color, it indicates that only virtual units of the same type exist in the current grid, and when the team color is a mixed color, it indicates that virtual units of different types exist in the current grid. The different types may include the aforementioned first type and second type.
For example, when the design of the virtual unit of the first type needs to be preferentially moved to the grids with both the virtual units of the first type and the virtual units of the second type, only the edge grids with mixed colors can be calculated to reduce the calculation amount, improve the calculation efficiency and save the calculation resources.
In an alternative embodiment, determining the moving direction and/or moving speed of each virtual unit in the first group unit according to other types of virtual units in the edge grid includes: determining N grids which are closest to the first grid in the edge grids, wherein N is a natural number; the moving direction and moving speed of each virtual unit in the first group unit are determined from the other types of virtual units in the N lattices.
Optionally, in this embodiment, fig. 7 is a schematic flowchart of a moving method of a virtual group unit according to another embodiment of the present invention, and as shown in fig. 7, the steps of the flowchart are as follows:
s702, dividing grids;
s704, dyeing;
s706, finding out edge grids;
s708, calculating the nearest edge grid;
s710, the nearest unit is calculated.
Alternatively, in this embodiment, the moving manner of the lattice at a closer distance may be preferentially obtained based on the distance between the first group unit and another lattice, for example, N is set to 3, and when edge lattices exist at distances of 3, 4, 5, and 6 from the first lattice, respectively, only the first 3 bits, that is, the edge lattices at distances of 3, 4, and 5, respectively, are selected as the edge lattices used for calculation, so that the technical effects of reducing the amount of calculation, improving the calculation efficiency, and saving the calculation resources may be achieved.
In an alternative embodiment, determining the moving direction and/or moving speed of each virtual unit in the first group unit according to other types of virtual units in the N lattices includes: determining a distance between each virtual unit in the first group unit to other types of virtual units in the N lattices; the moving direction and/or moving speed of each virtual unit in the first group unit is determined according to the distance.
Optionally, in this embodiment, the moving manner of each virtual unit in the first group unit may be determined based only on the distance between each virtual unit in the first group unit and the other type of virtual units in the N lattices, the calculation manner is simpler, and the method is applicable to a technical scheme that mainly needs to consider the distance between the virtual units, and can achieve the technical effects of reducing the calculation amount, improving the calculation efficiency, and saving the calculation resources.
In an optional embodiment, before obtaining a group of lattices in which other types of virtual units in the plurality of lattices are located, the method further includes: under the condition that the first group unit is in a trend target object state, determining grids where other types of virtual units different from the first type are needed to be determined, wherein the trend target object state indicates that an enemy exists in a range of a fairy and moves to the enemy; under the condition that the first group unit is in a skill release state, determining grids where other types of virtual units different from the first type are needed to be determined, wherein the skill release state indicates that enemies exist in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining a grid where other types of virtual units different from the first type need to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
Alternatively, in this embodiment, the grid in which the virtual unit of another type different from the first type needs to be determined may be selectively determined based on different states of the first group unit, such as a free advance state, a tendency target state, a skill release state, a blocking state, and the like.
By the embodiment, selective determination can be performed based on different states of the first group unit, and the lattice where other types of virtual units different from the first type need to be determined is determined, so that the lattice can be identified, subsequent calculation processing is facilitated, group movement is performed under different states, and the use experience of a user is optimized.
The invention is generally illustrated below with reference to specific examples:
in an alternative embodiment, the unit move logic in RTS (instant strategy) game is first divided into 7 states:
1. an initial waiting state: initial entry state
2. Strict population movement status: the object is in the square matrix and moves forward strictly according to the speed of the square matrix
3. Free advance state: the square matrix is dissolved, but the target is not found in the range of the souvenir and freely moves forwards
4. And (3) tending to a target object state: enemies are in the range of the soul and move to the enemies.
5. Releasing the skill state: the enemy exists in the attack range, attack is started, and the skill is released
6. Movement blocked state: in a normal moving state, if the displacement is detected to be smaller than a certain distance within a period of time, the current area state is judged to be a blocking area, the moving in the blocking area needs to translate and detour, and then the moving is carried out.
7. Final end state: terminal state
From the above 7 states, an associated velocity formula is designed for each state as follows:
1. initial and final states: no move is required and the move state update is skipped.
2. Strict population movement status: the individual moving speed completely multiplexes the moving speed of the square matrix, and extra calculation is not needed.
3. Free advance state: and calculating the mutual repulsion and the default moving direction, and combining the two forces to form a moving direction. The velocity calculation formula is: velocity default speed + performance speed Separtedpeight SepartSpeedweight. (which may be associated with the velocity weight values described above)
4. And (3) tending to a target state: and calculating the moving direction facing the enemy moving direction and the mutual repulsion moving direction. The velocity calculation formula is: velocity. enemySeeking-enemySeeking weight + permeability speed. SepartentionsSpeedweight
5. Skill release state: and calculating the dispersion force in the orthogonal direction facing the enemy direction, and performing micro translation. Calculating the translation direction firstly calculates the direction facing the enemy, then calculates two orthogonal directions of the direction, and takes one orthogonal direction with an included angle of less than 90 degrees with the repulsive force as the translation direction. The velocity calculation formula is: velocity of absorbing flowing value
6. A blocking state: under the state of normally tending to enemy, when a large number of units are piled, congestion occurs, at this time, except peripheral units, accidents can be slowly removed by using a basic fish swarm algorithm, the units in the middle of a cluster are difficult to evacuate, and the phenomenon is that front-row soldiers stop and output, rear-row soldiers walk disorderly, and the scattered soldiers cannot move forward. The method comprises the steps of defining a blocking state, wherein a unit is in a moving state, only micro displacement is carried out for a long time, the unit is converted into the blocking state, the blocking state is removed when a enemy is found in a surrounding unit in the blocking state, in addition to the calculation trend of the enemy and mutual repulsion, an evacuation force is additionally added to the unit in the blocking state, the evacuation force is calculated by firstly calculating two orthogonal directions facing the enemy direction, then calculating the direction far away from the center of gravity of a current block, and finally taking the direction with an included angle smaller than 90 degrees with the direction far away from the center of gravity of the block in the two orthogonal directions as the evacuation direction, wherein the evacuation force is larger when the unit is in the blocking state for a longer time. The velocity calculation formula is: velocity of excitation, excitation
According to the formula, a finite state machine related to the virtual group moving strategy is produced, and the virtual group moving direction is determined by the control target enemy parameter and the surrounding unit parameter.
For the surrounding unit parameters:
firstly, dividing grids on an M × N map by using an M × N array, recording a potential energy value for each grid, wherein the potential energy value is a linked list of units, when a unit is placed in the map, the unit can correspondingly generate a potential energy influence on surrounding grids, marking an influence value (corresponding to the first potential energy parameter or the second potential energy parameter) on the peripheral grids on the corresponding grid for each unit, and the unit can have different influence ranges according to the volume:
after the labeling of the lattice is completed, when the unit needs to acquire the peripheral unit, only the potential energy value of the lattice at the current position needs to be taken, and the unit which has an influence on the current lattice, namely the peripheral unit, can be acquired.
Potential energy of a unit is preprocessed, data reading and writing are separated, parallel calculation can be carried out, and efficiency of peripheral unit indexing is greatly improved.
For the target enemy parameter:
in a mobile scenario that needs to be configured to be associated with a target enemy (corresponding to the aforementioned second type of virtual unit), the large-scale group units are distributed at the edge of the cluster in general during the routing process.
1. Dyeing process
The method comprises the steps of firstly dividing a virtual map into M-N grids, wherein each grid comprises a plurality of units, accumulating team color values of the current grid when the units are placed into the grids, and finally, each grid has a team color.
2. Finding edge grids
And then calculating the team color of the current grid, if the current grid is a mixed color grid, determining that the current grid is an edge area, if the current grid is a pure color grid, judging whether the color of the current grid is equal to that of the peripheral 8 grids, if the color of the current grid is equal to that of the peripheral 8 grids, determining that the current grid is a central grid, and if the color of the current grid is not equal to that of the.
3. Precomputing the nearest three hostile edge grids per grid
All edge bins were collected by color. And then calculating the distances between all grids containing units and the edge grids, taking the grids of the first three bits for recording, and directly obtaining the units in the three grids for distance sorting when the units in the current grid are subjected to the operation of the soul and enemy to find the nearest enemy.
By the technical scheme, the lattice is pre-calculated and space division is carried out, so that the repeated workload is reduced, and the algorithm can be operated in parallel by read-write separation and pre-calculation.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present invention, there is also provided a virtual group unit moving apparatus for implementing the above-described virtual group unit moving method. As shown in fig. 8, the apparatus includes:
a first determining module 802, configured to determine a first potential energy parameter of a virtual map according to a grid in which a first type of virtual unit on the virtual map is located, where the virtual map is divided into multiple grids, the first potential energy parameter includes a potential energy value on each grid in the multiple grids, the first potential energy parameter is generated by superimposing a first value and a second value, a potential energy value generated on the grid in which each first type of virtual unit is located is the first value, a potential energy value generated on a grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is greater than the second value;
an obtaining module 804, configured to obtain a first group of potential energy values corresponding to a first lattice in a first potential energy parameter when a virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, where the first lattice has the first group unit thereon, and the first group of potential energy values includes potential energy values on a first group of adjacent lattices adjacent to the first lattice in the first potential energy parameter;
a second determining module 806, configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to a potential energy value greater than 0 in the first set of potential energy values.
In an alternative embodiment, the second determining module is configured to determine the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the first group of potential energy values by: determining a directional weight value of a first group of lattices with potential energy values larger than 0 in the first group of adjacent lattices according to the potential energy value larger than 0 in the first group of potential energy values, wherein the larger the potential energy value on the first group of lattices is, the smaller the directional weight value of the first group of lattices is, and the directional weight value of the first group of lattices is used for representing the weight value of the first group unit moving from the first lattice to the lattices in the first group of lattices; determining a moving direction of each virtual unit in the first group unit according to the direction weight values of the first group of grids; and/or determining a velocity weight value of a first group of cells having potential energy values greater than 0 in the first group of adjacent cells according to potential energy values greater than 0 in the first group of potential energy values, wherein the velocity weight value of the first group of cells is smaller the greater the potential energy value in the first group of cells is, and the velocity weight value of the first group of cells is used to determine the velocity at which the first group of cells moves from the first cell to a cell in the first group of cells; the moving speed of each virtual unit in the first group unit is determined according to the speed weight values of the first group of grids.
In an alternative embodiment, the apparatus is further configured to perform one of the following: before a first group of potential energy values corresponding to a first grid are obtained from a first potential energy parameter, under the condition that a first group unit is in a free forward movement state, determining a virtual unit adjacent to the first group unit in a first type of virtual unit to be determined, wherein the free forward movement state represents that a queue where the group unit is located is dispersed, but a target is not found in a range of a rope and moves forward freely; under the condition that the first group unit is in a trend target object state, determining a virtual unit which is adjacent to the first group unit and needs to be determined in the first type of virtual unit, wherein the trend target object state indicates that an enemy exists in a range of a enemy and moves to the enemy; under the condition that the first group unit is in a skill release state, determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined, wherein the skill release state indicates that an enemy exists in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
In an alternative embodiment, the apparatus is further configured to: determining a second potential energy parameter of the virtual map according to a grid in which a second type of virtual unit on the virtual map is located, wherein the second potential energy parameter comprises a potential energy value on each grid in the multiple grids, the second potential energy parameter is generated by overlapping a third value and a fourth value, the potential energy value generated on the grid in which each second type of virtual unit is located is the third value, the potential energy value generated on the grid adjacent to the grid in which the second type of virtual unit is located is the fourth value, and the third value is larger than the fourth value; under the condition that virtual units adjacent to the first group unit in the second type of virtual units need to be determined, acquiring a second group of potential energy values corresponding to the first grid in a second potential energy parameter, wherein the second group of potential energy values comprise potential energy values on the first group of adjacent grids in the second potential energy parameter; and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy values which are larger than 0 in the second group of potential energy values.
In an alternative embodiment, the apparatus is configured to determine the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the second group of potential energy values by: determining a directional weight value of a second group of lattices with potential energy values larger than 0 in the first group of adjacent lattices according to the potential energy value larger than 0 in the second group of potential energy values, wherein the larger the potential energy value on the second group of lattices is, the larger the directional weight value of the second group of lattices is, and the directional weight value of the second group of lattices is used for representing the weight value of the first group unit moving from the second lattice to the lattices in the second group of lattices; determining the moving direction of each virtual unit in the second group unit according to the direction weight value of the second group of grids; and/or determining a velocity weight value of a second group of lattices with potential energy values larger than 0 in the first group of adjacent lattices according to the potential energy value larger than 0 in the second group of potential energy values, wherein the velocity weight value of the second group of lattices is larger when the potential energy value on the second group of lattices is larger, and the velocity weight value of the second group of lattices is used for determining the velocity of the first group of unit bodies moving from the second lattice to the lattices in the second group of lattices; the moving speed of each virtual unit in the second group unit is determined according to the speed weight values of the second group of grids.
In an alternative embodiment, the apparatus is further configured to perform one of the following: before a second group of potential energy values corresponding to the first grid are obtained from the second potential energy parameter, under the condition that the first group unit is in a free forward movement state, determining a virtual unit adjacent to the first group unit in a virtual unit of a second type to be determined, wherein the free forward movement state represents that a queue where the group unit is located is dispersed, but a target is not found in a range of a cable enemy, and the virtual unit moves forwards freely; under the condition that the first group unit is in a trend target object state, determining a virtual unit which is adjacent to the first group unit and needs to be determined in the second type of virtual unit, wherein the trend target object state indicates that an enemy exists in a range of a enemy and moves to the enemy; under the condition that the first group unit is in a skill release state, determining a virtual unit adjacent to the first group unit in a second type of virtual unit to be determined, wherein the skill release state indicates that an enemy exists in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the second type of virtual unit needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
In an alternative embodiment, fig. 9 is a schematic structural diagram of another virtual group unit mobile device according to an embodiment of the present invention, and the second determining module 806 includes: an obtaining unit 902, configured to obtain a group of lattices in which virtual units of other types are located in the multiple lattices when it is necessary to determine lattices in which virtual units of other types different from the first type are located; a first determining unit 904 for determining an edge lattice in a group of lattices; a second determining unit 906 configured to determine a moving direction and/or a moving speed of each of the virtual units in the first group unit according to other types of virtual units in the edge grid.
In an alternative embodiment, the first determination unit is configured to determine the edge lattice in the group of lattices by: configuring a single color corresponding to one type for a first type lattice in a case where the first type lattice exists in a group of lattices, wherein the first type lattice has only a virtual unit of one type among the other types; configuring a mixed color corresponding to a plurality of types for a second type lattice in which virtual units of a plurality of types among other types exist, in a case where the second type lattice exists in a group of lattices; determining a first edge lattice in a set of lattices, wherein the first edge lattice is configured with a single color and the first edge lattice and an adjacent lattice are configured with different colors; determining a second edge lattice in the group of lattices, wherein the second edge lattice is configured with mixed colors; the edge lattice is determined to include a first edge lattice and a second edge lattice.
In an alternative embodiment, the second determining unit is configured to determine the moving direction and/or the moving speed of each virtual unit in the first group unit according to other types of virtual units in the edge grid by: determining N grids which are closest to the first grid in the edge grids, wherein N is a natural number; the moving direction and moving speed of each virtual unit in the first group unit are determined from the other types of virtual units in the N lattices.
In an alternative embodiment, the second determining unit is configured to determine the moving direction and/or the moving speed of each virtual unit in the first group unit from other types of virtual units in the N lattices by: determining a distance between each virtual unit in the first group unit to other types of virtual units in the N lattices; the moving direction and/or moving speed of each virtual unit in the first group unit is determined according to the distance.
In an alternative embodiment, the apparatus is further configured to: before a group of grids in which other types of virtual units are located in a plurality of grids are obtained, determining grids in which other types of virtual units different from the first type need to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in a range of a fairy and moves to the enemy; under the condition that the first group unit is in a skill release state, determining grids where other types of virtual units different from the first type are needed to be determined, wherein the skill release state indicates that enemies exist in an attack range, starting attack and releasing skills; and under the condition that the first group unit is in a blocking state, determining a grid where other types of virtual units different from the first type need to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
According to another aspect of the embodiment of the present invention, there is also provided an electronic device for implementing the above-mentioned moving method of the virtual group unit, where the electronic device may be a terminal device or a server shown in fig. 1. The embodiment may be described by taking the electronic device as an example that can be placed on a terminal and a server. As shown in fig. 10, the electronic device comprises a memory 1002 and a processor 1004, the memory 1002 having stored therein a computer program, the processor 1004 being arranged to execute the steps of any of the method embodiments described above by means of the computer program.
Optionally, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, determining a first potential energy parameter of the virtual map according to a grid in which a first type of virtual unit is located on the virtual map, wherein the virtual map is divided into a plurality of grids, the first potential energy parameter comprises a potential energy value on each grid in the plurality of grids, the first potential energy parameter is generated by overlapping a first value and a second value, the potential energy value generated on the grid in which each first type of virtual unit is located is the first value, the potential energy value generated on the grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is larger than the second value;
s2, under the condition that a virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, acquiring a first group of potential energy values corresponding to the first grid in the first potential energy parameter, wherein the first grid has the first group unit thereon, and the first group of potential energy values comprises potential energy values on a first group of adjacent grids adjacent to the first grid in the first potential energy parameter;
s3, determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the first group of potential energy values.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 10 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 10 is a diagram illustrating a structure of the electronic device. For example, the electronics may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 10, or have a different configuration than shown in FIG. 10.
The memory 1002 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for moving a virtual group unit in the embodiment of the present invention, and the processor 1004 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002, that is, implements the above-described method for moving a virtual group unit. The memory 1002 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1002 may further include memory located remotely from the processor 1004, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1002 may be, but not limited to, information such as relevant parameters for the virtual group and relevant parameters of the virtual map. As an example, as shown in fig. 10, the memory 1002 may include, but is not limited to, a first determining module 802, an obtaining module 804, and a second determining module 806 in the mobile device including the virtual group unit. In addition, the mobile device may further include, but is not limited to, other module units in the above virtual group unit, which is not described in detail in this example.
Optionally, the above-mentioned transmission device 1006 is used for receiving or sending data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1006 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices so as to communicate with the internet or a local area Network. In one example, the transmission device 1006 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1008 for displaying the virtual map and the virtual group; and a connection bus 1010 for connecting the respective module parts in the above-described electronic apparatus.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting a plurality of nodes through a network communication. Nodes can form a Peer-To-Peer (P2P, Peer To Peer) network, and any type of computing device, such as a server, a terminal, and other electronic devices, can become a node in the blockchain system by joining the Peer-To-Peer network.
According to a further aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the above-mentioned computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, determining a first potential energy parameter of the virtual map according to a grid in which a first type of virtual unit is located on the virtual map, wherein the virtual map is divided into a plurality of grids, the first potential energy parameter comprises a potential energy value on each grid in the plurality of grids, the first potential energy parameter is generated by overlapping a first value and a second value, the potential energy value generated on the grid in which each first type of virtual unit is located is the first value, the potential energy value generated on the grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is larger than the second value;
s2, under the condition that a virtual unit adjacent to the first group unit in the first type of virtual unit needs to be determined, acquiring a first group of potential energy values corresponding to the first grid in the first potential energy parameter, wherein the first grid has the first group unit thereon, and the first group of potential energy values comprises potential energy values on a first group of adjacent grids adjacent to the first grid in the first potential energy parameter;
s3, determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the first group of potential energy values.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be substantially or partially implemented in the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, or network devices) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit is merely a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.

Claims (15)

1. A method for moving a virtual group unit, comprising:
determining a first potential energy parameter of a virtual map according to a grid in which a first type of virtual unit is located on the virtual map, wherein the virtual map is divided into a plurality of grids, the first potential energy parameter comprises a potential energy value on each grid in the plurality of grids, the first potential energy parameter is generated by overlapping a first value and a second value, the potential energy value generated on the grid in which each first type of virtual unit is located is the first value, the potential energy value generated on the grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is larger than the second value;
acquiring a first group of potential energy values corresponding to a first grid in the first potential energy parameter under the condition that virtual units adjacent to the first group unit in the first type of virtual units need to be determined, wherein the first grid has the first group unit thereon, and the first group of potential energy values comprises potential energy values on a first group of adjacent grids adjacent to the first grid in the first potential energy parameter;
determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to potential energy values greater than 0 in the first set of potential energy values.
2. The method of claim 1, wherein determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to a potential energy value greater than 0 in the first set of potential energy values comprises:
determining a directional weight value of a first group of cells in the first group of adjacent cells, wherein the directional weight value of the first group of cells is smaller when the potential energy value of the first group of cells is larger than 0, and the directional weight value of the first group of cells is used for representing the weight value of the first group unit moving from the first cell to the cell in the first group of cells; determining a moving direction of each virtual unit in the first group unit according to the direction weight values of the first group of grids; and/or
Determining a velocity weight value for the first group of bins having potential values greater than 0 in the first group of adjacent bins based on potential values greater than 0 in the first group of potential values, wherein the velocity weight value for the first group of bins is smaller for larger potential values in the first group of bins and is used to determine a velocity at which the first group of units of the first group moves from the first bin to a bin in the first group of bins; determining a moving speed of each virtual unit in the first group unit according to the speed weight values of the first group of cells.
3. The method of claim 1, wherein prior to obtaining the first set of potential energy values for the first grid in the first potential energy parameter, the method further comprises one of:
determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined under the condition that the first group unit is in a free forward movement state, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a challenge and freely moves forward;
determining that a virtual unit adjacent to the first group unit in the first type of virtual units needs to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy;
determining a virtual unit adjacent to the first group unit in the first type of virtual unit to be determined under the condition that the first group unit is in a skill release state, wherein the skill release state indicates that an enemy exists in an attack range, attack is started, and skills are released;
and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the first type of virtual units needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
4. The method of claim 1, comprising:
determining a second potential energy parameter of the virtual map according to a grid in which a second type of virtual unit is located on the virtual map, wherein the second potential energy parameter includes a potential energy value on each grid in the multiple grids, the second potential energy parameter is generated by overlapping a third value and a fourth value, the potential energy value generated on the grid in which each second type of virtual unit is located is the third value, the potential energy value generated on the grid adjacent to the grid in which the second type of virtual unit is located is the fourth value, and the third value is greater than the fourth value;
acquiring a second set of potential energy values corresponding to the first grid in the second potential energy parameter if virtual units adjacent to the first group unit in the second type of virtual unit need to be determined, wherein the second set of potential energy values comprises potential energy values on the first set of adjacent grids in the second potential energy parameter;
and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the potential energy values which are larger than 0 in the second group of potential energy values.
5. The method of claim 4, wherein determining the moving direction and/or moving speed of each virtual unit in the first group unit according to the potential energy value greater than 0 in the second set of potential energy values comprises:
determining a directional weight value of a second group of cells in the first group of adjacent cells, wherein the directional weight value of the second group of cells is larger according to a potential energy value larger than 0 in the second group of potential energy values, and the directional weight value of the second group of cells is larger according to the larger potential energy value in the second group of potential energy values, and the directional weight value of the second group of cells is used for representing the weight value of the first group unit moving from the second cell to the cell in the second group of cells; determining a moving direction of each virtual unit in the second group of units according to the direction weight values of the second group of grids; and/or
Determining a velocity weight value for the second group of bins having potential values greater than 0 in the second group of adjacent bins based on potential values greater than 0 in the second group of potential values, wherein the velocity weight value for the second group of bins is greater for greater potential values in the second group of bins and is used to determine a velocity at which the first group of units moves from the second bin to a bin in the second group of bins; determining a moving speed of each virtual unit in the second group unit according to the speed weight values of the second group of grids.
6. The method of claim 4, wherein prior to obtaining the second set of potential energy values for the first lattice in the second potential energy parameter, the method further comprises one of:
determining a virtual unit adjacent to the first group unit in the second type of virtual unit to be determined under the condition that the first group unit is in a free forward movement state, wherein the free forward movement state indicates that a queue where the group unit is located is dispersed, but a target is not found in a range of a challenge and freely moves forward;
determining that a virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined under the condition that the first group unit is in a trend target object state, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy;
determining a virtual unit adjacent to the first group unit in the second type of virtual unit to be determined under the condition that the first group unit is in a skill release state, wherein the skill release state indicates that an enemy exists in an attack range, attack is started, and skills are released;
and under the condition that the first group unit is in a blocking state, determining that the virtual unit adjacent to the first group unit in the second type of virtual units needs to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
7. The method of claim 1, comprising:
under the condition that grids where other types of virtual units different from the first type are located need to be determined, acquiring a group of grids where the other types of virtual units are located in the plurality of grids;
determining an edge lattice in the set of lattices;
determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the edge lattice.
8. The method of claim 7, wherein the determining the edge lattice in the set of lattices comprises:
configuring a single color corresponding to one type for a first type lattice having only a virtual unit of the one type of the other types in the first type lattice, in a case where the first type lattice exists in the group of lattices;
configuring a mixed color corresponding to a plurality of types for a second type lattice having virtual units of the plurality of types in the other types in the second type lattice, in a case where the second type lattice exists in the group of lattices;
determining a first edge lattice in the group of lattices, wherein the first edge lattice is configured with the single color and the first edge lattice and an adjacent lattice are configured with different colors;
determining a second edge lattice in the set of lattices, wherein the second edge lattice is configured with the mixed color;
determining the edge lattice to include the first edge lattice and the second edge lattice.
9. The method according to claim 7, wherein the determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the edge grid comprises:
determining N grids which are nearest to the first grid in the edge grids, wherein N is a natural number;
determining a moving direction and a moving speed of each of the first group unit according to the other types of virtual units in the N lattices.
10. The method according to claim 9, wherein the determining a moving direction and/or a moving speed of each virtual unit in the first group unit according to the other types of virtual units in the N lattices comprises:
determining a distance between each virtual unit in the first population unit to the other types of virtual units in the N lattices;
and determining the moving direction and/or the moving speed of each virtual unit in the first group unit according to the distance.
11. The method of claim 7, wherein prior to obtaining a set of the plurality of grids in which the other types of virtual units are located, the method further comprises:
under the condition that the first group unit is in a trend target object state, determining grids where other types of virtual units different from the first type need to be determined, wherein the trend target object state indicates that an enemy exists in the enemy range and moves to the enemy;
under the condition that the first group unit is in a skill release state, determining grids where other types of virtual units different from the first type are needed to be determined, wherein the skill release state indicates that enemies exist in an attack range, starting attack and releasing skills;
and under the condition that the first group unit is in a blocking state, determining a grid where other types of virtual units different from the first type need to be determined, wherein the blocking state represents that the group unit is blocked in the moving process.
12. A mobile device for a virtual group unit, comprising:
a first determining module, configured to determine a first potential energy parameter of a virtual map according to a grid in which a first type of virtual unit is located on the virtual map, where the virtual map is divided into multiple grids, the first potential energy parameter includes a potential energy value on each grid in the multiple grids, the first potential energy parameter is generated by superimposing a first value and a second value, a potential energy value generated on the grid in which each first type of virtual unit is located is the first value, a potential energy value generated on a grid adjacent to the grid in which the first type of virtual unit is located is the second value, and the first value is greater than the second value;
an obtaining module, configured to obtain, in a case that a virtual unit adjacent to a first group unit in the first type of virtual unit needs to be determined, a first group of potential energy values corresponding to a first lattice in the first potential energy parameter, where the first lattice has the first group unit thereon, and the first group of potential energy values includes potential energy values on a first group of adjacent lattices adjacent to the first lattice in the first potential energy parameter;
a second determining module, configured to determine a moving direction and/or a moving speed of each virtual unit in the first group unit according to a potential energy value greater than 0 in the first group of potential energy values.
13. The apparatus of claim 12, wherein the second determining module comprises:
an obtaining unit, configured to obtain, when it is necessary to determine a lattice in which a virtual unit of another type different from the first type is located, a group of lattices in which the virtual unit of the other type is located from among the multiple lattices;
a first determination unit configured to determine an edge lattice in the group of lattices;
a second determining unit configured to determine a moving direction and/or a moving speed of each of the virtual units in the first group unit according to the other types of virtual units in the edge lattice.
14. A computer-readable storage medium comprising a stored program, wherein the program when executed performs the method of any of claims 1 to 11.
15. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 11 by means of the computer program.
CN202010323309.XA 2020-04-22 2020-04-22 Virtual group unit moving method and device, storage medium and electronic equipment Active CN111544888B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010323309.XA CN111544888B (en) 2020-04-22 2020-04-22 Virtual group unit moving method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010323309.XA CN111544888B (en) 2020-04-22 2020-04-22 Virtual group unit moving method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111544888A true CN111544888A (en) 2020-08-18
CN111544888B CN111544888B (en) 2021-03-16

Family

ID=71998414

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010323309.XA Active CN111544888B (en) 2020-04-22 2020-04-22 Virtual group unit moving method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111544888B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060022974A1 (en) * 1998-08-07 2006-02-02 Kabushiki Kaisha Sega Enterprises Image processing device and information recording medium
JP2012191544A (en) * 2011-03-14 2012-10-04 Olympus Imaging Corp Reproduction apparatus, imaging apparatus, and moving image reproduction program
CN102819264A (en) * 2012-07-30 2012-12-12 山东大学 Path planning Q-learning initial method of mobile robot
CN105056528A (en) * 2015-07-23 2015-11-18 珠海金山网络游戏科技有限公司 Virtual character moving method and apparatus
CN105867932A (en) * 2016-04-07 2016-08-17 浙江工业大学 Metadata reflection chain based game cloud design method
CN107899241A (en) * 2017-11-22 2018-04-13 网易(杭州)网络有限公司 Information processing method and device, storage medium, electronic equipment
JP2018114198A (en) * 2017-01-20 2018-07-26 株式会社カプコン Game program and game system
JP6404877B2 (en) * 2016-09-30 2018-10-17 株式会社コロプラ GAME PROGRAM, GAME PROVIDING METHOD, AND INFORMATION PROCESSING DEVICE
EP3406313A1 (en) * 2017-05-23 2018-11-28 Nintendo Co., Ltd. Information processing program, information processing device, information processing system, and information processing method
CN109364484A (en) * 2018-12-20 2019-02-22 北京像素软件科技股份有限公司 Game role mobile test method and device
CN110812838A (en) * 2019-11-13 2020-02-21 网易(杭州)网络有限公司 Method and device for controlling virtual unit in game and electronic equipment

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060022974A1 (en) * 1998-08-07 2006-02-02 Kabushiki Kaisha Sega Enterprises Image processing device and information recording medium
US7471297B2 (en) * 1998-08-07 2008-12-30 Kabushiki Kaisha Sega Enterprises Image processing device and information recording medium
JP2012191544A (en) * 2011-03-14 2012-10-04 Olympus Imaging Corp Reproduction apparatus, imaging apparatus, and moving image reproduction program
CN102819264A (en) * 2012-07-30 2012-12-12 山东大学 Path planning Q-learning initial method of mobile robot
CN105056528A (en) * 2015-07-23 2015-11-18 珠海金山网络游戏科技有限公司 Virtual character moving method and apparatus
CN105867932A (en) * 2016-04-07 2016-08-17 浙江工业大学 Metadata reflection chain based game cloud design method
JP6404877B2 (en) * 2016-09-30 2018-10-17 株式会社コロプラ GAME PROGRAM, GAME PROVIDING METHOD, AND INFORMATION PROCESSING DEVICE
JP2018114198A (en) * 2017-01-20 2018-07-26 株式会社カプコン Game program and game system
EP3406313A1 (en) * 2017-05-23 2018-11-28 Nintendo Co., Ltd. Information processing program, information processing device, information processing system, and information processing method
CN107899241A (en) * 2017-11-22 2018-04-13 网易(杭州)网络有限公司 Information processing method and device, storage medium, electronic equipment
CN109364484A (en) * 2018-12-20 2019-02-22 北京像素软件科技股份有限公司 Game role mobile test method and device
CN110812838A (en) * 2019-11-13 2020-02-21 网易(杭州)网络有限公司 Method and device for controlling virtual unit in game and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHEN Y F等: "《Decentralized non-communicating multiagent collision avoidance with deep reinforcement learning》", 《PROC OF 2017 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION》 *
金翔 等: "《基于值迭代网络的路径规划算法》", 《华中科技大学学报(自然科学版)》 *

Also Published As

Publication number Publication date
CN111544888B (en) 2021-03-16

Similar Documents

Publication Publication Date Title
WO2022160886A1 (en) Task allocation method, apparatus, storage medium, and electronic device
CN106412277B (en) The loading method and device of virtual scene
US9922051B2 (en) Image-based faceted system and method
US20100113159A1 (en) Method and apparatus for partitioning virtual worlds using prioritized topic spaces in virtual world systems
CN113179206B (en) Session display method, session acquisition method, device, equipment, system and medium
CN103917966A (en) Optimization of resource utilization in a collection of devices
CN106469190A (en) Three-dimensional scenic management method and three-dimensional scenic management system
CN107911300B (en) Multicast routing optimization method based on whale algorithm and application of multicast routing optimization method on Spark platform
CN109506654A (en) Low latitude Route planner and device, aircraft
CN112675545B (en) Method and device for displaying surface simulation picture, storage medium and electronic equipment
CN111135574A (en) Game scene generation method and device, computer readable medium and electronic equipment
CN108964964A (en) A kind of network topology display methods and device
JP6359111B2 (en) Method and apparatus for processing data packets based on parallel protocol stack instances
CN107153889B (en) Optimization method for path planning of water quality sampling cruise ship
CN111371608B (en) Method, device and medium for deploying SFC service chain
CN109155846A (en) Three-dimensional reconstruction method and device of scene, electronic equipment and storage medium
CN111544888B (en) Virtual group unit moving method and device, storage medium and electronic equipment
CN114996703A (en) Power system network safety target range hybrid simulation method, system and equipment
CN112711647B (en) Map information display method and device, storage medium and electronic equipment
CN103218265A (en) Parallel virtual character classification method based on spatial density clustering
CN103299298A (en) Service processing method and system
CN105281960A (en) Method for managing flow entry in software defined network
CN106254282B (en) The implementation method and device of link aggregation
CN107294746B (en) Method and equipment for deploying service
CN110368693A (en) A kind of MMO game element cutting method and its device based on multi-quadtree

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40027431

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant