CN111177291B - Object moving method, device, equipment and medium - Google Patents
Object moving method, device, equipment and medium Download PDFInfo
- Publication number
- CN111177291B CN111177291B CN201911333999.0A CN201911333999A CN111177291B CN 111177291 B CN111177291 B CN 111177291B CN 201911333999 A CN201911333999 A CN 201911333999A CN 111177291 B CN111177291 B CN 111177291B
- Authority
- CN
- China
- Prior art keywords
- target
- path
- point
- control data
- moving
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/29—Geographical information databases
-
- 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Multimedia (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Computing Systems (AREA)
- Remote Sensing (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention discloses an object moving method, an object moving device, an object moving equipment and an object moving medium, wherein the method comprises the steps of obtaining a target map, carrying out grid division on the target map, distributing path points along each edge of a grid, and enabling the distance between every two adjacent path points to be smaller than a preset path point division threshold value; determining short-distance moving paths according to the adjacent path points, generating moving control data for the short-distance moving paths, and constructing a mapping relation between the short-distance moving paths and the moving control data; acquiring a target starting point and a target ending point of a target object to be moved on the target map, and determining a target path point sequence according to the target starting point and the target ending point; determining a target mobile control data sequence according to the target path point sequence; and controlling the object to move based on the target movement control data sequence. The invention enriches the change of the object in the moving process, thereby improving the viscosity of the user.
Description
Technical Field
The present invention relates to the field of object motion control, and in particular, to an object moving method, apparatus, device, and medium.
Background
Conventional moving technologies for moving objects based on a routing algorithm are widely used in many scenarios, such as moving objects based on a routing algorithm in a game scenario or moving objects based on a routing algorithm in a navigation scenario. The prior art object moving based on the way-finding algorithm generally needs to search a moving path and then move the object at a constant speed along the moving path. Because the moving posture and the moving speed of the object are lack of change in the moving process of the object, the object is clumsy and stiff in the moving process, is not vivid enough, and further cannot achieve the anthropomorphic effect.
Disclosure of Invention
In order to solve the technical problem that the object moving process is too rigid and the anthropomorphic effect cannot be achieved in the prior art, embodiments of the present invention provide an object moving method, apparatus, device and medium.
In one aspect, the present invention provides an object moving method, including:
acquiring a target map, carrying out grid division on the target map, and distributing path points along each edge of a grid, wherein the distance between every two adjacent path points is smaller than a preset path point division threshold value;
determining short-distance moving paths according to the adjacent path points, generating moving control data for the short-distance moving paths, and constructing a mapping relation between the short-distance moving paths and the moving control data;
acquiring a target starting point and a target ending point of a target object to be moved on the target map, and determining a target path point sequence according to the target starting point and the target ending point;
determining a target mobile control data sequence according to the target path point sequence;
and controlling the object to move based on the target movement control data sequence.
In another aspect, the present invention provides an object moving apparatus, the apparatus comprising:
the target map processing module is used for acquiring a target map, carrying out grid division on the target map, distributing path points along each edge of a grid, and enabling the distance between every two adjacent path points to be smaller than a preset path point division threshold value;
the mapping construction module is used for determining short-distance moving paths according to the adjacent path points, generating movement control data for the short-distance moving paths and constructing the mapping relation between the short-distance moving paths and the movement control data;
the target path point sequence determining module is used for acquiring a target starting point and a target ending point of a target object to be moved on the target map and determining a target path point sequence according to the target starting point and the target ending point;
the target movement control data sequence determining module is used for determining a target movement control data sequence according to the target path point sequence;
and the movement control module is used for controlling the object to move based on the target movement control data sequence.
In another aspect, the present invention provides an object moving apparatus, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by the processor to implement an object moving method.
In another aspect, the present invention provides a computer storage medium having stored therein at least one instruction, at least one program, set of codes, or set of instructions that is loaded by a processor and that performs an object moving method.
The invention provides an object moving method, device, equipment and medium. According to the invention, the target map is subjected to grid division to obtain a plurality of path points, and the distances between adjacent path points are short, so that the long-distance object movement problem is converted into the short-distance object movement problem. By constructing the mapping relation between the short-distance moving path and the moving control data, the moving of the object is controlled through the moving control data, and the moving control data is generated by a real user, so that the object can meet the anthropomorphic requirement in the moving process, the change of the object in the moving process is enriched, and the viscosity of the user is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of an implementation environment of an object moving method provided by the present invention;
FIG. 2 is an alternative structural schematic of the blockchain system provided by the present invention;
FIG. 3 is a block diagram of the present invention;
FIG. 4 is a flow chart of a method for moving an object according to the present invention;
FIG. 5 is a diagram illustrating the result of performing mesh partitioning according to an embodiment of the present invention;
FIG. 6 is a flow chart of the present invention providing for generating movement control data for a short-range movement path;
FIG. 7 is a flowchart of a target waypoint sequence determined according to the target start point and the target end point provided by the present invention;
FIG. 8 is a schematic diagram of a sequence of target waypoints provided by the present invention;
FIG. 9 is a flow chart for controlling an object to move based on the target movement control data sequence provided by the present invention;
FIG. 10 is a diagram of long-range object control scene start positions provided by the present invention;
FIG. 11 is a schematic diagram of a long-range object control scene movement path provided by the present invention;
FIG. 12 is a schematic diagram of an end position of a long-range object control scene provided by the present invention;
FIG. 13 is a block diagram of an object moving apparatus provided in the present invention;
FIG. 14 is a block diagram of a target mobile control data sequence determination module provided by the present invention;
fig. 15 is a hardware structural diagram of an apparatus for implementing the method provided by the embodiment of the invention.
Detailed Description
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 obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the 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 server 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.
In order to make the objects, technical solutions and advantages disclosed in the embodiments of the present invention more clearly apparent, the embodiments of the present invention are described in further detail below with reference to the accompanying drawings and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of the invention and are not intended to limit the embodiments of the invention.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present embodiment, "a plurality" means two or more unless otherwise specified. In order to facilitate understanding of the technical solutions and the technical effects thereof described in the embodiments of the present invention, the embodiments of the present invention first explain related terms:
online Game (Online Game): also known as online games, generally refer to electronic games in which multiple players play interactively over a computer network.
Network Game Client (Game Client): the program is a program corresponding to the network game server and providing local service for the client. The system is generally installed on a common user machine and needs to be matched with a server side to operate.
Network Game Server (Game Server): the network game client-side is a software program which corresponds to the network game client-side, is installed in a cloud terminal or an IDC and provides data forwarding and logic processing services for the network game client-side. In network games, complex and critical logic requires computation on the network game server, since clients installed on player machines are easily cracked and cheated by exploitation.
An Internet Data Center (IDC) refers to a service platform with perfect equipment (including high-speed Internet access bandwidth, high-performance local area network, safe and reliable computer room environment and the like), specialized management and perfect application. On the basis of the platform, the IDC service provider provides Internet basic platform services (server hosting, virtual host, mail caching, virtual mail and the like) and various value-added services (site renting services, domain name system services, load balancing systems, database systems, data backup services and the like) for the client.
Data packet is data communication content between the network game server and the network game client through the network. The content is organized in packets, and 1 packet may be 1 independent message. The method comprises the following steps of dividing the message into a message header and a message body, wherein the message header mainly comprises a protocol number of the message; the message body is the specific content of the message.
Map: the implementation basis of the routing algorithm is also the carrier for the movement of the object. The virtual physical world in which the game characters interact in the online game can give the player the appearance similar to the real world. Generally in the form of cities, lakes, forests, highways, etc. World coordinates may be two-dimensional or three-dimensional.
Non-Player Character (Non-Player Character, NPC): is a type of character in a game, meaning a non-player character, or a non-player character, refers to a game character in a game that is not manipulated by a player, or to a non-player controlled character in a role-playing game, which may be controlled by artificial intelligence.
Man-machine fight: the game method is a mode that players challenge a computer to play games, in the mode, players can form teams or challenge BOT enemies in a team competition mode together with BOT teammates, and winning can be achieved after target scores are achieved.
BOT: the robot is a robot, and can be used for NPC (network platform control) which is specially used for forming a team with a player or fighting in man-machine fighting in a game scene. The behavior is required to be as humanoid as possible to give the player a sense of intimacy. The BOT number in the game is generally equal to the number of players, and in some game modes, the BOT number far exceeds the number of players.
Path point: a point in the map is marked in the file by specifying a coordinate location.
Path: a line of travel that sequentially passes through two, or more, waypoints. The BOT needs to move between two points, and a path between the two points needs to be calculated first, and then the BOT needs to move along the path.
In the prior art, a conventional moving technology for moving an object based on a routing algorithm generally needs to find a path between a starting point and a target point through the routing algorithm and then move the object according to the path. During the moving process of the object, the moving direction or the moving position of the object can be controlled by continuously sending data packets to the controller of the object. The prior art control approach can result in the object appearing clumsy and stiff during movement. Taking a game scene as an example, a map is usually loaded in the game scene, so that a player can have a real world impression, and when the BOT moves in the map, if the BOT moves at a constant speed according to a conventional moving technology, the user can have an impression that the BOT is disjointed from the map, because the BOT cannot change along with the fluctuation of the terrain in the map. In addition, in the moving process, the BOT can only perform simple and mechanical running, and does not have game behaviors which can be generally done by players in running, such as pause observation, jumping, auxiliary moving by using self equipment, and the like.
Mechanization of the BOT moving process is a reason that BOT moving in a game scene cannot achieve the anthropomorphic effect, in order to enable BOT to move anthropomorphic objects, BOT control by using artificial intelligence is an optional scheme, but the thought of achieving the anthropomorphic effect by BOT control based on artificial intelligence inevitably causes the operation amount of a network game server to increase steeply, and the performance pressure of the network game server is caused. The difficulty of using artificial intelligence to achieve the personification effect of the BOT moving process is still high, and a player can easily distinguish that the BOT is controlled by the artificial intelligence and is not really controlled by a game player.
In order to solve the technical problem that the BOT robot in the prior art is too stiff in moving process and cannot achieve the anthropomorphic effect, the embodiment of the invention provides an object moving method.
First, the embodiment of the present invention discloses an implementation environment of the object moving method in a possible embodiment.
Referring to fig. 1, the implementation environment includes: at least one client 01 and a server 03.
The client 01 may include: the physical devices may also include software running in the physical devices, such as applications having a function of moving objects based on a routing algorithm. The application having the function of moving the object based on the routing algorithm may be a game-type application or a navigation-type application. The Client 01 may be communicatively connected to the Server 03 based on a Browser/Server mode (Browser/Server, B/S) or a Client/Server mode (Client/Server, C/S).
The server 03 may comprise an independently operating server, or a distributed server, or a server cluster composed of a plurality of servers.
Specifically, the server 03 may obtain a target map, perform mesh division on the target map, and lay path points along each edge of a mesh, where a distance between adjacent path points is smaller than a preset path point division threshold. And determining short-distance moving paths according to the adjacent path points, generating movement control data for the short-distance moving paths, and constructing a mapping relation between the short-distance moving paths and the movement control data. And acquiring a target starting point and a target ending point of a target object to be moved on the target map through communication with the client 01, and determining a target path point sequence according to the target starting point and the target ending point. And determining a target mobile control data sequence according to the target path point sequence. And performing data packet interaction with the client 01 based on the target movement control data sequence, and controlling the object to move by the client 01.
The distributed server may specifically be a block chain structure, and any one node in the block chain structure may execute or participate in executing the object moving method.
Referring To fig. 2, fig. 2 is an optional structural schematic diagram of the block chain system according To the embodiment of the present invention, a Peer-To-Peer (P2P, Peer To Peer) network is formed among a plurality of nodes, and a P2P Protocol is an application layer Protocol operating on a Transmission Control Protocol (TCP). In the blockchain system, any machine such as a server and a terminal can be added to become a node, and the node comprises a hardware layer, a middle layer, an operating system layer and an application layer.
Referring to the functions of each node in the blockchain system shown in fig. 2, the functions involved include:
1) routing, a basic function that a node has, is used to support communication between nodes.
Besides the routing function, the node may also have the following functions:
2) the application is used for being deployed in a block chain, realizing specific services according to actual service requirements, recording data related to the realization functions to form recording data, carrying a digital signature in the recording data to represent a source of task data, and sending the recording data to other nodes in the block chain system, so that the other nodes add the recording data to a temporary block when the source and integrity of the recording data are verified successfully.
3) And the Block chain comprises a series of blocks (blocks) which are mutually connected according to the generated chronological order, new blocks cannot be removed once being added into the Block chain, and recorded data submitted by nodes in the Block chain system are recorded in the blocks.
Referring to fig. 3, fig. 3 is an optional schematic diagram of a Block Structure (Block Structure) according to an embodiment of the present invention, where each Block includes a hash value of a transaction record stored in the Block (hash value of the Block) and a hash value of a previous Block, and the blocks are connected by the hash values to form a Block chain. The block may include information such as a time stamp at the time of block generation. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using cryptography, and each data block contains related information for verifying the validity (anti-counterfeiting) of the information and generating a next block.
Referring to fig. 4, a flowchart of an object moving method is shown, which may be implemented by a server in the implementation environment of fig. 1 as an execution subject, and may include:
s101, obtaining a target map, carrying out grid division on the target map, distributing path points along each edge of a grid, wherein the distance between every two adjacent path points is smaller than a preset path point division threshold value.
Specifically, the target map may be one or more, and the target map may be a map loaded in a game scene and used as a carrier for movement of each object in the game. And further, path points are distributed along the edge of the grid, and the obtained path between the adjacent path points can be used as the minimum path unit of short-distance movement in the object moving process of the object moving method. As shown in fig. 5, if the object moving process needs to move the object from the 720 path point to the 722 path point, two short-distance movements need to be performed, that is, the object is moved from the 720 path point to the 721 path point as one short-distance movement, and then the object is moved from the 721 path point to the 722 path point as another short-distance movement.
In fact, the dividing density of the path points can be adaptively adjusted according to the actual situation, for example, if the requirement of the user on personification of the object movement is high, the dividing density of the path points can be appropriately increased; on the contrary, if the user has a low requirement for personification of object movement, the division density of the path points can be appropriately reduced.
In order to meet the anthropomorphic demand of the user for object movement and reduce the consumption of network data and related hardware resources as much as possible, a method for setting the path point division threshold in a preferred embodiment of the present invention may be: and acquiring a preset time threshold value of short-distance movement and an object movement average speed, and acquiring the path point division threshold value according to the time threshold value of short-distance movement and the object movement average speed. For example, if the time threshold for short-distance movement is 1 minute, the maximum straight-line distance that the object can travel within one minute can be used as the path point division threshold.
In another preferred embodiment, the path point partitioning threshold may also be determined based on a way-finding algorithm. In the embodiment of the invention, the object needs to move along the adjacent path points, and each adjacent path point forming the moving path of the object can be calculated through the routing algorithm, so that the path point division threshold value can be determined based on the routing algorithm. For example, a path-finding algorithm for calculating the movement path of the object is acquired, and the maximum value of all movement paths that can be calculated by a single operation of the path-finding algorithm is used as the path point division threshold.
In the embodiment of the invention, the purpose of meshing the target map is to obtain path points, and the object is moved from the starting point to the target point by moving the adjacent path points in a short distance. The distance between the starting point and the target point is long distance, and the distance between the adjacent path points is short distance, and the object movement problem of long distance is converted into the object movement problem of short distance by grid division. As shown in fig. 5, which is a schematic diagram illustrating a result of the mesh division performed in the embodiment of the present invention, more path points are obtained by performing mesh division on the target map, so as to create conditions for subsequent object movement.
S103, determining short-distance moving paths according to the adjacent path points, generating moving control data for the short-distance moving paths, and constructing a mapping relation between the short-distance moving paths and the moving control data.
Any two adjacent path points in the embodiment of the invention can determine the short-distance moving path. Taking any adjacent path point as point a and point B as an example, a to B is a one-way short-distance moving path, and B to a is another one-way short-distance moving path. If the same moving posture is used from A to B and from B to A, any two adjacent path points can uniquely determine a short-distance moving path (two unidirectional short-distance moving paths are integrally expressed as a short-distance moving path, regardless of directions); if different moving postures can be used from A to B and from B to A, any two adjacent path points can uniquely determine two short-distance moving paths (two one-way short-distance moving paths are two short-distance moving paths, and the directions are considered)
In one possible embodiment, a method of generating movement control data for a short-range movement path is also disclosed, the generating movement control data for a short-range movement path, as shown in fig. 6, comprising:
s1, acquiring a starting path point and an ending path point of the short-distance moving path.
Specifically, in a game scenario, a game client may be used to log in, load a target map, and determine an object at a starting waypoint.
And S3, acquiring moving data generated in the process that the object moves from the starting path point to the ending path point through interaction with the client, and moving the object to the ending path point based on the moving data.
In particular, by interacting with the client to move the object, the client is controlled by the real player, so that the moving object embodies the characteristic of artificial control in moving and is not stiff and clumsy. The movement data in this process is collected, and when the object movement is needed to be controlled along the short-distance movement path again in the following process, the movement in the step S3 can be reproduced through the movement data, so as to achieve the purpose of personification.
Specifically, the client may control the object to make various changes in the process of moving to the termination path point, for example, by doing actions, changing speed and route, the complexity of the moving process may be increased, and the moving process may be more anthropomorphic. Specifically, such as:
a. other game supporting actions such as jumping, squatting and the like are added to the control action.
b. The walking and running switching is added to the control speed change. The squatting and running can be increased beside obstacles such as a wall and the like.
c. And appropriate broken line movement is added on the control line according to the terrain change.
And S5, generating mobile control data according to the mobile data.
Repeating the steps S1-S5 may result in multiple sets of movement control data. In a preferred embodiment, the short-distance movement path may correspond to one or more movement control data.
And S105, acquiring a target starting point and a target ending point of the target object to be moved on the target map, and determining a target path point sequence according to the target starting point and the target ending point.
Specifically, the determining a target path point sequence according to the target start point and the target end point, as shown in fig. 7, includes:
s1051, carrying out route finding on the target map according to the target starting point and the target ending point, and determining at least one movable path.
Specifically, the way-finding algorithm is not limited in the embodiment of the present invention, and the way-finding may be performed by using a breadth-optimal search, Dijkstra (Dijkstra) algorithm, greedy algorithm, a-search algorithm, or B-search algorithm. The A-Star search algorithm is the most effective direct search method for solving the shortest path in the static road network, and is also an effective algorithm for solving a plurality of search problems. The closer the distance estimate is to the actual value in the algorithm, the faster the final search speed. The B search algorithm is a Branch Star Branch routing algorithm corresponding to the a search algorithm.
S1053, determining a target moving path in the movable path.
Specifically, one target moving path may be determined in the plurality of movable paths according to actual conditions, for example, the target moving path may be determined according to a shortest path principle or an obstacle avoidance principle.
In a preferred embodiment, different routing algorithms or different specific determination methods of target moving paths can be used for each object, so that the diversity of the object moving process is increased, and the user impression is further improved.
And S1055, determining a target path point sequence along the target moving path.
If the target starting point and the target ending point are both path points, the target path point sequence can be directly determined. As shown in fig. 8, the object moves from the target start point a to the target end point E along the target movement path. The sequence of target waypoints is A, B, C, D, E. In another scenario, if the target start point and the target end point are not all path points, the target path point sequence may be determined along the path points that the target moving path passes through.
And S107, determining a target mobile control data sequence according to the target path point sequence.
Specifically, if an adjacent target path point in the target path point sequence uniquely determines a short-distance moving path, the determining a target movement control data sequence according to the target path point sequence includes:
s1071, determining each target short-distance moving path according to the adjacent target path points.
S1073, target movement control data corresponding to the target short-distance movement path is determined.
Specifically, target movement control data corresponding to the target short-distance movement path is determined according to the mapping relationship between the constructed short-distance movement path and the movement control data: if the mapping relation is a single shot, directly determining the target mobile control data; if the mapping relationship is a one-to-many mapping, determining target movement control data from a plurality of movement control data corresponding to the target short-distance movement path according to a preset movement control data selection method, for example, the selection method may be random selection.
S1075, generating a target movement control data sequence corresponding to the target path point sequence according to the target movement control data sequence.
And S109, controlling the object to move based on the target movement control data sequence.
Specifically, the controlling the object to move based on the target movement control data sequence, as shown in fig. 9, includes:
s1091, if the first target point in the target path point sequence coincides with the target starting point, controlling the object to move to the last target point in the target path point sequence based on the target movement control data sequence.
S1093, if the first target point in the target path point sequence is not coincident with the target starting point, the control object moves from the target starting point to the first target point in the target path point sequence, and the control object moves to the last target point in the target path point sequence based on the target movement control data sequence.
Specifically, the object may be moved from the target starting point to the first target point in the target path point sequence based on the object moving method in the prior art, and the moving process may cause a problem of insufficient anthropomorphic degree due to the use of the prior art, but since the target starting point is closer to the first target point in the target path point sequence, the distance between the target starting point and the first target point in the target path point sequence is inevitably smaller than the path point division threshold, and the user's impression is not affected.
S1095, if the last target point in the target path point sequence is not coincident with the target termination point, controlling the object to move from the last target point in the target path point sequence to the target termination point.
Similarly, step S1095 may also control the object to move based on the object moving method in the prior art, and this process does not affect the user' S appearance because the last target point in the target path point sequence is close to the target end point.
If the last target point in the target route point sequence coincides with the target end point, step S1095 does not need to be executed.
In this embodiment of the present invention, in step S109, the motion of the object in the client may be controlled by sending a data packet to the client through the server. Each data packet is packed with target movement control data or control data for object movement control using the related art.
According to the object moving method disclosed by the embodiment of the invention, a plurality of path points are obtained by carrying out grid division on a target map, and the distance between adjacent path points is short, so that the problem of long-distance object movement is converted into the problem of short-distance object movement. By constructing the mapping relation between the short-distance moving path and the moving control data, the moving of the object is controlled through the moving control data, and the moving control data is generated by a real user, so that the object can meet the anthropomorphic requirement in the moving process, the change of the object in the moving process is enriched, and the viscosity of the user is improved. Furthermore, the embodiment of the invention drives the object to move by acquiring the movement control data in advance, so that the operation consumption of the object in the long-distance movement process can be reduced.
The object moving method in the embodiment of the invention can be widely applied to various scenes needing personified object control. Taking a game scene as an example, in a scene that some NPCs assisting a player to complete a task need to move for a long distance along a route specified by the task, the NPCs can be controlled to move by using the object moving method; in a scene of competing with a player, if the NPC is far from the player and needs to move to a place before the player performs a battle, the NPC may be moved by using the object moving method. As shown in fig. 10-12, which illustrate in-game long-range object control scenarios. Fig. 10 shows the start position of the object, and the object is finally moved to the end position shown in fig. 12 through the movement path shown in fig. 11.
The present invention provides an object moving apparatus, as shown in fig. 13, the apparatus including:
the target map processing module 201 is configured to obtain a target map, perform mesh division on the target map, and lay path points along each edge of a mesh, where a distance between adjacent path points is smaller than a preset path point division threshold;
the mapping construction module 203 is configured to determine a short-distance moving path according to each adjacent path point, generate movement control data for each short-distance moving path, and construct a mapping relationship between the short-distance moving path and the movement control data;
a target route point sequence determining module 205, configured to obtain a target starting point and a target ending point of a target object to be moved on the target map, and determine a target route point sequence according to the target starting point and the target ending point;
a target movement control data sequence determination module 207, configured to determine a target movement control data sequence according to the target path point sequence;
a movement control module 209 for controlling the object to move based on the target movement control data sequence.
Specifically, as shown in fig. 14, the target movement control data sequence determination module 207 includes:
a target short-distance moving path determining unit 2071, configured to determine each target short-distance moving path according to adjacent target path points;
a target movement control data determination unit 2073 for determining target movement control data corresponding to the target short-distance movement path;
a sequence generating unit 2075, configured to generate a target motion control data sequence corresponding to the target waypoint sequence from the target motion control data sequence;
the target movement control data determining unit is specifically configured to determine target movement control data corresponding to the target short-distance movement path according to the mapping relationship between the constructed short-distance movement path and the movement control data: if the mapping relation is a single shot, directly determining the target mobile control data; and if the mapping relation is one-to-many mapping, determining target movement control data from a plurality of movement control data corresponding to the target short-distance movement path according to a preset movement control data selection method.
Specifically, the object moving device and the method of the embodiment of the invention are all based on the same inventive concept. For details, please refer to the method embodiment, which is not described herein.
The embodiment of the invention also provides a computer storage medium, and the computer storage medium can store a plurality of instructions. The instructions may be adapted to be loaded by a processor and to perform a method of object movement according to an embodiment of the invention, the method comprising at least the steps of:
a method of object movement, the method comprising:
acquiring a target map, carrying out grid division on the target map, and distributing path points along each edge of a grid, wherein the distance between every two adjacent path points is smaller than a preset path point division threshold value;
determining short-distance moving paths according to the adjacent path points, generating moving control data for the short-distance moving paths, and constructing a mapping relation between the short-distance moving paths and the moving control data;
acquiring a target starting point and a target ending point of a target object to be moved on the target map, and determining a target path point sequence according to the target starting point and the target ending point;
determining a target mobile control data sequence according to the target path point sequence;
and controlling the object to move based on the target movement control data sequence.
Preferably, the method further includes setting a path point division threshold, where setting the path point division threshold includes:
acquiring a preset time threshold of short-distance movement and an object movement average rate, and obtaining the path point division threshold according to the time threshold of short-distance movement and the object movement average rate;
or the like, or, alternatively,
and determining a path point division threshold value based on a routing algorithm.
Preferably, the method further includes generating movement control data for the short-distance movement path, the generating movement control data for the short-distance movement path includes:
acquiring a starting path point and a terminating path point of the short-distance moving path;
the method comprises the steps that moving data generated in the process that an object moves from a starting path point to a terminating path point are obtained through interaction with a client, and the object is moved to the terminating path point based on the moving data;
and generating movement control data according to the movement data.
Preferably, the determining a target path point sequence according to the target start point and the target end point includes:
performing path finding on the target map according to the target starting point and the target ending point to determine at least one movable path;
determining a target moving path in the movable path;
and determining a target path point sequence along the target moving path.
Preferably, the determining a target movement control data sequence according to the target path point sequence includes:
determining each target short-distance moving path according to the adjacent target path points;
determining target movement control data corresponding to a target short-distance movement path;
generating a target movement control data sequence corresponding to the target path point sequence according to the target movement control data sequence;
the determining target movement control data corresponding to a target short-distance movement path includes:
determining target movement control data corresponding to the target short-distance movement path according to the mapping relation between the constructed short-distance movement path and the movement control data: if the mapping relation is a single shot, directly determining the target mobile control data; and if the mapping relation is one-to-many mapping, determining target movement control data from a plurality of movement control data corresponding to the target short-distance movement path according to a preset movement control data selection method.
Preferably, the controlling the object to move based on the target movement control data sequence includes:
if the first target point in the target path point sequence coincides with the target starting point, controlling the object to move to the last target point in the target path point sequence based on the target movement control data sequence;
if the first target point in the target path point sequence is not coincident with the target starting point, the control object moves from the target starting point to the first target point in the target path point sequence, and the control object moves to the last target point in the target path point sequence based on the target movement control data sequence;
and if the last target point in the target path point sequence is not coincident with the target termination point, controlling the object to move from the last target point in the target path point sequence to the target termination point.
Further, fig. 15 shows a hardware structure diagram of an apparatus for implementing the method provided by the embodiment of the present invention, and the apparatus may participate in forming or containing the device or system provided by the embodiment of the present invention. As shown in fig. 15, the device 10 may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 15 is only an illustration and is not intended to limit the structure of the electronic device. For example, device 10 may also include more or fewer components than shown in FIG. 15, or have a different configuration than shown in FIG. 15.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuitry may be a single, stand-alone processing module, or incorporated in whole or in part into any of the other elements in the device 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used for storing software programs and modules of application software, such as program instructions/data storage devices corresponding to the methods described in the embodiments of the present invention, and the processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 104, so as to implement an object moving method as described above. The memory 104 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, memory 104 may further include memory located remotely from processor 102, which may be connected to device 10 via 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 transmission device 106 is used for receiving or transmitting data via a network. Specific examples of such networks may include wireless networks provided by the communication provider of the device 10. In one example, the transmission device 106 includes a network adapter (NIC) that can be connected to other network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the device 10 (or mobile device).
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device and server embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the partial description of the method embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (9)
1. An object moving method, characterized in that the method comprises:
acquiring a target map, carrying out grid division on the target map, and distributing path points along each edge of a grid, wherein the distance between adjacent path points is smaller than a preset path point division threshold value, and the target map is a two-dimensional map in a plane space;
acquiring a target starting point and a target ending point of a target object to be moved on the target map, and determining a target path point sequence according to the target starting point and the target ending point, wherein the target object to be moved is an object corresponding to a non-player character;
determining a short-distance moving path according to each adjacent path point;
acquiring a starting path point and a terminating path point of the short-distance moving path;
acquiring movement data generated in the process that the real player controlled object moves from the starting path point to the ending path point through interaction with a client;
generating movement control data according to the movement data;
constructing a mapping relation between the short-distance moving path and the movement control data;
determining each target short-distance moving path according to adjacent target path points in the target path point sequence;
determining target movement control data corresponding to the target short-distance movement path according to the mapping relation;
generating a target movement control data sequence corresponding to the target path point sequence according to the target movement control data;
and controlling the object to move based on the target movement control data sequence.
2. The method of claim 1, further comprising the step of setting a waypoint partition threshold comprising:
acquiring a preset time threshold of short-distance movement and an object movement average rate, and obtaining the path point division threshold according to the time threshold of short-distance movement and the object movement average rate;
or the like, or, alternatively,
and determining a path point division threshold value based on a routing algorithm.
3. The method according to claim 1 or 2, wherein said determining a target path point sequence from said target start point and said target end point comprises:
performing path finding on the target map according to the target starting point and the target ending point to determine at least one movable path;
determining a target moving path in the movable path;
and determining a target path point sequence along the target moving path.
4. The method according to claim 1 or 2, wherein the determining target movement control data corresponding to the target short-distance movement path according to the mapping relation comprises:
if the mapping relation is a single shot, directly determining the target mobile control data;
and if the mapping relation is one-to-many mapping, determining target movement control data from a plurality of movement control data corresponding to the target short-distance movement path according to a preset movement control data selection method.
5. The method according to claim 1 or 2, wherein said controlling the object to move based on said target movement control data sequence comprises:
if the first target point in the target path point sequence coincides with the target starting point, controlling the object to move to the last target point in the target path point sequence based on the target movement control data sequence;
if the first target point in the target path point sequence is not coincident with the target starting point, the control object moves from the target starting point to the first target point in the target path point sequence, and the control object moves to the last target point in the target path point sequence based on the target movement control data sequence;
and if the last target point in the target path point sequence is not coincident with the target termination point, controlling the object to move from the last target point in the target path point sequence to the target termination point.
6. An object moving apparatus, characterized in that the apparatus comprises:
the target map processing module is used for acquiring a target map, carrying out grid division on the target map, distributing path points along each edge of a grid, wherein the distance between every two adjacent path points is smaller than a preset path point division threshold value, and the target map is a two-dimensional map in a plane space;
the target path point sequence determining module is used for acquiring a target starting point and a target ending point of a target object to be moved on the target map, and determining a target path point sequence according to the target starting point and the target ending point, wherein the target object to be moved is an object corresponding to a non-player character;
the mapping construction module is used for determining a short-distance moving path according to each adjacent path point; acquiring a starting path point and a terminating path point of the short-distance moving path; acquiring movement data generated in the process that the real player controlled object moves from the starting path point to the ending path point through interaction with a client; generating movement control data according to the movement data; constructing a mapping relation between the short-distance moving path and the movement control data;
the target movement control data sequence determining module is used for determining each target short-distance movement path according to adjacent target path points in the target path point sequence; determining target movement control data corresponding to the target short-distance movement path according to the mapping relation; generating a target movement control data sequence corresponding to the target path point sequence according to the target movement control data;
and the movement control module is used for controlling the object to move based on the target movement control data sequence.
7. The apparatus of claim 6, wherein the target mobility control data sequence determining module is further configured to:
if the mapping relation is a single shot, directly determining the target mobile control data;
and if the mapping relation is one-to-many mapping, determining target movement control data from a plurality of movement control data corresponding to the target short-distance movement path according to a preset movement control data selection method.
8. A computer storage medium having stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement an object moving method as claimed in any one of claims 1 to 5.
9. An object moving apparatus, characterized in that the apparatus comprises a processor and a memory, in which at least one instruction, at least one program, a set of codes or a set of instructions is stored, which is loaded by the processor and which performs an object moving method according to any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911333999.0A CN111177291B (en) | 2019-12-23 | 2019-12-23 | Object moving method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911333999.0A CN111177291B (en) | 2019-12-23 | 2019-12-23 | Object moving method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111177291A CN111177291A (en) | 2020-05-19 |
CN111177291B true CN111177291B (en) | 2021-12-14 |
Family
ID=70654124
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911333999.0A Active CN111177291B (en) | 2019-12-23 | 2019-12-23 | Object moving method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111177291B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111773671B (en) * | 2020-07-13 | 2024-07-23 | 网易(杭州)网络有限公司 | Virtual object movement control method and device and terminal equipment |
CN112473142A (en) * | 2020-11-06 | 2021-03-12 | 杭州电魂网络科技股份有限公司 | Progressive way-finding method, system, electronic device and storage medium |
CN113633987B (en) * | 2021-08-18 | 2024-02-09 | 腾讯科技(深圳)有限公司 | Object control method and device, storage medium and electronic equipment |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101261136A (en) * | 2008-04-25 | 2008-09-10 | 浙江大学 | Route searching method based on mobile navigation system |
US8005860B1 (en) * | 2003-12-31 | 2011-08-23 | Precise Software Solutions, Inc. | Object-level database performance management |
CN102999160A (en) * | 2011-10-14 | 2013-03-27 | 微软公司 | User controlled real object disappearance in a mixed reality display |
CN104784934A (en) * | 2015-04-13 | 2015-07-22 | 四川天上友嘉网络科技有限公司 | Method for moving game role |
CN106154252A (en) * | 2015-03-31 | 2016-11-23 | 北京智谷睿拓技术服务有限公司 | Motion state of mobile terminal determines method and determines device |
CN107677285A (en) * | 2017-04-11 | 2018-02-09 | 平安科技(深圳)有限公司 | The path planning system and method for robot |
CN108459599A (en) * | 2017-12-21 | 2018-08-28 | 华为技术有限公司 | A kind of trajectory path planning method and device |
US10102226B1 (en) * | 2015-06-08 | 2018-10-16 | Jasmin Cosic | Optical devices and apparatuses for capturing, structuring, and using interlinked multi-directional still pictures and/or multi-directional motion pictures |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10525356B2 (en) * | 2017-06-05 | 2020-01-07 | Nintendo Co., Ltd. | Storage medium, game apparatus, game system and game control method |
CN108434741A (en) * | 2018-03-15 | 2018-08-24 | 网易(杭州)网络有限公司 | Control method for movement in virtual reality and device |
-
2019
- 2019-12-23 CN CN201911333999.0A patent/CN111177291B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8005860B1 (en) * | 2003-12-31 | 2011-08-23 | Precise Software Solutions, Inc. | Object-level database performance management |
CN101261136A (en) * | 2008-04-25 | 2008-09-10 | 浙江大学 | Route searching method based on mobile navigation system |
CN102999160A (en) * | 2011-10-14 | 2013-03-27 | 微软公司 | User controlled real object disappearance in a mixed reality display |
CN106154252A (en) * | 2015-03-31 | 2016-11-23 | 北京智谷睿拓技术服务有限公司 | Motion state of mobile terminal determines method and determines device |
CN104784934A (en) * | 2015-04-13 | 2015-07-22 | 四川天上友嘉网络科技有限公司 | Method for moving game role |
US10102226B1 (en) * | 2015-06-08 | 2018-10-16 | Jasmin Cosic | Optical devices and apparatuses for capturing, structuring, and using interlinked multi-directional still pictures and/or multi-directional motion pictures |
CN107677285A (en) * | 2017-04-11 | 2018-02-09 | 平安科技(深圳)有限公司 | The path planning system and method for robot |
CN108459599A (en) * | 2017-12-21 | 2018-08-28 | 华为技术有限公司 | A kind of trajectory path planning method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111177291A (en) | 2020-05-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111177291B (en) | Object moving method, device, equipment and medium | |
JP7169338B2 (en) | Method, apparatus and computer program for synchronous display of game content | |
US8480498B2 (en) | Synchronizing mission progress in cooperative games | |
JP5887458B1 (en) | A game system for searching for a route of a non-player character based on a player's movement history | |
US10086279B2 (en) | Cross-realm zones for interactive gameplay | |
KR20210121289A (en) | Augmented Reality Mobile Edge Computing | |
US9560131B2 (en) | Efficient synchronization of behavior trees using network significant nodes | |
CN105288998B (en) | The exchange method and device of Intelligent hardware | |
CN111202985B (en) | Path planning method and system in 2D game and electronic equipment | |
WO2022142543A1 (en) | Prop control method and apparatus, and electronic device and storage medium | |
CN111921195B (en) | Three-dimensional scene generation method and device, storage medium and electronic device | |
CN110585729A (en) | Game account matching method and device, storage medium and electronic device | |
JP2015528317A (en) | Online game fraud prevention method and system | |
Bujari et al. | Optimal configuration of active and backup servers for augmented reality cooperative games | |
CN109529358B (en) | Feature integration method and device and electronic device | |
Tremblay et al. | An algorithmic approach to analyzing combat and stealth games | |
US10232271B2 (en) | Systems and methods for regulating access to game content of an online game | |
CN111389007B (en) | Game control method and device, computing equipment and storage medium | |
CN106861192B (en) | Event execution method and device | |
Reis et al. | Coordination in multi-robot systems: Applications in robotic soccer | |
CN106075910A (en) | The three-dimension navigation system of mobile terminal network game | |
CN106422331B (en) | Chinese checkers information processor system based on unity3D engine | |
CN111318016B (en) | Map element display method and device, storage medium and electronic device | |
CN111803958B (en) | Virtual object queuing method and device and storage medium | |
CN109857567B (en) | AI state information synchronization method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |