Area positioning method and device, electronic equipment, storage medium and program product

CN121243770BActive Publication Date: 2026-10-20BEIJING PIXEL SOFTWARE TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511791069.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-01
Publication Date
2026-10-20
Estimated Expiration
2045-12-01

AI Technical Summary

Technical Problem

但是随着游戏场景中区域数量增加,尤其是存在大量重叠区域时,每帧执行全量遍历将消耗大量CPU资源,导致性能瓶颈,影响游戏帧率和响应速度

Benefits of technology

[0015]与现有技术相比,本发明实施例提供了一种区域定位方法、装置、电子设备、存储介质及程序产品,该方法为:当感知到角色移动时,获取角色在三维游戏场景中的角色位置;再基于角色位置确定角色所在当前网格的索引坐标;接着基于当前网格的索引坐标,对预先创建的网格映射表进行查找;网格映射表包括三维游戏场景中多个网格的索引坐标和嵌套区域列表,嵌套区域列表包括对应网格所涉及的每种效果区域的区域标识;若从网格映射表中查找到匹配的目标区域列表,最后则基于角色位置从目标区域列表中确定待生效的每种目标效果区域。本发明只需要从当前网格对应的目标区域列表中的各个效果区域来筛选出待生效的目标效果区域,提高了区域确定效率,减少CPU资源消耗,保障游戏运行流畅。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121243770B_ABST
    Figure CN121243770B_ABST
Patent Text Reader

Abstract

The application provides a region positioning method and device, electronic equipment, storage medium and program product. When the movement of a role is perceived, the role position of the role in a three-dimensional game scene is obtained. Then, the index coordinates of the current grid where the role is located are determined based on the role position. Next, the pre-created grid mapping table is searched based on the index coordinates of the current grid. The grid mapping table includes the index coordinates of a plurality of grids in the three-dimensional game scene and a nested region list. The nested region list includes the region identifiers of each effect region involved in the corresponding grid. If a matching target region list is found from the grid mapping table, finally, each target effect region to be activated is determined from the target region list based on the role position. The application only needs to screen the target effect region to be activated from each effect region in the target region list corresponding to the current grid, improves the region determination efficiency, reduces the CPU resource consumption, and ensures the smooth operation of the game.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of game technology, and more specifically, to a method, apparatus, electronic device, storage medium, and program product for area positioning. Background Technology

[0002] In complex 3D game environments, there are often multiple functional effect areas (such as healing areas, mana restoration areas, and slowing areas). These areas may overlap spatially and have different types and levels. Whenever a character's status needs to be updated, the system must accurately determine all valid areas where the character is currently located and decide on the final effect based on the rules.

[0003] The traditional approach is to traverse all regions to determine if a character is within the specified area. However, as the number of regions in a game scene increases, especially with a large number of overlapping regions, performing a full traversal every frame consumes significant CPU resources, leading to a performance bottleneck and impacting game frame rate and response speed. Summary of the Invention

[0004] The purpose of this invention is to provide a regional positioning method, device, electronic device, storage medium, and program product to improve the problems existing in the prior art.

[0005] The embodiments of the present invention can be implemented as follows: In a first aspect, the present invention provides a method for locating a region, comprising: When character movement is detected, the character's position in the 3D game scene is obtained; The index coordinates of the current grid where the character is located are determined based on the character's position; Based on the index coordinates of the current grid, a pre-created grid mapping table is searched; the grid mapping table includes the index coordinates of multiple grids in the 3D game scene and a list of nested regions, and the list of nested regions includes the region identifier of each effect region involved by the corresponding grid; If a matching list of target regions is found in the grid mapping table, then the region for each target effect to be applied is determined from the list of target regions based on the character's position.

[0006] In an optional implementation, the step of determining the region of each target effect to be applied from the list of target regions based on the character's position includes: Create an initially empty temporary list and use the first effect area in the target area list as the undetermined area; Based on the location information of the undetermined area and the character's location, determine whether the character is within the undetermined area; If the character is within the pending area, then based on the effect type and priority of the pending area, it is determined whether the pending area and the effect areas in the temporary list are mutually exclusive; if they are not mutually exclusive, then the area identifier and effect type of the pending area are added to the temporary list. If the character is not within the pending area or the pending area is mutually exclusive with the effect areas in the temporary list, then the next effect area in the target area list is taken as the pending area, and the process of determining whether the character is within the pending area based on the position information of the pending area and the character's position is repeated until the last effect area in the target area list is traversed. In this case, each effect area in the temporary list is taken as the target effect area.

