Patent Description:
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for adding a map element, a terminal, and a storage medium.

With the development of computer technologies and the diversification of terminal functions, more and more types of games can be run on a terminal.

To perceive a position or the like in a virtual scene, many games start to provide a map function, which provides a game player with prompts and convenience. For example, a game provides a map displayed in a virtual scene.

However, the development of a map requires a lot of labor. A display setting of each map element needs to be implemented through complex code writing, and a display logic of the map element is complex, resulting in low development efficiency and high development complexity.

<NPL> discloses adding a GameObject to a scene in a unity editor, the scene corresponding to a map, where the unit editor includes a layer manager that establishes the layer to which a certain game object belongs and a camera module which establishes the view of the map, the layer name for rendering the object is set in the inspector, the layer of the prefab can be set at the creation time of the prefab.

<NPL>), Retrieved from the Internet:URL:https://www. com/watch?v=28JTTXqMvOU&t=<NUM> discloses creating a minimap in the unity editor, which involves creating a minimap from a main map, and includes: adding a new camera view and pinning it in the main scene; linking the behaviour of the minimap to the behaviour and property of the objects in the main map via the use of adding a script component, where the script component describes the behaviour of the object with respect to changes of the scene or events.

Design <NPL> [retrieved on <NUM>-<NUM>-<NUM>] discloses the use of script components in the unity editor.

According embodiments of the present disclosure, a method for adding a map element, a terminal, and a storage medium are provided, so as to improve development efficiency and reduce development complexity. The technical solutions are as follows.

According to an aspect, a method for adding a map element is provided. The method is applicable to a development terminal of a target application, the target application including a map layer manager module and a base map view module, the map layer manager module including a layer name class, a display follow class, and a weather impact class, the base map view module including an area map base class and a minimap base class,.

In some embodiments, the display follow information indicates whether the map element zooms with a map, and the weather impact information indicates whether the map element is affected by a virtual weather in a virtual scene.

In some embodiments, the base map view module includes an area map base class submodule, and the area map base class submodule is configured to: invoke, in response to detection of a display state update operation for an area map, a function that is in the area map base class submodule and that corresponds to an operation type of the display state update operation; and update a display of the area map by using the function in the area map base class submodule.

In some embodiments, the area map base class submodule is configured to:.

In some embodiments, a first-class map element and a second-class map element of the target application are drawn in different canvases, the first-class map element changes at a frequency greater than a target frequency threshold, and the second-class map element changes at a frequency less than the target frequency threshold.

In some embodiments, an update interval of a display interface of the target application is longer than a display duration of two frames.

In some embodiments, the target application performs a display update in response to detection of a change in a display position of the display element.

In some embodiments, the target application loads a map element that is loaded for a threshold number of times into a memory pool.

In some embodiments, the target application expands at least one of a zoom display function, a multi-touch function and a centering function for the area map, and a three-dimensional engine of the target application includes a component having the at least one function.

In some embodiments, the target application performs a display update according to a distance change degree of the map element between a first position and a second position in a virtual scene, the first position is a position of the map element in the virtual scene at a current time instant, and the second position is a position of the map element in the virtual scene at a previous time instant.

In some embodiments, the performing, by the target application, a display update according to a distance change degree of the map element between a first position and a second position in a virtual scene includes:.

In some embodiments, different map elements correspond to different distance thresholds.

In some embodiments, an element type of the map element includes a map element that does not change after a map is loaded, a map element that is updated based on an event, and an element that is updated in real time.

According to an aspect, a terminal is provided, the terminal including one or more processors and one or more memories, the one or more memories storing at least one piece of program code, the at least one piece of program code being loaded and executed by the one or more processors to implement the operations performed by any one of possible implementations of the method for adding a map element described above.

According to an aspect, a storage medium is provided, the storage medium storing at least one piece of program code, the at least one piece of program code being loaded and executed by a processor to implement any one of possible implementations of the method for adding a map element described above.

The technical solutions of the embodiments of the present disclosure provide a novel development framework, in which classes for implementing maps are encapsulated in a corresponding module in advance, so that when adding a map element, the map element can be created based on the existing classes in the module, thereby greatly improving development efficiency and avoiding development complexity.

To describe the technical solutions in embodiments of the present disclosure more clearly, the following briefly describes the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following descriptions show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may still derive other accompanying drawings from these accompanying drawings without creative efforts.

To make the objectives, technical solutions, and advantages of the present disclosure clearer, the following further describes the implementations of the present disclosure in detail with reference to the accompanying drawings.

The terms involved in the present disclosure are explained as follows.

A virtual scene is displayed (or provided) by an application when the application runs on a terminal.

In some embodiments, the virtual scene may be a simulated environment of a real world, a semi-simulated and semi-fictional virtual environment, or a completely fictional virtual environment.

