Map picture display method, database generation method, device and equipment
By generating an offline database to store the visual information of the virtual map and performing ray detection, the problem of frequent fog changes caused by frequent changes in the position of virtual characters was solved, achieving an efficient fog display effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU BULLET FINGER UNIVERSE TECH CO LTD
- Filing Date
- 2022-12-05
- Publication Date
- 2026-05-12
AI Technical Summary
In games, how to quickly display fog effects, especially when the virtual character's position changes frequently and the fog also changes frequently, is a challenge that current technology struggles to handle efficiently.
By generating an offline database, multiple locations on the virtual map and their corresponding visual information are stored. Based on the location of the virtual object and the offline database, the target visual information is determined, fog maps are generated and the map is updated. Ray detection and obstacle information are used to optimize the fog rendering process.
It improves the efficiency of fog map generation and fog display in the map, enabling quick identification and rendering of fog areas, thus enhancing the visual quality of the game.
Smart Images

Figure CN115721935B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of Internet technology, and in particular to a method for displaying map images, a method for generating databases, an apparatus, and a device. Background Technology
[0002] With the rapid development of the gaming industry, more and more game genres are adopting fog of war. In the gaming field, fog of war refers to a game mechanic where, after a player enters the game, their controlled virtual character has their own field of vision within a map. This map contains numerous obstacles, and the virtual character cannot see areas obscured by these obstacles. Because the virtual character's position on the map changes frequently, and different positions may correspond to different obstacles, the fog of war corresponding to the virtual character also changes frequently. Therefore, how to quickly implement fog of war is an important task in displaying the map. Summary of the Invention
[0003] This disclosure provides a method for displaying map images, a database generation method, an apparatus, and a device. This method improves the efficiency of displaying fog in map images. The technical solution of this disclosure is as follows:
[0004] According to a first aspect of the present disclosure, a method for displaying a map screen is provided, the method comprising:
[0005] Display a target map screen, in which virtual objects are displayed, and the target map screen is a view of a local area of the virtual map;
[0006] Based on the target location of the virtual object in the target map screen and the offline database of the virtual map, the target visual information corresponding to the target location is determined. The offline database stores multiple locations on the virtual map and the visual information corresponding to each of the multiple locations. The visual information corresponding to each location is used to indicate the visible area and the invisible area corresponding to the location.
[0007] Based on the target visibility information, a fog map corresponding to the target map is generated, and the invisible areas in the target visibility information are rendered with shadows in the fog map;
[0008] The target map is updated based on the fog map.
[0009] According to a second aspect of the present disclosure, a database generation method is provided, the method comprising:
[0010] Ray detection is performed on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map;
[0011] For each of the multiple locations on the virtual map, a preset ray height for emitting a ray from that location is determined based on the height of that location and a preset field of view height.
[0012] Based on the preset ray height, ray detection is performed within a preset area corresponding to the position to obtain obstacles within the preset area, wherein the preset area is determined based on the position and a preset field of view radius;
[0013] Based on the obstacles within the preset area, an invisible area within the preset area is determined, and the remaining area within the preset area excluding the invisible area is taken as the visible area.
[0014] Based on the visible and invisible areas within the preset area, the visual information corresponding to the location is obtained;
[0015] Based on multiple locations on the virtual map and the visual information corresponding to each location, an offline database is obtained. The offline database is used to perform fog rendering on the map screen when displaying the map screen, where the map screen is a partial area of the virtual map.
[0016] According to a third aspect of the present disclosure, a map display device is provided, the device comprising:
[0017] The display unit is configured to display a target map screen, in which virtual objects are displayed, and the target map screen is a view of a local area of the virtual map;
[0018] The determining unit is configured to determine the target visual information corresponding to the target location based on the target location of the virtual object in the target map screen and the offline database of the virtual map. The offline database stores multiple locations on the virtual map and the visual information corresponding to the multiple locations respectively. The visual information corresponding to each location is used to indicate the visible area and the invisible area corresponding to the location.
[0019] The generation unit is configured to generate a fog map corresponding to the target map image based on the target visibility information, wherein the invisible areas in the target visibility information are rendered with shadows in the fog map;
[0020] The update unit is configured to update the target map screen based on the fog map.
[0021] In some embodiments, the determining unit is configured to: when the obstacle information of the virtual map is not stored in the offline database, determine the target visual information corresponding to the target location from the visual information corresponding to the plurality of locations based on the target location, wherein the obstacle information is stored when the complexity of the obstacles in the virtual map is higher than a preset complexity, and the obstacle information includes dynamic obstacle information of multiple locations on the virtual map, wherein the dynamic obstacle information of each location is used to indicate whether there are dynamic obstacles at the location; when the obstacle information is stored in the offline database, determine the target area corresponding to the target location based on the target location and a preset field of view radius, determine the obstacle presence information of the target area based on the dynamic obstacle information of multiple locations located within the target area in the obstacle information, and determine the target visual information corresponding to the target location based on the target location, the obstacle presence information and the offline database, wherein the obstacle presence information is used to indicate whether there are dynamic obstacles in the target area and the number of dynamic obstacles present.
[0022] In some embodiments, the determining unit is configured to: when it is determined based on the obstacle presence information that there are no dynamic obstacles in the target area, determine target visual information corresponding to the target position from the visual information corresponding to the plurality of positions respectively, based on the target position; when it is determined based on the obstacle presence information that there are dynamic obstacles in the target area and the number of obstacles is less than a preset number, determine target visual information corresponding to the target position from the visual information corresponding to the plurality of positions respectively, based on the target position; and when it is determined based on the obstacle presence information that there are dynamic obstacles in the target area and the number of obstacles is greater than or equal to a preset number, perform ray detection on the target position to obtain target visual information corresponding to the target position.
[0023] In some embodiments, each dynamic obstacle corresponds to multiple occlusion states. The determining unit is configured to: determine multiple visual information corresponding to the target location from multiple visual information corresponding to the multiple locations, wherein the multiple visual information corresponding to the target location corresponds to multiple occlusion states of dynamic obstacles in the target area; and determine target visual information corresponding to the target occlusion state from the multiple visual information corresponding to the target location based on the target occlusion state of the dynamic obstacles in the target area in the target map image.
[0024] In some embodiments, the obstacle information further includes the heights of multiple locations on the virtual map. The determining unit is configured to: determine the target height of the target location based on the obstacle information; determine the target ray height based on the target height and a preset field of view height; perform ray detection in the target area based on the target ray height to obtain obstacles in the target area; determine the invisible area in the target area based on the obstacles in the target area, and take the remaining area in the target area excluding the invisible area as the visible area.
[0025] In some embodiments, the updating unit is configured to: determine the scene type of the virtual map based on the ground parameters of the virtual map, wherein the ground parameters are used to reflect the degree of change in ground height of the virtual map; and render the target map image based on the scene type and the fog map to update the target map image.
[0026] In some embodiments, the updating unit is configured to: when the scene type is a first type, perform world space rendering on the target map based on the fog map to update the target map; when the scene type is a second type, perform screen space rendering on the target map based on the fog map to update the target map, wherein the ground height change of the virtual map of the first type is less than the ground height change of the virtual map of the second type.
[0027] According to a fourth aspect of the present disclosure, a database generation apparatus is provided, the apparatus comprising:
[0028] The height detection unit is configured to perform ray detection on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map;
[0029] The height determination unit is configured to determine a preset ray height for a ray emitted from a location based on the height of the location and a preset field of view height for each of a plurality of locations on the virtual map.
[0030] An obstacle detection unit is configured to perform ray detection within a preset area corresponding to the position based on the preset ray height, thereby obtaining obstacles within the preset area, wherein the preset area is determined based on the position and a preset field of view radius;
[0031] The region determination unit is configured to determine the invisible region within the preset region based on obstacles within the preset region, and to take the region remaining in the preset region excluding the invisible region as the visible region.
[0032] The visual information determination unit is configured to obtain the visual information corresponding to the location based on the visible and invisible areas within the preset area;
[0033] The database determination unit is configured to obtain the offline database based on multiple locations on the virtual map and the visual information corresponding to each of the multiple locations on the virtual map. The offline database is used to perform fog rendering on the map screen when displaying the map screen, where the map screen is a view of a local area of the virtual map.
[0034] In some embodiments, both the visible and invisible areas within the preset area include multiple locations. The visual information determining unit is configured to: determine a bit array corresponding to the location, wherein multiple element positions in the bit array match multiple locations within the preset area corresponding to the location; mark a first element position in the bit array as a first identifier, and mark a second element position in the bit array as a second identifier to obtain a target bit array corresponding to the location, wherein the first element position corresponds to multiple locations within the visible area of the preset area, and the second element position corresponds to multiple locations within the invisible area of the preset area, wherein the first identifier is used to indicate the visible area, and the second identifier is used to indicate the invisible area; and use the target bit array corresponding to the location as the visual information corresponding to the location.
[0035] In some embodiments, the database determining unit is configured to: when the complexity of obstacles in the virtual map is higher than a preset complexity, for each of multiple locations on the virtual map, generate sub-obstacle information corresponding to the location based on the static obstacle information, dynamic obstacle information, and height of the location, wherein the static obstacle information is used to indicate whether there are static obstacles at the location, and the dynamic obstacle information is used to indicate whether there are dynamic obstacles at the location; generate obstacle information for the virtual map based on the multiple locations on the virtual map and the sub-obstacle information corresponding to the multiple locations on the virtual map respectively; and obtain the offline database based on the multiple locations on the virtual map, the visual information corresponding to the multiple locations on the virtual map respectively, and the obstacle information.
[0036] According to a sixth aspect of the present disclosure, an electronic device is provided, the electronic device comprising:
[0037] One or more processors;
[0038] Memory used to store the executable program code of the processor;
[0039] The processor is configured to execute the program code to implement the above-mentioned map display method or database generation method.
[0040] According to a seventh aspect of the present disclosure, a computer-readable storage medium is provided, which, when the program code in the computer-readable storage medium is executed by a processor of an electronic device, enables the electronic device to perform the map display method or the database generation method described above.
[0041] According to an eighth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described method for displaying map images or the method for generating databases.
[0042] This disclosure provides a method for displaying a map. The method uses an offline database to store multiple locations on a virtual map and their corresponding visual information. Based on the target location of a virtual object in the target map, the visual information corresponding to that target location can be quickly determined from the offline database. Furthermore, a fog map is generated based on the target visual information, thus improving the generation efficiency of the fog map and consequently increasing the efficiency of updating the target map based on the fog map. In other words, this method improves the efficiency of displaying fog in the map.
[0043] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0044] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0045] Figure 1 This is a schematic diagram illustrating an implementation environment according to an exemplary embodiment.
[0046] Figure 2 This is a flowchart illustrating a database generation method according to an exemplary embodiment.
[0047] Figure 3 This is a flowchart illustrating another database generation method according to an exemplary embodiment.
[0048] Figure 4 This is a schematic diagram of a virtual map according to an exemplary embodiment.
[0049] Figure 5 This is a schematic diagram of a bit array according to an exemplary embodiment.
[0050] Figure 6 This is a flowchart illustrating a method for displaying a map screen according to an exemplary embodiment.
[0051] Figure 7 This is a flowchart illustrating another method for displaying a map screen according to an exemplary embodiment.
[0052] Figure 8 This is a flowchart illustrating another method for displaying a map screen according to an exemplary embodiment.
[0053] Figure 9 This is a block diagram illustrating a map display device according to an exemplary embodiment.
[0054] Figure 10 This is a block diagram illustrating a database generation apparatus according to an exemplary embodiment.
[0055] Figure 11 This is a block diagram illustrating a terminal according to an exemplary embodiment.
[0056] Figure 12 This is a block diagram illustrating a server according to an exemplary embodiment. Detailed Implementation
[0057] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0058] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0059] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the virtual maps involved in this application were obtained with full authorization.
[0060] Figure 1 This is a schematic diagram of an implementation environment provided in this embodiment of the disclosure. See also: Figure 1The implementation environment includes a terminal 101 and a server 102. In this embodiment, the server 102 is the backend server of the terminal 101. The server 102 is used to generate an offline database and send it to the terminal 101. The terminal 101 is used to store the offline database so that when displaying the map screen, it can perform fog rendering on the map screen based on the offline database.
[0061] Terminal 101 can be at least one of the following devices: smartphone, smartwatch, desktop computer, laptop, virtual reality terminal, augmented reality terminal, wireless terminal, and laptop computer. Terminal 101 has communication capabilities and can access wired or wireless networks. Terminal 101 can refer to one of multiple terminals; those skilled in the art will understand that the number of terminals can be more or less. Server 102 can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed file system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some embodiments, server 102 and terminal 101 are directly or indirectly connected via wired or wireless communication; this disclosure does not limit this. Optionally, the number of servers 102 can be more or less; this disclosure does not limit this. Of course, server 102 can also include other functional servers to provide more comprehensive and diversified services. In this embodiment, server 102 undertakes the main computing work and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work and terminal 101 undertakes the main computing work; or, server 102 or terminal 101 can each undertake computing work independently, and this embodiment does not limit this.
[0062] The fog rendering method for map images disclosed herein requires implementation based on an offline database. The following is based on... Figure 2 This section explains how offline databases are generated. Figure 2 This is a flowchart illustrating a database generation method according to an exemplary embodiment, such as... Figure 2 As shown, this method is executed by the server and includes the following steps:
[0063] In step S201, the server performs ray detection on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map.
[0064] In this embodiment of the disclosure, the virtual map can be a virtual map in games such as RTS (Real-Time Strategy Game) and MOBA (Multiplayer Online Battle Arena), and the virtual map displays virtual objects, which can be game characters in the game.
[0065] In this embodiment of the disclosure, the virtual map has varying terrain elevations, meaning different locations on the virtual map can have different heights. In this embodiment, this height can be relative to a reference ground level, where the height of the reference ground level is 0.
[0066] In this embodiment of the disclosure, obstacles are displayed on the virtual map, and virtual objects cannot see areas obscured by these obstacles. When there is an obstacle at a certain location, the height of that location is the height of the obstacle; when there is no obstacle at a certain location, the height of that location is the height of the ground.
[0067] In step S202, for each of the multiple locations on the virtual map, the server determines the preset ray height for emitting a ray at that location based on the location's height and a preset field of view height.
[0068] In this embodiment of the disclosure, the preset field of view height is the same for different positions. The preset ray height is obtained based on the height of the position and the preset field of view height, so that positions at different heights can have different preset ray heights.
[0069] In step S203, the server performs ray detection within a preset area corresponding to the preset ray height to obtain obstacles within the preset area. The preset area is determined based on the position and a preset field of view radius.
[0070] In this embodiment of the disclosure, the preset area corresponding to each position is the area obtained by drawing a circle with that position as the center and a preset field of view radius as the radius.
[0071] In step S204, the server determines the invisible area within the preset area based on the obstacles within the preset area, and takes the remaining area within the preset area excluding the invisible area as the visible area.
[0072] In this embodiment of the disclosure, the server designates the area obscured by obstacles within a preset area as the invisible area.
[0073] In step S205, the server obtains the visual information corresponding to the location based on the visible and invisible areas within the preset area.
[0074] In this embodiment of the disclosure, the visual information corresponding to each location is used to indicate the visible and invisible areas corresponding to that location.
[0075] In step S206, the server obtains an offline database based on multiple locations on the virtual map and the visual information corresponding to each location. This offline database is used to perform fog rendering on the map screen when displaying the map screen, which is a view of a local area of the virtual map.
[0076] In this embodiment, each location and its corresponding visual information are stored in an offline database. Therefore, when displaying a map, the visual information corresponding to the virtual object's location on the map and the offline database can be used to determine the location. Fog rendering is then applied to the map based on this visual information. Fog rendering refers to generating fog in the map, so that invisible areas of the map are rendered with shadows.
[0077] This disclosure provides a database generation method. The method performs ray detection on each of multiple locations on a virtual map to obtain visual information corresponding to each location. Based on this visual information, an offline database is generated. When displaying the map, the visual information corresponding to a specific location can be quickly determined based on this offline database. Fog rendering of the map is then implemented based on this visual information, thereby improving the efficiency of fog rendering for the map.
[0078] In some embodiments, both the visible and invisible regions within a preset area include multiple locations. Based on the visible and invisible regions within the preset area, visual information corresponding to a location is obtained, including: determining a bit array corresponding to a location, wherein multiple element positions in the bit array match multiple locations within the preset area corresponding to the location; marking the first element position in the bit array as a first identifier and marking the second element position in the bit array as a second identifier to obtain a target bit array corresponding to the location, wherein the first element position corresponds to multiple locations within the visible region of the preset area, and the second element position corresponds to multiple locations within the invisible region of the preset area, wherein the first identifier is used to indicate the visible region, and the second identifier is used to indicate the invisible region; and using the target bit array corresponding to the location as the visual information corresponding to the location.
[0079] In this embodiment of the disclosure, a more compact data storage method is achieved based on the bit array, thereby reducing the storage resources occupied by visual information.
[0080] In some embodiments, an offline database is obtained based on multiple locations on a virtual map and the visual information corresponding to each of the multiple locations on the virtual map, including: when the complexity of obstacles in the virtual map is higher than a preset complexity, for each of the multiple locations on the virtual map, generating sub-obstacle information corresponding to the location based on the static obstacle information, dynamic obstacle information, and height of the location, wherein the static obstacle information is used to indicate whether there are static obstacles at the location, and the dynamic obstacle information is used to indicate whether there are dynamic obstacles at the location; generating obstacle information of the virtual map based on the multiple locations on the virtual map and the sub-obstacle information corresponding to each of the multiple locations on the virtual map; and obtaining the offline database based on the multiple locations on the virtual map, the visual information corresponding to each of the multiple locations on the virtual map, and the obstacle information.
[0081] In this embodiment of the disclosure, obstacle information is generated and stored in an offline database. Thus, when the complexity of obstacles in the virtual map is high, the existence of dynamic obstacles can be determined based on the obstacle information. Furthermore, based on the existence, the method of determining visual information can be flexibly selected.
[0082] The above Figure 2 This is the basic process for generating a database, and the following is based on... Figure 3 The database generation process will be further explained. See [link / reference] Figure 3 , Figure 3 This is a flowchart illustrating a database generation method according to an exemplary embodiment. The method is executed by a server and includes the following steps:
[0083] In step S301, the server performs ray detection on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map.
[0084] In this embodiment of the disclosure, to facilitate the determination of multiple locations on the virtual map, the server divides the virtual map into a grid, obtaining m*n cells, where m and n are both integers greater than 1. The positions of these multiple cells represent multiple locations on the virtual map; that is, one cell corresponds to one location. The positions of these multiple cells can be obtained based on the coordinate system corresponding to the virtual map. The virtual map is set to be parallel to the xz plane of the coordinate system, with the positive direction of the y-axis above the virtual map. For example, see... Figure 4 , Figure 4 This is a schematic diagram of a virtual map according to an exemplary embodiment.
[0085] In this embodiment of the disclosure, the server performs downward ray detection on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map.
[0086] In step S302, for each of the multiple locations on the virtual map, the server determines the preset ray height for emitting a ray at that location based on the location's height and the preset field of view height.
[0087] In this embodiment, the preset field of view height can be the height of the virtual object. For each position, the sum of the height of that position and the preset field of view height is used as the preset ray height. This allows the virtual object to have different field of view heights at different heights, improving the rationality and accuracy of determining the preset ray height.
[0088] In step S303, the server performs ray detection within a preset area corresponding to the preset ray height to obtain obstacles within the preset area. The preset area is determined based on the position and a preset field of view radius.
[0089] In this embodiment, ray detection involves emitting a ray parallel to the xz plane into a preset area, centered at the given location. The location where the ray hits is then determined as the location of an obstacle, thus identifying the obstacles within the preset area. The ray's height is a preset ray height, and its maximum length is a preset field-of-view radius.
[0090] In step S304, the server determines the invisible area within the preset area based on the obstacles within the preset area, and takes the remaining area within the preset area excluding the invisible area as the visible area.
[0091] In this embodiment, the server treats the area obscured by obstacles as a non-visible area. Obstacles include static obstacles and dynamic obstacles. Static obstacles are those whose obscuration state remains unchanged, such as rocks or mountains. Dynamic obstacles are those whose obscuration state changes; the area obscured by a dynamic obstacle varies depending on its obscuration state. A door that can be opened and closed is a dynamic obstacle; the door corresponds to different obscuration states when it is open and closed, and the obscured area also differs.
[0092] In step S305, the server determines the bit array corresponding to the position, and the positions of multiple elements in the bit array match multiple positions within the preset area corresponding to the position.
[0093] In this embodiment of the disclosure, the positions of multiple elements in the bit array match multiple positions within a preset region corresponding to those positions. Accordingly, the number of multiple element positions in the bit array is not less than the number of multiple positions within the preset region. If the preset field of view radius r is represented by the number of grids, then r represents r grids, where r is an integer greater than 1. Accordingly, the size of the bit array can be (2r+1)*(2r+1).
[0094] For example, see Figure 5 , Figure 5 This is a schematic diagram of a bit array according to an exemplary embodiment. The position of the bit array has an abscissa of 78, an ordinate of 46, and a height of 24. After coordinate transformation based on the abscissa and ordinate, a one-dimensional value of 5966 representing the position can be obtained.
[0095] In step S306, the server marks the position of the first element in the bit array as a first identifier and the position of the second element in the bit array as a second identifier to obtain the target bit array corresponding to the position. The target bit array corresponding to the position is used as the visible information corresponding to the position. The first element position corresponds to multiple positions in the visible area within the preset area, and the second element position corresponds to multiple positions in the invisible area within the preset area. The first identifier is used to indicate the visible area, and the second identifier is used to indicate the invisible area.
[0096] In this embodiment of the disclosure, the first identifier and the second identifier can be determined based on binary numbers, such as the first identifier being 0 and the second identifier being 1. For example, see below. Figure 5 In this bit array, light-colored cells correspond to the visible area, which is marked as 0, and dark-colored cells correspond to the invisible area, which is marked as 1.
[0097] In this embodiment of the disclosure, through the above steps S305-S306, the process of obtaining the visual information corresponding to the location based on the visible and invisible areas within the preset area is realized. In this way, a relatively compact data storage method is realized based on the bit array, thereby reducing the storage resources occupied by the visual information.
[0098] In step S307, the server obtains an offline database based on multiple locations on the virtual map and the visual information corresponding to each location. This offline database is used to perform fog rendering on the map screen when displaying the map screen, which is a partial area of the virtual map.
[0099] In this embodiment, the server stores visual information in an offline database as a visual information array. Accordingly, the server determines the visual information array corresponding to the virtual map. The size of this visual information array matches the size of the virtual map; that is, if the number of locations on the virtual map is m*n, then the size of the visual information array is also m*n. Multiple element positions within the visual information array correspond one-to-one with multiple locations on the virtual map, and each element position stores the visual information corresponding to its location on the virtual map. This method stores visual information based on a visual information array, further improving the correspondence and regularity of the stored visual information. Furthermore, by using this visual information array to search for visual information, search efficiency can be improved.
[0100] In this embodiment of the disclosure, when the complexity of obstacles in the virtual map is higher than a preset complexity, obstacle information for the virtual map is also generated and stored in an offline database. Accordingly, the process by which the server obtains the offline database includes the following steps: When the complexity of obstacles in the virtual map is higher than a preset complexity, for each of multiple locations on the virtual map, based on the static obstacle information, dynamic obstacle information, and height of that location, the server generates sub-obstacle information corresponding to that location. The static obstacle information indicates whether a static obstacle exists at that location, and the dynamic obstacle information indicates whether a dynamic obstacle exists at that location. The server generates obstacle information for the virtual map based on the multiple locations on the virtual map and the sub-obstacle information corresponding to each of the multiple locations on the virtual map. The server obtains the offline database based on the multiple locations on the virtual map, the visual information corresponding to each of the multiple locations on the virtual map, and the obstacle information.
[0101] In this embodiment of the disclosure, since obstacle information is generated and stored in an offline database, the existence of dynamic obstacles can be determined based on the obstacle information when the complexity of obstacles in the virtual map is high; furthermore, the method of determining visual information can be flexibly selected based on the existence of obstacles.
[0102] In this embodiment, the complexity of obstacles in the virtual map is positively correlated with the number of dynamic obstacles present on the virtual map; the more dynamic obstacles there are, the higher the complexity. The preset complexity can be set and changed as needed. In this embodiment, the example of a preset complexity corresponding to 0 dynamic obstacles is used; that is, if dynamic obstacles exist on the virtual map, the complexity of the obstacles in the virtual map is determined to be higher than the preset complexity.
[0103] In this embodiment of the disclosure, the static obstacle information at each location is further used to indicate the attribute information of the static obstacle present at that location when a static obstacle exists there; the dynamic obstacle information at each location is further used to indicate the attribute information of the dynamic obstacle present at that location when a dynamic obstacle exists there. The attribute information of any obstacle includes the name, category, etc. of the obstacle.
[0104] In this embodiment, obstacle information of the virtual map is recorded in the color channels of an obstacle map. The R, G, and B (Red, Green, Blue) color channels of the obstacle map are used to record static obstacle information, dynamic obstacle information, and height, respectively. Each pixel of the obstacle map corresponds to multiple locations on the virtual map, and the three color channels of each pixel record the static obstacle information, dynamic obstacle information, and height of its corresponding location on the virtual map.
[0105] It's important to note that, to improve the flexibility of obstacle setting, not all objects in the virtual map are designated as obstacles. Instead, the system pre-defines which objects are obstacles and which are not, based on specific needs. For example, grass can be designated as an obstacle, while walls can be designated as non-obstacles. Furthermore, it allows for the designation of static and dynamic obstacles, as well as the marking of obstacles based on their identifiers. This facilitates the acquisition of static and dynamic obstacle information for each location.
[0106] In this embodiment, when dynamic obstacles exist on the virtual map, since each dynamic obstacle corresponds to multiple occlusion states, for each location within a preset area, if a dynamic obstacle exists within that area, the visual information corresponding to that location is multiple, and these multiple visual information pieces correspond to the multiple occlusion states of the dynamic obstacles within the preset area. It should be noted that if there are too many dynamic obstacles within the preset area, the occlusion states of these multiple dynamic obstacles will intersect and combine, and determining the visual information based on the multiple occlusion states corresponding to each dynamic obstacle will increase the complexity of determining the visual information. Therefore, in this embodiment, multiple visual information corresponding to a location is determined based on the multiple occlusion states of the dynamic obstacles only when the number of dynamic obstacles within the preset area is less than a preset number. In this embodiment, a preset number of 2 is used as an example for explanation.
[0107] This disclosure provides a database generation method. The method performs ray detection on each of multiple locations on a virtual map to obtain visual information corresponding to each location. Based on this visual information, an offline database is generated. When displaying the map, the visual information corresponding to a specific location can be quickly determined based on this offline database. Fog rendering of the map is then implemented based on this visual information, thereby improving the efficiency of fog rendering for the map.
[0108] The above Figures 2-3 The process for generating the database, Figure 6 This is a flowchart illustrating a method for displaying a map screen according to an exemplary embodiment, the method being implemented based on an offline database generated in any of the above embodiments. For example... Figure 6 As shown, this method is executed by a terminal and includes the following steps.
[0109] In step S601, the terminal displays a target map screen, which displays virtual objects. The target map screen is a partial view of the virtual map.
[0110] The virtual map in this step is the same as the virtual map in step S201, and will not be described again here.
[0111] In step S602, the terminal determines the target visual information corresponding to the target location based on the target location of the virtual object in the target map screen and the offline database of the virtual map. The offline database stores multiple locations on the virtual map and the visual information corresponding to each of the multiple locations. The visual information corresponding to each location is used to indicate the visible area and the invisible area corresponding to that location.
[0112] In this embodiment of the disclosure, the visible and invisible areas corresponding to each location are both regions within the target area corresponding to that location. The target area is determined based on the target location and a preset field of view radius, that is, the target area is the area obtained by drawing a circle with the target location as the center and the preset field of view radius as the radius.
[0113] In step S603, the terminal generates a fog map corresponding to the target map based on the target visibility information. The invisible areas in the target visibility information are rendered with shadows in the fog map.
[0114] In this embodiment of the disclosure, the target area is the maximum field of view corresponding to the target location, that is, the area outside the target area on the virtual map is the invisible area corresponding to the target location. Accordingly, when the area of the target map screen is larger than the area of the target area, the remaining area on the target map screen other than the target area is the invisible area, and this part of the area is also rendered with shadows in the fog map.
[0115] In step S604, the terminal updates the target map screen based on the fog map.
[0116] In this embodiment of the disclosure, the terminal integrates the fog map onto the target map screen to update the target map screen.
[0117] This disclosure provides a method for displaying a map. The method uses an offline database to store multiple locations on a virtual map and their corresponding visual information. Based on the target location of a virtual object in the target map, the visual information corresponding to that target location can be quickly determined from the offline database. Furthermore, a fog map is generated based on the target visual information, thus improving the generation efficiency of the fog map and consequently increasing the efficiency of updating the target map based on the fog map. In other words, this method improves the efficiency of displaying fog in the map.
[0118] In some embodiments, determining the target visual information corresponding to the target location based on the target location of the virtual object in the target map screen and the offline database of the virtual map includes: when the offline database does not store obstacle information of the virtual map, determining the target visual information corresponding to the target location from the visual information corresponding to multiple locations, where obstacle information is stored when the complexity of obstacles in the virtual map is higher than a preset complexity, and obstacle information includes dynamic obstacle information at multiple locations on the virtual map, where the dynamic obstacle information at each location is used to indicate whether there are dynamic obstacles at the location; when the offline database stores obstacle information, determining the target area corresponding to the target location based on the target location and a preset field of view radius, determining obstacle presence information of the target area based on the dynamic obstacle information at multiple locations within the target area in the obstacle information, where obstacle presence information is used to indicate whether there are dynamic obstacles in the target area and the number of dynamic obstacles present, and determining the target visual information corresponding to the target location based on the target location, obstacle presence information, and the offline database.
[0119] In this embodiment of the disclosure, the method for determining the visual information of the target is selected based on the complexity of obstacles in the virtual map, thereby improving the flexibility of determining the visual information.
[0120] In some embodiments, determining the target visual information corresponding to the target location based on the target location, obstacle presence information, and an offline database includes: when it is determined based on the obstacle presence information that there are no dynamic obstacles in the target area, determining the target visual information corresponding to the target location from the visual information corresponding to multiple locations; when it is determined based on the obstacle presence information that there are dynamic obstacles in the target area and the number of obstacles is less than a preset number, determining the target visual information corresponding to the target location from the visual information corresponding to multiple locations; and when it is determined based on the obstacle presence information that there are dynamic obstacles in the target area and the number of obstacles is greater than or equal to a preset number, performing ray detection on the target location to obtain the target visual information corresponding to the target location.
[0121] In this embodiment of the disclosure, different methods are adopted to determine visual information based on the different existence of dynamic obstacles in the target area, thereby improving the flexibility and efficiency of determining visual information.
[0122] In some embodiments, each dynamic obstacle corresponds to multiple occlusion states. When it is determined that there are no dynamic obstacles in the target area based on obstacle presence information, target visual information corresponding to the target location is determined from the visual information corresponding to the multiple locations, including: determining multiple visual information corresponding to the target location from the multiple visual information corresponding to the multiple locations, wherein the multiple visual information corresponding to the target location respectively corresponds to multiple occlusion states of dynamic obstacles in the target area; and determining the target visual information corresponding to the target occlusion state from the multiple visual information corresponding to the target location based on the target occlusion state of the dynamic obstacles in the target area in the target map image.
[0123] In this embodiment of the disclosure, if the number of dynamic obstacles in the target area is less than a preset number, it indicates that the complexity of the obstacles in the target area is low, and thus visual information can be directly obtained from the offline database, improving the efficiency of obtaining visual information.
[0124] In some embodiments, obstacle information also includes the height of multiple locations on a virtual map. When it is determined that there are dynamic obstacles in the target area based on obstacle presence information, and the number of obstacles is greater than or equal to a preset number, ray detection is performed on the target location to obtain target visual information corresponding to the target location, including: determining the target height of the target location based on obstacle information; determining the target ray height based on the target height and a preset field of view height; performing ray detection in the target area based on the target ray height to obtain obstacles in the target area; determining the invisible area in the target area based on the obstacles in the target area, and taking the remaining area in the target area excluding the invisible area as the visible area.
[0125] In this embodiment of the disclosure, if the number of obstacles is greater than or equal to a preset number, it indicates that the complexity of the obstacles in the target area is high, resulting in low efficiency in generating visual information offline. However, by using real-time ray detection, the efficiency of obtaining visual information is improved.
[0126] In some embodiments, updating the target map image based on the fog map includes: determining the scene type of the virtual map based on the ground parameters of the virtual map, wherein the ground parameters are used to reflect the degree of change in ground height of the virtual map; and rendering the target map image based on the scene type and the fog map to update the target map image.
[0127] In this embodiment of the disclosure, rendering is performed based on scene type, which effectively improves the targeting and flexibility of rendering, thereby improving the rendering effect.
[0128] In some embodiments, rendering a target map based on scene type and fog map to update the target map includes: when the scene type is a first type, rendering the target map in world space based on fog map to update the target map; when the scene type is a second type, rendering the target map in screen space based on fog map to update the target map, wherein the ground height change of the virtual map in the first type is less than the ground height change of the virtual map in the second type.
[0129] In this embodiment, a small change in ground height indicates minimal ground undulation, allowing for improved rendering efficiency through world space rendering. Conversely, a large change in ground height indicates significant ground undulation, necessitating screen space rendering to address the issue of characters being visible through fog in free-view games with complex terrain. This method effectively enhances the flexibility and accuracy of displaying fog on the map.
[0130] The above Figure 6 This is the basic process for displaying map images. The following is based on... Figure 7 The process of displaying map images is further explained. See [link / reference] Figure 7 , Figure 7 This is a flowchart illustrating a method for displaying a map screen according to an exemplary embodiment. The method is executed by a terminal and includes the following steps:
[0131] In step S701, the terminal displays a target map screen, which displays virtual objects. The target map screen is a partial view of the virtual map.
[0132] This step is the same as step S601, and will not be repeated here.
[0133] In step S702, the terminal obtains the storage information of the offline database of the virtual map. The storage information is used to indicate whether the offline database stores obstacle information of the virtual map. The offline database stores multiple locations on the virtual map and the visual information corresponding to each of the multiple locations. The visual information corresponding to each location is used to indicate the visible area and the invisible area corresponding to that location.
[0134] In this embodiment of the disclosure, the obstacle information is stored when the complexity of the obstacles in the virtual map is higher than a preset complexity. The obstacle information includes dynamic obstacle information at multiple locations on the virtual map, and the dynamic obstacle information at each location is used to indicate whether there are dynamic obstacles at that location.
[0135] In this embodiment of the disclosure, if it is determined based on the storage information that the offline database does not store obstacle information of the virtual map, step S703 is executed; if it is determined based on the storage information that the offline database stores obstacle information of the virtual map, step S704 is executed.
[0136] In step S703, if the terminal does not store obstacle information of the virtual map in the offline database, it determines the target visual information corresponding to the target position from the visual information corresponding to the multiple positions based on the target position of the virtual object in the target map screen.
[0137] In this embodiment of the disclosure, if the offline database does not store obstacle information of the virtual map, it indicates that the complexity of the obstacles in the virtual map is low. Therefore, the target visual information can be directly obtained from the offline database, which improves the efficiency of obtaining visual information.
[0138] In step S704, when obstacle information is stored in the offline database, the terminal determines the target area corresponding to the target location based on the target location and a preset field of view radius. Based on the dynamic obstacle information of multiple locations within the target area in the obstacle information, the terminal determines the obstacle presence information of the target area. Based on the target location of the virtual object in the target map screen, the obstacle presence information, and the offline database, the terminal determines the target visual information corresponding to the target location. The obstacle presence information is used to indicate whether there are dynamic obstacles within the target area and the number of dynamic obstacles present.
[0139] In this embodiment of the disclosure, the process of determining the target visual information corresponding to the target location based on the target location, the obstacle existence information, and the offline database can be divided into the following cases.
[0140] In scenario one, if the terminal determines that there are no dynamic obstacles in the target area based on obstacle presence information, it determines the target visual information corresponding to the target location from the visual information corresponding to multiple locations based on the target location.
[0141] In scenario two, if the terminal determines that there are dynamic obstacles in the target area based on obstacle presence information and the number of obstacles is less than a preset number, it determines the target visual information corresponding to the target location from the visual information corresponding to multiple locations based on the target location.
[0142] In this embodiment of the disclosure, each dynamic obstacle corresponds to multiple occlusion states. Accordingly, the process of determining the target visual information corresponding to the target location from the visual information corresponding to the multiple locations based on the target location includes the following steps: the terminal determines multiple visual information corresponding to the target location from the multiple visual information corresponding to the multiple locations, and the multiple visual information corresponding to the target location respectively corresponds to multiple occlusion states of dynamic obstacles in the target area; the terminal determines the target visual information corresponding to the target occlusion state from the multiple visual information corresponding to the target location based on the target occlusion state of the dynamic obstacles in the target area in the target map screen.
[0143] In this embodiment of the disclosure, when the number of dynamic obstacles in the target area is greater than 1, the occlusion state corresponding to each of the multiple visual information corresponding to the target location is a cross-combination state of the occlusion states corresponding to the multiple dynamic obstacles in the target area, and the target occlusion state includes the target occlusion states corresponding to the multiple dynamic obstacles.
[0144] The preset number can be set and changed as needed. It should be noted that since each dynamic obstacle corresponds to multiple occlusion states, if there are too many dynamic obstacles, the occlusion states of these obstacles will be combined to obtain multiple visual information, increasing the complexity of offline visual information generation. Therefore, in this embodiment, a preset number of 2 is used as an example for explanation.
[0145] In this embodiment of the disclosure, if the number of dynamic obstacles in the target area is less than a preset number, it indicates that the complexity of the obstacles in the target area is low, and thus visual information can be directly obtained from the offline database, improving the efficiency of obtaining visual information.
[0146] Scenario 3: When the terminal determines that there are dynamic obstacles in the target area based on the obstacle presence information, and the number of obstacles is greater than or equal to the preset number, it performs ray detection on the target position to obtain the target visual information corresponding to the target position.
[0147] In this embodiment of the disclosure, the terminal performs real-time ray detection to obtain target visual information. Accordingly, the process by which the terminal performs ray detection on the target location to obtain the target visual information corresponding to the target location includes the following steps: the terminal determines the target height of the target location based on obstacle information; the terminal determines the target ray height based on the target height and a preset field of view height; the terminal performs ray detection within the target area based on the target ray height to obtain obstacles within the target area; the terminal determines the invisible area within the target area based on the obstacles within the target area, and takes the area remaining in the target area excluding the invisible area as the visible area.
[0148] In this embodiment, the ray detection performed within the target area can be grid-based eight-directional ray detection, that is, emitting a ray at 45-degree angles centered on the target location. In this embodiment, if the number of obstacles is greater than or equal to a preset number, it indicates that the complexity of the obstacles in the target area is high, resulting in low efficiency in offline generation of visual information. Real-time ray detection improves the efficiency of acquiring visual information.
[0149] In this embodiment of the disclosure, different methods are adopted to determine visual information based on the different existence of dynamic obstacles in the target area, thereby improving the flexibility and efficiency of determining visual information.
[0150] In this embodiment of the disclosure, the above steps S703-S704 realize the process of determining the target visual information corresponding to the target location based on the target location of the virtual object in the target map screen and the offline database of the virtual map, thereby realizing flexible determination of visual information and improving the efficiency of visual information acquisition.
[0151] In step S705, the terminal generates a fog map corresponding to the target map based on the target visibility information. The invisible areas in the target visibility information are rendered with shadows in the fog map.
[0152] In some embodiments, the process by which the terminal generates a fog map corresponding to a target map image based on target visibility information includes the following steps: the terminal vertically projects the target map image to obtain a screen texture corresponding to the target map image; based on fog parameter information and target visibility information, the portion of the screen texture corresponding to the invisible area is rendered as a shadow area to obtain a fog map; the fog parameter information includes the shadow color and shadow brightness of the fog, etc. The fog map generated by this method effectively integrates target visibility information, thereby facilitating the updating of the target map image based on the fog map.
[0153] In step S706, the terminal updates the target map screen based on the fog map.
[0154] In this embodiment, different scene types of virtual maps correspond to different rendering methods. Accordingly, the process of the terminal updating the target map image based on the fog map includes the following steps: the terminal determines the scene type of the virtual map based on the ground parameters of the virtual map; the terminal renders the target map image based on the scene type and the fog map to update the target map image. In this embodiment, rendering based on scene type effectively improves the targeting and flexibility of rendering, thereby improving the rendering effect.
[0155] In this embodiment, the ground parameter is used to reflect the degree of change in ground elevation of the virtual map. For example, the ground parameter can be the variance or squared difference of the elevations of multiple locations on the virtual map. Scene types include a first type and a second type, where the degree of change in ground elevation of the virtual map in the first type is less than that of the virtual map in the second type. Optionally, the scene type of a virtual map with a ground parameter less than a preset value is determined as the first type, and the scene type of a virtual map with a ground parameter greater than or equal to the preset value is determined as the second type.
[0156] In this embodiment of the disclosure, different scene types correspond to different rendering methods. Accordingly, the process by which the terminal renders the target map image based on the scene type and the fog map to update the target map image includes the following two cases: when the scene type of the virtual map is the first type, the terminal performs world space rendering on the target map image based on the fog map to update the target map image; when the scene type of the virtual map is the second type, the terminal performs screen space rendering on the target map image based on the fog map to update the target map image.
[0157] In this embodiment, a small change in ground height indicates minimal ground undulation, allowing for improved rendering efficiency through world space rendering. Conversely, a large change in ground height indicates significant ground undulation, necessitating screen space rendering to address the issue of characters being visible through fog in free-view games with complex terrain. This method effectively enhances the flexibility and accuracy of displaying fog on the map.
[0158] In this embodiment of the disclosure, since an offline database is generated in advance, offline baking of visual information is realized. Then, combined with the obstacle information of the virtual map, the method can be applied to various types of virtual maps, such as those without obstacles, with obstacles, and with dynamic obstacles, thereby meeting the needs of most games to display fog.
[0159] In this embodiment of the disclosure, one or more virtual objects may be displayed in the target map screen. When one virtual object is displayed, a fog map corresponding to the target map screen is generated based on the target visibility information corresponding to the target location of the virtual object. When multiple virtual objects are displayed, a fog map corresponding to the target map screen is generated based on the target visibility information corresponding to the target locations of the multiple virtual objects, thereby enabling the multiple virtual objects to share the field of view.
[0160] See Figure 8 , Figure 8This is a flowchart illustrating a fog map generation method according to an exemplary embodiment, where the method is executed by a terminal. After the process begins, the terminal needs to traverse all virtual objects in the target map screen, first determining whether all virtual objects have been traversed. If not, for the target location of the current virtual object, it first determines whether obstacle information is stored in the offline database. If not, it queries the offline database to obtain the target's visual information and writes it into the fog array; if yes, it determines whether there are dynamic obstacles within the target area based on the obstacle information. If not, it queries the offline database to obtain the target's visual information and writes it into the fog array; if yes, it performs grid-based eight-directional ray detection to obtain the target's visual information and writes it into the fog array; if all virtual objects have been traversed, a fog map is generated based on the visual information in the fog array, and the process ends.
[0161] This disclosure provides a method for displaying a map. The method uses an offline database to store multiple locations on a virtual map and their corresponding visual information. Based on the target location of a virtual object in the target map, the visual information corresponding to that target location can be quickly determined from the offline database. Furthermore, a fog map is generated based on the target visual information, thus improving the generation efficiency of the fog map and consequently increasing the efficiency of updating the target map based on the fog map. In other words, this method improves the efficiency of displaying fog in the map.
[0162] Figure 9 This is a block diagram illustrating a map display device according to an exemplary embodiment. (Refer to...) Figure 9 The device includes:
[0163] Display unit 901 is configured to display a target map screen, in which virtual objects are displayed, and the target map screen is a partial area of the virtual map;
[0164] The determining unit 902 is configured to determine the target visual information corresponding to the target location based on the target location of the virtual object in the target map screen and the offline database of the virtual map. The offline database stores multiple locations on the virtual map and the visual information corresponding to each location. The visual information corresponding to each location is used to indicate the visible area and invisible area corresponding to the location.
[0165] The generation unit 903 is configured to generate a fog map corresponding to the target map based on the target visibility information, and the invisible areas in the target visibility information are rendered with shadows in the fog map;
[0166] Update unit 904 is configured to update the target map based on the fog map.
[0167] In some embodiments, the determining unit 902 is configured to: when the obstacle information of the virtual map is not stored in the offline database, determine the target visual information corresponding to the target location from the visual information corresponding to multiple locations based on the target location; the obstacle information is stored when the complexity of the obstacles in the virtual map is higher than a preset complexity; the obstacle information includes dynamic obstacle information at multiple locations on the virtual map, and the dynamic obstacle information at each location is used to indicate whether there are dynamic obstacles at the location; when the obstacle information is stored in the offline database, determine the target area corresponding to the target location based on the target location and a preset field of view radius; determine the obstacle presence information of the target area based on the dynamic obstacle information at multiple locations within the target area in the obstacle information; the obstacle presence information is used to indicate whether there are dynamic obstacles in the target area and the number of dynamic obstacles present; determine the target visual information corresponding to the target location based on the target location, the obstacle presence information, and the offline database; and determine the target area based on the target location and the preset field of view radius.
[0168] In some embodiments, the determining unit 902 is configured to: when it is determined that there are no dynamic obstacles in the target area based on obstacle presence information, determine the target visual information corresponding to the target position from the visual information corresponding to multiple positions based on the target position; when it is determined that there are dynamic obstacles in the target area based on obstacle presence information and the number of obstacles is less than a preset number, determine the target visual information corresponding to the target position from the visual information corresponding to multiple positions based on the target position; when it is determined that there are dynamic obstacles in the target area based on obstacle presence information and the number of obstacles is greater than or equal to a preset number, perform ray detection on the target position to obtain the target visual information corresponding to the target position.
[0169] In some embodiments, each dynamic obstacle corresponds to multiple occlusion states. The determining unit 902 is configured to: determine multiple visual information corresponding to a target location from multiple visual information corresponding to multiple locations, wherein the multiple visual information corresponding to the target location corresponds to multiple occlusion states of dynamic obstacles in the target area; and determine target visual information corresponding to the target occlusion state from the multiple visual information corresponding to the target location based on the target occlusion state of the dynamic obstacles in the target area in the target map image.
[0170] In some embodiments, the obstacle information also includes the heights of multiple locations on a virtual map. The determining unit 902 is configured to: determine the target height of the target location based on the obstacle information; determine the target ray height based on the target height and a preset field of view height; perform ray detection in the target area based on the target ray height to obtain obstacles in the target area; determine the invisible area in the target area based on the obstacles in the target area, and take the remaining area in the target area other than the invisible area as the visible area.
[0171] In some embodiments, the updating unit 904 is configured to: determine the scene type of the virtual map based on the ground parameters of the virtual map, wherein the ground parameters are used to reflect the degree of change in ground height of the virtual map; and render the target map image based on the scene type and fog map to update the target map image.
[0172] In some embodiments, the updating unit 904 is configured to: when the scene type is a first type, perform world space rendering on the target map image based on the fog map to update the target map image; when the scene type is a second type, perform screen space rendering on the target map image based on the fog map to update the target map image, wherein the ground height change of the virtual map of the first type is less than the ground height change of the virtual map of the second type.
[0173] This disclosure provides a map display device. Its offline database stores multiple locations on a virtual map and their corresponding visual information. Based on the target location of a virtual object in the target map, the target visual information corresponding to that location can be quickly determined from the offline database. Furthermore, a fog map is generated based on the target visual information, thus improving the fog map generation efficiency and consequently the efficiency of updating the target map based on the fog map. In other words, this method improves the efficiency of displaying fog in the map.
[0174] Figure 10 This is a block diagram illustrating a database generation apparatus according to an exemplary embodiment. (Refer to...) Figure 10 The device includes:
[0175] The height detection unit 1001 is configured to perform ray detection on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map;
[0176] The height determination unit 1002 is configured to determine the preset ray height of the ray emitted from the location for each of multiple locations on the virtual map, based on the height of the location and a preset field of view height.
[0177] The obstacle detection unit 1003 is configured to perform ray detection within a preset area corresponding to a position based on a preset ray height, thereby obtaining obstacles within the preset area. The preset area is determined based on the position and a preset field of view radius.
[0178] The region determination unit 1004 is configured to determine the invisible region within the preset region based on obstacles within the preset region, and to take the region remaining in the preset region other than the invisible region as the visible region.
[0179] The visual information determination unit 1005 is configured to obtain the visual information corresponding to the location based on the visible and invisible areas within a preset area.
[0180] The database determination unit 1006 is configured to obtain an offline database based on multiple locations on the virtual map and the visual information corresponding to each location. The offline database is used to perform fog rendering on the map screen when displaying the map screen, and the map screen is a partial area of the virtual map.
[0181] In some embodiments, both the visible and invisible areas within the preset area include multiple locations. The visual information determination unit 1005 is configured to: determine a bit array corresponding to a location, wherein multiple element positions in the bit array match multiple locations within the preset area corresponding to the location; mark the first element position in the bit array as a first identifier, and mark the second element position in the bit array as a second identifier to obtain a target bit array corresponding to the location, wherein the first element position corresponds to multiple locations within the visible area of the preset area, and the second element position corresponds to multiple locations within the invisible area of the preset area, wherein the first identifier is used to indicate the visible area, and the second identifier is used to indicate the invisible area; and use the target bit array corresponding to the location as the visual information corresponding to the location.
[0182] In some embodiments, the database determination unit 1006 is configured to: when the complexity of obstacles in the virtual map is higher than a preset complexity, for each of multiple locations on the virtual map, generate sub-obstacle information corresponding to the location based on the static obstacle information, dynamic obstacle information, and height of the location, wherein the static obstacle information is used to indicate whether there are static obstacles at the location, and the dynamic obstacle information is used to indicate whether there are dynamic obstacles at the location; generate obstacle information of the virtual map based on the multiple locations on the virtual map and the sub-obstacle information corresponding to the multiple locations on the virtual map respectively; and obtain an offline database based on the multiple locations on the virtual map, the visual information and obstacle information corresponding to the multiple locations on the virtual map respectively.
[0183] This disclosure provides a database generation apparatus that performs ray detection on each of multiple locations on a virtual map to obtain visual information corresponding to each location. Based on this visual information, an offline database is generated. When displaying a map, the visual information corresponding to a specific location can be quickly determined using this offline database. Fog rendering of the map is then performed based on this visual information, thereby improving the efficiency of fog rendering for the map.
[0184] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0185] Figure 11 A structural block diagram of a terminal 1100 provided in an exemplary embodiment of this disclosure is shown. The terminal 1100 may be a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The terminal 1100 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.
[0186] Typically, terminal 1100 includes a processor 1101 and a memory 1102.
[0187] Processor 1101 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1101 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1101 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1101 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1101 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0188] The memory 1102 may include one or more computer-readable storage media, which may be non-transitory. The memory 1102 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1102 are used to store at least one program code, which is executed by the processor 1101 to implement the map display method or database generation method provided in the method embodiments of this disclosure.
[0189] In some embodiments, the terminal 1100 may also optionally include a peripheral device interface 1103 and at least one peripheral device. The processor 1101, memory 1102, and peripheral device interface 1103 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1103 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, and a power supply 1108.
[0190] Peripheral device interface 1103 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1101 and memory 1102. In some embodiments, processor 1101, memory 1102 and peripheral device interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1101, memory 1102 and peripheral device interface 1103 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0191] The radio frequency (RF) circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1104 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1104 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1104 can communicate with other terminals via at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1104 may also include circuitry related to NFC (Near Field Communication), which is not limited in this disclosure.
[0192] Display screen 1105 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1105 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1101 for processing. In this case, display screen 1105 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1105, which serves as the front panel of terminal 1100; in other embodiments, there may be at least two display screens, respectively disposed on different surfaces of terminal 1100 or in a folded design; in still other embodiments, display screen 1105 may be a flexible display screen, disposed on a curved or folded surface of terminal 1100. Furthermore, display screen 1105 may also be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. The display screen 1105 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0193] The camera assembly 1106 is used to acquire images or videos. Optionally, the camera assembly 1106 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 1106 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.
[0194] The audio circuit 1107 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 1101 for processing, or input to the radio frequency circuit 1104 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 1100. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1101 or the radio frequency circuit 1104 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1107 may also include a headphone jack.
[0195] Power supply 1108 is used to power the various components in terminal 1100. Power supply 1108 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 1108 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0196] Those skilled in the art will understand that Figure 11 The structure shown does not constitute a limitation on terminal 1100 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0197] Figure 12 This is a schematic diagram of a server structure according to an embodiment of this application. The server 1200 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1201 and one or more memories 1202. The memories 1202 are used to store executable program code, and the processors 1201 are configured to execute the executable program code to implement the map display method or database generation method provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated here.
[0198] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, which can be executed by a terminal's processor to complete the map display method or database generation method described above. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.
[0199] In an exemplary embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the aforementioned map display method or database generation method. In some embodiments, the computer program product involved in this application embodiment can be deployed and executed on a single computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network. These multiple computer devices distributed across multiple locations and interconnected via a communication network can constitute a blockchain system.
[0200] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0201] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for displaying a map image, characterized in that, The method includes: The target map screen is displayed, and the target map screen displays virtual objects. The target map screen is a partial area of the virtual map. The offline database of the virtual map stores multiple locations on the virtual map and the visual information corresponding to each of the multiple locations. The visual information corresponding to each location is used to indicate the visible and invisible areas corresponding to the location. If the obstacle information of the virtual map is not stored in the offline database, the target visual information corresponding to the target position is determined from the visual information corresponding to the multiple positions based on the target position of the virtual object in the target map screen. The obstacle information is stored when the complexity of the obstacles in the virtual map is higher than a preset complexity. The obstacle information includes dynamic obstacle information of multiple positions on the virtual map, and the dynamic obstacle information of each position is used to indicate whether there are dynamic obstacles at the position. When the obstacle information is stored in the offline database, the target area corresponding to the target location is determined based on the target location and a preset field of view radius. Based on the dynamic obstacle information located at multiple locations within the target area in the obstacle information, the obstacle presence information of the target area is determined. Based on the target location, the obstacle presence information, and the offline database, the target visibility information corresponding to the target location is determined. The obstacle presence information is used to indicate whether there are dynamic obstacles within the target area and the number of dynamic obstacles present. Based on the target visibility information, a fog map corresponding to the target map is generated, and the invisible areas in the target visibility information are rendered with shadows in the fog map; Update the target map image based on the fog map; The offline database is obtained based on the plurality of locations and the visualization information and obstacle information corresponding to the plurality of locations respectively. For each of the plurality of locations, the visualization information of the location is determined based on obstacles in a preset area corresponding to the location. The obstacles in the preset area are obtained by ray detection in the preset area. The obstacle information is obtained based on the static obstacle information, dynamic obstacle information and height of each of the plurality of locations. The static obstacle information is used to indicate whether there are static obstacles at the location, and the dynamic obstacle information is used to indicate whether there are dynamic obstacles at the location.
2. The method for displaying map images according to claim 1, characterized in that, The step of determining the target visual information corresponding to the target location based on the target location, the obstacle presence information, and the offline database includes: If it is determined that there are no dynamic obstacles in the target area based on the obstacle presence information, the target visual information corresponding to the target position is determined from the visual information corresponding to the plurality of positions, based on the target position. If, based on the obstacle presence information, it is determined that there are dynamic obstacles in the target area and the number of obstacles is less than a preset number, then, based on the target location, the target visual information corresponding to the target location is determined from the visual information corresponding to the plurality of locations respectively. If, based on the obstacle presence information, it is determined that there are dynamic obstacles in the target area, and the number of obstacles is greater than or equal to a preset number, ray detection is performed on the target location to obtain the target visual information corresponding to the target location.
3. The method for displaying map images according to claim 2, characterized in that, Each dynamic obstacle corresponds to multiple occlusion states. When it is determined, based on the obstacle presence information, that no dynamic obstacle exists within the target area, the target visual information corresponding to the target position is determined from the visual information corresponding to each of the multiple positions, including: From the multiple visual information corresponding to the multiple locations respectively, determine the multiple visual information corresponding to the target location, wherein the multiple visual information corresponding to the target location respectively correspond to multiple occlusion states of dynamic obstacles in the target area; Based on the target occlusion status of dynamic obstacles within the target area in the target map, the target visual information corresponding to the target occlusion status is determined from multiple visual information corresponding to the target location.
4. The method for displaying map images according to claim 2, characterized in that, The obstacle information also includes the height of multiple locations on the virtual map. When it is determined based on the obstacle presence information that dynamic obstacles exist within the target area, and the number of obstacles is greater than or equal to a preset number, ray detection is performed on the target location to obtain the target visual information corresponding to the target location, including: Based on the obstacle information, the target height of the target location is determined; The target ray height is determined based on the target height and the preset field of view height; Based on the target ray height, ray detection is performed within the target area to identify obstacles within the target area; Based on the obstacles within the target area, an invisible area within the target area is determined, and the remaining area within the target area excluding the invisible area is taken as the visible area.
5. The method for displaying map images according to claim 1, characterized in that, The step of updating the target map image based on the fog map includes: Based on the ground parameters of the virtual map, the scene type of the virtual map is determined, and the ground parameters are used to reflect the degree of change in ground elevation of the virtual map; Based on the scene type and the fog map, the target map is rendered to update the target map.
6. The method for displaying map images according to claim 5, characterized in that, The step of rendering the target map image based on the scene type and the fog map to update the target map image includes: When the scene type is the first type, the target map image is rendered in world space based on the fog map to update the target map image; When the scene type is the second type, the target map is rendered in screen space based on the fog map to update the target map. The ground height change of the virtual map in the first type is less than that of the virtual map in the second type.
7. A database generation method, characterized in that, The method includes: Ray detection is performed on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map; For each of the multiple locations on the virtual map, a preset ray height for emitting a ray from that location is determined based on the height of that location and a preset field of view height. Based on the preset ray height, ray detection is performed within a preset area corresponding to the position to obtain obstacles within the preset area, wherein the preset area is determined based on the position and a preset field of view radius; Based on the obstacles within the preset area, an invisible area within the preset area is determined, and the remaining area within the preset area excluding the invisible area is taken as the visible area. Based on the visible and invisible areas within the preset area, the visual information corresponding to the location is obtained; When the complexity of obstacles in the virtual map exceeds a preset complexity, for each of the multiple locations on the virtual map, sub-obstacle information corresponding to that location is generated based on the static obstacle information, dynamic obstacle information, and height of that location. The static obstacle information indicates whether a static obstacle exists at that location, and the dynamic obstacle information indicates whether a dynamic obstacle exists at that location. Obstacle information for the virtual map is generated based on the multiple locations on the virtual map and the sub-obstacle information corresponding to each location. An offline database is obtained based on the multiple locations on the virtual map, the visual information corresponding to each location, and the obstacle information. This offline database is used to perform fog rendering on the map screen when displaying the map screen, where the map screen is a partial area of the virtual map and displays virtual objects. During the fog rendering process, if the obstacle information of the virtual map is stored in the offline database, the target visual information corresponding to the target location of the virtual object in the map screen is determined based on the dynamic obstacle information of multiple locations within the target area corresponding to the target location in the obstacle information, the target location, and the offline database.
8. The database generation method according to claim 7, characterized in that, The visible and invisible areas within the preset area each include multiple locations. The step of obtaining visual information corresponding to each location based on the visible and invisible areas within the preset area includes: Determine the bit array corresponding to the position, wherein the positions of multiple elements in the bit array match multiple positions within a preset area corresponding to the position; The position of the first element in the bit array is marked as a first identifier, and the position of the second element in the bit array is marked as a second identifier to obtain the target bit array corresponding to the position. The position of the first element corresponds to multiple positions in the visible area within the preset area, and the position of the second element corresponds to multiple positions in the invisible area within the preset area. The first identifier is used to indicate the visible area, and the second identifier is used to indicate the invisible area. The target bit array corresponding to the location is used as the visual information corresponding to the location.
9. A map display device, characterized in that, The device includes: The display unit is configured to display a target map screen, in which virtual objects are displayed. The target map screen is a partial area of the virtual map. The offline database of the virtual map stores multiple locations on the virtual map and visual information corresponding to each of the multiple locations. The visual information corresponding to each location is used to indicate the visible and invisible areas corresponding to the location. The determining unit is configured to, when the obstacle information of the virtual map is not stored in the offline database, determine the target visual information corresponding to the target position from the visual information corresponding to the multiple positions based on the target position of the virtual object in the target map screen. The obstacle information is stored when the complexity of the obstacles in the virtual map is higher than a preset complexity. The obstacle information includes dynamic obstacle information at multiple positions on the virtual map, and the dynamic obstacle information at each position is used to indicate whether there are dynamic obstacles at that position. When the obstacle information is stored in the offline database, the unit determines the target area corresponding to the target position based on the target position and a preset field of view radius. Based on the dynamic obstacle information at multiple positions located within the target area in the obstacle information, the unit determines the obstacle presence information of the target area. Based on the target position, the obstacle presence information, and the offline database, the unit determines the target visual information corresponding to the target position. The obstacle presence information is used to indicate whether there are dynamic obstacles in the target area and the number of dynamic obstacles present. The generation unit is configured to generate a fog map corresponding to the target map image based on the target visibility information, wherein the invisible areas in the target visibility information are rendered with shadows in the fog map; The update unit is configured to update the target map image based on the fog map; The offline database is obtained based on the plurality of locations and the visualization information and obstacle information corresponding to the plurality of locations respectively. For each of the plurality of locations, the visualization information of the location is determined based on obstacles in a preset area corresponding to the location. The obstacles in the preset area are obtained by ray detection in the preset area. The obstacle information is obtained based on the static obstacle information, dynamic obstacle information and height of each of the plurality of locations. The static obstacle information is used to indicate whether there are static obstacles at the location, and the dynamic obstacle information is used to indicate whether there are dynamic obstacles at the location.
10. A database generation apparatus, characterized in that, The device includes: The height detection unit is configured to perform ray detection on multiple locations on the virtual map to obtain the height of the multiple locations on the virtual map; The height determination unit is configured to determine a preset ray height for a ray emitted from a location based on the height of the location and a preset field of view height for each of a plurality of locations on the virtual map. An obstacle detection unit is configured to perform ray detection within a preset area corresponding to the position based on the preset ray height, thereby obtaining obstacles within the preset area, wherein the preset area is determined based on the position and a preset field of view radius; The region determination unit is configured to determine the invisible region within the preset region based on obstacles within the preset region, and to take the region remaining in the preset region excluding the invisible region as the visible region. The visual information determination unit is configured to obtain the visual information corresponding to the location based on the visible and invisible areas within the preset area; The database determination unit is configured to, when the complexity of obstacles in the virtual map is higher than a preset complexity, generate sub-obstacle information corresponding to each of multiple locations on the virtual map, based on the static obstacle information, dynamic obstacle information, and height of the location. The static obstacle information indicates whether a static obstacle exists at the location, and the dynamic obstacle information indicates whether a dynamic obstacle exists at the location. It also generates obstacle information for the virtual map based on the multiple locations on the virtual map and the sub-obstacle information corresponding to each location. The visual information corresponding to multiple locations on the simulated map and the obstacle information are used to obtain an offline database. The offline database is used to perform fog rendering on the map screen when displaying the map screen. The map screen is a partial area of the virtual map and displays virtual objects. During the fog rendering process of the map screen, with the obstacle information of the virtual map stored in the offline database, the target visual information corresponding to the target location of the virtual object in the map screen is determined based on the dynamic obstacle information of multiple locations within the target area corresponding to the target location in the obstacle information, the target location, and the offline database.
11. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the map display method as described in any one of claims 1 to 6 or the database generation method as described in any one of claims 7 to 8.
12. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the map display method of any one of claims 1 to 6 or the database generation method of any one of claims 7 to 8.