[0007] In an optional implementation, the step of determining whether the undetermined region and the effect regions in the temporary list are mutually exclusive based on the effect type and priority of the undetermined region includes: If there is no traversed effect region in the temporary list that has the same effect type as the undetermined region, then it is confirmed that the undetermined region and the effect regions in the temporary list are not mutually exclusive. If the temporary list contains an already traversed effect region with the same effect type as the undetermined region and the priority of the undetermined region is the same as the priority of the already traversed effect region, then it is confirmed that the undetermined region and the effect regions in the temporary list are not mutually exclusive. If there is an already traversed effect region in the temporary list that has the same effect type as the undetermined region and the priority of the undetermined region is greater than the priority of the already traversed effect region, then it is confirmed that the undetermined region and the effect regions in the temporary list are not mutually exclusive, and the already traversed region is removed from the temporary list. If the temporary list contains an already traversed effect region with the same effect type as the undetermined region, and the priority of the undetermined region is lower than the priority of the already traversed effect region, then the undetermined region and the effect regions in the temporary list are confirmed to be mutually exclusive.

[0008] In an optional implementation, the method further includes: When any of the preset effect areas needs to be deleted, obtain the list of associated grids corresponding to the effect area to be deleted; For each grid in the associated grid list, remove the area to be deleted and its associated grid list from the nested area list of that grid in the grid mapping table; If the nested region list of the grid in the grid mapping table is empty, then the table entry containing the grid is removed from the grid mapping table.

[0009] In an optional implementation, the grid mapping table is created in the following manner: The 3D game scene is divided into multiple grids according to a preset size, and the index coordinates of each grid are obtained; Initialize the mapping table; Obtain the position information of each of the preset effect areas; For each effect region, based on the location information of the effect region, determine all the occupied grids involved to obtain the grid list corresponding to the effect region; Based on each occupied grid covered by all the aforementioned effect areas, determine the total effect area corresponding to each occupied grid. Each effect region corresponding to each occupied grid and its grid list are nested and combined into a nested region list; Each occupied grid is traversed sequentially, and the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the nested region list are stored as a table entry in the mapping table to obtain the nested region list of the grid mapping table.

[0010] In an optional implementation, the method further includes: Get the location information of the newly added effect area; Based on the location information of the newly added effect area, determine each occupied grid involved to obtain a grid list corresponding to the newly added effect area; For each occupied grid corresponding to the newly added effect area, if the grid mapping table includes the index coordinates of the occupied grid, then the effect area and its grid list are added to the nested area list of the occupied grid. If the grid mapping table does not include the index coordinates of the occupied grid, a new entry is added to the grid mapping table. After combining the effect area and its grid list into a new nested area list, the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the new nested area list are stored in the newly added entry.

[0011] In a second aspect, the present invention provides a region positioning device, comprising: The motion sensing module is used to obtain the character's position in the 3D game scene when the character's movement is sensed; The motion sensing module is also used to determine the index coordinates of the current grid where the character is located based on the character's position; The grid lookup module is used to look up a pre-created grid mapping table based on the index coordinates of the current grid. The grid mapping table includes the index coordinates of multiple grids in the 3D game scene and a list of nested regions. The list of nested regions includes the region identifier of each effect region involved by the corresponding grid. The region filtering module is used to determine the region of each target effect to be applied from the target region list based on the character's position if a matching target region list is found from the grid mapping table.

[0012] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the area positioning method as described in the first aspect above.

[0013] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the area positioning method described in the first aspect.

[0014] Fifthly, the present invention provides a program product that, when executed by a processor, implements the area positioning method described in the first aspect.

[0015] Compared with existing technologies, embodiments of the present invention provide a region positioning method, device, electronic device, storage medium, and program product. The method involves: when character movement is detected, acquiring the character's position in a 3D game scene; then determining the index coordinates of the current grid where the character is located based on the character's position; next, searching a pre-created grid mapping table based on the index coordinates of the current grid; the grid mapping table includes the index coordinates of multiple grids in the 3D game scene and a nested region list, the nested region list including the region identifier of each effect region involved in the corresponding grid; if a matching target region list is found in the grid mapping table, finally, determining each target effect region to be activated from the target region list based on the character's position. This invention only requires filtering the target effect regions to be activated from each effect region in the target region list corresponding to the current grid, improving region determination efficiency, reducing CPU resource consumption, and ensuring smooth game operation. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is one of the flowcharts illustrating a regional positioning method provided in an embodiment of the present invention.

[0018] Figure 2 This is a second flowchart illustrating a regional positioning method provided in an embodiment of the present invention.

