Object movement control method, device and electronic device
By drawing and editing multiple alternative movement areas in the game map and generating random advancement routes, the problem of low anthropomorphism of the game AI is solved, and the randomness of the game and the player experience are improved.
Patent Information
- Application Number
- CN202310216031.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-02
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-03-02
AI Technical Summary
The combat advancement routes of existing game AI are fixed, resulting in a low degree of anthropomorphism, making it easy for real players to identify and avoid it, affecting game balance and player experience.
By drawing and editing multiple alternative movement areas in the game map, setting the subsequent movement areas of the current movement area, and generating area editing results, the movement of virtual objects is controlled to ensure that their advancement routes are random and anthropomorphic.
It improves the anthropomorphism of the game's AI, increases the randomness and challenge of the game, improves the gaming experience of real players, and reduces the impact of repetitive operations.
Smart Images

Figure CN116370955B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game control technology, and in particular to an object movement control method, device and electronic equipment. Background Art
[0002] Game AI refers to a "humanoid player" in the game, controlled by a pre-programmed program. It's also known as a virtual player. Game AI is essential for many games, and an intelligent AI provides players with a better gaming experience.
[0003] In order to enable the game AI to advance the battle process, planners usually set fixed points in the game scene map and sort all the fixed points in a certain order. Then, based on the sorted fixed points, a battle advancement route is formed, and the battle advancement route is then assigned to the game AI. In this way, the battle advancement route assigned to each game AI is completely fixed, resulting in a low degree of anthropomorphism of the game AI, which affects the gaming experience of real players. At the same time, real players can observe the actual combat situation of the AI by repeating the game, so as to be able to count the moving points that the AI will definitely pass through, so that they can avoid other real players in the game and blindly look for AI to kill, affecting the balance of the game and the gaming experience of other real players. Summary of the Invention
[0004] The purpose of the present invention is to provide an object movement control method, device and electronic device to improve the anthropomorphism of game AI, thereby enhancing the gaming experience of real players.
[0005] In a first aspect, the present invention provides an object movement control method, which includes: obtaining a target game map of a target game; responding to a drawing operation on the target game map, and based on the drawing operation, determining multiple alternative movement areas corresponding to virtual objects in the target game map; responding to an editing operation on multiple alternative movement areas, determining a current movement area, setting a subsequent movement area corresponding to the current movement area, and obtaining an area editing result; wherein the virtual object can move from the current movement area to a subsequent movement area corresponding to the current movement area; the subsequent movement area is at least one alternative movement area among the multiple alternative movement areas; based on the area editing result, controlling the movement of the virtual object in the target game.
[0006] In a second aspect, the present invention provides an object movement control device, which includes: a map acquisition module for obtaining a target game map of a target game; an area drawing module for responding to a drawing operation for the target game map, and based on the drawing operation, determining multiple alternative movement areas corresponding to the virtual object in the target game map; an area editing module for responding to an editing operation for multiple alternative movement areas, determining a current movement area, setting a subsequent movement area corresponding to the current movement area, and obtaining an area editing result; wherein the virtual object can move from the current movement area to a subsequent movement area corresponding to the current movement area; the subsequent movement area is at least one alternative movement area among the multiple alternative movement areas; and a movement control module for controlling the movement of the virtual object in the target game based on the area editing result.
[0007] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned object movement control method.
[0008] In a fourth aspect, the present invention provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned object movement control method.
[0009] The embodiments of the present invention bring the following beneficial effects:
[0010] The present invention provides an object movement control method, device, and electronic device. The method first obtains a target game map of a target game; then responds to a drawing operation on the target game map and, based on the drawing operation, determines multiple alternative movement areas corresponding to a virtual object in the target game map; then responds to an editing operation on the multiple alternative movement areas, determines a current movement area, sets a subsequent movement area corresponding to the current movement area, and obtains an area editing result; wherein the virtual object can move from the current movement area to a subsequent movement area corresponding to the current movement area; the subsequent movement area is at least one of the multiple alternative movement areas; then, based on the area editing result, the movement of the virtual object in the target game is controlled. In this method, the virtual object determines its advancement route in the game based on the alternative movement areas in the area editing result and the subsequent movement areas corresponding to the alternative movement areas. Since there is at least one subsequent movement area for each alternative movement area, the advancement route of the virtual object is no longer fixed and has a certain degree of randomness, making the virtual object in the game more human-like, which helps to enhance the gaming experience of real players.
[0011] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.
[0012] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are specifically listed below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 A flowchart of an object movement control method provided by an embodiment of the present invention;
[0015] Figure 2 A schematic diagram of drawing a candidate moving area provided by an embodiment of the present invention;
[0016] Figure 3 A schematic diagram of a subsequent movement area provided by an embodiment of the present invention;
[0017] Figure 4 A flowchart of another object movement control method provided by an embodiment of the present invention;
[0018] Figure 5 A flowchart of another object movement control method provided by an embodiment of the present invention;
[0019] Figure 6 A schematic diagram of a quadtree node partitioning rule provided by an embodiment of the present invention;
[0020] Figure 7 A schematic structural diagram of an object movement control device provided by an embodiment of the present invention;
[0021] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0023] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort are intended to fall within the scope of protection of the present invention.
[0024] In order to enable the game AI (Artificial Intelligence) to advance the battle process, planners usually set fixed points in the game scene map and sort all the fixed points in a certain order. Then, based on the sorted fixed points, a battle advancement route is formed, and the battle advancement route is then assigned to the game AI. In this method, the battle advancement route assigned to each game AI is completely fixed, and the battle advancement route assigned to each game AI is the same, resulting in a low degree of anthropomorphism of the game AI. It is easy for real players to observe and distinguish which characters are real players and which characters are AI, thus affecting the real players' gaming experience.
[0025] At the same time, the battle advancement route is completely fixed, and there is no randomness in the AI battle. Real players can observe the actual combat progress of the AI through repeated play, so that they can count which movement points the AI will definitely pass through, and then specify a set plan at the beginning of the game, avoiding the field of vision of real players as much as possible, and blindly looking for AI to kill, affecting the balance of the game and the gaming experience of other real players, so that the game enters a vicious cycle and corrupts the gaming atmosphere.
[0026] In addition, each battle advancement route requires planners to enter the game and find the accurate map points for route editing, which will take a lot of man-hours to complete the route editing work. And the route points are completely fixed. If the map has been highly fine-tuned, or the target point you want to move to has been occupied by a player, it will affect the AI's pathfinding module, causing it to get stuck in the middle of the journey. If there are more AIs surviving in the battlefield at this time and fewer players, it may cause a battle to enter a deadlock and be unable to continue fighting normally until the game time naturally passes to the maximum time and finally a draw. In this case, after the player has fought hard for a whole round, the AI enters a deadlock state and stands there in a daze, which greatly affects the player's gaming experience.
[0027] Based on the above problems, an embodiment of the present invention provides an object movement control method, device and electronic device. This technology can be applied to the control scenarios of virtual objects in games, especially the movement control scenarios of game AI; at the same time, this method can be applied to the real-time path editing scenarios of virtual objects, and can also be applied to scenarios that are edited in advance and then imported into the game.
[0028] In order to facilitate understanding of the embodiments of the present invention, a method for controlling object movement disclosed in the present invention is first described in detail. Figure 1 As shown, the method includes the following specific steps:
[0029] Step S102: Obtain a target game map of a target game.
[0030] The target game can be any game that includes movable virtual objects. These virtual objects can be characters controlled by real players, or game AI. These AI can be objects that compete with real players, or objects that roam within the game scene. The target game map can be a map corresponding to the game scene of the target game, or it can be a thumbnail image. Virtual objects in the game can move within this map.
[0031] Step S104 , responding to a drawing operation on the target game map, and determining a plurality of candidate movement areas corresponding to the virtual object in the target game map based on the drawing operation.
[0032] The above-mentioned drawing operation can be an operation in which the user uses a virtual brush or finger to circle an area in the target game map. The area circled by the drawing operation is also the candidate movement area, and the candidate movement area is also the area where the virtual object in the target game can move. Figure 2 FIG. 1 is a schematic diagram of drawing a candidate moving area provided by an embodiment of the present invention. Figure 2 A brush is displayed above the Figure 2 There are also two circled alternative moving areas shown in the figure. These two alternative moving areas are closed areas. At the same time, different alternative moving areas can be marked with different colors.
[0033] Step S106, in response to the editing operation on multiple alternative moving areas, determines the current moving area, sets the subsequent moving area corresponding to the current moving area, and obtains the area editing result; wherein, the virtual object can move from the current moving area to the subsequent moving area corresponding to the current moving area; the subsequent moving area is at least one alternative moving area among the multiple alternative moving areas.
[0034] The aforementioned editing operation may be an operation in which the user edits the attribute information of each of the drawn candidate movement areas. This attribute information includes the area identifier corresponding to the candidate movement area, restriction information such as the object type of virtual objects allowed to enter the candidate movement area, and the subsequent movement areas corresponding to the candidate movement area. Each candidate movement area may correspond to one or more subsequent movement areas. The subsequent movement area is the next candidate movement area to which the virtual object will move after moving to a candidate movement area.
[0035] like Figure 3 FIG. 1 is a schematic diagram of a subsequent moving area provided by an embodiment of the present invention. Figure 3 The irregular shape area encircled by solid lines in the figure is the candidate moving area. Figure 3 There are multiple candidate moving areas included, wherein the three candidate moving areas indicated by arrows are subsequent moving areas corresponding to the candidate moving area corresponding to the starting end of the arrows.
[0036] Step S108: Based on the region editing result, the virtual object in the target game is controlled to move.
[0037] After editing multiple candidate movement areas, a region editing result is obtained. This region editing result is used to indicate which candidate movement areas in the target game map the virtual object can enter, as well as which subsequent movement areas correspond to each candidate movement area. In specific implementations, after a virtual object in the target game moves to a candidate movement area, a movement area can be randomly determined from the subsequent movement areas corresponding to the candidate movement area based on the region editing result, and the virtual object can be controlled to move toward the determined movement area. Then, based on the region editing result, a movement area can be randomly determined from the subsequent movement areas corresponding to the determined movement area, thereby controlling the movement of the virtual object in the target game map.
[0038] An embodiment of the present invention provides an object movement control method, which first obtains a target game map of a target game; then responds to a drawing operation on the target game map, and based on the drawing operation, determines multiple alternative movement areas corresponding to a virtual object in the target game map; then responds to an editing operation on the multiple alternative movement areas, determines a current movement area, sets a subsequent movement area corresponding to the current movement area, and obtains an area editing result; wherein the virtual object can move from the current movement area to a subsequent movement area corresponding to the current movement area; the subsequent movement area is at least one of the multiple alternative movement areas; then, based on the area editing result, the movement of the virtual object in the target game is controlled. In this method, the virtual object determines its advancement route in the game based on the alternative movement areas in the area editing result and the subsequent movement areas corresponding to the alternative movement areas. Since there is at least one subsequent movement area for each alternative movement area, the advancement route of the virtual object is no longer fixed and has a certain degree of randomness, making the virtual object in the game more human-like, which helps to enhance the gaming experience of real players.
[0039] The embodiment of the present invention further provides another object movement control method, which is implemented on the basis of the above embodiment. The method focuses on the specific process of responding to the editing operation on multiple candidate movement areas, determining the current movement area, setting the subsequent movement area corresponding to the current movement area, and obtaining the area editing result (implemented by the following steps S406-S410); Figure 4 As shown, the method includes the following specific steps:
[0040] Step S402: Obtain a target game map of a target game.
[0041] Step S404 : responding to a drawing operation on the target game map, and determining a plurality of candidate movement areas corresponding to the virtual object in the target game map based on the drawing operation.
[0042] Step S406 : For each candidate moving region among the plurality of candidate moving regions, in response to the first editing operation on the current moving region, setting a region identifier of the current moving region.
[0043] Each of the multiple candidate movement areas included in the target game map can be used as a current movement area. The above-mentioned first editing operation is generally an operation to number each candidate movement area. According to the first editing operation, the area identifier corresponding to each candidate movement area can be set. In specific implementation, the user can manually set the area identifier corresponding to each candidate movement area, or click a button in the visual interface of the area editor to automatically number the candidate movement areas, thereby obtaining the area identifier corresponding to each candidate movement area. Specifically, the above-mentioned area identifier can be a number, letter, or other string of characters.
[0044] In some embodiments, after setting the region identifier corresponding to each alternative movement region, the object type of the virtual objects that can be moved within the current movement region can be set in response to a third editing operation on the current movement region. This third editing operation can be an operation for setting the object type of the virtual objects that can enter the alternative movement region. Specifically, by clicking on the alternative movement region in the visual interface of the region editor, the region identifier of the alternative movement region can be manually entered. The object type of the virtual objects that can enter the alternative movement region can also be selected from multiple preset object types. Specifically, the multiple preset object types can be set according to game rules or game strategies. For example, if the virtual object is a tank, the multiple preset object types can be tank types, including: light tanks, medium tanks, heavy tanks, anti-tank vehicles, and artillery.
[0045] Step S408 : for each candidate movement region among the plurality of candidate movement regions, in response to a second editing operation on the current movement region, determining a subsequent movement region corresponding to the current movement region based on the second editing operation.
[0046] Each of the multiple candidate movement areas included in the target game map can be used as a current movement area. The aforementioned second editing operation typically involves setting the subsequent movement area corresponding to each candidate movement area. Specifically, after the user has edited information such as the area identifier corresponding to each candidate movement area and the object type of the virtual object that can enter, the combat logic for the candidate movement areas can be edited to specify the area identifiers of the subsequent movement areas corresponding to each candidate movement area. The subsequent movement areas can be any one or more of the multiple candidate movement areas included in the target game map.
[0047] Step S410: Generate an area editing result based on multiple candidate movement areas set in the target game map, the area identifier of each candidate movement area, and the area identifier of the subsequent movement area corresponding to each candidate movement area.
[0048] Step S412: Based on the region editing result, the virtual object in the target game is controlled to move.
[0049] In practical applications, the above step S412 can be implemented by the following steps 10-12:
[0050] Step 10: According to the target candidate movement area where the virtual object is currently located, determine the target subsequent movement area corresponding to the target candidate movement area from the area editing result.
[0051] Step 11: For each target subsequent movement area, determine the target subsequent movement area as a new target candidate area, and continue to execute the step of determining the target subsequent movement area corresponding to the target candidate movement area from the area editing result according to the target candidate movement area where the virtual object is currently located, until the preset number of movements is reached or the designated movement area is reached.
[0052] Step 12: determining a moving path of the virtual object according to the target candidate area and the multiple target subsequent moving areas, and controlling the movement of the virtual object based on the moving path.
[0053] In a specific implementation, the target alternative moving area can correspond to multiple target subsequent moving areas, each target subsequent moving area can correspond to multiple subsequent moving areas, and then the subsequent moving area corresponding to the target subsequent moving area can also correspond to multiple subsequent moving areas. Therefore, based on the connection between the alternative moving area and the subsequent moving area, multiple movable paths in which the virtual object can move can be obtained, and then a movable path can be randomly selected from the multiple movable paths as the moving path of the virtual object.
[0054] The above-mentioned object movement control method can determine the advancement route of the virtual object in the game based on the alternative movement area in the area editing results and the subsequent movement area corresponding to the alternative movement area, replacing the complex and troublesome editing process in which planners need to enter the game to select points and then fill out forms; at the same time, the advancement strategy of the entire game map can be edited in this way, which improves editing efficiency.
[0055] The embodiment of the present invention also provides another object movement control method, which can be applied to a preset area editor, which is used to set the movement area of the virtual object; this method is implemented on the basis of the above embodiment, such as Figure 5 As shown, the method includes the following specific steps:
[0056] Step S502: import the target game map of the target game into the area editor; wherein the target game map is divided into a plurality of grids.
[0057] The region editor in this invention enables visual editing and provides an editing solution compatible with the entire in-game map. This effectively mitigates the impact of fine-tuning the game map and improves the efficiency of planning and intelligence department staff when editing AI combat advancement content. In its specific implementation, the region editor utilizes the PyQt technology solution. PyQt is a Python GUI programming solution developed by the UK-based company Riverbank Computing. It can run on operating systems such as Microsoft Windows, Mac OS X, and Linux, supporting applications on most operating systems. It has high compatibility and a wide range of technical applications.
[0058] Specifically, the actual design and implementation process of the above-mentioned area editor is: in the operating system of the production environment, install in sequence: Python3, PyQt5, QT Designer, cx_freeze, opencv_python; then use QTDesigner to design the visual interface of the area editor; then use Python programming language and utilize the PyQt5 toolkit to implement the editor visualization logic, tool usage logic, jump logic, etc.; then use the cx_freeze toolkit to package the implemented content and generate an executable software (the executable software is also the area editor); finally, deliver the packaged content together with the usage guide document to the staff of the planning functional department for their use.
[0059] In practice, the region editor can read image resources of any format and display them in the region editor's visual interface as a base image for editing. Specifically, a thumbnail of the game map from above is usually used as the base image.
[0060] Step S504 , responding to a drawing operation on the target game map, and determining a plurality of candidate movement areas corresponding to the virtual object in the target game map based on the drawing operation.
[0061] After the target game map is imported into the region editor, the region editor will provide a brush function, and users can use the brush to draw alternative movement areas on the target game map.
[0062] Step S506, in response to the editing operation on multiple alternative moving areas, determine the current moving area, set the subsequent moving area corresponding to the current moving area, and obtain the area editing result; wherein, the virtual area editing result includes the area identifier corresponding to each alternative moving area in the target game map, and the area identifier of the subsequent moving area corresponding to each alternative moving area.
[0063] The above-mentioned area editor also has an archiving function and a reading function. After obtaining the area editing result, the area editing result can be saved; if the user wants to modify the area editing result, the user can also respond to the modification operation on the area editing result and adjust the alternative moving area in the area editing result, and / or the subsequent moving area corresponding to the alternative moving area. In specific implementation, the area editor can archive and retain it at any time, making it convenient for the user to read the file later and perform operations such as adding, deleting, and modifying the editing results. Specifically, the user can expand the area range of the alternative moving area, increase the number of alternative moving areas in the target game map, and adjust the number and range of subsequent moving areas corresponding to the alternative moving area.
[0064] Step S508: Based on the area editing result, in the target game map, the grid values of the grids included in the alternative movement area are determined as the area identifiers corresponding to the alternative movement area, and the grid values of the grids included in the area outside the alternative movement area are determined as specified values.
[0065] In specific implementation, the above-mentioned area editor also has a data export function. When the user determines that the editing work of a game map has been completed, the area editing results can be exported. The area editing results will be a series of result files. After importing the files into the game running environment, they can be read and used in the game.
[0066] In order to load and apply the region editing results exported by the region editor in the target game, it is necessary to compress the content of the exported results and reduce the disk space it occupies. Therefore, in order to encode and compress the results later, the present invention divides the target game map into multiple grids. The size of each grid can be set according to R&D requirements, and each grid will have a numerical value. Generally, if the grid is located in the alternative moving area, the grid value of the grid is the numerical value corresponding to the region identifier; if the grid is located in an area outside the alternative moving area, the grid value of the grid is a specified numerical value, which can be set according to R&D requirements. The specified numerical value is a numerical value different from the region identifier of the alternative moving area. For example, the region identifier can be an integer between 1 and 254, and the specified numerical value is set to 0.
[0067] When the region editor exports the region editing results, it is necessary to focus on the data loading speed when the exported result data file is read into the game for application, as well as the disk size occupied by the result file. Therefore, it is necessary to design a set of structural export and reading solutions, and optimize and solve the corresponding problems. In the specific implementation, the target game map can be divided into multiple grids. For example, the target game map can be divided into a grid point map of n*m units. Each grid point will have a value representing the region identifier of the alternative moving area to which it belongs. For example, the grid value of the position point in the alternative moving area is the region identifier of the alternative moving area. For the URL without a position point set in the alternative moving area, its grid value is set to a specified value (such as 0).
[0068] In specific implementation, when drawing alternative moving areas, if there is a grid that is covered by multiple alternative moving areas, then the grid value of the grid belongs to the area identifier of the last alternative moving area drawn. At the same time, the area identifiers between the drawn alternative moving areas cannot be repeated, and it is stipulated that all grids in each alternative moving area are interconnected, that is, two grids in the same alternative moving area can be connected to each other by moving adjacent grids. In actual applications, the minimum value of the area identifier of the alternative moving area can be set to 1, and the maximum value can be set to 254, that is, a maximum of 254 alternative moving areas are allowed to be edited. During work, the actual number of alternative moving areas edited for each game map does not exceed 100, and 254 available area identifiers are sufficient.
[0069] Step S510 , encoding and compressing the region editing result based on the grid values of the grids included in the target game map to obtain the final region editing result.
[0070] In specific implementation, a binary tree data structure, a quadtree data structure, or an octree data structure may be used to encode and compress the regional editing structure, which is not specifically limited here.
[0071] In an optional embodiment, the above step S510 may be implemented by the following steps 20-24:
[0072] Step 20: Divide the target game map into multiple grid areas on average; wherein one grid area corresponds to one node.
[0073] In a specific implementation, the target game map can be divided into a corresponding number of grid areas according to the multi-tree data structure used. For example, the present invention can use a quadtree data structure to construct the read-in area editing results. Among them, the quadtree is a tree-like data structure with four sub-blocks on each node. The quadtree is often used for the analysis and classification of two-dimensional spatial data, and can therefore be applied to game maps divided into multiple grids. The present invention stipulates that the root node of the quadtree manages the matrix from the lower left corner position (1,1) to the upper right corner (n*m), and its four child nodes respectively manage:
[0074] Child node 1: the matrix from the lower left corner (1,1) to the upper right corner (n / 2,m / 2);
[0075] Child node 2: the matrix from the lower left corner (n / 2,1) to the upper right corner (n,m / 2);
[0076] Child node 3: the matrix from the lower left corner (m / 2,1) to the upper right corner (n / 2,m);
[0077] Subnode 4: Matrix from the lower left corner (n / 2, m / 2) to the upper right corner (n, m);
[0078] Then the child node 1 of the root node is further divided into four parts, thus constructing a tree structure, where each node manages four child nodes until it can no longer be divided downward. Figure 6 FIG2 is a schematic diagram of a quadtree node partitioning rule provided by an embodiment of the present invention.
[0079] Step 21, for each grid area, if the grid values of the grids contained in the current grid area are the same, the grid values of the grids contained in the current grid area are determined as the node values of the nodes corresponding to the current grid area; if the grid values of the grids contained in the current grid area are different, the current grid area is used as the new target game map, and the step of evenly dividing the target game map into multiple grid areas is continued until the node value of the node corresponding to the current grid area is obtained.
[0080] In the specific implementation, for each grid area, it is determined whether the grid values of the grids contained in the current grid area are all the same. If they are all the same, the area identifier corresponding to the alternative mobile area where the grid is located is determined as the node value of the node corresponding to the current grid area; if they are not the same, the current grid area is divided into multiple sub-grid areas, and for each sub-grid area, it is determined whether the grid values of the grids contained in the current sub-grid area are all the same. If they are all the same, the area identifier corresponding to the alternative mobile area where the current sub-grid area is located is determined as the node value of the sub-node corresponding to the current sub-grid area; if they are not the same, the current sub-grid area is continued to be divided into multiple grid areas until the grid area is no longer divided, and the node value position corresponding to each node is obtained.
[0081] Step 22: sort the node values of the multiple nodes corresponding to the target game map according to a preset rule to obtain a node array; wherein the preset rule is used to indicate the sorting method of the node values of the multiple nodes.
[0082] The above preset rules can be set according to R&D needs. For example, the preset rules can be the order of node values from large to small, the order of node values from small to large, or the node value sorting method corresponding to the preset data structure. For example, if a quadtree data structure is used, first divide the target game map into four grid areas evenly; wherein, one grid area corresponds to one node; then, based on the quadtree algorithm, assign a node value V to each node. If the positions managed by the four child nodes it manages belong to the same alternative mobile area v in the drawn game map, that is, the area identifiers corresponding to the alternative mobile areas managed by the entire node are equal, we set this node value V as the area identifier v of the alternative mobile area. If the node cannot meet the above requirements, then for its node value V, it is set to 255, indicating a null value. This process can be called the process of quadtree analysis and classification of data.
[0083] Based on the above process, the n*m grid corresponding to the target game map can be constructed as a quadtree. During the construction process, the key is to determine the node value V of each node. If the value V is 255, it means that it needs to be divided into four equal parts. If the node value V is not 255, the node is considered to have been classified. In this process, when constructing the quadtree, the node values V are arranged in sequence, and we will obtain a node array: {V1, V2, V3, ...}. This node array contains the node value corresponding to each node.
[0084] Step S23, based on the area identifier of the subsequent moving area corresponding to the alternative moving area in the area editing result, determine the advancement array corresponding to the node whose node value is the area identifier in the node array; wherein the advancement array is used to indicate the subsequent moving area of the alternative moving area corresponding to the node value.
[0085] In the specific implementation, the node array {V1, V2, V3, ...} is exported. It is known that in computer science, an integer will occupy 4 bytes of memory space, and 1 byte has 32 bits, so an integer will need to occupy 32 bits of memory space. The present invention stipulates that all area identifiers can only be values from 1 to 254, so only 8 bits of space are needed to represent a node value V. Based on this, the exported result can be reduced by four times. In addition, there is also a set of advancement route data that needs to be exported. The format of the data is also very simple, that is, the alternative moving area with the area identifier u, and the advancement array for the subsequent moving area v where the battle is expected to advance is {v1, v2, v3, ...}. Because the values of u and v are also values from 1 to 254, the base processing is also optimized.
[0086] Step 24: determine the node array and the advancement array as the final region editing result.
[0087] Step S512: Send the final region editing result to the target game through the region editor, so that the virtual object in the target game is controlled to move based on the final region editing result.
[0088] When the game is running in real time, the game match with virtual objects needs to load the area editing results of the corresponding map. When loading the area editing results in the game, the preset reverse encoding conversion mechanism can be used to quickly and efficiently read the compressed area editing results into the game and can be applied to the virtual objects in real time.
[0089] In a specific implementation, the specific process of controlling the movement of the virtual object in the target game based on the final region editing result can be achieved through the following steps 30-31:
[0090] Step 30, in response to the virtual object in the target game moving to the target location point, determine the target node value corresponding to the target location point based on the node array in the final area editing result; wherein the target location point is a location point in the alternative movement area in the target game map.
[0091] Step 31: In the target game, a target advancement array is determined from the final area editing result based on the target node value, a target area identifier is randomly determined from the target advancement array, and the virtual object is controlled to move to the alternative movement area corresponding to the target area identifier.
[0092] In the target game, the final region edit results are exported into the game environment and then, following the quadtree construction process, are read into the game to be used by the virtual object. If the virtual object is at the target location (x, y) on the game map, the quadtree can be used to quickly locate the region identifier of the candidate movement region where the virtual object is located. The final region edit results are then searched for the desired subsequent movement region in the advancement array, and a random subsequent movement region is selected from the advancement array for movement.
[0093] The above-mentioned object movement control method takes into account that in actual game battles, the operation of the area advancement system will occupy the server-side operation consumption. In order not to affect the normal operation of the game, the virtual object needs to quickly query the movement advancement method and movement area. The present invention uses a multi-tree data structure to construct the read-in editing data and provides a function interface for the virtual object to quickly query the movement area. This allows the virtual object to query the next movement area in a very efficient manner when querying the movement area in actual combat.
[0094] In addition, the virtual object in the above method determines its in-game advancement route based on the alternative movement area and the subsequent movement area corresponding to the alternative movement area in the area editing result obtained by editing the area editor. Thus, the area editor solves the task of editing the virtual object's advancement route in a one-stop manner, replacing the complex and cumbersome editing process that requires planners to enter the game to select points and then fill out forms; at the same time, the entire game map can be edited through the area editor to edit the advancement strategy, thereby improving work efficiency under this requirement. In addition, in the prior art, if the map is fine-tuned, the original fixed route will need to be completely re-edited before it can be continued to be used. However, the present invention reduces the game map to a two-dimensional dot grid map. In actual application, that is, the game map is fine-tuned, and the previous area editing results can still be used.
[0095] Corresponding to the above method embodiment, an embodiment of the present invention further provides an object movement control device, the device comprising:
[0096] The map acquisition module 70 is used to obtain a target game map of a target game.
[0097] The area drawing module 71 is used to respond to a drawing operation on a target game map and determine a plurality of candidate movement areas corresponding to the virtual object in the target game map based on the drawing operation.
[0098] The area editing module 72 is used to respond to editing operations on multiple alternative moving areas, determine the current moving area, set the subsequent moving area corresponding to the current moving area, and obtain the area editing result; wherein, the virtual object can move from the current moving area to the subsequent moving area corresponding to the current moving area; the subsequent moving area is at least one alternative moving area among the multiple alternative moving areas.
[0099] The movement control module 73 is used to control the movement of the virtual object in the target game based on the region editing result.
[0100] The object movement control device described above first obtains a target game map of the target game; then responds to a drawing operation on the target game map, and based on the drawing operation, determines multiple alternative movement areas corresponding to the virtual object in the target game map; then responds to an editing operation on the multiple alternative movement areas, determines the current movement area, sets a subsequent movement area corresponding to the current movement area, and obtains an area editing result; wherein the virtual object can move from the current movement area to a subsequent movement area corresponding to the current movement area; the subsequent movement area is at least one alternative movement area among the multiple alternative movement areas; then, based on the area editing result, the movement of the virtual object in the target game is controlled. In this method, the virtual object determines its advancement route in the game based on the alternative movement areas in the area editing result and the subsequent movement areas corresponding to the alternative movement areas. Since there is at least one subsequent movement area for each alternative movement area, the advancement route of the virtual object is no longer fixed and has a certain degree of randomness, making the virtual object in the game more human-like, which helps to enhance the gaming experience of real players.
[0101] Specifically, the above-mentioned area editing module 72 is used to: for each alternative moving area in multiple alternative moving areas, respond to the first editing operation on the current moving area, and set the area identification of the current moving area; for each alternative moving area in multiple alternative moving areas, respond to the second editing operation on the current moving area, and determine the subsequent moving area corresponding to the current moving area based on the second editing operation; generate area editing results based on multiple alternative moving areas set in the target game map, the area identification of each alternative moving area, and the area identification of the subsequent moving area corresponding to each alternative moving area.
[0102] Furthermore, the above-mentioned device also includes a type setting module, which is used to: after setting the area identifier of the current moving area in response to the first editing operation on the current moving area for each alternative moving area among multiple alternative moving areas, set the object type of the movable virtual object in the current moving area in response to the third editing operation on the current moving area.
[0103] In a specific implementation, the above-mentioned device also includes a saving and updating module, which is used to: in response to an editing operation on multiple alternative moving areas, determine the current moving area, set the subsequent moving area corresponding to the current moving area, and save the area editing result after obtaining the area editing result; in response to a modification operation on the area editing result, adjust the alternative moving areas in the area editing result, and / or the subsequent moving areas corresponding to the alternative moving areas.
[0104] In actual applications, the target game map is divided into multiple grids; the area editing result includes an area identifier corresponding to each alternative movement area in the target game map; the device also includes a result importing module, which is used to: before controlling the movement of virtual objects in the target game based on the area editing result, based on the area editing result, in the target game map, determine the grid value of the grid contained in the alternative movement area as the area identifier corresponding to the alternative movement area, and determine the grid value of the grid contained in the area outside the alternative movement area as a specified value; based on the grid value of the grid contained in the target game map, encode and compress the area editing result to obtain the final area editing result; send the final area editing result to the target game, so that the virtual objects in the target game are controlled to move based on the final area editing result.
[0105] Furthermore, the above-mentioned result import module is also used to: divide the target game map into multiple grid areas on average; wherein, one grid area corresponds to one node; for each grid area, if the grid values of the grids contained in the current grid area are all the same, the grid value of the grid contained in the current grid area is determined as the node value of the node corresponding to the current grid area; if the grid values of the grids contained in the current grid area are different, the current grid area is used as the new target game map, and the step of dividing the target game map into multiple grid areas on average is continued until the node value of the node corresponding to the current grid area is obtained; according to preset rules, the node values of the multiple nodes corresponding to the target game map are sorted to obtain a node array; wherein the preset rules are used to indicate the sorting method of the node values of the multiple nodes; based on the area identifier of the subsequent moving area corresponding to the alternative moving area in the area editing result, the advancement array corresponding to the node whose node value is the area identifier in the node array is determined; wherein the advancement array is used to indicate the subsequent moving area of the alternative moving area corresponding to the node value; the node array and the advancement array are determined as the final area editing result.
[0106] Furthermore, the above-mentioned movement control module 73 is used to: in response to the virtual object moving to the target position point, determine the target node value corresponding to the target position point based on the node array in the area editing result; wherein the target position point is a position point within the alternative movement area in the target game map; determine the target advancement array from the area editing result based on the target node value, randomly determine the target area identifier from the target advancement array, and control the virtual object to move to the alternative movement area corresponding to the target area identifier.
[0107] In some embodiments, the above-mentioned movement control module 73 is also used to: determine the target subsequent movement area corresponding to the target alternative movement area from the area editing results according to the target alternative movement area where the virtual object is currently located; for each target subsequent movement area, determine the target subsequent movement area as a new target alternative area, and continue to execute the step of determining the target subsequent movement area corresponding to the target alternative movement area from the area editing results according to the target alternative movement area where the virtual object is currently located until the preset number of movements is reached or the designated movement area is reached; determine the movement path of the virtual object according to the target alternative area and multiple target subsequent movement areas, and control the movement of the virtual object based on the movement path.
[0108] The object movement control device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned method embodiment.
[0109] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, the electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned object movement control method.
[0110] Furthermore, Figure 8 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0111] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0112] The processor 101 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 101 or by software instructions. The above processor 101 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.
[0113] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned object movement control method. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0114] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, terminal device, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0115] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0116] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A method for controlling object movement, characterized in that: The method comprises: Obtain a target game map of a target game; In response to a drawing operation on the target game map, based on the drawing operation, a plurality of candidate movement areas corresponding to the virtual object are determined in the target game map; wherein the plurality of candidate movement areas corresponding to the virtual object are areas that the virtual object can enter in the target game map; In response to an editing operation on the multiple candidate movement areas, a current movement area is determined, and a subsequent movement area corresponding to the current movement area is set to obtain a region editing result; wherein the virtual object can move from the current movement area to a subsequent movement area corresponding to the current movement area; and the subsequent movement area is at least one candidate movement area among the multiple candidate movement areas; Based on the region editing result, the movement of the virtual object in the target game is controlled; wherein the region editing result is used to indicate the candidate movement regions that the virtual object can enter in the target game map, and the subsequent movement regions corresponding to each candidate movement region; The step of determining a current moving area in response to an editing operation on the multiple candidate moving areas, setting a subsequent moving area corresponding to the current moving area, and obtaining a region editing result includes: For each of the candidate movement regions, in response to a first editing operation on a current movement region, setting a region identifier of the current movement region; For each of the candidate movement regions, in response to a second editing operation on a current movement region, determining a subsequent movement region corresponding to the current movement region based on the second editing operation; The area editing result is generated based on a plurality of candidate movement areas set in the target game map, an area identifier of each candidate movement area, and an area identifier of a subsequent movement area corresponding to each candidate movement area.
2. The method according to claim 1, characterized in that After the step of setting, for each of the plurality of candidate movement regions, a region identifier of the current movement region in response to a first editing operation on the current movement region, the method further comprises: In response to a third editing operation on the current moving area, an object type of a movable virtual object in the current moving area is set.
3. The method according to claim 1, characterized in that After the steps of determining a current moving area in response to an editing operation on the multiple candidate moving areas, setting a subsequent moving area corresponding to the current moving area, and obtaining a region editing result, the method further includes: Saving the region editing result; In response to a modification operation on the region editing result, the candidate movement region in the region editing result and / or the subsequent movement region corresponding to the candidate movement region are adjusted.
4. The method according to claim 1, wherein The target game map is divided into a plurality of grids; the region editing result includes a region identifier corresponding to each candidate movement region in the target game map; Before the step of controlling the movement of the virtual object in the target game based on the region editing result, the method further includes: Based on the region editing result, in the target game map, determining the grid values of the grids included in the candidate movement region as the region identifier corresponding to the candidate movement region, and determining the grid values of the grids included in the region outside the candidate movement region as the specified value; Based on the grid values of the grids included in the target game map, encoding and compressing the region editing result to obtain a final region editing result; The final region editing result is sent to the target game, so that the virtual object in the target game is controlled to move based on the final region editing result.
5. The method according to claim 4, characterized in that The step of encoding and compressing the region editing result based on the grid values of the grids included in the target game map to obtain the final region editing result includes: Divide the target game map into multiple grid areas on average; wherein each grid area corresponds to one node; For each of the grid areas, if the grid values of the grids included in the current grid area are all the same, the grid values of the grids included in the current grid area are determined as the node values of the nodes corresponding to the current grid area; if the grid values of the grids included in the current grid area are different, the current grid area is used as a new target game map, and the step of evenly dividing the target game map into a plurality of grid areas is continued until the node value of the node corresponding to the current grid area is obtained; Sort the node values of the plurality of nodes corresponding to the target game map according to a preset rule to obtain a node array; wherein the preset rule is used to indicate a sorting method of the node values of the plurality of nodes; Determine, based on the region identifier of the subsequent moving region corresponding to the candidate moving region in the region editing result, a propagation array corresponding to the node whose node value is the region identifier in the node array; wherein the propagation array is used to indicate the subsequent moving region of the candidate moving region corresponding to the node value; The node array and the advancement array are determined as the final area editing result.
6. The method according to claim 5, characterized in that The step of controlling the movement of the virtual object in the target game based on the region editing result includes: In response to the virtual object moving to a target location point, determining a target node value corresponding to the target location point based on the node array in the area editing result; wherein the target location point is a location point within the candidate movement area in the target game map; A target advancement array is determined from the region editing result based on the target node value, a target region identifier is randomly determined from the target advancement array, and the virtual object is controlled to move to a candidate movement region corresponding to the target region identifier.
7. The method according to claim 1, characterized in that The step of controlling the movement of the virtual object in the target game based on the region editing result includes: According to the target candidate movement area where the virtual object is currently located, determining a target subsequent movement area corresponding to the target candidate movement area from the area editing result; For each target subsequent movement area, determining the target subsequent movement area as a new target candidate area, and continuing to perform the step of determining the target subsequent movement area corresponding to the target candidate movement area from the area editing result according to the target candidate movement area currently located by the virtual object, until a preset number of movements is reached or a designated movement area is reached; A moving path of the virtual object is determined according to the target candidate area and the plurality of target subsequent moving areas, and movement of the virtual object is controlled based on the moving path.
8. An object movement control device, characterized in that: The device comprises: A map acquisition module, used to obtain a target game map of a target game; an area drawing module, configured to respond to a drawing operation on the target game map and determine, based on the drawing operation, a plurality of candidate movement areas corresponding to the virtual object in the target game map; wherein the plurality of candidate movement areas corresponding to the virtual object are areas that the virtual object can enter in the target game map; a region editing module, configured to respond to an editing operation on the plurality of candidate movement regions, determine a current movement region, set a subsequent movement region corresponding to the current movement region, and obtain a region editing result; wherein the virtual object can move from the current movement region to a subsequent movement region corresponding to the current movement region; and the subsequent movement region is at least one candidate movement region among the plurality of candidate movement regions; a movement control module, configured to control the movement of a virtual object in the target game based on the region editing result; wherein the region editing result is used to indicate candidate movement regions that the virtual object can enter in the target game map, and subsequent movement regions corresponding to each candidate movement region; The area editing module is further used to: for each of the multiple alternative moving areas, in response to a first editing operation on the current moving area, set the area identifier of the current moving area; for each of the multiple alternative moving areas, in response to a second editing operation on the current moving area, determine the subsequent moving area corresponding to the current moving area based on the second editing operation; generate the area editing result based on the multiple alternative moving areas set in the target game map, the area identifier of each of the alternative moving areas, and the area identifier of the subsequent moving area corresponding to each of the alternative moving areas.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the object movement control method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the object movement control method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Navigation method for virtual object in game and electronic equipment
CN112370788A
Path finding method and device in virtual scene, equipment and storage medium
CN114377397A