In some embodiments, the virtual scene is any one of a two-dimensional virtual scene, a <NUM>-dimensional virtual scene, and a three-dimensional virtual scene. A dimension of the virtual scene is not limited in the embodiments of the present disclosure. For example, the virtual scene includes sky, land, ocean, or the like. The land includes an environmental element such as a desert and a city. A user controls a virtual object to move in the virtual scene.

A virtual object is a movable object in the virtual scene.

In some embodiments, the movable object is a virtual character, a virtual animal, a cartoon character, or the like, such as a character, an animal, a plant, an oil drum, a wall, or a stone displayed in a virtual scene. The virtual object is a virtual figure representing a user in the virtual scene. In some embodiments, the virtual scene includes multiple virtual objects, and each virtual object has a shape and a volume in the virtual scene, and occupies some space in the virtual scene.

In some embodiments, the virtual object is a player character controlled through an operation on a client, an artificial intelligence (AI) set in the virtual scene, or a non-player character (NPC) set in the virtual scene. In some embodiments, the AI set in the virtual scene is obtained through model training.

In some embodiments, the virtual object is a virtual character competing in the virtual scene.

In some embodiments, of the number of virtual objects joining in interaction in the virtual scene is preset, or is dynamically determined according to of the number of clients participating in the interaction.

A user interface (UI) design is an overall design of a human-computer interaction, an operation logic, and an aesthetically pleasing interface of software.

A map system is a strategically indispensable part of a multiplayer online battle arena (MOBA) and a massive multiplayer online role-playing game (MMORPG), and is also one of the most frequently used functions by a player in a game. The map system is a set of UI thumbnails of game scenes and UI elements dynamically marking key positions, and generally includes an area map (which is also called a big map) and a minimap (which is also called a mini-map). A player generally observes an overall view of a game by using a map function. For example, in the MOBA, a player uses a map to clearly observe the positions of creeps, defensive towers, terrains, monsters, and heroes of both sides. In another example, in the MMORPG, a player uses a map to view the position of the player or another player, to find an NPC, a monster and a teleporter.

The map element in the embodiments of the present disclosure is any one of display elements in the virtual scene. In some embodiments, the map element includes a virtual object, a virtual item, and an environment element. A specific type of the map element is not limited in the embodiments of the present disclosure.

Unity is an engine for rendering a three-dimensional interface.

Lua is a lightweight and small script language, written in standard C language and exposed as source code. Lua is designed to be embedded into an application, so as to provide flexible extended and customized functions.

<FIG> is a schematic diagram of an implementation environment according to an embodiment of the present disclosure. Referring to <FIG>, the implementation environment includes a first terminal <NUM>, a server <NUM>, and a second terminal <NUM>.

An application supporting a virtual scene is installed and run on the first terminal <NUM>. In some embodiments, the application is any one of a first-person shooting game (FPS), a third-person shooting game, the MOBA, a virtual reality application, a three-dimensional map program, a military simulation program, and a multiplayer gunfight survival game. The first terminal <NUM> is used by a first user, and the first user uses the first terminal <NUM> to operate a first virtual object located in the virtual scene to perform an action. The action includes, but is not limited to, at least one of adjusting a body posture, crawling, walking, running, cycling, jumping, driving, picking-up, shooting, attacking, and throwing. Schematically, the first virtual object is a first virtual character such as a simulated character role or a cartoon character role.

The first terminal <NUM> and the second terminal <NUM> are connected to the server <NUM> by using a wireless network or a wired network.

The server <NUM> includes at least one of a server, multiple servers, a cloud computing platform, and a virtualization center. The server <NUM> is used for providing a backend service for the application supporting the virtual scene. In some embodiments, the server <NUM> takes on primary computing work, and the first terminal <NUM> and the second terminal <NUM> take on secondary computing work; alternatively, the server <NUM> takes on secondary computing work, and the first terminal <NUM> and the second terminal <NUM> take on primary computing work; alternatively, the server <NUM>, the first terminal <NUM>, and the second terminal <NUM> function as a distributed computing architecture to perform collaborative computing.

An application supporting a virtual scene is installed and run on the second terminal <NUM>. In some embodiments, the application is any one of the FPS, the third-person shooting game, the MOBA, the virtual reality application, the three-dimensional map program, the military simulation program, and the multiplayer gunfight survival game. The second terminal <NUM> is used by a second user. The second user uses the second terminal <NUM> to operate a second virtual object in the virtual scene to perform an action. The action includes, but is not limited to, at least one of adjusting a body posture, crawling, walking, running, cycling, jumping, driving, picking-up, shooting, attacking, and throwing. Schematically, the second virtual object is a second virtual character such as a simulated character role or a cartoon character role.