[0019] Figure 3 This is a schematic diagram of a regional positioning device provided in an embodiment of the present invention.

[0020] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0022] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0023] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0024] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0025] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.

[0026] Please see Figure 1 , Figure 1 This is a flowchart illustrating a regional positioning method provided in an embodiment of the present invention. The subject executing this method may be, but is not limited to, computing devices such as smartphones, personal laptops, personal computers, and servers. The regional positioning method may include the following steps S401 to S404.

[0027] S401. When character movement is detected, obtain the character's position in the 3D game scene.

[0028] S402. Determine the index coordinates of the current grid where the character is located based on the character's position.

[0029] In this embodiment, the character's position is the world coordinate in the 3D game scene. Therefore, based on the character's position and the grid size, the index coordinates of the current grid where the character is located can be determined.

[0030] S403. Based on the index coordinates of the current grid, search the pre-created grid mapping table.

[0031] In this embodiment, the mesh mapping table includes the index coordinates of multiple meshes in the 3D game scene and a list of nested regions. The list of nested regions includes the region identifier of each effect region involved by the corresponding mesh.

[0032] The effect area is a pre-defined area in the 3D game scene (such as a sphere or cube). Different effect areas have different buffs or debuffs, such as increasing health, increasing magic attack, slowing down enemies, or dealing continuous damage.

[0033] S404. If a matching list of target regions is found in the grid mapping table, then the region of each target effect to be applied is determined from the list of target regions based on the character's position.

[0034] In this embodiment, if a list of target regions matching the index coordinates of the current grid is found in the grid mapping table, then the target effect region to be applied needs to be determined from the target region list based on the character's position. If no matching target region list is found in the grid mapping table, then it is determined that the character does not belong to any effect region at all.

[0035] The region positioning method provided by this invention mainly involves managing the effect area corresponding to each grid after the 3D game scene is meshed, through a grid mapping table. This avoids global search and only requires local search within the target area list corresponding to the grid where the character is located, thus improving efficiency.

[0036] The following describes the process of creating a grid mapping table, which may include the following steps S101 to S107.

[0037] S101. Divide the 3D game scene into multiple grids according to the preset size, and obtain the index coordinates of each grid.

[0038] The three-dimensional game scene is divided into multiple grids according to a preset size (e.g., 128m×128m×128m), so that the continuous game space is transformed into a discrete grid with clear boundaries. This also allows us to obtain the index coordinates of each grid, which consists of integer indices in three dimensions, representing the position number of the grid in the X-axis, Y-axis and Z-axis directions, respectively.

[0039] S102. Initialize the mapping table; The mapping table is empty during initialization and serves as a data container for managing the bidirectional mapping relationship between regions and grids.

[0040] S103. Obtain the position information of each of the preset effect areas.

[0041] The location information for each effect area is pre-set and determined by the game designers. This location information typically includes, but is not limited to, the coordinates of the center point of the area, shape parameters (such as the radius of a sphere, the side length of a cube, the height of a cylinder and the radius of its base), and orientation information.

[0042] Optionally, in the planning data, each effect area can also include preset effect information, which may include, but is not limited to, effect type, priority, and effect description. The effect types between any two effect areas can be the same or different. If the priority of two effect areas with the same effect type is the same, they can be applied to the character at the same time. Otherwise, only the effect area with the higher priority can be applied to the character.

[0043] S104. For each effect area, determine all the occupied grids involved based on the location information of the effect area, and obtain the grid list corresponding to the effect area.

[0044] In this embodiment, for each effect area, based on its location information and geometric shape, the actual spatial range it occupies in the 3D game space is determined, and further, it is determined which pre-divided grids this range intersects with or contains, thereby identifying each grid involved. This process can be implemented through spatial geometric algorithms, such as by projecting the effect area boundary onto the grid coordinate system and performing grid traversal or using bounding box cross-detection.

[0045] Next, the index identifiers of each identified occupied grid are combined into an ordered or unordered grid list, forming a data structure unit that describes the spatial distribution characteristics of the area affected.

[0046] S105. Based on each occupied grid corresponding to the total effect area, determine the total effect area corresponding to each occupied grid.

[0047] At the same time, based on each occupied grid corresponding to all effect areas, we reverse-analyze all effect areas associated with each occupied grid, that is, we count which effect areas have coverage areas that include the same grid.

[0048] S106. Combine each effect area corresponding to each occupied grid and its grid list into a nested area list.

[0049] In this embodiment, a nested region list includes each effect region corresponding to an occupied grid and its grid list.

