Coordinate Encoding Method and Device for Virtual Objects in Game Scenes

By dividing the game scene into sector-shaped partitions and encoding the distance and angle of objects, the problem that neural networks are difficult to fit the coordinates of multiple virtual objects is solved, achieving better training results.

CN115731314BActive Publication Date: 2025-08-01GUANGDONG Q-DAZZLE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211491392.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2025-08-01
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

In the prior art, it is difficult for neural networks to effectively fit and learn coordinate information of multiple virtual objects, resulting in poor training results.

Method used

The game scene is divided into sector-shaped partitions, and the angle and distance encoding are generated based on the distance and angle between the object and the preset starting point, which is used to represent the coordinates of the virtual object.

Benefits of technology

It improves the identification and use of virtual object coordinates by neural networks and improves the training effect of fitting learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115731314B_ABST
    Figure CN115731314B_ABST
Patent Text Reader

Abstract

The present application provides a coordinate encoding method and device for virtual objects in a game scene, including: dividing the game scene into a number of partitions according to a preset precision; dividing the objects to be encoded in the game scene into corresponding partitions according to the angle between the object to be encoded and a preset starting point; if the partition contains the object to be encoded, recording the angle encoding in the partition as the first angle encoding, and determining whether the number of objects to be encoded contained in the partition is greater than 1; if so, recording the minimum distance value as the distance encoding of the partition; if not, recording the distance value of the object to be encoded as the distance encoding of the partition; if the partition does not contain the object to be encoded, recording the angle encoding in the partition as the second angle encoding and the distance encoding as 0; and recording the arranged angle encoding and distance encoding as the coordinate encoding of the object to be encoded in the game scene. The position of the object to be encoded encoded by the above method can be better used by the neural network to extract features and perform fitting learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a coordinate encoding method and device for virtual objects in a game scene. Background Art

[0002] AI training tasks involved in game scenarios require fitting and learning the position information of virtual objects. For example, in a football game, AI training needs to pass information such as the position of the ball, the position of teammates, and the position of opponents to the neural network for fitting and learning.

[0003] Currently, during the neural network fitting and learning process, the global coordinates of virtual objects in the global coordinate system are directly transmitted to the neural network; or the global coordinates of virtual objects are converted to a coordinate system with the AI as the origin to obtain relative coordinates, which are then transmitted to the neural network. Due to the presence of multiple virtual objects in the game scene, the neural network has difficulty fitting and learning the coordinate information of multiple virtual objects, resulting in poor training results. Summary of the Invention

[0004] Based on this, the present invention provides a coordinate encoding method and device for virtual objects in a game scene, which can transmit the coordinates of multiple virtual objects in the game scene to a neural network. The neural network can understand the position information and obtain better training results after fitting learning.

[0005] In a first aspect, the present invention provides a coordinate encoding method for virtual objects in a game scene, comprising:

[0006] Get the coordinates of all objects to be encoded in the game scene;

[0007] With the preset starting point as the center, the game scene is divided into several partitions according to the preset accuracy, and each partition is assigned a corresponding partition number;

[0008] Obtaining the distance and angle between each object to be encoded and a preset starting point according to the coordinates;

[0009] Divide all objects to be encoded in the game scene into corresponding partitions according to the angle between the object to be encoded and the preset starting point;

[0010] According to the order of partition numbers from small to large, determine whether each partition contains the object to be encoded;

[0011] If the partition contains an object to be encoded, record the angle code in the partition as the first angle code, and determine whether the number of objects to be encoded contained in the partition is greater than 1;

[0012] If the number of objects to be encoded contained in the partition is greater than 1, the minimum distance value is recorded as the distance code of the partition;

[0013] If the number of objects to be encoded contained in a partition is equal to 1, record the distance value of the object to be encoded as the distance encoding of the partition;

[0014] If no object to be encoded is contained in a partition, record the angle encoding within the partition as the second angle encoding, and record the distance encoding as 0;

