Map element adding method, device, terminal and storage medium
By encapsulating the classes of map elements into modules, using map hierarchical management and basic view modules, the problem of low development efficiency of map elements is solved, efficient development and optimized display updates are achieved, and terminal performance is improved.
Patent Information
- Application Number
- CN202010053597.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-17
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2040-01-17
AI Technical Summary
Map elements require a lot of complex code writing in game development, resulting in inefficient development and high complexity.
By pre-encapsulating the classes required for map implementation into the corresponding module, using the map hierarchy management module and the basic map view module, creating the hierarchy name of the map element, displaying follow-up information and weather impact information, and creating a prefabricated body in the target folder, adding update codes to indicate the storage location and display status of the map element.
It greatly improves the development efficiency of map elements, reduces development complexity, and improves the performance of the terminal through optimized display update and rendering processes.
Smart Images

Figure CN113134235B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, terminal and storage medium for adding map elements. Background Art
[0002] With the advancement of computer technology and the diversification of terminal functions, the variety of games available on these terminals is increasing. To facilitate location awareness within virtual scenes, many games are beginning to offer map features, providing players with prompts and convenience. Games can display maps mounted on the virtual scene. However, map development requires significant development manpower, and the display settings for each map element require complex code. The complex display logic of map elements also leads to low development efficiency and high complexity. Summary of the Invention
[0003] The embodiments of the present application provide a method, device, terminal, and storage medium for adding map elements, which can solve the problems of low development efficiency and high development complexity. The technical solution is as follows:
[0004] On the one hand, a method for adding map elements is provided, which is applied to a development terminal of a target application. The target application includes a map layer management module and a basic map view module. The map layer management module defines a layer name class, a display follow class, and a weather influence class. The basic map view module defines a global map base class and a local map base class.
[0005] The method comprises:
[0006] For a map element to be added, based on the encapsulated level name class, display follower class, and weather impact class in the map level management module, create the name of the level to which the map element belongs, the display follower information of the map element at the level, and the weather impact information of the map element;
[0007] Create a prefab of the map element in the target folder, where the name of the prefab is a combination of the name of the layer to which it belongs and the name of the map element;
[0008] Based on the global map base class and the local map base class in the basic map view module, code for updating the map element is added, and the code is used to indicate the storage location of the prefab of the map element and the display status information of the map element when it is displayed at the level.
[0009] On the one hand, a map element adding device is provided, which is applied to a development terminal of a target application. The target application includes a map layer management module and a basic map view module. The map layer management module defines a layer name class, a display follow class, and a weather influence class. The basic map view module defines a global map base class and a local map base class.
[0010] The device comprises:
[0011] an element creation unit, configured to create, for a map element to be added, a name of the layer to which the map element belongs, display follower information of the map element at the layer, and weather impact information of the map element based on the layer name class, display follower class, and weather impact class encapsulated in the map layer management module;
[0012] a prefab creating unit, configured to create a prefab of the map element in a target folder, wherein the name of the prefab is a combination of the name of the layer to which it belongs and the name of the map element;
[0013] A code adding unit is used to add code for updating the map element in the basic map view module, wherein the code is used to indicate the storage location of the prefabricated body of the map element and the display status information of the map element when displayed at the level.
[0014] In a possible implementation, the display follow information is used to indicate whether the map element is scaled along with the map, and the weather impact information is used to indicate whether the map element is affected by virtual weather in the virtual scene.
[0015] In one possible implementation, the basic map view module includes a global map base class submodule, and the global map base class submodule is used to call a corresponding function in the global map base class submodule according to the operation type of the display status update operation when a display status update operation on the global map is detected; and update the display of the global map through the corresponding function in the global map base class submodule.
[0016] In one possible implementation, the global map base class submodule is used to:
[0017] When the display status update operation is a zoom operation, calling the zoom function in the global map base class submodule; or,
[0018] When the display status update operation is a drag operation, calling the position movement function in the global map base class submodule; or,
[0019] When the display status update operation is an automatic centering operation, the automatic centering function in the global map base class submodule is called.
[0020] In a possible implementation, display elements of the target application whose change frequency is greater than a target frequency threshold and display elements whose change frequency is less than the target frequency threshold are drawn in different canvases respectively.
[0021] In a possible implementation, the update interval of the display interface of the target application is greater than the display duration of two frames.
[0022] In a possible implementation, the target application performs a display update when detecting that a display position of a display element has changed.
[0023] In a possible implementation, the target application loads display elements whose loading times reach a threshold into a memory pool.
[0024] In a possible implementation, the target application may draw a local map by performing texture clipping based on a shader, and when displaying the local map, a picture with a hollow shape is superimposed on the local map.
[0025] In one possible implementation, the three-dimensional engine of the target application has a component that extends at least one of the zoom display, multi-touch, and automatic centering functions of the global map based on the native ScrollRect component.
[0026] On the one hand, a terminal is provided, which includes one or more processors and one or more memories, wherein the one or more memories store at least one program code, and the at least one program code is loaded and executed by the one or more processors to implement the operations performed by the map element adding method in any possible implementation manner as described above.
[0027] On the one hand, a storage medium is provided, in which at least one program code is stored. The at least one program code is loaded and executed by a processor to implement the operations performed by the map element adding method according to any possible implementation manner described above.
[0028] The technical solution provided in the embodiments of the present application provides a new development framework, which encapsulates some classes required for map implementation into corresponding modules in advance, so that when map elements are added, they can be created based on the classes in the existing modules, thereby greatly improving development efficiency and avoiding development complexity. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0030] Figure 1 This is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0031] Figure 2 This is a class diagram of a map system provided in an embodiment of the present application;
[0032] Figure 3 This is a schematic diagram of an expanded component provided by an embodiment of the present application;
[0033] Figure 4 This is a flowchart of a method for adding map elements provided in an embodiment of the present application;
[0034] Figure 5 This is a schematic diagram of a mask-based local map drawing provided by an embodiment of the present application;
[0035] Figure 6 This is a schematic diagram of local map drawing based on shader texture clipping provided by an embodiment of the present application;
[0036] Figure 7 This is a local map display effect diagram provided by an embodiment of the present application;
[0037] Figure 8 This is a structural diagram of a map element adding device provided in an embodiment of the present application;
[0038] Figure 9 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0040] The following explains the terms used in this application.
[0041] Virtual scene: It is a virtual scene displayed (or provided) when the application is running on the terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, the virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. The user can control the movement of virtual objects in the virtual scene.
[0042] Virtual objects are movable objects within a virtual scene. These movable objects can be virtual people, virtual animals, or animated characters, for example, people, animals, plants, oil drums, walls, rocks, and so on displayed within a virtual scene. A virtual object can be a virtual avatar representing the user within the virtual scene. A virtual scene can contain multiple virtual objects, each with its own unique shape and volume, occupying a portion of the space within the virtual scene.
[0043] Optionally, the virtual object can be a player character controlled through operations on the client, an artificial intelligence (AI) trained to compete in a virtual scene, or a non-player character (NPC) set for interaction in the virtual scene. Optionally, the virtual object can be an avatar competing in the virtual scene. Optionally, the number of virtual objects participating in the interaction in the virtual scene can be pre-set or dynamically determined based on the number of clients participating in the interaction.
[0044] UI (User Interface) design refers to the overall design of the software's human-computer interaction, operating logic, and interface aesthetics.
[0045] Map system: The map system is an integral strategic component of MOBA (Multiplayer Online Battle Arena) and MMORPG (Massive Multiplayer Online Role-Playing Game) games, and is one of the most frequently used features during gameplay. The map system refers to a collection of UI thumbnails representing the game scene, along with dynamic UI elements that mark key locations. It typically includes a global map (also known as a large map) and a local map (also known as a small map). Players primarily use the map to gain a broad overview of the game. For example, in MOBA games, players can use the map to clearly see the locations of both teams' minions, towers, terrain, monsters, heroes, and more. In MMORPGs, players can use the map to view their own and other players' locations, locate NPCs (Non-Player Characters), monsters, and teleportation points.
[0046] The map element in the embodiment of the present application may refer to any display element displayed in a virtual scene, including virtual objects, virtual props, and environmental elements, etc. The embodiment of the present application does not limit its specific type.
[0047] Unity: An engine for rendering three-dimensional interfaces.
[0048] Lua: It is a lightweight and compact scripting language written in standard C language and open in source code form. It is designed to be embedded in applications, providing flexible expansion and customization capabilities for applications.
[0049] Figure 1 This is a schematic diagram of an implementation environment provided by the embodiment of the present application, see Figure 1 The implementation environment includes: a first terminal 120, a server 140 and a second terminal 160.
[0050] The first terminal 120 has an application installed and running that supports virtual scenes. The application can be any of a first-person shooter (FPS), a third-person shooter, a multiplayer online battle arena (MOBA), a virtual reality application, a three-dimensional map program, or a multiplayer shooter survival game. The first terminal 120 can be a terminal used by a first user, who uses the first terminal 120 to manipulate a first virtual object in the virtual scene to perform an activity, including but not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, and throwing. Illustratively, the first virtual object is a first virtual character, such as a simulated human character or an anime character.
[0051] The first terminal 120 and the second terminal 160 are connected to the server 140 via a wireless network or a wired network.
[0052] Server 140 may include at least one of a single server, multiple servers, a cloud computing platform, or a virtualization center. Server 140 provides backend services for applications supporting virtual scenarios. Optionally, server 140 may perform primary computing tasks, while first terminal 120 and second terminal 160 may perform secondary computing tasks. Alternatively, server 140 may perform secondary computing tasks, while first terminal 120 and second terminal 160 may perform primary computing tasks. Alternatively, server 140, first terminal 120, and second terminal 160 may collaborate on computing tasks using a distributed computing architecture.
[0053] Second terminal 160 has an application installed and running that supports virtual scenes. This application can be any of an FPS, third-person shooter, MOBA, virtual reality application, 3D map program, or multiplayer shooter survival game. Second terminal 160 can be used by a second user, who uses second terminal 160 to manipulate a second virtual object in the virtual scene to perform activities, including but not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, and throwing. Illustratively, the second virtual object is a second virtual character, such as a realistic or animated character.
[0054] Optionally, a first virtual object controlled by the first terminal 120 and a second virtual object controlled by the second terminal 160 are in the same virtual scene. In this case, the first virtual object can interact with the second virtual object in the virtual scene. In some embodiments, the first virtual object and the second virtual object can be in a hostile relationship. For example, the first virtual object and the second virtual object can belong to different teams or organizations. The hostile virtual objects can interact with each other on land by shooting at each other in a combat-like manner.
[0055] Optionally, the applications installed on the first terminal 120 and the second terminal 160 are the same, or the applications installed on the two terminals are the same type of applications on different operating system platforms. The first terminal 120 can generally refer to one of multiple terminals, and the second terminal 160 can generally refer to one of multiple terminals. This embodiment uses the first terminal 120 and the second terminal 160 as an example. The first terminal 120 and the second terminal 160 can be of the same or different device types, including at least one of a smartphone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer, and a desktop computer. For example, the first terminal 120 and the second terminal 160 can be smartphones or other handheld portable gaming devices. The following embodiments illustrate the example of a smartphone as a terminal.
[0056] Those skilled in the art will appreciate that the number of the above-mentioned terminals may be more or less. For example, the above-mentioned terminal may be only one, or the above-mentioned terminals may be dozens or hundreds, or a larger number. The embodiments of the present application do not limit the number of terminals and device types.
[0057] The method provided in the embodiment of the present application can be applied to the development terminal of the target application, see Figure 2 ,Should Figure 2The following is a class diagram of a map system provided by an embodiment of the present application. The target application's map system includes a map layer management module, MapLayerManager, and a base map view module, BaseMapView. The map layer management module defines a layer name class, a display follower class, and a weather impact class, which are used to manage map size, coordinate conversion, and element levels. It also manages whether elements follow map zooming, whether they are affected by fog or extreme weather, and other factors. The map layer management module can provide various interfaces for updating map elements, including single coordinate point updates, two-point line updates, and batch updates. The base map view module defines a global map base class and a local map base class, which are responsible for switching maps, loading, and updating various map elements. The base map view module includes a global map base class submodule. When a display status update operation on the global map is detected, the global map base class submodule is used to call the corresponding function in the global map base class submodule according to the operation type of the display status update operation; the display of the global map is updated through the corresponding function in the global map base class submodule. The above display status update operations may include zooming, dragging, clicking, automatically centering an element, and refreshing fog. The main function of the local map base class submodule MiniMapView is to move the map to ensure that the protagonist is in the center of the map when the protagonist moves.
[0058] Optionally, in order to realize the zoom and drag functions of the global map, the embodiment of the present application also expands the zoom display, multi-touch and automatic centering functions of the global map based on the native ScrollRect component, and also rewrites the drag and click interfaces to form the following Figure 3 The MapScrollView component shown.
[0059] Figure 4 This is a flowchart of a method for adding map elements provided by an embodiment of the present application. Figure 4 , the method comprising:
[0060] 401. For the map element to be added, based on the encapsulated level name class, display follower class and weather impact class in the map level management module, create the name of the level to which the map element belongs, the display follower information of the map element at the level and the weather impact information of the map element.
[0061] The map element can be any display element or interactive element. For example, for a newly added feature element, its level can be defined based on the existing class, and it can be defined whether it follows the map zoom and whether it is affected by shortness of breath weather.
[0062] 402. Create a prefab of the map element in the target folder, where the name of the prefab is a combination of the name of the layer to which it belongs and the name of the map element.
[0063] The target folder can be a folder preset as an element path, in which prefabs can be created according to the naming method of level + name. For example, the prefab stores a game object, including all components of the game object and all sub-game objects under it.
[0064] 403. Based on the global map base class and the local map base class in the basic map view module, add code for updating the map element, wherein the code is used to indicate the storage location of the prefab of the map element and the display status information of the map element when displayed at the level.
[0065] By adding the code for updating the map elements in step 403, the updated display of the map elements can be realized by the code during implementation.
[0066] In one possible implementation, when a map element has its own special logic, such as a clickable navigation function, you can also add your own script.
[0067] Because the modules above already encapsulate the interfaces required to add new elements, developers don't need to worry about how to implement internal functions during development, and can complete related requirements with minimal effort. By using this underlying structure to add elements, development time can be greatly shortened, and the above three or four steps can be completed in less than an hour.
[0068] In order to reduce the amount of processor calculations and reduce the frequency of canvas reconstruction, the update frequency of map elements can be minimized. Accordingly, the method can include: setting the update interval of the map display interface to be longer than the display duration of two frames. For example, for specific objects, such as real-time changing self-position, teammate position, assassination target and other elements, the update frequency can be reduced from every frame to every two frames, or every 0.2s. In addition, the position of the map element can be modified and re-rendered each time a position change actually occurs, that is, the display update is performed when a change in the display position of the display element is detected. Optionally, to further reduce the update frequency, the determination of whether to perform a display update can be based on the degree of change in the distance between the map element's current position and its previous position. Specifically, this determination can be based on a pre-set distance threshold. After obtaining the current position of the target map element in the virtual world scene, the target map element's movement distance is determined based on the current and previous positions. This movement distance is then compared with the distance threshold. When the movement distance exceeds the distance threshold, a display update based on the current position is triggered. For example, a display update is triggered when element A's movement distance reaches 2 meters. Of course, the 2 meters refers to the distance measured in the virtual world scene using coordinates, not the actual distance in real life. Optionally, different distance thresholds can be set for different map elements. This allows map elements with high display requirements and a greater impact on the overall scene to be updated promptly. A relatively small distance threshold can be set to ensure timely updates. For map elements with lower display requirements and a smaller impact on the overall scene, a relatively large distance threshold can be set. This ensures that some elements are updated promptly while reducing the overall update frequency. For example, if a first map element is detected as an element required by the terminal control object, such as a treasure, a first distance threshold can be configured for it. If a second map element is detected as an element already held by the terminal control object, such as a prop, a second distance threshold can be configured for it, where the first distance threshold is smaller than the second distance threshold. This distance-based display update can significantly reduce the update frequency and rendering overhead of map elements, thereby improving overall performance.
[0069] In one optional implementation, map elements can be categorized into different types based on their update characteristics. These types can include: map elements that persist after map loading, such as teleportation points; map elements that update based on events, such as mission markers and treasure markers; and real-time updating elements, such as the terminal's currently controlled object's own position, teammate positions, and specific map elements such as Eagle Eye mode targets, route information, and survivable area restriction information. Based on these element type categorizations, the decision to perform a display update can be made based on the element type. For example, during mini-map display, map elements that persist after map loading can be updated at a first, lower frequency. Event-based map elements can be updated only after an event is detected, and real-time elements can be updated at a second, higher frequency. By distinguishing display updates based on the map element's inherent update characteristics, the update frequency and rendering overhead of map elements can be significantly reduced, thereby improving overall performance.
[0070] In an optional implementation, a display update method that conforms to different game modes can be set. For example, for a 20V20 game mode, the positions of virtual objects in map elements can be updated in batches. At the first moment, the display is updated based on the positions of the first group of virtual objects at the first moment. At the next moment after the first moment, that is, the second moment, the display is updated based on the positions of the second group of virtual objects at the second moment. This reduces the amount of data that needs to be processed during each update and display process, thereby improving overall performance.
[0071] In one possible implementation, map elements frequently appear and disappear. To avoid game lag caused by frequent element loading and unloading, a memory pool is used to cache resources. To avoid the extra overhead caused by SetActive, these elements are moved off-screen to improve efficiency. The target application loads map elements that have been loaded a threshold number of times into the memory pool, eliminating the need to reload them with each refresh.
[0072] In one possible implementation, when switching from the first map to the second map, only some map elements in the first map that have been loaded in the memory pool can be cleared, while the duplicate map elements in the first map and the second map are retained. In this way, when loading the second map, reloading can be avoided, thereby achieving the purpose of improving the display loading speed.
[0073] In one possible implementation, there are many types of map elements, and there may be dozens of elements that exist at the same time. In order to reduce the number of drawcalls for rendering, the image resources of all map elements are put into an atlas. Placing all elements under one canvas can make the map element part only generate one drawcall, but this will cause the position of an element to change, and the texture coordinates of the entire canvas must be recalculated. Therefore, the map elements are separated into dynamic and static types. Frequently changing elements are placed under one canvas, and low-frequency elements are placed under one canvas, so as to achieve a balance between minimizing canvas reconstruction and minimizing drawcall waste. That is, the map elements whose change frequency of the target application is greater than the target frequency threshold and the map elements whose change frequency is less than the target frequency threshold are drawn in different canvases respectively. In an optional implementation, the map elements can be divided into different element types based on the characteristics of the map elements in updating, so that elements of different categories can be drawn in layers.
[0074] In one possible implementation, a local map, also known as a small map, is used to display a portion of the global map (also known as a large map). It is inevitable to apply a mask method. When applying the mask method, it is necessary to first draw the entire map, and then use the mask to cut out the portion for display. However, since the map itself is very large, this process causes a serious over-rendering problem, resulting in a serious waste of computing resources. For example, Figure 5 The area within the frame 500 shown in the figure is the terminal display area, the frame 501 is the entire map to be drawn, and the portion determined by the frame 502 is the final display portion. To this end, the target application can draw a local map based on texture clipping using a shader, and when displaying the local map, a picture with a hollow shape is superimposed on the local map. That is, in the embodiment of the present application, a special shader can be set for the base map portion of the local map, and the texture clipping method is used to draw based on the four vertices of the portion to be drawn, thereby avoiding the problem of OverDraw, such as Figure 6 As shown, Figure 6 The area within the middle frame 600 is the terminal display area, and the part determined by the frame 601 is the drawing part. The amount of calculation required for drawing is greatly reduced. At the same time, a picture with a shape can be passed in to do the hollowing out of the shape. The final display effect can be as follows: Figure 7. That is, when displaying the mini-map, the terminal can adopt a texture clipping method to draw the base map based on the four vertices of the mini-map area to be drawn, and draw a graphic with a hollow area in the upper layer of the base map based on the positions of the four vertices, so that the part of the base map corresponding to the hollow area can be observed by the human eye. For example, the hollow area can be a circular area. By drawing the displayed mini-map in this way, a smoother display can be achieved. Optionally, the hollow area can also have a gradient effect, that is, its transparency gradient, so that the display effect is soft and beautiful, which is more in line with the visual habits of the human eye.
[0075] The above process introduces the base map drawing method of the small map. The following provides a corresponding optimization method for the drawing process of the base map elements in this drawing process. The optimization can include the following three optimization aspects: 1. Each map element is calculated with the root node as the bounding box. For a map element, it can include multiple layers of UI nodes. In the embodiment of the present application, only the root node in the multi-layer UI node is used as the bounding box for calculation to draw the map element. Compared with some current technologies that need to traverse the parent node calculation method, it can improve the flexibility of the calculation and greatly reduce the amount of calculation while ensuring the display effect of the map element. 2. The relative coordinates of the UI node are used when calculating the intersection. 3. It can provide a special effect deletion function, that is, during the drawing process, the terminal can determine whether to display special effects in the minimap based on the user's choice. If the user sets the special effects to be displayed in the minimap, the special effects can be drawn when drawing map elements. When the user sets the special effects not to be displayed in the minimap, since the shader information corresponding to the special effects has been written into the code in advance, the special effects can be removed by controlling the shader corresponding to the special effects, that is, the special effects are not drawn on the minimap. Based on the above optimization method, the RectMask2D component is improved, and the improved component is applied to map drawing. It can reduce the amount of calculation while reducing drawcalls, and can improve the overall performance. Experiments have shown that based on the above optimization, the drawing consumption can be reduced by about 40%, which can greatly improve the display performance of the terminal.
[0076] In one possible implementation, the drawing of large-size map elements can also be optimized. For example, for map elements larger than a preset size, a new shader can be used to use a certain transparency as a blending factor to mix with the existing color values in the map elements to obtain a new color, thereby achieving a better display effect and avoiding the jagged display problem caused by the original clipping method.
[0077] The embodiment of the present application provides a map implementation solution. The map system is powerful and scalable, can improve the efficiency of use by others, and has good performance. It can be applied to various MOBA games and MMORPG games.
[0078] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0079] Figure 8 This is a schematic diagram of the structure of a map element adding device provided in an embodiment of the present application, see Figure 8 , the device comprises:
[0080] An element creation unit 801 is configured to create, for a map element to be added, a name of the layer to which the map element belongs, display follower information of the map element at the layer, and weather impact information of the map element based on the layer name class, display follower class, and weather impact class encapsulated in the map layer management module;
[0081] A prefab creating unit 802 is configured to create a prefab of the map element in a target folder, wherein the name of the prefab is a combination of the name of the layer to which it belongs and the name of the map element;
[0082] The code adding unit 803 is used to add code for updating the map element in the basic map view module, where the code is used to indicate the storage location of the prefab of the map element and the display status information of the map element when displayed at the level.
[0083] In a possible implementation, the display follow information is used to indicate whether the map element is scaled along with the map, and the weather impact information is used to indicate whether the map element is affected by virtual weather in the virtual scene.
[0084] In one possible implementation, the basic map view module includes a global map base class submodule, and the global map base class submodule is used to call a corresponding function in the global map base class submodule according to the operation type of the display status update operation when a display status update operation on the global map is detected; and update the display of the global map through the corresponding function in the global map base class submodule.
[0085] In one possible implementation, the global map base class submodule is used to:
[0086] When the display status update operation is a zoom operation, calling the zoom function in the global map base class submodule; or,
[0087] When the display status update operation is a drag operation, calling the position movement function in the global map base class submodule; or,
[0088] When the display status update operation is an automatic centering operation, the automatic centering function in the global map base class submodule is called.
[0089] In a possible implementation, display elements of the target application whose change frequency is greater than a target frequency threshold and display elements whose change frequency is less than the target frequency threshold are drawn in different canvases respectively.
[0090] In a possible implementation, the update interval of the display interface of the target application is greater than the display duration of two frames.
[0091] In a possible implementation, the target application performs a display update when detecting that a display position of a display element has changed.
[0092] In a possible implementation, the target application loads display elements whose loading times reach a threshold into a memory pool.
[0093] In a possible implementation, the target application may draw a local map by performing texture clipping based on a shader, and when displaying the local map, a picture with a hollow shape is superimposed on the local map.
[0094] In one possible implementation, the three-dimensional engine of the target application has a component that extends at least one of the zoom display, multi-touch, and automatic centering functions of the global map based on the native ScrollRect component.
[0095] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0096] It should be noted that the map element adding device provided in the above embodiment, when controlling interactive props, is merely illustrated by the division of the aforementioned functional modules. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, i.e., the internal structure of the terminal can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the map element adding device provided in the above embodiment and the map element adding method embodiment are based on the same concept. The specific implementation process is detailed in the map element adding method embodiment and will not be repeated here.
[0097] Figure 9The figure is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. Terminal 900 may be a smartphone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, or a desktop computer. Terminal 900 may also be referred to as user equipment, a portable terminal, a laptop terminal, a desktop terminal, or other similar names.
[0098] Typically, the terminal 900 includes a processor 901 and a memory 902 .
[0099] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0100] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one instruction, which is executed by the processor 901 to implement the map element addition method provided in various embodiments of the present application.
[0101] In some embodiments, terminal 900 may also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 903 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 904, a touchscreen display 905, a camera assembly 906, an audio circuit 907, and a power supply 909.
[0102] The peripheral device interface 903 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0103] The RF circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 904 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, and the like. The RF circuit 904 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 904 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0104] Display screen 905 is used to display a user interface (UI). This UI can include graphics, text, icons, videos, or any combination thereof. When display screen 905 is a touchscreen display, it can also capture touch signals on or above the surface of display screen 905. These touch signals can be input as control signals to processor 901 for processing. Display screen 905 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 can be a single display screen 905, located on the front panel of terminal 900. In other embodiments, there can be at least two display screens 905, located on different surfaces of terminal 900 or in a foldable design. In still other embodiments, display screen 905 can be a flexible display, located on a curved or foldable surface of terminal 900. Display screen 905 can also be configured as a non-rectangular, irregular shape, i.e., a special-shaped screen. Display screen 905 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0105] The camera assembly 906 is used to capture images or videos. Optionally, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0106] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals to be input into the processor 901 for processing, or input into the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal 900. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0107] Power supply 909 is used to power various components in terminal 900. Power supply 909 can be AC power, DC power, disposable batteries, or rechargeable batteries. When power supply 909 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.
[0108] In some embodiments, the terminal 900 further includes one or more sensors 910 , including but not limited to: an acceleration sensor 911 , a gyroscope sensor 912 , a pressure sensor 913 , an optical sensor 915 , and a proximity sensor 916 .
[0109] The accelerometer 911 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal 900. For example, the accelerometer 911 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 901 can control the touch screen display 905 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 911. The accelerometer 911 can also be used to collect game or user motion data.
[0110] The gyroscope sensor 912 can detect the orientation and rotation angle of the terminal 900. It can work with the accelerometer 911 to collect the user's 3D movements on the terminal 900. Based on the data collected by the gyroscope sensor 912, the processor 901 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0111] The pressure sensor 913 can be set on the side frame of the terminal 900 and / or the lower layer of the touch screen display 905. When the pressure sensor 913 is set on the side frame of the terminal 900, it can detect the user's grip signal of the terminal 900, and the processor 901 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 913. When the pressure sensor 913 is set on the lower layer of the touch screen display 905, the processor 901 controls the operable controls on the UI interface based on the user's pressure operation on the touch screen display 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0112] The optical sensor 915 is used to detect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the touchscreen display 905 based on the ambient light intensity detected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the touchscreen display 905 is increased; when the ambient light intensity is low, the display brightness of the touchscreen display 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 based on the ambient light intensity detected by the optical sensor 915.
[0113] Proximity sensor 916, also known as a distance sensor, is typically located on the front panel of terminal 900. Proximity sensor 916 is used to detect the distance between the user and the front of terminal 900. In one embodiment, when proximity sensor 916 detects that the distance between the user and the front of terminal 900 is gradually decreasing, processor 901 controls touchscreen display 905 to switch from the screen-on state to the screen-off state. When proximity sensor 916 detects that the distance between the user and the front of terminal 900 is gradually increasing, processor 901 controls touchscreen display 905 to switch from the screen-off state to the screen-on state.
[0114] Those skilled in the art will understand that Figure 9 The structure shown in the figure does not constitute a limitation on the terminal 900, and the terminal 900 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0115] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including at least one program code. The at least one program code can be executed by a processor in a terminal to implement the map element adding method of the above embodiment. For example, the computer-readable storage medium can be a ROM (Read-Only Memory), RAM (Random-Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, or optical data storage device.
[0116] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0117] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A method for adding map elements, characterized in that: The method is applied to a development terminal of a target application, wherein the target application includes a map hierarchy management module and a basic map view module. The map hierarchy management module defines a hierarchy name class, a display follow class, and a weather impact class. The map hierarchy management module is used to determine the hierarchy of map elements, whether map elements follow map zooming, and whether map elements are affected by weather. The basic map view module defines a global map base class and a local map base class. The basic map view module is used to update various map elements. The method includes: For a map element to be added, based on the encapsulated level name class, display follower class, and weather impact class in the map level management module, create the name of the level to which the map element belongs, display follower information of the map element at the level, and weather impact information of the map element. The map element refers to any display element displayed in the virtual scene. The display follower information is used to indicate whether the map element is scaled with the map. The weather impact information is used to indicate whether the map element is affected by virtual weather in the virtual scene. Create a prefab of the map element in the target folder, where the name of the prefab is a combination of the name of the layer to which it belongs and the name of the map element; Based on the global map base class and the local map base class in the basic map view module, code for updating the map element is added, and the code is used to indicate the storage location of the prefab of the map element and the display status information of the map element when it is displayed at the level.
2. The method according to claim 1, characterized in that The basic map view module includes a global map base class submodule, which is used to call the corresponding function in the global map base class submodule according to the operation type of the display status update operation when a display status update operation on the global map is detected; and update the display of the global map through the corresponding function in the global map base class submodule.
3. The method according to claim 2, characterized in that The calling of the corresponding function in the global map base class submodule according to the operation type of the display status update operation includes: When the display status update operation is a zoom operation, calling the zoom function in the global map base class submodule; or, When the display status update operation is a drag operation, calling the position movement function in the global map base class submodule; or, When the display status update operation is an automatic centering operation, the automatic centering function in the global map base class submodule is called.
4. The method according to claim 1, wherein The display elements of the target application whose change frequency is greater than a target frequency threshold and the display elements whose change frequency is less than the target frequency threshold are drawn in different canvases respectively.
5. The method according to claim 1, wherein The update interval of the display interface of the target application is longer than the display duration of two frames.
6. The method according to claim 1, characterized in that The target application performs display update when detecting that the display position of the display element changes.
7. The method according to claim 1, characterized in that The target application loads display elements whose loading times reach a threshold into a memory pool.
8. The method according to claim 1, characterized in that The target application performs texture clipping based on a shader to draw a local map. When the local map is displayed, a picture with a hollow shape is superimposed on the local map.
9. The method according to claim 1, characterized in that The three-dimensional engine of the target application has a component that expands at least one of the zoom display, multi-touch and automatic centering functions of the global map based on the native ScrollRect component.
10. A map element adding device, characterized in that: The device is applied to a development terminal of a target application, wherein the target application includes a map layer management module and a basic map view module. The map layer management module defines a layer name class, a display follow class, and a weather impact class. The map layer management module is used to determine the layer of map elements, whether map elements follow map zooming, and whether map elements are affected by weather. The basic map view module defines a global map base class and a local map base class. The basic map view module is used to update various map elements. The device includes: an element creation unit, configured to create, for a map element to be added, a name of the layer to which the map element belongs, display follower information for the map element at the layer, and weather influence information for the map element based on the layer name class, display follower class, and weather influence class encapsulated in the map layer management module, wherein the display follower information indicates whether the map element is scaled with the map, and the weather influence information indicates whether the map element is affected by virtual weather in the virtual scene; a prefab creating unit, configured to create a prefab of the map element in a target folder, wherein the name of the prefab is a combination of the name of the layer to which it belongs and the name of the map element; A code adding unit is used to add code for updating the map element based on the global map base class and the local map base class in the basic map view module, wherein the code is used to indicate the storage location of the prefabricated body of the map element and the display status information of the map element when it is displayed at the level.
11. The device according to claim 10, characterized in that The basic map view module includes a global map base class submodule, which is used to call the corresponding function in the global map base class submodule according to the operation type of the display status update operation when a display status update operation on the global map is detected; and update the display of the global map through the corresponding function in the global map base class submodule.
12. The device according to claim 11, characterized in that The global map base class submodule is used to: When the display status update operation is a zoom operation, calling the zoom function in the global map base class submodule; or, When the display status update operation is a drag operation, calling the position movement function in the global map base class submodule; or, When the display status update operation is an automatic centering operation, the automatic centering function in the global map base class submodule is called.
13. The device according to claim 10, characterized in that The display elements of the target application whose change frequency is greater than a target frequency threshold and the display elements whose change frequency is less than the target frequency threshold are drawn in different canvases respectively.
14. The device according to claim 10, characterized in that The update interval of the display interface of the target application is longer than the display duration of two frames.
15. The device according to claim 10, characterized in that The target application performs display update when detecting that the display position of the display element changes.
16. The device according to claim 10, characterized in that The target application loads display elements whose loading times reach a threshold into a memory pool.
17. The device according to claim 10, characterized in that The target application performs texture clipping based on a shader to draw a local map. When the local map is displayed, a picture with a hollow shape is superimposed on the local map.
18. The device according to claim 10, characterized in that The three-dimensional engine of the target application has a component that expands at least one of the zoom display, multi-touch and automatic centering functions of the global map based on the native ScrollRect component.
19. A terminal, characterized in that: The terminal includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the operations performed by the map element adding method according to any one of claims 1 to 9.
20. A storage medium, characterized in that The storage medium stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the operations performed by the map element adding method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Template based one-button type thematic map automatic forming method and system
CN104008162A
Cited By
Map element adding method, device, terminal, and storage medium
WO2021143262A1