[0050] S107. Iterate through each occupied grid sequentially, and store the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the list of nested regions as a table entry in the mapping table to obtain the grid mapping table. In this embodiment, the grid information may include, but is not limited to, the grid size, the grid center point, and the grid vertex coordinates (three-dimensional coordinates in the game world).

[0051] Specifically, for any occupied grid, the corresponding grid information and nested region list are treated as a grid object. Then, the occupied grid and the grid object as a whole are stored as a table entry in the mapping table. Once all occupied grids have undergone this process, the latest mapping table is the completed grid mapping table.

[0052] This grid mapping table implements a reverse indexing function from the index coordinates of a grid to all effect areas it contains, allowing you to quickly find all effect areas currently within a given grid location. Additionally, the nested region list in this grid mapping table includes a region list for each region, facilitating rapid region deletion.

[0053] Optionally, if a new effect area is planned in the 3D game scene, then the mesh mapping table and the region mapping table need to be updated synchronously. This update process may include the following steps S201~S205.

[0054] S201. Obtain the location information of the newly added effect area.

[0055] S202. Based on the location information of the newly added effect area, determine each occupied grid involved, and obtain the grid list corresponding to the newly added effect area.

[0056] S203. Add the region identifier of the newly added effect area and the index coordinates of each occupied grid as a new table entry to the region mapping table.

[0057] S204. For each occupied grid corresponding to the newly added effect area, if the grid mapping table includes the index coordinates of the occupied grid, then add the effect area and its grid list to the nested area list of the occupied grid.

[0058] S205. For each occupied grid corresponding to the newly added effect area, if the grid mapping table does not include the index coordinates of the occupied grid, a new table entry is added to the grid mapping table. After combining the effect area and its grid list into a new nested area list, the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the new nested area list are stored in the newly added table entry.

[0059] The implementation process of S201~S205 is similar to the process of constructing the grid mapping table described above, and will not be repeated here.

[0060] Optionally, if the game designer needs to delete a certain effect area, then all nested area lists in the grid mapping table that include the effect area to be deleted need to be updated. At this time, the grid mapping table can be quickly updated based on the grid list of the effect area to be deleted. Therefore, the process of deleting the effect area may include the following steps S301~S302.

[0061] S301. When any preset effect area needs to be deleted, obtain the list of associated grids corresponding to the effect area to be deleted. S302. For each grid in the associated grid list, remove the area to be deleted and its associated grid list from the nested area list of the grid in the grid mapping table. If the nested area list of the grid in the grid mapping table becomes empty at this time, remove the table entry containing the grid from the grid mapping table.

[0062] As can be seen from steps S301 to S302, by using the grid list of the effect area to be deleted, each grid in the grid mapping table can be quickly located, avoiding the need to traverse all grids to delete the effect area, realizing fast reverse cleaning of the effect area and improving the game running efficiency.

[0063] In this invention, due to the bidirectional mapping index mechanism between grids and regions in the grid mapping table, on the one hand, it avoids traversing all regions when searching for a region, and on the other hand, it avoids traversing all grids when deleting a region, which greatly reduces CPU resource consumption and ensures smooth game operation.

[0064] For example, in multiplayer online tactical battle royale games, the continuous damage zone or buff aura zone on the map can complete the grid mapping table construction during loading. When a player enters a specific location, they can quickly obtain a list of potentially effective target areas through their grid, and then find the target effect area that needs to take effect from the target area list, without having to compare all area boundaries one by one.

[0065] For example, assuming six effect zones (Zone A to Zone F) are preset, the spatial range can be confirmed to involve a total of seven grids based on the location information of each of the six effect zones. ~ And through the above steps S101~S107, the mesh mapping table shown in Table 1 can be obtained. For ease of viewing, Table 1 does not show the mesh information of each mesh, and it is assumed that the effect information of the six effect areas is as shown in Table 2 below.

[0066] Table 1 Grid Mapping Table

[0067] Table 2 Effect information for each effect area

[0068] In one scenario, based on Tables 1 and 2, if a new effect area, Zone G, is added, and its associated grids are determined based on its location information (O7, r7): ~ That is, the grid list of Zone G. ={ },So: On the one hand, a new entry will be added to Table 2, which includes Zone G and its effect type, priority, and location information; On the other hand, it is necessary to include Table 1 ~ Add Zone G and Zone G to their respective nested region lists. Furthermore, a new entry needs to be added to Table 1, which includes... The index coordinates and only include Zone G and A list of nested regions.