In some embodiments, the first virtual object controlled by the first terminal <NUM> and the second virtual object controlled by the second terminal <NUM> are located in the same virtual scene. In this case, the first virtual object interacts with the second virtual object in the virtual scene.

In some embodiments, the first virtual object is hostile to the second virtual object, for example, the first virtual object and the second virtual object belong to different teams and different organizations, and the virtual objects in a hostile relationship fight against each other by shooting at each other on land.

In some embodiments, the applications installed on the first terminal <NUM> and the second terminal <NUM> are the same, or the applications installed on the two terminals are the same type of application on different operation system platforms. The first terminal <NUM> is generally one of multiple terminals, and the second terminal <NUM> is generally one of multiple terminals. In the embodiments of the present disclosure, only the first terminal <NUM> and the second terminal <NUM> are used for description. The first terminal <NUM> and the second terminal <NUM> are of the same device type or of different device types. The device type includes at least one of a smartphone, a tablet computer, an e-book reader, a moving picture experts group audio layer III (MP3) player, a moving picture experts group audio layer IV (MP4) player, a portable laptop computer, a desktop computer, and the like. For example, the first terminal <NUM> and the second terminal <NUM> are the smartphones, or other handheld portable game devices. The following embodiment is described by using an example that the terminals are smartphones.

A person skilled in the art learn that there may be more or fewer terminals. For example, there is only one terminal, or there may be dozens of or hundreds of terminals or more. The quantity and the device type of the terminal are not limited in the embodiments of the present disclosure.

In some embodiments, the method according to the embodiments of the present disclosure is applicable to a development terminal of a target application. Reference is made to <FIG>, which is a schematic diagram showing classes of a map system according to an embodiment of the present disclosure.

The map system of the target application includes a map layer manager module (MapLayerManager) <NUM> and a base map view module (BaseMapView) <NUM>. The map layer manager module <NUM> includes a layer name class (LayerNameCfg). The map layer manager module <NUM> is configured to manage a map size, coordinate conversion, and an element layer. Further, the map layer manger module <NUM> includes a display follow class (ScallFollowCfg) configured to manage whether an element zooms with a map, and a weather impact class (WeatherMaskWhiteList) configured to manage whether an element is affected extreme weather such as frog. The map layer manager module <NUM> provides various interfaces updating the map element, including a single coordinate point update, a double-point connection update, and a batch update.

The base map view module <NUM> defines an area map base class and a minimap base class, and is responsible for the functions of switching a map and loading and updating various map elements of the map. The base map view module <NUM> includes an area map base class submodule (AreaMapBase), and the area map base class submodule is configured to: invoke, in response to detection of a display state update operation for an area map, a function that is in the area map base class submodule and that corresponds to an operation type of the display state update operation; and update a display of the area map by using the function in the area map base class submodule.

In some embodiments, the display state update operation includes zooming the map, dragging, clicking, centering a map element, and refreshing fog. The main function of the minimap base class submodule (MiniMapView) is moving a map to ensure that a leading role is in the center of the map in a case that the leading role moves.

In some embodiments, to implement zoom and drag functions on the area map, according to an embodiment of the present disclosure, a zoom display function, a multi-touch function, and a centering function for the area map are expended based on native ScrollRect components, and drag and click interfaces are rewritten, to form a MapScrollView component as shown in <FIG>.

<FIG> is a flowchart of a method for adding a map element according to an embodiment of the present disclosure. The method according to the embodiments of the present disclosure is applicable to a development terminal of a target application. Referring to <FIG>, the method includes the following steps <NUM> to <NUM>.

In step <NUM>, for a to-be-added map element, a name of a layer to which the map element belongs, display follow information of the map element in the layer, and weather impact information of the map element are created based on the layer name class, the display follow class, and the weather impact class in the map layer manager module.

The map element is any one of display elements or interaction elements. For example, for a newly added map element, a layer to which the map element belongs is defined based on existing classes, and whether the map element zooms with the map, whether the map element is affected by the weather, and the like are defined.

In step <NUM>, a prefab of the map element is created in a target folder, a name of the prefab being a combination of the name of the layer and a name of the map element.

The target folder corresponds to a storage path of the preform. In some embodiments, in the target folder, a prefab may be created and named in a form of layer+name. For example, the prefab storages a game object, all components of the game object and all subgame objects subordinate to the game object.

In step <NUM>, a code for updating the map element is added based on the area map base class and the minimap base class in the base map view module, the code indicates a storage position of the prefab of the map element and display state information of the map element being displayed in the layer.

The code for updating the map element is added by using step <NUM>, so that the updated display of the map element may be implemented by using the code.