[0015] Arrange the angle encodings and distance encodings of all partitions in ascending order of partition numbers, and record the arranged angle encodings and distance encodings as the coordinate encodings of the objects to be encoded in the game scene.

[0016] In a second aspect, the present invention provides a coordinate encoding device for virtual objects in a game scene, including:

[0017] A coordinate acquisition module, configured to acquire the coordinates of all objects to be encoded in the game scene;

[0018] A scene preprocessing module, configured to divide the game scene into a plurality of partitions with a preset starting point as the center point according to a preset precision, and set corresponding partition numbers for each partition;

[0019] An object-to-be-encoded preprocessing module, configured to acquire the distance and angle between each object to be encoded and the preset starting point according to the coordinates;

[0020] An object-to-be-encoded partitioning module, configured to divide all objects to be encoded in the game scene into corresponding partitions according to the angle between the object to be encoded and the preset starting point;

[0021] A partition object judgment module, configured to judge whether each partition contains an object to be encoded in ascending order of partition numbers;

[0022] A partition angle encoding module, configured to, if a partition contains an object to be encoded, record the angle encoding within the partition as the first angle encoding, and judge whether the number of objects to be encoded contained in the partition is greater than 1;

[0023] A partition distance retention module, configured to, if the number of objects to be encoded contained in a partition is greater than 1, record the minimum distance value as the distance encoding of the partition;

[0024] A partition distance encoding module, configured to, if the number of objects to be encoded contained in a partition is equal to 1, record the distance value of the object to be encoded as the distance encoding of the partition;

[0025] A partition no-object module, configured to, if a partition does not contain an object to be encoded, record the angle encoding within the partition as the second angle encoding, and record the distance encoding as 0;

[0026] A scene encoding module, which is used to arrange the angle encodings and distance encodings of all partitions in ascending order of partition serial numbers, and record the arranged angle encodings and distance encodings as the coordinate encodings of the objects to be encoded in the game scene.

[0027] In a third aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the coordinate encoding methods of the game scene virtual objects in the first aspect are implemented.

[0028] In a fourth aspect, the present invention provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it executes any one of the coordinate encoding methods of the game scene virtual objects in the first aspect.

[0029] The beneficial effects of adopting the above technical solutions are as follows: The coordinates of multiple virtual objects in the game scene are represented by means of partition encoding, and this encoding method is in a form recognizable by a neural network, which is conducive to the neural network's recognition and use of the coordinates of each virtual object during the fitting learning process, and a better training effect is obtained. Description of the Drawings

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.

[0031] Figure 1 It is a schematic diagram of the coordinate encoding method of the game scene virtual object in an embodiment of the present application;

[0032] Figure 2 It is a schematic diagram of the coordinate encoding conversion of the football in a football game in an embodiment of the present application;

[0033] Figure 3 It is a schematic diagram of the coordinate encoding conversion of the players in a football game in an embodiment of the present application;

[0034] Figure 4 It is a schematic diagram of the football coordinate encoding restoration in an embodiment of the present application;

[0035] Figure 5 It is a schematic diagram of the coordinate encoding device of the game scene virtual object in an embodiment of the present application. Detailed Embodiments

[0036] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. To describe the present invention in more detail, the coordinate encoding method and device for virtual objects in the game scene provided by the present invention will be specifically described below in conjunction with the accompanying drawings.

[0037] In the game scene, when it comes to AI training tasks, it is necessary to perform fitting learning on the position information of virtual objects. For example, in a football game, AI training needs to transmit information such as the position of the ball, the position of teammates, and the position of opponents to the neural network for learning. The existing transmission of position information usually uses global coordinates, relative coordinates, or polar coordinates. However, due to the large number of virtual objects involved, it is difficult for the neural network to process the coordinate information of the above virtual objects, resulting in poor fitting learning effects.

[0038] The embodiment of the present application provides a specific application scenario of the coordinate encoding method for virtual objects in the game scene. This application scenario includes a terminal device with a display screen provided by the embodiment. The terminal device includes, but is not limited to, a smart phone and a computer device. The computer device can be at least one of devices such as a desktop computer, a portable computer, a laptop computer, and a tablet computer. The user operates the terminal device, and the terminal device executes the coordinate encoding method and device for virtual objects in the game scene of the present invention, and displays the game scene on the display screen. For the specific process, please refer to the embodiment of the coordinate encoding method for virtual objects in the game scene.

[0039] Based on this, the embodiment of the present invention provides a coordinate encoding method for virtual objects in the game scene. Taking the application of this method to a terminal device as an example, it is described in conjunction with the attached Figure 1 Schematic diagram showing the coordinate encoding method for virtual objects in the game scene.

[0040] Step S101: Obtain the coordinates of all objects to be encoded in the game scene.

[0041] The game scene contains one or more virtual objects. In the embodiment of the present invention, the virtual objects participating in encoding are called objects to be encoded, and those not participating in encoding are called other objects. Taking a football game as an example, the virtual objects included in this game scene include players, footballs, goal frames, seats, and audiences; among them, the objects to be encoded in the game scene include several players, footballs, and goal frames; the other objects in the game scene include background objects such as audiences or seats in the football stadium audience seats, which do not participate in encoding and are not the objects to be encoded in the present invention.

[0042] For the object to be encoded with a relatively small volume, the coordinates of the object to be encoded can be directly obtained according to the above method; for the object to be encoded with a relatively large volume, such as a wall spanning multiple partitions, the object to be encoded needs to be divided into multiple objects to be encoded with relatively small volumes, and then the coordinates of each object to be encoded with a relatively small volume are obtained respectively.

[0043] Step S102: Centered on a preset starting point, divide the game scene into several partitions according to a preset precision, and set a corresponding partition number for each partition.

[0044] Among them, the preset starting point is the position of the character controlled by the game scene AI.

[0045] In addition, the preset precision is an angle, and the size of the precision can be set according to specific scene requirements; the divided partitions are fan-shaped partitions.

[0046] Step S103: Obtain the distance and angle between each object to be encoded and the preset starting point according to the coordinates.

[0047] Among them, the angle between the object to be encoded and the preset starting point is the preset starting point, that is, the straight-ahead direction of the line of sight of the character controlled by the game scene AI, and the direction from the preset starting point to the object to be encoded. If the position of the object to be encoded does not change and the character controlled by the AI rotates itself, then the angle changes.

[0048] Step S104: Divide all the objects to be encoded in the game scene into corresponding partitions according to the angle between the object to be encoded and the preset starting point.

[0049] Specifically, if the angle between the object to be encoded and the preset starting point is within the range of the partition and the precision, divide the object to be encoded into the partition corresponding to the angle.

[0050] Step S105: Judging whether each partition contains an object to be encoded in ascending order of the partition number.

[0051] Step S106: If the partition contains an object to be encoded, record the angle encoding in the partition as the first angle encoding, and judge whether the number of objects to be encoded contained in the partition is greater than 1.

[0052] Among them, the first angle number can be numbered in a variety of notations, used to indicate that there is an object to be encoded in the partition, and the commonly used number is 1.

[0053] Step S107: If the number of objects to be encoded contained in the partition is greater than 1, record the minimum distance value as the distance encoding of the partition.

[0054] Step S108: If the number of objects to be encoded in the partition is equal to 1, record the distance value of the object to be encoded as the distance encoding of the partition.

[0055] Step S109: If there is no object to be encoded in the partition, record the angle encoding in the partition as the second angle encoding, and record the distance encoding as 0.

[0056] Among them, the second angle number can be numbered in a variety of notations, which is used to indicate that there is no object to be encoded in the partition, and the commonly used number is 0.