[0069] In another scenario, based on Tables 1 and 2, if it is necessary to delete the effect area Zone E, then the associated grid list corresponding to Zone E can be obtained directly first: ={ }, then next: 1. Directly delete the entire row containing Zone E from Table 2; 2. In Table 1, respectively from... Remove Zone E and its corresponding nested zone from the respective list of zones. After this deletion, in Table 1 The corresponding nested region list will become empty, and then directly... The relevant entry in the table will be deleted directly.

[0070] The examples above are merely illustrations. The grid numbers shown in Table 1 are for ease of understanding only. In reality, the grid mapping table can use only the index coordinates as the unique identifier of the grid. This embodiment of the invention does not limit the form and content of the grid mapping table. Furthermore, the representation of effect type, priority, and position information shown in Table 2 is also for illustrative purposes only. The shape of the effect area is not limited to a sphere; it can also be a cube. This invention does not limit the form in which the position information of the effect area is represented.

[0071] Among the optional implementation methods, in Figure 1 Based on this, please refer to Figure 2In step S404 above, the process of "determining the target effect area to be applied from the target area list based on the character position" may include the following steps a1 to a6.

[0072] Step a1: Create an initially empty temporary list and use the first effect area in the target area list as the undetermined area.

[0073] It's understandable that we need to start from the first type of effect area in the target area list and iterate through each area to see if it is a target effect area to be applied.

[0074] Step a2: Based on the location information of the undetermined area and the character's position, determine whether the character is within the undetermined area.

[0075] In this embodiment, based on the location information of the region to be determined, the three-dimensional spatial range of the region can be determined, and then it can be directly determined whether the character's position is within that three-dimensional spatial range. Wherein: If the judgment structure of step a2 is "yes", then continue to execute the following step a3; If the judgment structure of step a2 is "no" and the region to be determined is not the last type of effect region in the target region list, then continue to execute the following step a5 and return to execute step a2; If the judgment structure of step a2 is "No" and the region to be determined is the last type of effect region in the target region list, then continue to execute the following step a6.

[0076] Step a3: If the character is in the pending area, determine whether the pending area and the effect area in the temporary list are mutually exclusive based on the effect type and priority of the pending area.

[0077] In this embodiment, if the pending region and the effect regions in the temporary list are mutually exclusive, it means that there is already an already traversed effect region in the temporary list with the same effect type as the pending region but a higher priority. Therefore, the current pending region, due to its lower priority, does not need to be activated. That is, whether the pending region and the effect regions in the temporary list are mutually exclusive depends on the following situations: Case 1: If there is no traversed effect region in the temporary list that has the same effect type as the pending region, then it is confirmed that the pending region and the effect regions in the temporary list are not mutually exclusive. Case 2: If there is an already traversed effect region in the temporary list with the same effect type as the pending region and the priority of the pending region is the same as that of the already traversed effect region, then it is confirmed that the pending region and the effect region in the temporary list are not mutually exclusive. Case 3: If there is an already traversed effect region in the temporary list with the same effect type as the pending region and the priority of the pending region is higher than that of the already traversed effect region, then it is confirmed that the pending region and the effect region in the temporary list are not mutually exclusive, and the already traversed region is removed from the temporary list. Case 4: If there is an already traversed effect region in the temporary list with the same effect type as the pending region, and the priority of the pending region is lower than the priority of the already traversed effect region, then the pending region and the effect region in the temporary list are confirmed to be mutually exclusive.

[0078] Step a4: Add the region identifier and effect type of the region to be determined to the temporary list.

[0079] For situations 1 to 3 above, step a4 must be executed.

[0080] Step a5: Select the next effect area from the target area list as the undetermined area.

[0081] Step a6: Use each effect region in the temporary list as the target effect region.

[0082] After traversing the entire target area list, the effect areas retained in the temporary list are the set of effective areas that meet the spatial triggering conditions and do not conflict with each other. Each effect area in the temporary list can then be used as a target effect area. However, if the temporary list is empty, it means that the character's position is not within the spatial range of any effect area in the target area list, and there is no target effect area to be activated.

[0083] This invention is achieved through, as follows Figure 2 The processing logic shown establishes a temporary list with dynamic update capabilities as a temporary storage structure. Combined with a dual mechanism of position matching and mutual exclusion logic, it achieves accurate filtering and reasonable integration in multi-region concurrent scenarios. This approach not only improves the accuracy of region-based decision-making but also avoids the superposition of invalid or conflicting effects, thereby enhancing the overall system's stability and response efficiency.

[0084] For example, referring to Table 1 above, assume that the current grid where the character is located is The corresponding target area list includes four areas to be traversed: Zone A, Zone B, Zone C, and Zone D. The traversal process is as follows: 1. The temporary list (List) is initially empty. For Zone A: Based on the position information of Zone A in Table 2, if it is determined that the character's position is in Zone A, then Zone A and its effect type need to be added to the temporary list List, i.e., List={"Type1": "Zone A"}; 2. For Zone B: Based on the location information of Zone B in Table 2, if the character's location is determined to be in Zone B, since Zone A with the same effect type as Zone B (both are Type 1) already exists in the List, and Zone A has a higher priority, Zone B will not take effect, that is, it will not be added to the temporary list. 3. For Zone C: Based on the location information of Zone C in Table 2, if it is determined that the character's location is not in Zone C, then Zone C will not take effect, that is, it will not be added to the temporary list. 4. For Zone D: Based on the location information of Zone D in Table 2, if it is determined that the character's location is in Zone D, and the temporary list List does not have a region with the same personality type as Zone D, then Zone D and its effect type need to be added to the temporary list List, i.e., List={"Type1": "Zone A", "Type3": "Zone D"}; The final target effect areas were determined to be Zone A and Zone D.

[0085] It should be noted that this example is for illustrative purposes only and is not intended to be limiting.

[0086] In order to perform the corresponding steps in the above method embodiments and various possible implementations, an implementation of a regional positioning device is given below.

[0087] Please see Figure 3 , Figure 3 A schematic diagram of the structure of a regional positioning device provided in an embodiment of the present invention is shown. The regional positioning device 200 includes: a motion sensing module 240, a grid lookup table module 250, and a regional filtering module 260.

[0088] The motion sensing module 240 is used to obtain the character's position in the three-dimensional game scene when the character's movement is sensed; The motion sensing module 240 is also used to determine the index coordinates of the current grid where the character is located based on the character's position; The mesh lookup module 250 is used to look up a pre-created mesh mapping table based on the index coordinates of the current mesh. The mesh mapping table includes the index coordinates of multiple meshes in the 3D game scene and a list of nested regions. The list of nested regions includes the region identifier of each effect region involved by the corresponding mesh. The region filtering module 260 is used to determine the region of each target effect to be applied from the target region list based on the character's position if a matching target region list is found from the grid mapping table.

[0089] Optionally, the area positioning device 200 may further include an area initialization module 210, which can be used to: divide the 3D game scene into multiple grids according to a preset size, and obtain the index coordinates of each grid; initialize a mapping table; obtain the position information of various preset effect areas; for each effect area, determine all the occupied grids involved based on the position information of the effect area, and obtain a grid list corresponding to the effect area; determine all effect areas corresponding to each occupied grid based on the occupied grids covered by all effect areas; nest and combine each effect area corresponding to each occupied grid and its grid list into a nested area list; sequentially traverse each occupied grid, and store the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the nested area list as an entry in the mapping table to obtain a grid mapping table nested area list nested area list.

[0090] Optionally, the area positioning device 200 may further include an area addition module 220, which can be used to: obtain the location information of the newly added effect area; determine each occupied grid involved in the newly added effect area based on the location information of the newly added effect area, and obtain a grid list corresponding to the newly added effect area; for each occupied grid corresponding to the newly added effect area, if the grid mapping table includes the index coordinates of the occupied grid, then add the effect area and its grid list to the nested area list of the occupied grid; if the grid mapping table does not include the index coordinates of the occupied grid, then add a new entry to the grid mapping table, and after combining the effect area and its grid list into a new nested area list, store the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the new nested area list into the new entry.

[0091] Optionally, the area positioning device 200 may further include an area deletion module 230, which can be used to: when any preset effect area needs to be deleted, obtain the associated grid list corresponding to the effect area to be deleted; for each grid in the associated grid list, remove the effect area to be deleted and its associated grid list from the nested area list of the grid in the grid mapping table; if the nested area list of the grid in the grid mapping table is empty, remove the table entry where the grid is located from the grid mapping table.

[0092] Optionally, the region filtering module 260 can be used specifically for: Create an initially empty temporary list and use the first effect area in the target area list as the pending area; based on the position information of the pending area and the character's position, determine whether the character is within the pending area; If the character is in the pending area, then based on the effect type and priority of the pending area, it is determined whether the pending area and the effect areas in the temporary list are mutually exclusive; if they are not mutually exclusive, then the area identifier and effect type of the pending area are added to the temporary list. If the character is not in the pending area or the pending area is mutually exclusive with the effect area in the temporary list, then the next effect area in the target area list is taken as the pending area, and the process of determining whether the character is in the pending area based on the position information of the pending area and the character's position is repeated until the last effect area in the target area list is traversed. Then, each effect area in the temporary list is taken as the target effect area.

[0093] Optionally, the region filtering module 260 can also be used for: If there is no traversed effect region in the temporary list that has the same effect type as the pending region, then it is confirmed that the pending region and the effect regions in the temporary list are not mutually exclusive. If there is an already traversed effect region in the temporary list with the same effect type as the pending region and the priority of the pending region is the same as the priority of the already traversed effect region, then it is confirmed that the pending region and the effect regions in the temporary list are not mutually exclusive. If there is an already traversed effect region in the temporary list with the same effect type as the pending region and the priority of the pending region is higher than the priority of the already traversed effect region, then it is confirmed that the pending region and the effect region in the temporary list are not mutually exclusive, and the already traversed region is removed from the temporary list. If there is an already traversed effect region in the temporary list with the same effect type as the pending region, and the priority of the pending region is lower than the priority of the already traversed effect region, then the pending region and the effect region in the temporary list are confirmed to be mutually exclusive.

[0094] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the area positioning device 200 described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0095] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 300 includes a processor 310, a memory 320, and a bus 330, with the processor 310 connected to the memory 320 via the bus 330.

[0096] The memory 320 can be used to store software programs or firmware, for example, the software program or firmware corresponding to the aforementioned area positioning device 200. The processor 310 executes various functional applications and data processing by running the software program stored in the memory 320 to implement the area positioning method provided in the embodiments of the present invention.

[0097] The memory 320 may be, but is not limited to, RAM (Random Access Memory), ROM (Read Only Memory), FLASH (Flash Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.

[0098] The processor 310 can be an integrated circuit chip with signal processing capabilities, capable of executing software programs, such as the software program corresponding to the aforementioned area positioning device 200. The processor 310 can be a general-purpose processor, including: CPU (Central Processing Unit), NP (Network Processor), SoC (System on Chip), etc.; it can also be: DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0099] Understandable. Figure 4 The structure shown is for illustrative purposes only; the electronic device 300 may also include components that are more advanced than those shown. Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown. Figure 4 The components shown can be implemented using hardware, software, or a combination thereof.

[0100] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the region positioning method disclosed in the above embodiments. The computer-readable storage medium can be, but is not limited to, various media capable of storing program code, such as a USB flash drive, portable hard drive, ROM, RAM, PROM, EPROM, EEPROM, FLASH disk, or optical disk.

[0101] This invention also provides a program product that, when executed by a processor, implements the area positioning method disclosed in the above embodiments.

[0102] In summary, this invention provides a region positioning method, device, electronic device, storage medium, and program product. The method involves: when character movement is detected, obtaining the character's position in a 3D game scene; then determining the index coordinates of the current grid where the character is located based on the character's position; next, searching a pre-created grid mapping table based on the index coordinates of the current grid; the grid mapping table includes the index coordinates of multiple grids in the 3D game scene and a nested region list, the nested region list including the region identifier of each effect region involved in the corresponding grid; if a matching target region list is found in the grid mapping table, finally, determining each target effect region to be applied from the target region list based on the character's position. This invention only requires filtering the target effect regions to be applied from each effect region in the target region list corresponding to the current grid, improving region determination efficiency, reducing CPU resource consumption, and ensuring smooth game operation.

[0103] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for locating a region, characterized in that, include: When character movement is detected, the character's position in the 3D game scene is obtained; The index coordinates of the current grid where the character is located are determined based on the character's position; Based on the index coordinates of the current grid, a pre-created grid mapping table is searched; the grid mapping table includes the index coordinates of multiple grids in the 3D game scene and a list of nested regions, and the list of nested regions includes the region identifier of each effect region involved by the corresponding grid; If a matching list of target regions is found in the grid mapping table, an initially empty temporary list is created, and the first effect region in the target region list is taken as the region to be determined. Based on the location information of the undetermined area and the character's location, determine whether the character is within the undetermined area; If the character is within the pending area, then based on the effect type and priority of the pending area, it is determined whether the pending area and the effect area in the temporary list are mutually exclusive. If they are not mutually exclusive, then the region identifier and effect type of the region to be determined are added to the temporary list; If the character is not within the pending area or the pending area is mutually exclusive with the effect areas in the temporary list, then the next effect area in the target area list is taken as the pending area, and the process of determining whether the character is within the pending area based on the position information of the pending area and the character's position is repeated until the last effect area in the target area list is traversed. Then, each effect area in the temporary list is taken as the target effect area to be activated.