In some embodiments, the responding to the map element further has a special logic. For example, if a way finding function is clicked, a script may be added. The way finding function is a smart function in a game, by which a game object can be moved to a specific position through a fastest moving route.

The foregoing modules encapsulate various interfaces for adding a new map element. Therefore, it is not necessary for a developer to consider the manner of implementing an internal function, to complete a related requirement with a minimal workload. A development time can be greatly reduced by adding the map element through the foregoing bottom layer structure.

In some embodiments, to reduce the computing amount of a processor and the frequency of recreating a canvas, the update frequency of the map element is reduced to the greatest extent. Correspondingly, the method includes: setting an update interval of a display interface of the map to be longer than a display duration of two frames. For example, for an element that changes in real time, including the position of a specific object, for example, an object controlled by a terminal, the position of a teammate of the object, and an assassination target, updating frame by frame is changed to updating every two frames or updating every N seconds. In some embodiments, the value of N is <NUM>. In addition, every time the position actually changes, the position of the map element may be re-rendered. That is, when the display position of the map element changes, display update is performed.

In some embodiments, to further reduce update frequency, whether to perform the display update is determined based on the distance change degree of the map element between a first position and a second position. The first position is the position of the map element at a current time instant, and the second position is the position of the map element at a previous time instant. In some embodiments, whether to perform the display update is determined based on a preset distance threshold. When a position of a target map element in the virtual scene at the current time instant is obtained, a movement distance of the target map element is determined based on positions of the target map element at the current time instant and a previous time instant, and the movement distance is compared with the distance threshold. In response to that the movement distance is greater than the distance threshold, a display update process is triggered. For example, when a movement distance of an element A reaches M meters, the display update is triggered. In some embodiments, the value of M is <NUM>. Certainly, the <NUM> meters is a distance measured with the coordinates of the virtual scene in the virtual scene rather than an actual distance in real world.

In some embodiments, for different map elements, different distance thresholds are set, so that display update can be performed in time for a map element that has a higher display requirement and has a greater impact on an overall scene. For the map element that has a high display requirement and has a greater impact on the overall scene, a smaller distance threshold is set to perform update in time. For a map element that has a lower display requirement and has a smaller impact on the overall scene, a larger distance threshold is set, to ensure that an overall update frequency is reduced while some elements are updated in time. For example, for a first map element, if it is detected that the first map element is an element such as a treasure required by the object controlled by the terminal, the first map element is configured with a first distance threshold; and for a second map element, if it is detected that the second map element is an element such as an item that is already held by the object controlled by the terminal, the second map element is configured with a second distance threshold. The first distance threshold is less than the second distance threshold. Through the foregoing display update based on a distance, the update frequency and the rendering consumption of the map element can be greatly reduced, thereby improving overall performance.

In some embodiments, based on update characteristics of map elements, the map elements are classified into different element types. The element types include a map element that does not change after a map is loaded, for example, a teleporter; a map element that is updated based on an event, for example, a mission mark or a treasure mark; and an element that is updated in real time, for example, a position of an object controlled by the terminal, a position of a teammate of the object, some specific map elements, a hawkeye mode target, airline information, and survivable region restriction information. Based on the foregoing classification of element types, whether to perform a display update is determined based on the element types. For example, in the process of displaying a minimap, for the map element that does not change after a map is loaded, the display update is performed at a first update frequency. That is, the first update frequency is a low update frequency. For the map element that is updated based on an event, the display update is performed only after the event is detected. For the element that is updated in real time, the display update is performed at a second update frequency. The second update frequency is greater than the first update frequency. Through the foregoing update characteristics based on the map element, the display update is performed differently, so that the update frequency and the rendering consumption of the map element can be greatly reduced, thereby improving overall performance.

In some embodiments, for different game modes, a display update manner that matches the game mode is set. For example, for a game mode of <NUM> vs <NUM>, positions of virtual objects in the map element is updated in batches. The update in batches refers to that at a first time instant, a display update is performed based on the positions of a first group of virtual objects at the first time instant, and at a time instant subsequent to the first time instant, that is, a second time instant, a display update is performed based on positions of a second group of virtual objects at the second time instant, so that the amount of data processed in every display update process is reduced, thereby improving overall performance.

In some embodiments, the map element on the map often appears or disappears. To avoid frequent loading and unloading of a map element causing a game to freeze, a memory pool is used for caching resources, which can further avoid extra consumption caused by a SetActive (which is used for controlling display and hiding of a game object in Unity) and improve efficiency. The target application loads a map element that is loaded for a threshold number of times into a memory pool, so that it is not necessary to reload the map element at every refresh.

In some embodiments, when the first map is switched to the second map, only a part of map elements in the first map that is loaded in memory pool are cleared, while a map element shared by the first map and the second map is reserved, so that when the second map is loaded, reloading of the shared map element can be avoided, thereby improving a loading speed.

In some embodiments, there are various types of map elements, and tens of map elements may coexist. To reduce the rendering and invoking of a drawcall (a process in which a CPU prepares data and notifies a GPU of the data in Unity is called a drawcall), picture resources of all map elements are stored in an atlas. All map elements are placed on one canvas, so that only one drawcall is generated for the map elements. However, in this case, when the position of one map element changes, texture coordinates need to be recalculated for the entire canvas. Accordingly, dynamic and static separation is performed on the map elements. Elements that change frequently are placed on one canvas, and map elements that change infrequently are placed on another canvas. A balance is reached between minimizing canvas reconstruction and minimizing a drawcall waste. That is, the target application draws the first-class map element and the second-class map element on different canvases. The first-class map element changes at a frequency greater than a target frequency threshold, and the second-class map element changes at a frequency less than the target frequency threshold. In some embodiments, based on the update characteristics of the map elements, the map elements are classified into different element types, so that different types of map elements are drawn in different layers.

The minimap (that is, a mini-map) is a part of the area map (that is, a big map), and is obtained by using a mask method. When the mask method is used, the entire map is drawn first, and a part of the entire map is cropped of the entire map through the mask and is displayed. However, due to the large size of the map, the processing causes a serious overdraw problem, leading to a serious waste of computing resources. As shown in <FIG>, a region inside a box <NUM> in <FIG> is a display area of the terminal. The box <NUM> is the entire drawn map, but a part determined by the box <NUM> is a final display part. Accordingly, the target application performs texture cropping to draw a minimap based on a shader, and a picture with a hollowed-out shape is superimposed on the minimap when the minimap is displayed. That is, the embodiments of the present disclosure provide a dedicated shader for the base part of the minimap, which uses a manner of texture cropping to perform drawing based on four vertices of a to-be-drawn part, thereby avoiding the overdraw problem.

As shown in <FIG>, an area inside a box <NUM> in <FIG> is a display area of the terminal. A part determined by the box <NUM> is a part to be drawn, and a computing amount required for the drawing is greatly reduced. Further, a picture with a shape is imported to perform hollowing on the shape. A final display effect of the hollowing is shown in a circular region framed by a box <NUM> in <FIG>. That is, when the minimap is displayed, the terminal uses the manner of texture cropping to draw the base map based on the four vertices of the to-be-drawn part of the minimap. A shape with a hollowed-out region is drawn 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 hollowed-out region is observable by human eyes. For example, the hollowed-out region is a circular region. By drawing the displayed minimap in this way, a smooth display can be implemented. In some embodiments, the hollowed-out region also has a gradient effect. That is, the transparency of the hollowed-out region is gradient, making the display effect soft, aesthetically pleasing, and more suitable for a visual habit of human eyes.

The foregoing process introduces a method for drawing a base map of the minimap. In some embodiments, optimized methods for drawing a base map element in this drawing process is provided, which is described as follows. The optimization includes the following three optimization manners. Computation of each map element is performed using a root node as a bounding box. A map element includes multiple layers of UI nodes. In the embodiments of the present disclosure, only the root node of the multiple layers of UI nodes is used as the bounding box to perform computing, to draw the map element. Compared with a computing method of traversing parent nodes in the conventional technology, the flexibility of computing is improved, and the computing amount is greatly reduced while ensuring the display effect of the map element. The relative coordinates of the UI node is used for computing intersectivity.

A predefined effect delete function is provided. That is, during drawing, the terminal determines, according to selection by a user, whether to display a predefined effect in the minimap. If the user sets that a predefined effect is to be displayed in the minimap, the predefined effect is drawn when the map element is drawn. If the user sets that a predefined effect is not to be displayed in the minimap, because shader information corresponding to the predefined effect is written in the code in advance, the predefined effect is deleted by controlling a shader corresponding to the predefined effect. That is, the predefined effect is not drawn on the minimap. A RectMask2D component is improved based on the foregoing optimization methods, and the improved component is applied to map drawing, which can reduce a computing amount while reducing drawcalls, thereby improving overall performance. Experiments prove that, based on the foregoing optimization, the drawing consumption can be reduced by about <NUM>%, thereby greatly improving the display performance of the terminal.

In some embodiments, the drawing of a large-size map element is optimized. For example, for a map element whose size is larger than a preset size, a new color is obtained by mixing a new shader with a certain degree of transparency as a mixing factor with an existing color value in the map element, thereby implementing an adequate display effect and avoiding a jagged display problem caused by the original cropping method.

In addition, frequent interactions between C# and Lua also cause a lot of extra performance consumption. The most direct solution is to reduce the interactions between C# and Lua. In addition, when C# interacts with Lua, complex value types such as Vector <NUM> and Vector <NUM> unique to C# need to be noted additionally. These value types on the C# side are reference types on the Lua side, which causes extra memory allocation, and requires creating a corresponding structure in advance, and then updating the value thereof in each frame of logic.

The embodiments of the present disclosure provide a map implementation solution. The map system has a powerful function and high expansibility, can improve use efficiency, has adequate performance, and is applicable to various MOBA games and MMORPG games.

Any combination of the foregoing optional technical solutions may be used to form an optional embodiment of the present disclosure.

<FIG> is a schematic structural diagram of an apparatus for adding a map element according to an embodiment of the present disclosure. The apparatus is applicable to a development terminal of a target application. The target application includes a map layer manager module and a base map view module. The map layer manager module includes a layer name class, a display follow class, and a weather impact class. The base map view module includes an area map base class and a minimap base class. Referring to <FIG>, the apparatus includes an element creation unit <NUM>, a prefab creation unit <NUM>, and a code addition unit <NUM>.

The element creation unit <NUM> is configured to create, for a to-be-added map element, a name of a layer to which the map element belongs, display follow information of the map element in the layer, and weather impact information of the map element, based on the layer name class, the display follow class, and the weather impact class in the map layer manager module.

The prefab creation unit <NUM> is configured to create a prefab of the map element in a target folder, a name of the prefab being a combination of the name of the layer and a name of the map element.

The code addition unit <NUM> is configured to add a code for updating the map element to the base map view module, the code indicating a storage position of the prefab of the map element and display state information of the map element being displayed in the layer.

In some embodiments, the target application performs a display update in response to detection of a change in a display position of the map element.

In some embodiments, the target application draws a minimap by performing texture cropping based on a shader, and display the minimap by superimposing a picture with a hollowed-out shape on the minimap.

In some embodiments, the target application performing a display update according to a distance change degree of the map element between a first position and a second position in a virtual scene includes:.

When the apparatus for adding a map element provided in the foregoing embodiments adds a map element, the division of the foregoing functional modules is merely an example for description. In a practical application, the functions may be assigned to and completed by different functional modules according to the requirements, that is, the internal structure of a terminal is divided into different functional modules, to implement all or some of the functions described above. In addition, the embodiments of the apparatus and method for adding a map element provided in the foregoing embodiments belong to one conception. For the specific implementation process, reference may be made to the embodiments of the method for adding a map element, and details are not described herein again.

<FIG> is a schematic structural diagram of a terminal according to an embodiment of the present disclosure. In some embodiments, the terminal <NUM> includes a smartphone, a tablet computer, an MP3 player, an MP4 player, a notebook computer, or a desktop computer. The terminal <NUM> may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal or the like.

Generally, the terminal <NUM> includes a processor <NUM> and a memory <NUM>.

The processor <NUM> includes one or more processing cores, for example, a <NUM>-core processor or an <NUM>-core processor. The processor <NUM> may be implemented by at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor <NUM> alternatively includes a main processor and a coprocessor. The main processor is configured to process data in an active state, also referred to as a central processing unit (CPU). The coprocessor is a low-power processor configured to process data in a standby state. In some embodiments, the processor <NUM> may be integrated with a graphics processing unit (GPU). The GPU is used for rendering and drawing content that needs to be displayed in a display. In some embodiments, the processor <NUM> further includes an AI processor. The AI processor is configured to process a computing operation related to machine learning.

The memory <NUM> includes one or more computer-readable storage media. The computer-readable storage medium may be non-transient. The memory <NUM> further includes a highspeed random access memory and a non-volatile memory, such as one or more magnetic disk storage devices or a flash storage device. In some embodiments, the non-transitory computer-readable storage medium in the memory <NUM> is configured to store at least one piece of program code, and the at least one piece of program code is configured to be executed by the processor <NUM> to implement the method for adding a map element provided in the embodiments of the present disclosure.

In some embodiments, the terminal <NUM> may optionally include: a peripheral interface <NUM> and at least one peripheral. The processor <NUM>, the memory <NUM>, and the peripheral interface <NUM> are connected by using a bus or a signal cable. Each peripheral is connected to the peripheral interface <NUM> through a bus, a signal cable, or a circuit board. In some embodiments, the peripheral includes: at least one of a radio frequency (RF) circuit <NUM>, a display screen <NUM>, a camera component <NUM>, an audio circuit <NUM>, a positioning component <NUM>, and a power supply <NUM>.

The peripheral interface <NUM> is configured to connect at least one peripheral related to input/output (I/O) to the processor <NUM> and the memory <NUM>. In some embodiments, the processor <NUM>, the memory <NUM>, and the peripheral interface <NUM> are integrated on the same chip or circuit board. In some other embodiments, any one or two of the processor <NUM>, the memory <NUM>, and the peripheral interface <NUM> is implemented on an independent chip or circuit board. This is not limited in the embodiments of the present disclosure.