[0057] Step S110: Arrange the angle encodings and distance encodings of all partitions in ascending order of the partition numbers, and record the arranged angle encodings and distance encodings as the coordinate encodings of the objects to be encoded in the game scene.

[0058] Furthermore, during the execution of the above coordinate encoding method for the objects to be encoded in the game scene, the objects to be encoded in the game scene can be classified and then encoded multiple times according to the classification.

[0059] For example, in a football game scene, the objects to be encoded include a football, teammates, and opposing players. The football is regarded as the first classification, 2 teammates are regarded as the second classification, and 3 opposing players are regarded as the third classification; execute the coordinate encoding method for the objects to be encoded in the game scene according to the above classification, and obtain the coordinate encodings of the first classification, the second classification, and the third classification in the game scene respectively; combine the coordinate encodings of the first classification, the second classification, and the third classification to obtain the coordinate encoding of the game scene.

[0060] By classifying the objects to be encoded and then executing the coordinate encoding method, different objects to be encoded in the game scene can be distinguished, and equivalent representations can be made for objects of the same type, avoiding the problem that objects of the same type are not equivalent due to the order of objects of the same type in the neural network.

[0061] The above coordinate encoding method for virtual objects in the game scene partitions the game scene according to the accuracy, and sets the corresponding angle encoding and distance encoding according to whether there is an object to be encoded in the partition. Then all the objects to be encoded in the game scene can be represented by encoding. The generated encoding has strong readability for the neural network, can more easily extract the position features of the objects to be encoded, and is better for fitting learning to obtain better training results.

[0062] Taking the preset accuracy of 60° as an example, the above coordinate encoding method for the objects to be encoded in the game scene is described.

[0063] Step S201: Obtain the coordinates of all objects to be encoded in the game scene;

[0064] Step S202: Divide the game scene into 6 sector partitions according to a preset precision;

[0065] Step S203: Randomly select one of the sector partitions as the starting partition, and in the clockwise direction, name the sector partitions as the zeroth partition, the first partition, the second partition, the third partition, the fourth partition, and the fifth partition in sequence. The precision range of the zeroth partition is [0°, 60°), the precision range of the first partition is [60°, 120°), the precision range of the second partition is [120°, 180°), the precision range of the third partition is [180°, 240°), the precision range of the fourth partition is [240°, 300°), and the precision range of the fifth partition is [300°, 360°);

[0066] Step S204: If the angle between the object to be encoded and the preset starting point is within the precision range of the sector partition, divide the object to be encoded into the corresponding partition according to the angle;

[0067] Step S205: In the order of increasing partition numbers, judge whether each partition contains the object to be encoded;

[0068] Step S206: If the partition contains the object to be encoded, record the angle encoding of the partition as 1, and judge whether the number of objects to be encoded contained in the partition is greater than 1; if the number of objects to be encoded contained in the partition is greater than 1, record the minimum distance value as the distance encoding of the partition; if the number of objects to be encoded contained in the partition is equal to 1, record the distance value of the object to be encoded as the distance encoding of the partition; if the partition does not contain the object to be encoded, record the angle encoding within the partition as 0;

[0069] Step S207: In the order of increasing partition numbers, arrange the angle encodings of all partitions in sequence as the angle encoding of the scene partition, where the angle encoding of the scene partition includes: the angle encoding of the zeroth partition, the angle encoding of the first partition, the angle encoding of the second partition, the angle encoding of the third partition, the angle encoding of the fourth partition, and the angle encoding of the fifth partition;

[0070] Step S208: In the order of increasing partition numbers, arrange the distance encodings of all partitions in sequence as the distance encoding of the scene partition, where the distance encoding of the scene partition includes: the distance encoding of the zeroth partition, the distance encoding of the first partition, the distance encoding of the second partition, the distance encoding of the third partition, the distance encoding of the fourth partition, and the distance encoding of the fifth partition;