2. The area positioning method according to claim 1, characterized in that, The step of determining whether the undetermined region and the effect regions in the temporary list are mutually exclusive based on the effect type and priority of the undetermined region includes: If there is no traversed effect region in the temporary list that has the same effect type as the undetermined region, then it is confirmed that the undetermined region and the effect regions in the temporary list are not mutually exclusive. If the temporary list contains an already traversed effect region with the same effect type as the undetermined region and the priority of the undetermined region is the same as the priority of the already traversed effect region, then it is confirmed that the undetermined region and the effect regions in the temporary list are not mutually exclusive. If there is an already traversed effect region in the temporary list that has the same effect type as the undetermined region and the priority of the undetermined region is greater than the priority of the already traversed effect region, then it is confirmed that the undetermined region and the effect regions in the temporary list are not mutually exclusive, and the already traversed region is removed from the temporary list. If the temporary list contains an already traversed effect region with the same effect type as the undetermined region, and the priority of the undetermined region is lower than the priority of the already traversed effect region, then the undetermined region and the effect regions in the temporary list are confirmed to be mutually exclusive.

3. The area positioning method according to claim 1, characterized in that, The method further includes: When any of the preset effect areas needs to be deleted, obtain the list of associated grids corresponding to the effect area to be deleted; For each grid in the associated grid list, remove the area to be deleted and its associated grid list from the nested area list of that grid in the grid mapping table; If the nested region list of the grid in the grid mapping table is empty, then the table entry containing the grid is removed from the grid mapping table.

4. The area positioning method according to claim 3, characterized in that, The grid mapping table is created in the following way: The 3D game scene is divided into multiple grids according to a preset size, and the index coordinates of each grid are obtained; Initialize the mapping table; Obtain the position information of each of the preset effect areas; For each effect region, based on the location information of the effect region, determine all the occupied grids involved to obtain the grid list corresponding to the effect region; Based on each occupied grid covered by all the aforementioned effect areas, determine the total effect area corresponding to each occupied grid. Each effect region corresponding to each occupied grid and its grid list are nested and combined into a nested region list; Each occupied grid is traversed sequentially, and the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the list of nested regions are stored as a table entry in the mapping table to obtain the grid mapping table.

5. The area positioning method according to claim 4, characterized in that, The method further includes: Get the location information of the newly added effect area; Based on the location information of the newly added effect area, determine each occupied grid involved to obtain a grid list corresponding to the newly added effect area; For each occupied grid corresponding to the newly added effect area, if the grid mapping table includes the index coordinates of the occupied grid, then the effect area and its grid list are added to the nested area list of the occupied grid. If the grid mapping table does not include the index coordinates of the occupied grid, a new entry is added to the grid mapping table. After combining the effect area and its grid list into a new nested area list, the index coordinates of the occupied grid, the grid information corresponding to the occupied grid, and the new nested area list are stored in the newly added entry.

6. A regional positioning device, characterized in that, include: The motion sensing module is used to obtain the character's position in the 3D game scene when the character's movement is sensed; The motion sensing module is also used to determine the index coordinates of the current grid where the character is located based on the character's position; The grid lookup module is used to look up a pre-created grid mapping table based on the index coordinates of the current grid. The grid mapping table includes the index coordinates of multiple grids in the 3D game scene and a list of nested regions. The list of nested regions includes the region identifier of each effect region involved by the corresponding grid. The region filtering module is used for: If a matching list of target regions is found in the grid mapping table, an initially empty temporary list is created, and the first effect region in the target region list is taken as the region to be determined. Based on the location information of the undetermined area and the character's location, determine whether the character is within the undetermined area; If the character is within the pending area, then based on the effect type and priority of the pending area, it is determined whether the pending area and the effect area in the temporary list are mutually exclusive. If they are not mutually exclusive, then the region identifier and effect type of the region to be determined are added to the temporary list; If the character is not within the pending area or the pending area is mutually exclusive with the effect areas in the temporary list, then the next effect area in the target area list is taken as the pending area, and the process of determining whether the character is within the pending area based on the position information of the pending area and the character's position is repeated until the last effect area in the target area list is traversed. Then, each effect area in the temporary list is taken as the target effect area to be activated.

7. An electronic device, characterized in that, include: The electronic device includes a memory and a processor, wherein the memory stores a software program, and the processor executes the software program to implement the area positioning method as described in any one of claims 1-5 when the electronic device is running.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the area positioning method according to any one of claims 1-5.

9. A program product, characterized in that, When the program product is executed by the processor, it implements the area positioning method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Special effect display method and device, electronic equipment and storage medium

    CN117797470A