The radio frequency circuit <NUM> is used for receiving and transmitting a radio frequency (RF) signal, which is also referred to as an electromagnetic signal. The RF circuit <NUM> communicates with a communication network and other communication devices through the electromagnetic signal. The RF circuit <NUM> converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. In some embodiments, the RF circuit <NUM> includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chip set, a subscriber identity module card, and the like. The RF circuit <NUM> communicates with other terminals by using at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to, a metropolitan area network, generations for mobile communication networks (<NUM>, <NUM>, <NUM>, and <NUM>), a wireless partial area network, and/or a wireless fidelity (Wi-Fi) network. In some embodiments, the RF circuit <NUM> further includes a circuit related to near field communication (NFC), which is not limited in the present disclosure.

The display screen <NUM> is used for displaying a UI. The UI includes a graph, a text, an icon, a video, and any combination thereof. When the display screen <NUM> is a touch display screen, the display screen <NUM> is further capable of collecting a touch signal on or above a surface of the display screen <NUM>. The touch signal may be used as a control signal to be inputted to the processor <NUM> for processing. In this case, the display screen <NUM> is further configured to provide a virtual button and/or a virtual keyboard that are/is also referred to as a soft button and/or a soft keyboard. In some embodiments, there may be one display screen <NUM> disposed on a front panel of the terminal <NUM>. In some other embodiments, there are at least two display screens <NUM> respectively disposed on different surfaces of the terminal <NUM> or designed in a foldable shape. In some other embodiments, the display screen <NUM> is a flexible display screen, disposed on a curved surface or a folded surface of the terminal <NUM>. Even, the display screen <NUM> can be further set to have a non-rectangular irregular pattern, that is, a special-shaped screen. The display screen <NUM> is manufactured by using a material such as a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

The camera component <NUM> is configured to collect images or videos. In some embodiments, the camera component <NUM> includes a front-facing camera and a rear-facing camera. Generally, the front-facing camera is disposed on the front panel of the terminal, and the rear-facing camera is disposed on a back face of the terminal. In some embodiments, there are at least two rear-facing cameras, each being any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, to implement a Bokeh function through fusion of the main camera and the depth of field camera, panoramic photo shooting and VR shooting functions through fusion of the main camera and wide-angle camera, or another fusion shooting function. In some embodiments, the camera <NUM> further includes a flash. The flash may be a single-color-temperature flash, or may be a double-color-temperature flash. The double-color-temperature flash refers to a combination of a warm-light flash and a cold-light flash, and is used for light compensation under different color temperatures.

The audio circuit <NUM> includes a microphone and a loudspeaker. The microphone is used for collecting sound waves of users and surroundings, and convert the sound waves into electrical signals and input the signals to the processor <NUM> for processing, or input the signals to the RF circuit <NUM> to implement voice communication. For the purpose of stereo collection or noise reduction, there are multiple microphones, respectively disposed at different portions of the terminal <NUM>. The microphone is further an array microphone or an omni-directional acquisition type microphone. The speaker is used for converting electrical signals from the processor <NUM> or the RF circuit <NUM> into acoustic waves. The loudspeaker is a conventional thin-film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is the piezoelectric ceramic speaker, the speaker can not only convert an electrical signal into sound waves audible to a human being, but also convert an electrical signal into sound waves inaudible to the human being for ranging and other purposes. In some embodiments, the audio circuit <NUM> also includes an earphone jack.

The positioning component <NUM> is configured to determine a current geographic location of the terminal <NUM>, to implement navigation or a location based service (LBS). The positioning component <NUM> is a positioning component based on a global positioning system (GPS) of the United States, a COMPASS System of China, a GLONASS System of Russia, or a GALILEO System of the European Union.

The power supply <NUM> is configured to supply power to components in the terminal <NUM>. The power supply <NUM> is an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power source <NUM> includes the rechargeable battery, the rechargeable battery is a wired rechargeable battery or a wireless rechargeable battery. The rechargeable battery is further used for supporting a quick charge technology.

In some embodiments, the terminal <NUM> may also include one or more sensors <NUM>. The one or more sensors <NUM> include, but are not limited to, an acceleration sensor <NUM>, a gyroscope sensor <NUM>, a pressure sensor <NUM>, a fingerprint sensor <NUM>, an optical sensor <NUM>, and a proximity sensor <NUM>.

The acceleration sensor <NUM> detects a magnitude of acceleration on three coordinate axes of a coordinate system established by the terminal <NUM>. For example, the acceleration sensor <NUM> is used for detecting components for gravity acceleration on the three coordinate axes. The processor <NUM> controls, according to a gravity acceleration signal collected by the acceleration sensor <NUM>, the display screen <NUM> to display the UI in a landscape view or a portrait view. The acceleration sensor <NUM> is further used for acquiring motion data of a game or a user.