[0071] Step S209: Record the arranged angle encoding of the scene partition and the distance encoding of the scene partition as the coordinate encoding of the object to be encoded in the game scene, including: the angle encoding of the scene partition, the distance encoding of the scene partition.

[0072] Furthermore, in the actual application of the above coordinate encoding method for the objects to be encoded in the game scene, there is also an operation for initializing the coordinate encoding, specifically as follows:

[0073] Step S301: Obtain the coordinates of all objects to be encoded in the game scene.

[0074] Step S302: Divide the game scene into several partitions according to a preset precision with a preset starting point as the center, and set corresponding partition numbers for each partition.

[0075] Step S303: Initialize the coordinate encoding of the game scene. The coordinate encoding includes an angle encoding and a distance encoding arranged in sequence.

[0076] Among them, the initialization process of the coordinate encoding is to set both the angle encoding and the distance encoding to 0.

[0077] Step S304: Obtain the distance and angle between each object to be encoded and the preset starting point according to the coordinates.

[0078] Step S305: Update the angle encoding. For each object to be encoded, obtain the partition where the object to be encoded is located according to the angle between the object to be encoded and the preset starting point, and update the angle encoding of the partition to the first angle encoding, and the first angle encoding is generally denoted as 1.

[0079] Step S306: Update the distance encoding. For each object to be encoded, obtain the distance value between the object to be encoded and the preset starting point according to the partition obtained in Step S305; if the distance encoding of the partition where the object is located is 0 or the distance encoding of the partition where the object is located is greater than the distance value, update the distance encoding of the partition to the distance value.

[0080] Thus, the actual coordinate encoding of the game scene can be obtained.

[0081] To more clearly illustrate the above coordinate encoding method for virtual objects in the game scene, the following is a specific application example:

[0082] See Appendix Figure 2 , in a 2D football game scene, the relative coordinates of the football are (0.8, 0.2), the distance between the football and the preset starting point is 0.82, and the football is in the first partition. Then the coordinate encoding in the game scene is 0, 1, 0, 0, 0, 0, 0.82.

[0083] See Appendix Figure 3, in a 2D football game scenario, there are 3 opposing players. The relative coordinates of player A are (0.8, 0.2), the relative coordinates of player B are (0.5, -0.1), and the relative coordinates of player C are (-0.2, -0.5). According to the partitioning result, the first partition contains player A and player B, and the third partition contains player C. Then the coordinate encoding in the game scenario is 0, 1, 0, 1, 0, 0, 0, 0.51, 0, 0.54, 0, 0.

[0084] The coordinate encoding in the generated game scenario is more conducive to the neural network to extract the position features of virtual objects and better perform fitting learning compared to the previous relative coordinates.

[0085] It should be noted that in the above coordinate encoding method for virtual objects in the game scenario, the accuracy is determined according to specific training tasks. For example, in a football game, if a higher accuracy is required, the accuracy can be set to 10°. The accuracy is actually the performance of post-encoding blurring. Points with the same distance within the same partition are equivalent after encoding. The higher the accuracy, the more partitions are divided, and the relatively weaker the post-encoding blurring.

[0086] As shown in the Figure 4 attachment, the coordinate encoding of the game scenario cannot completely restore the original coordinates, but can only restore an arc where the original coordinates are located. It can also be understood that this encoding represents the original coordinates with an arc. The smaller the distance value, the shorter the arc, and the smaller the deviation after restoration, that is, the more accurate the encoding result; while the larger the distance value, the longer the arc, and the larger the deviation after restoration, that is, the more blurred the encoding result.

[0087] It should be understood that although each step in the flowchart of the Figure 1 attachment is shown in sequence according to the arrow indication, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the Figure 1 attachment may include multiple sub-steps or sub-phases. These sub-steps or phases are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or phases is not necessarily sequential either, but can be executed alternately or in turn with at least a part of other steps or sub-steps or phases of other steps.

