CN107433039A - The dynamic auto method for searching of AI - Google Patents
The dynamic auto method for searching of AI Download PDFInfo
- Publication number
- CN107433039A CN107433039A CN201610354522.0A CN201610354522A CN107433039A CN 107433039 A CN107433039 A CN 107433039A CN 201610354522 A CN201610354522 A CN 201610354522A CN 107433039 A CN107433039 A CN 107433039A
- Authority
- CN
- China
- Prior art keywords
- role
- target point
- shortest path
- starting point
- calculated
- 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.)
- Pending
Links
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
- A63F13/56—Computing 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
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/64—Methods for processing data by generating or executing the game program for computing dynamical parameters of game objects, e.g. motion determination or computation of frictional forces for a virtual car
- A63F2300/646—Methods for processing data by generating or executing the game program for computing dynamical parameters of game objects, e.g. motion determination or computation of frictional forces for a virtual car for calculating the trajectory of an object
Abstract
The invention discloses a kind of dynamic auto moving methods of AI, including:S1:Mobile starting point and target point are determined according to movement directive, to S2;S2:Shortest path delimited according to starting point and target point, to S3;S3:Calculated in the shortest path and whether there is barrier, if nothing, to S4, if having, to S5;S4:Control role is moved to target point along the shortest path by starting point;S5:Role is calculated the distance between to barrier, if being more than default designated value, to S6, if being less than or equal to default designated value, to S7;S6:Control role is moved by starting point along the shortest path, to S5;S7:Using target point as the center of circle, drawn and justified as radius using role's attack distance, the fresh target point on role to the circle is calculated, to S2.The present invention carries out automatic pathfinding using complete formula of mathematical, can flexibly apply in various game AI.Game need not limit the refreshing quantity of monster, and user's game experiencing is excellent.
Description
Technical field
The present invention relates to game intelligence technical field, relates in particular to a kind of dynamic auto method for searching of AI being applied in online game and single-play game.
Background technology
With the development of science and technology the online game of more and more moneys and single-play game are entered into the amateur entertainment life of people.In traditional game, player needs operation game role to perform the various action commands such as movement, fight, standby.Wherein, movement is the most basic action command of game role.To save the energy of player, the dynamic auto pathfindings of AI in gaming are arisen at the historic moment.The existing method that automatically moves is that map is divided into latticed pathfinding point, and player to the most short reachable path of target point search and controls game role directly from reachable path after selected target point, from starting point.This move mode causes when occurring monster in reachable path, and game role can be directed through monster and either simply be pushed open with monster collision.Cause must strictly to limit the refreshing quantity of monster in traditional game, and cause the game experiencing of user poor, the game tactics and playing method of more novelties can not be developed.Therefore, how to develop a kind of dynamic auto method for searching of brand-new AI to overcome above mentioned problem is the direction that those skilled in the art need to study.
The content of the invention
To overcome above mentioned problem, the invention provides a kind of dynamic auto method for searching of AI.
The concrete technical scheme that it is used is as follows:
A kind of dynamic auto moving methods of AI, comprise the following steps:
S1:Movement directive is received, mobile starting point and target point are determined according to movement directive, to S2;
S2:Shortest path delimited according to starting point and target point, to S3;
S3:Calculated in the shortest path and whether there is barrier, if nothing, to S4, if having, to S5;
S4:Control role is moved to target point along the shortest path by starting point;
S5:Role current location is calculated the distance between to barrier, if the distance is more than default designated value, to S6, if the distance is less than or equal to default designated value, to S7;
S6:Control role is moved by starting point along the shortest path, to S5;
S7:Using target point as the center of circle, drawn and justified as radius using role's attack distance, the fresh target point on role current location to the circle is calculated premised on the cut-through thing of role current location, former target point is substituted with fresh target point, former starting point is substituted with role current location, to S2.
By using this technical scheme:The whole process realized with formula of mathematical, is realized and automatically moving for multiple barriers is evaded.The problem of overcoming refreshing quantity and poor user's game experiencing that monster must be strictly limited in existing game.
Preferably, in the dynamic auto moving methods of above-mentioned AI:Default designated value described in step S5 is adjustable value.
By using this technical scheme:In practice by adjust it is default be specified to reduce or increase amount of calculation, reach dynamic pathfinding effect more true to nature by increasing amount of calculation in PC game, amount of calculation reduced in hand trip, sacrifice the consumption that expression effect saves CPU.
Compared with prior art, the dynamic auto method for searching of AI provided by the invention is carried out using complete formula of mathematical, can flexibly be applied in various game AI.Game need not limit the refreshing quantity of monster, and user's game experiencing is excellent, can develop the game tactics and playing method of more novelties.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the embodiment of the present invention 1.
Embodiment
In order to illustrate more clearly of technical scheme, below in conjunction with accompanying drawing, the invention will be further described.
Embodiments of the invention 1 as shown in Figure 1:
A kind of dynamic auto moving methods of AI, comprise the following steps:
S1:Movement directive is received, mobile starting point A and target point B are determined according to movement directive, to S2;
S2:Shortest path AB delimited according to starting point A and target point B, to S3;
S3:Calculated in shortest path AB and whether there is barrier P, if nothing, to S4, if having, to S5;
S4:Control role M is moved to target point B along shortest path AB by starting point A;
S5:Role M current locations are calculated the distance between to barrier P, if distance MP is more than default designated value, to S6, if distance MP is less than or equal to default designated value, to S7;
S6:Control role M is moved by starting point A along shortest path AB, until role M is moved to and skips to S5;
S7:Using target point N as the center of circle, drawn and justified as radius using role's attack distance, using barrier P to target point B distance PB as vector, simultaneously to 10 degree of rotation clockwise and counterclockwise, and take out with two crosspoint (K on circumference, J), judge whether BK and BJ has barrier, if clear, the point on the circumference is the point C that can be walked, if K and J points are simultaneously effective, then take out the most short point fresh target point C of AK and AJ distances, former target point B is substituted with fresh target point C, former starting point A is substituted with role M current location A1, to S2.Loop nesting calculates.
Wherein, judge whether have the specific implementation code of barrier as follows between 2 points:
Note:A, B is 2 points, and C is barrier coordinate points, and radius is C radius
Vector3 direction = B - A;
Vector3 AC = C - A;
float r = Vector3.Dot(direction,
ac);
float len = Vector3.Dot(direction, direction);
r /= len;
if (r < 0 || r > 1)
{
continue;
}
Vector3 D = A + direction * r;
Vector3 tmp = D - C;
float dis = tmp.magnitude;
if (dis
< radius)
{
// there is barrier
}
Else
{
// clear
}
The specific implementation code for calculating the distance between AP is as follows:
Float distance = sqrt((A.x
– P.x)*(A.x – P.x) + (A.y – P.y)*(A.y
– P.y))
It is described above; only specific embodiment of the invention, but protection scope of the present invention is not limited thereto, and any those skilled in the art is in technical scope disclosed by the invention; the change or replacement that can be readily occurred in, it should all be included within the scope of the present invention.Protection scope of the present invention is defined by the protection domain of claims.
Claims (2)
1. a kind of dynamic auto moving methods of AI, it is characterised in that comprise the following steps:
S1:Movement directive is received, mobile starting point and target point are determined according to movement directive, to S2;
S2:Shortest path delimited according to starting point and target point, to S3;
S3:Calculated in the shortest path and whether there is barrier, if nothing, to S4, if having, to S5;
S4:Control role is moved to target point along the shortest path by starting point;
S5:Role current location is calculated the distance between to barrier, if the distance is more than default designated value, to S6, if the distance is less than or equal to default designated value, to S7;
S6:Control role is moved by starting point along the shortest path, to S5;
S7:Using target point as the center of circle, drawn and justified as radius using role's attack distance, the fresh target point on role current location to the circle is calculated premised on the cut-through thing P of role current location, former target point is substituted with fresh target point, former starting point is substituted with role current location, to S2.
A kind of 2. dynamic auto moving methods of AI as claimed in claim 1, it is characterised in that:Default designated value described in step S5 is adjustable value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610354522.0A CN107433039A (en) | 2016-05-26 | 2016-05-26 | The dynamic auto method for searching of AI |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610354522.0A CN107433039A (en) | 2016-05-26 | 2016-05-26 | The dynamic auto method for searching of AI |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107433039A true CN107433039A (en) | 2017-12-05 |
Family
ID=60452993
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610354522.0A Pending CN107433039A (en) | 2016-05-26 | 2016-05-26 | The dynamic auto method for searching of AI |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107433039A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109529341A (en) * | 2018-10-23 | 2019-03-29 | 深圳豪客互联网有限公司 | A kind of paths planning method, device and computer readable storage medium |
CN110812844A (en) * | 2019-11-06 | 2020-02-21 | 网易(杭州)网络有限公司 | Path finding method in game, terminal and readable storage medium |
CN112221147A (en) * | 2020-10-15 | 2021-01-15 | 网易(杭州)网络有限公司 | Obstacle avoidance method in game scene, electronic device and machine-readable storage medium |
CN113134236A (en) * | 2021-05-14 | 2021-07-20 | 网易(杭州)网络有限公司 | Game role control method and device, storage medium and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080085767A1 (en) * | 2005-01-31 | 2008-04-10 | Konami Digital Entertainment Co., Ltd. | Game Device, Game Device Control Method, and Information Storage Medium |
CN104548598A (en) * | 2014-12-31 | 2015-04-29 | 北京像素软件科技股份有限公司 | Virtual reality scene path searching method |
CN104759097A (en) * | 2015-04-13 | 2015-07-08 | 四川天上友嘉网络科技有限公司 | Automatic way-finding method in game |
-
2016
- 2016-05-26 CN CN201610354522.0A patent/CN107433039A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080085767A1 (en) * | 2005-01-31 | 2008-04-10 | Konami Digital Entertainment Co., Ltd. | Game Device, Game Device Control Method, and Information Storage Medium |
CN104548598A (en) * | 2014-12-31 | 2015-04-29 | 北京像素软件科技股份有限公司 | Virtual reality scene path searching method |
CN104759097A (en) * | 2015-04-13 | 2015-07-08 | 四川天上友嘉网络科技有限公司 | Automatic way-finding method in game |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109529341A (en) * | 2018-10-23 | 2019-03-29 | 深圳豪客互联网有限公司 | A kind of paths planning method, device and computer readable storage medium |
CN110812844A (en) * | 2019-11-06 | 2020-02-21 | 网易(杭州)网络有限公司 | Path finding method in game, terminal and readable storage medium |
CN110812844B (en) * | 2019-11-06 | 2023-04-07 | 网易(杭州)网络有限公司 | Path finding method in game, terminal and readable storage medium |
CN112221147A (en) * | 2020-10-15 | 2021-01-15 | 网易(杭州)网络有限公司 | Obstacle avoidance method in game scene, electronic device and machine-readable storage medium |
CN112221147B (en) * | 2020-10-15 | 2024-03-22 | 网易(杭州)网络有限公司 | Obstacle avoidance method in game scene, electronic equipment and machine-readable storage medium |
CN113134236A (en) * | 2021-05-14 | 2021-07-20 | 网易(杭州)网络有限公司 | Game role control method and device, storage medium and electronic equipment |
CN113134236B (en) * | 2021-05-14 | 2024-02-02 | 网易(杭州)网络有限公司 | Game role control method and device, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107433039A (en) | The dynamic auto method for searching of AI | |
TWI664836B (en) | Methord, device and server for controlling route search for simulated objects | |
CN107607120B (en) | Unmanned aerial vehicle dynamic track planning method based on improved restoration type Anytime sparse A algorithm | |
CN111780777A (en) | Unmanned vehicle route planning method based on improved A-star algorithm and deep reinforcement learning | |
CN106774425B (en) | A kind of method and system of unmanned plane during flying navigation | |
CN109407676A (en) | The moving robot obstacle avoiding method learnt based on DoubleDQN network and deeply | |
CN103744428B (en) | A kind of unmanned surface vehicle paths planning method based on neighborhood intelligent water drop algorithm | |
CN106989748A (en) | A kind of Agriculture Mobile Robot man-computer cooperation paths planning method based on cloud model | |
CN104156459B (en) | A kind of method and system of the efficient pathfinding based on identical expense grid | |
CN108444490B (en) | Robot path planning method based on depth fusion of visible view and A-x algorithm | |
KR101585504B1 (en) | Method and apparatus for generating pathe of autonomous vehicle | |
CN110755848B (en) | Path finding method in game, terminal and readable storage medium | |
CN105068550A (en) | Auction mode-based underwater robot multi-target selection strategy | |
CN113031616B (en) | Cleaning robot return path planning method and system and cleaning robot | |
CN109163728A (en) | A kind of dynamic environment barrier-avoiding method, controller and robot | |
CN110362070A (en) | Path follower method, system, electronic equipment and storage medium | |
CN108724189A (en) | Control method, apparatus, the Robert controller of robot movement | |
CN110531782A (en) | Unmanned aerial vehicle flight path paths planning method for community distribution | |
CN103940420A (en) | Method for designing equal-voyage great circle route | |
CN114625150A (en) | Rapid ant colony unmanned ship dynamic obstacle avoidance method based on danger index and distance function | |
CN115167478A (en) | Robot map-free path planning method and system based on deep reinforcement learning | |
CN110514224B (en) | Method for evaluating local path planning performance of unmanned vehicle | |
CN104606886B (en) | A kind of method of distributed collisionless movement planning | |
Muñoz et al. | S-Theta: low steering path-planning algorithm | |
CN103632008B (en) | A kind of vehicle movement analogue simulation method |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171205 |