The gyroscope sensor <NUM> detects a body direction and a rotation angle of the terminal <NUM>, and works with the acceleration sensor <NUM> to acquire a 3D action performed by the user on the terminal <NUM>. The processor <NUM> implements the following functions according to the data collected by the gyroscope sensor <NUM>: motion sensing (such as changing the UI according to a tilt operation of the user), image stabilization during shooting, game control, and inertial navigation.

The pressure sensor <NUM> is disposed on a side frame of the terminal <NUM> and/or a lower layer of the display screen <NUM>. When the pressure sensor <NUM> is disposed at the side frame of the terminal <NUM>, a holding signal of the user on the terminal <NUM> is detected. The processor <NUM> performs left/right hand recognition or a quick operation according to the holding signal collected by the pressure sensor <NUM>. When the pressure sensor <NUM> is disposed on the lower layer of the display screen <NUM>, the processor <NUM> controls, according to a pressure operation of the user on the display screen <NUM>, an operable control on the UI. The operable control includes at least one of a button control, a scroll-bar control, an icon control, and a menu control.

The fingerprint sensor <NUM> is configured to collect a fingerprint of the user, and the processor <NUM> recognizes an identity of the user according to the fingerprint collected by the fingerprint sensor <NUM>, or the fingerprint sensor <NUM> recognizes the identity of the user according to the collected fingerprint. When the identity of the user is recognized as credible, the processor <NUM> authorizes the user to perform a related sensitive operation. The sensitive operation includes unlocking a screen, viewing encrypted information, downloading software, paying, changing a setting, and the like. The fingerprint sensor <NUM> is disposed on a front face, a back face, or a side face of the terminal <NUM>. When a physical button or a vendor logo is disposed on the terminal <NUM>, the fingerprint sensor <NUM> is integrated together with the physical button or the vendor logo.

The optical sensor <NUM> is configured to acquire ambient light intensity. In some embodiments, the processor <NUM> controls display brightness of the display screen <NUM> according to the ambient light intensity collected by the optical sensor <NUM>. When the ambient light intensity is relatively high, the display brightness of the display screen <NUM> is increased. When the ambient light intensity is relatively low, the display brightness of the display screen <NUM> is decreased. In another embodiment, the processor <NUM> may further dynamically adjust a camera parameter of the camera <NUM> according to the ambient light intensity acquired by the optical sensor <NUM>.

The proximity sensor <NUM>, also referred to as a distance sensor, is generally disposed on the front panel of the terminal <NUM>. The proximity sensor <NUM> is configured to collect a distance between the user and the front face of the terminal <NUM>. In an embodiment, when the proximity sensor <NUM> detects that the distance between the user and the front surface of the terminal <NUM> gradually becomes smaller, the touch display screen <NUM> is controlled by the processor <NUM> to switch from a screen-on state to a screen-off state. When the proximity sensor <NUM> detects that the distance between the user and the front surface of the terminal <NUM> gradually becomes larger, the touch display screen <NUM> is controlled by the processor <NUM> to switch from the screen-off state to the screen-on state.

A person skilled in the art may understand that the structure shown in <FIG> does not constitute a limitation to the terminal <NUM>, and the terminal <NUM> may include more components or fewer components than those shown in the figure, or some components may be combined, or a different component deployment may be used.

In an exemplary embodiment, a computer-readable storage medium is further provided, such as a memory including instructions, where the foregoing instructions may be executed by a processor in a terminal to complete the method for adding a map element in the foregoing embodiments. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, or the like.

Claim 1:
A method for adding a map element, applicable to a development terminal of a target application, the target application comprising a map layer manager module and a base map view module, the map layer manager module comprising a layer name class, a display follow class, and a weather impact class, the base map view module comprising an area map base class and a minimap base class,
the method comprising:
creating (<NUM>), for a to-be-added map element, a name of a layer to which the map element belongs, display follow information of the map element in the layer, and weather impact information of the map element, based on the layer name class, the display follow class, and the weather impact class in the map layer manager module;
creating (<NUM>) a prefab of the map element in a target folder, a name of the prefab being a combination of the name of the layer and a name of the map element; and
adding (<NUM>), based on the area map base class and the minimap base class in the base map view module, a code for updating the map element, the code indicating a storage position of the prefab of the map element and display state information of the map element being displayed in the layer, wherein the method is characterized in that
the target application draws a minimap based on four vertices of the minimap by performing texture cropping based on a shader, and displays the minimap by superimposing a picture with a hollowed-out shape on the minimap.