[0088] In the above embodiments disclosed in the present invention, the coordinate encoding method for virtual objects in the game scenario is described in detail. For the above method disclosed in the present invention, it can be implemented by various forms of devices. Therefore, the present invention also discloses a coordinate encoding device for virtual objects in the game scenario corresponding to the above method. Referring to the Figure 5, specific embodiments are given below for detailed description.

[0089] A coordinate acquisition module 301, configured to acquire the coordinates of all objects to be encoded in the game scene.

[0090] A scene preprocessing module 302, configured to divide the game scene into several partitions with a preset starting point as the center point according to a preset precision, and set corresponding partition numbers for each partition.

[0091] An object-to-be-encoded preprocessing module 303, configured to acquire the distance and angle between each object to be encoded and the preset starting point according to the coordinates.

[0092] An object-to-be-encoded partitioning module 304, configured to divide all objects to be encoded in the game scene into corresponding partitions according to the angle between the object to be encoded and the preset starting point.

[0093] A partition object judgment module 305, configured to judge whether each partition contains an object to be encoded in ascending order of the partition numbers.

[0094] A partition angle encoding module 306, configured to, if the partition contains an object to be encoded, record the angle encoding in the partition as the first angle encoding, and judge whether the number of objects to be encoded contained in the partition is greater than 1.

[0095] A partition distance retention module 307, configured to, if the number of objects to be encoded contained in the partition is greater than 1, record the minimum distance value as the distance encoding of the partition.

[0096] A partition distance encoding module 308, configured to, if the number of objects to be encoded contained in the partition is equal to 1, record the distance value of the object to be encoded as the distance encoding of the partition.

[0097] A partition objectless module 309, configured to, if the partition does not contain an object to be encoded, record the angle encoding in the partition as the second angle encoding and the distance encoding as 0.

[0098] A scene encoding module 310, configured to arrange the angle encodings and distance encodings of all partitions in ascending order of the partition numbers, and record the arranged angle encodings and distance encodings as the coordinate encoding of the objects to be encoded in the game scene.

[0099] For the specific limitations on the coordinate encoding device of the virtual object in the game scene, reference can be made to the limitations on the method in the above text, which will not be elaborated here. Each module in the above device can be implemented in whole or in part by software, hardware, and their combinations. The above modules can be embedded in the processor of the terminal device in hardware form or be independent of it, or can be stored in the memory of the terminal device in software form so that the processor can call and execute the operations corresponding to the above modules.

[0100] In one embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the coordinate encoding method for virtual objects in a game scenario in the above first aspect are implemented.

[0101] The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM (erasable programmable read-only memory), a hard disk, or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has a storage space for program codes for executing any method steps in the above method. These program codes can be read from or written into one or more computer program products, and the program codes can be compressed in a suitable form.

[0102] In one embodiment, the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the coordinate encoding method for virtual objects in the game scenario are executed.

[0103] The computer device includes a memory, a processor, and one or more computer programs, where one or more computer programs can be stored in the memory and configured to be executed by one or more processors, and one or more application programs are configured to execute the coordinate encoding method for virtual objects in the game scenario.

[0104] The processor may include one or more processing cores. The processor utilizes various interfaces and circuits to connect various parts within the entire computer device. By running or executing instructions, programs, code sets, or instruction sets stored in the memory, and by invoking data stored in the memory, it performs various functions of the computer device and processes data. Optionally, the processor may be implemented in at least one of the hardware forms of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor may integrate one or a combination of several of the central processing unit (CPU), the reporting verifier for buried point data (Graphics Processing Unit, GPU), and the modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the displayed content; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor and may be implemented separately through a communication chip.

[0105] The memory may include random access memory (RAM) and may also include read-only memory. The memory can be used to store instructions, programs, code, code sets, or instruction sets. The memory may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created during the use of the terminal device.

[0106] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A coordinate encoding method for virtual objects in a game scene, characterized in that, Including: Obtaining the coordinates of all objects to be encoded within the game scene; Centering on a preset starting point, dividing the game scene into several partitions according to a preset precision, and setting corresponding partition numbers for each partition; Obtaining the distance and angle between each object to be encoded and the preset starting point according to the coordinates; Dividing all objects to be encoded within the game scene into corresponding partitions according to the angle between the object to be encoded and the preset starting point; Judging whether each partition contains an object to be encoded in ascending order of the partition number; If the partition contains an object to be encoded, recording the angle encoding within the partition as the first angle encoding, and judging whether the number of objects to be encoded contained in the partition is greater than 1; If the number of objects to be encoded contained in the partition is greater than 1, recording the minimum distance value as the distance encoding of the partition; If the number of objects to be encoded contained in the partition is equal to 1, recording the distance value of the object to be encoded as the distance encoding of the partition; If the partition does not contain an object to be encoded, recording the angle encoding within the partition as the second angle encoding and the distance encoding as 0; Arranging the angle encodings and distance encodings of all partitions in ascending order of the partition number, and recording the arranged angle encodings and distance encodings as the coordinate encoding of the objects to be encoded in the game scene.

2. The coordinate encoding method for virtual objects in a game scene according to claim 1, wherein, The dividing the game scene into several partitions according to a preset precision and setting corresponding partition numbers for each partition includes: The preset precision is 60°; Dividing the game scene into 6 sector partitions according to the preset precision; Randomly selecting one of the sector partitions as the starting partition, and naming the sector partitions in clockwise order as the zeroth partition, the first partition, the second partition, the third partition, the fourth partition, and the fifth partition, where the precision range of the zeroth partition is [0°, 60°), the precision range of the first partition is [60°, 120°), the precision range of the second partition is [120°, 180°), the precision range of the third partition is [180°, 240°), the precision range of the fourth partition is [240°, 300°), and the precision range of the fifth partition is [300°, 360°).

3. The coordinate encoding method for virtual objects in a game scene according to claim 2, characterized in that, The dividing all objects to be encoded within the game scene into corresponding partitions according to the angle between the object to be encoded and the preset starting point includes: If the angle between the object to be encoded and the preset starting point is within the precision range of the sector partition, dividing the object to be encoded into the corresponding partition.

4. The coordinate encoding method for virtual objects in a game scene according to claim 3, wherein The arranging the angle encodings and distance encodings of all partitions in ascending order of the partition number and recording the arranged angle encodings and distance encodings as the coordinate encoding of the objects to be encoded in the game scene includes: Arranging the angle encodings of all partitions in ascending order of the partition number and recording them as the angle encoding of the scene partitions, where the angle encoding of the scene partitions includes: the angle encoding of the zeroth partition, the angle encoding of the first partition, the angle encoding of the second partition, the angle encoding of the third partition, the angle encoding of the fourth partition, and the angle encoding of the fifth partition; Arrange the distance codes of all partitions in ascending order of the partition serial numbers, and record them as the distance codes of the scene partitions. The distance codes of the scene partitions include: the distance code of the zero partition, the distance code of the first partition, the distance code of the second partition, the distance code of the third partition, the distance code of the fourth partition, and the distance code of the fifth partition. Record the arranged angle codes of the scene partitions and the distance codes of the scene partitions as the coordinate codes of the objects to be coded in the game scene, including: the angle codes of the scene partitions and the distance codes of the scene partitions.

5. A coordinate encoding device for virtual objects in a game scene, characterized in that, Including: A coordinate acquisition module for acquiring the coordinates of all objects to be coded in the game scene; A scene preprocessing module for dividing the game scene into several partitions with a preset starting point as the center point according to a preset precision, and setting corresponding partition serial numbers for each partition; A preprocessing module for objects to be coded, which is used to obtain the distance and angle between each object to be coded and the preset starting point according to the coordinates; A module for dividing objects to be coded, which is used to divide all objects to be coded in the game scene into corresponding partitions according to the angle between the objects to be coded and the preset starting point; A partition object judgment module for judging whether each partition contains objects to be coded in ascending order of the partition serial numbers; A partition angle coding module for, if the partition contains objects to be coded, recording the angle code in the partition as the first angle code and judging whether the number of objects to be coded contained in the partition is greater than 1; A partition distance retention module for, if the number of objects to be coded contained in the partition is greater than 1, recording the minimum distance value as the distance code of the partition; A partition distance coding module for, if the number of objects to be coded contained in the partition is equal to 1, recording the distance value of the object to be coded as the distance code of the partition; A partition without object module for, if the partition does not contain objects to be coded, recording the angle code in the partition as the second angle code and the distance code as 0; A scene coding module for arranging the angle codes and distance codes of all partitions in ascending order of the partition serial numbers, and recording the arranged angle codes and distance codes as the coordinate codes of the objects to be coded in the game scene.

6. The coordinate encoding device for virtual objects in a game scene according to claim 5, wherein, The dividing the game scene into several partitions according to the preset precision and setting corresponding partition serial numbers for each partition includes: A precision setting unit, and the preset precision is 60°; A scene dividing unit for dividing the game scene into 6 sector partitions according to the preset precision; A partition setting unit for randomly selecting one of the sector partitions as the starting partition, and naming the sector partitions as the zero partition, the first partition, the second partition, the third partition, the fourth partition, and the fifth partition in a clockwise direction. Among them, the precision range of the zero partition is [0°, 60°), the precision range of the first partition is [60°, 120°), the precision range of the second partition is [120°, 180°), the precision range of the third partition is [180°, 240°), the precision range of the fourth partition is [240°, 300°), and the precision range of the fifth partition is [300°, 360°).

7. The coordinate encoding device for virtual objects in a game scene according to claim 6, wherein, The object to be encoded partitioning module is used to partition all objects to be encoded in the game scene into corresponding partitions according to the angle between the object to be encoded and a preset starting point, including: The partition division unit is used to partition the object to be encoded into the partition corresponding to the angle if the angle between the object to be encoded and the preset starting point is within the accuracy range of the sector partition.

8. The coordinate encoding device for virtual objects in a game scene according to claim 7, characterized in that, The scene encoding module is used to arrange the angle encoding and distance encoding of all partitions in ascending order of partition numbers, and record the arranged angle encoding and distance encoding as the coordinate encoding of the objects to be encoded in the game scene, including: The angle encoding unit is used to arrange the angle encoding of all partitions in ascending order of partition numbers as the angle encoding of the scene partitions, where the angle encoding of the scene partitions includes: the angle encoding of the zero partition, the angle encoding of the first partition, the angle encoding of the second partition, the angle encoding of the third partition, the angle encoding of the fourth partition, and the angle encoding of the fifth partition; The distance encoding unit is used to arrange the distance encoding of all partitions in ascending order of partition numbers as the distance encoding of the scene partitions, where the distance encoding of the scene partitions includes: the distance encoding of the zero partition, the distance encoding of the first partition, the distance encoding of the second partition, the distance encoding of the third partition, the distance encoding of the fourth partition, and the distance encoding of the fifth partition; The integrated encoding unit is used to record the arranged angle encoding of the scene partitions and the distance encoding of the scene partitions as the coordinate encoding of the objects to be encoded in the game scene, including: the angle encoding of the scene partitions, the distance encoding of the scene partitions.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the coordinate encoding method of the virtual object in the game scene according to any one of claims 1-4 are implemented.

10. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the coordinate encoding method of the virtual object in the game scene according to any one of claims 1-4 is executed.

Citation Information

Patent Citations

  • Method for generating irregular wall of inclined 45 degrees of 2D game

    CN108537873A

  • Game scene loading method, device, computer readable medium and electronic equipment

    CN110716766A