Display method and device of virtual attack prop, storage medium and electronic equipment

文档序号:1207253 发布日期:2020-09-04 浏览:16次 中文

阅读说明:本技术 虚拟攻击道具的显示方法和装置、存储介质和电子设备 (Display method and device of virtual attack prop, storage medium and electronic equipment ) 是由 姚丽 于 2020-05-28 设计创作,主要内容包括:本发明公开了一种虚拟攻击道具的显示方法和装置、存储介质和电子设备,包括:在目标游戏应用中获取待渲染的目标虚拟攻击道具和目标虚拟攻击道具上的目标虚拟部件;获取目标虚拟攻击道具的第一材质以及目标虚拟部件的第二材质;在第一材质和第二材质为同一材质时,对目标虚拟攻击道具和目标虚拟部件进行合批操作得到目标虚拟对象,对第一渲染组件和第二渲染组件进行合批操作得到目标渲染组件;在目标游戏应用中使用目标渲染组件对目标虚拟对象进行渲染,以在目标游戏应用中显示目标虚拟攻击道具和目标虚拟部件。采用上述技术方案,解决了相关技术中,在游戏运行过程中,武器及其部件在运行过程中存在性能消耗大的问题。(The invention discloses a display method and a device of a virtual attack prop, a storage medium and electronic equipment, wherein the display method comprises the following steps: acquiring a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application; acquiring a first material of a target virtual attack prop and a second material of a target virtual component; when the first material and the second material are the same, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and carrying out batch operation on the first rendering assembly and the second rendering assembly to obtain a target rendering assembly; the target virtual object is rendered in the target game application using a target rendering component to display the target virtual attack prop and the target virtual part in the target game application. By adopting the technical scheme, the problem that in the related art, weapons and parts thereof have high performance consumption in the running process of a game is solved.)

1. A display method of a virtual attack prop is characterized by comprising the following steps:

acquiring a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application;

obtaining a first material of the target virtual attack prop and a second material of the target virtual component;

under the condition that the first material and the second material are the same, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and carrying out batch operation on a first rendering assembly and a second rendering assembly to obtain a target rendering assembly, wherein the first rendering assembly is used for rendering the target virtual attack prop, the second rendering assembly is used for rendering the target virtual component, the target virtual object is used for representing the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material;

rendering, in the target game application, the target virtual object using the target rendering component to display the target virtual attack prop and the target virtual part in the target game application.

2. The method of claim 1, wherein the batching the target virtual attack prop and the target virtual component to obtain a target virtual object, and the batching the first rendering component and the second rendering component to obtain a target rendering component comprises:

synthesizing the target virtual attack prop and the target virtual component to obtain the target virtual object;

generating the target rendering component for the target virtual object, wherein the target rendering component is used for rendering the target virtual object;

and deleting the first rendering assembly and the second rendering assembly.

3. The method of claim 2, wherein the synthesizing the target virtual attack prop and the target virtual component to obtain the target virtual object comprises:

and splicing the target virtual attack prop and the target virtual component to obtain the spliced target virtual object.

4. The method of claim 1, wherein obtaining the target virtual attack prop to be rendered and the target virtual component on the target virtual attack prop in the target game application comprises:

under the condition that the target virtual attack prop and the target virtual component are not loaded in a memory of a target terminal, acquiring the target virtual attack prop and the target virtual component from a database of the target terminal; or

And under the condition that the target virtual attack prop and the target virtual component are loaded in the memory of the target terminal once, acquiring the target virtual attack prop and the target virtual component from the memory of the target terminal.

5. The method of claim 4, wherein obtaining the target virtual attack prop and the target virtual component from the database of the target terminal when the target virtual attack prop and the target virtual component are not loaded in the memory of the target terminal comprises:

acquiring the target virtual attack prop from a database of the target terminal;

and under the condition that the target virtual attack prop is obtained, obtaining the target virtual component from a database of the target terminal.

6. The method of claim 4, wherein in the event that the target virtual attack prop and the target virtual component are not loaded in memory of a target terminal, the method further comprises:

and loading a pre-configured script, wherein the pre-configured script is used for configuring the target virtual attack prop and the target virtual component.

7. The method of claim 1, wherein the batching the target virtual attack prop and the target virtual component to obtain a target virtual object, and the batching the first rendering component and the second rendering component to obtain a target rendering component comprises:

and under the condition that the target virtual attack prop and the target virtual component are determined to meet the preset condition for carrying out the batching operation, carrying out batching operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and carrying out batching operation on the first rendering assembly and the second rendering assembly to obtain the target rendering assembly, wherein the preset condition is used for determining whether the information contained in the target virtual attack prop and the target virtual component is in the range set by the preset condition.

8. The method according to claim 7, wherein the obtaining the target virtual object by performing a batching operation on the target virtual attack prop and the target virtual component and obtaining the target rendering component by performing the batching operation on the first rendering component and the second rendering component when it is determined that the target virtual attack prop and the target virtual component satisfy a preset condition for performing the batching operation comprises:

under the condition that the sum of the number of first vertexes contained in the target virtual attack prop and the number of second vertexes contained in the target virtual component does not exceed a first preset threshold value, carrying out batching operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and carrying out batching operation on the first rendering component and the second rendering component to obtain a target rendering component; and/or

Under the condition that the sum of the number of third vertexes of a first grid contained in the target virtual attack prop and the number of fourth vertexes of a second grid of the target virtual component does not exceed a second preset threshold value, carrying out batching operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and carrying out batching operation on the first rendering component and the second rendering component to obtain a target rendering component;

wherein the first mesh and the second mesh each include a plurality of triangular faces, and the first vertex, the second vertex, the third vertex, and the fourth vertex are vertices of the plurality of triangular faces.

9. A display device for a virtual attack prop, comprising:

the system comprises a first obtaining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is used for obtaining a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application;

a second obtaining unit, configured to obtain a first material of the target virtual attack prop and a second material of the target virtual component;

a first processing unit, configured to, when the first material and the second material are the same material, batch the target virtual attack prop and the target virtual component to obtain a target virtual object, and batch a first rendering component and a second rendering component to obtain a target rendering component, where the first rendering component is configured to render the target virtual attack prop, the second rendering component is configured to render the target virtual component, the target virtual object is configured to represent the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material;

a second processing unit to render the target virtual object in the target game application using the target rendering component to display the target virtual attack prop and the target virtual component in the target game application.

10. The apparatus of claim 9, wherein the first processing unit comprises:

the synthesis module is used for synthesizing the target virtual attack prop and the target virtual component to obtain the target virtual object;

a generating module, configured to generate the target rendering component for the target virtual object, where the target rendering component is configured to render the target virtual object;

and the deleting module is used for deleting the first rendering assembly and the second rendering assembly.

11. The apparatus of claim 10, wherein the composition module is further configured to splice the target virtual attack prop and the target virtual component to obtain the spliced target virtual object.

12. The apparatus of claim 9, wherein the first obtaining unit comprises:

a first obtaining module, configured to obtain the target virtual attack prop and the target virtual component from a database of a target terminal when the target virtual attack prop and the target virtual component are not loaded in a memory of the target terminal; or

A second obtaining module, configured to obtain the target virtual attack prop and the target virtual component from the memory of the target terminal when the target virtual attack prop and the target virtual component are loaded in the memory of the target terminal once.

13. The apparatus according to claim 12, wherein the first obtaining module is further configured to obtain the target virtual attack prop from a database of a target terminal if the target virtual attack prop and the target virtual component are not loaded in a memory of the target terminal; and under the condition that the target virtual attack prop is obtained, obtaining the target virtual component from a database of the target terminal.

14. A computer-readable storage medium, comprising a stored program, wherein the program is executable by a terminal device or a computer to perform the method of any one of claims 1 to 8.

15. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 8 by means of the computer program.

Technical Field

The invention relates to the technical field of computers, in particular to a display method and device of a virtual attack prop, a storage medium and electronic equipment.

Background

In the current mobile terminal shooting game, with the making of a large map and the fine design of characters, the memory consumption is larger and larger, so that each detail needs to be optimized as much as possible, the performance of the game is improved, a weapon is used as a soul of the game and is also an element which is used most frequently by a player, and the performance of the weapon and accessories thereof needs to be optimized in rendering.

In the game, each weapon is actually rendered by a grid renderer (also called a component), namely, each component has a material, and each material is actually a performance consumption.

In the related art, an effective solution is not provided for the problem that weapons and parts thereof have high performance consumption in the running process of a game.

Disclosure of Invention

The embodiment of the invention provides a display method and device of a virtual attack prop, a storage medium and electronic equipment, which are used for at least solving the technical problem that in the related technology, weapons and parts thereof have high performance consumption in the running process of a game.

According to an aspect of an embodiment of the present invention, a method for displaying a virtual attack prop is provided, including: acquiring a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application; obtaining a first material of the target virtual attack prop and a second material of the target virtual component; under the condition that the first material and the second material are the same, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and carrying out batch operation on a first rendering component and a second rendering component to obtain a target rendering component, wherein the first rendering component is used for rendering the target virtual attack prop, the second rendering component is used for rendering the target virtual component, the target virtual object is used for representing the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material; and rendering the target virtual object in the target game application by using the target rendering component so as to display the target virtual attack prop and the target virtual component in the target game application.

According to another aspect of the embodiments of the present invention, there is also provided a display device of a virtual attack prop, including: the system comprises a first obtaining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is used for obtaining a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application; a second obtaining unit, configured to obtain a first material of the target virtual attack prop and a second material of the target virtual component; a first processing unit, configured to, when the first material and the second material are the same material, batch the target virtual attack prop and the target virtual component to obtain a target virtual object, and batch a first rendering component and a second rendering component to obtain a target rendering component, where the first rendering component is configured to render the target virtual attack prop, the second rendering component is configured to render the target virtual component, the target virtual object is configured to represent the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material; a second processing unit, configured to render the target virtual object in the target game application using the target rendering component, so as to display the target virtual attack prop and the target virtual component in the target game application.

According to another aspect of the embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above display method of the virtual attack prop when running.

According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for displaying the virtual attack prop through the computer program.

In the embodiment of the invention, in the target game application, firstly, the target virtual attack prop to be rendered and the target virtual component on the target virtual attack prop are obtained, and obtaining a first material of the target virtual attack prop and a second material of the target virtual component, if the first material and the second material are the same material, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, carrying out batch operation on the first rendering component and the second rendering component to obtain a target rendering component, wherein the target virtual object is used for representing the target virtual attack prop and the target virtual component, the material of the target virtual object is a first material, and finally, the target virtual object is rendered in the target game application using the target rendering component, and the target virtual attack prop and the target virtual part are displayed in the target game application. By the batch operation mode, the target rendering component and the target virtual object are obtained, the target rendering component can be used for rendering the target virtual object (the target virtual attack prop and the target virtual component), the situation that a plurality of components are used for rendering the target virtual attack prop and the target virtual component is avoided, the performance consumption is reduced, and the smoothness of game operation is improved.

Drawings

The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:

fig. 1 is a schematic diagram of an application environment of a display method of a virtual attack prop according to an embodiment of the present invention;

FIG. 2 is a flowchart illustrating a method for displaying selectable virtual attack props according to an embodiment of the present invention;

FIG. 3 is a schematic diagram of an optional unbatched virtual attack prop according to an embodiment of the present invention;

FIG. 4 is a schematic diagram of an alternative weapon and component grid processor, according to an embodiment of the invention;

FIG. 5 is a schematic illustration of the material of an alternative weapon and component according to an embodiment of the invention;

FIG. 6 is a schematic diagram of results of an alternative batching operation process according to an embodiment of the present invention;

FIG. 7 is a schematic diagram of an alternative weapon and common components of components, according to an embodiment of the invention;

FIG. 8 is a schematic flow chart diagram illustrating an alternative method for displaying virtual attack props, according to an embodiment of the present invention;

FIG. 9 is a schematic diagram of an alternative weapon that has been loaded in a memory pool, in accordance with embodiments of the present invention;

FIG. 10 is a diagram of an alternative script component in accordance with an embodiment of the present invention;

FIG. 11 is a schematic illustration of alternative hitch point information for weapons and components of a new object in accordance with an embodiment of the present invention;

FIG. 12 is a schematic illustration of the positions of weapons and components of an alternative new object in accordance with an embodiment of the present invention;

FIG. 13 is a schematic structural diagram of a display device of an alternative virtual attack prop according to an embodiment of the present invention;

fig. 14 is a schematic structural diagram of an alternative electronic device according to an embodiment of the invention.

Detailed Description

In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

Technical terms involved in the embodiments of the present invention include:

(1) a mobile terminal: generally referred to as the handset side, including but not limited to all handheld portable game devices.

(2) Hand swimming: including, but not limited to, first person shooter games, third person shooter games, and the like, all games that use hot arms to conduct remote attacks.

(3) Dynamic batching (batching operation): and carrying out dynamic batch processing on objects using the same material.

According to one aspect of the embodiment of the invention, a control method of a virtual item is provided. Optionally, the control method of the virtual prop may be applied to, but not limited to, an application environment shown in fig. 1. As shown in fig. 1, a client (e.g., Android, iOS, or Web) of a target game application is running on a first terminal device 102. Through the client, the game player can play a network game (such as a virtual shooting game), obtain a target virtual attack item to be rendered and a target virtual component on the target virtual attack item in a target game application, and send the target virtual attack path and the target virtual component to the server 104 through the network. Server 104 may be a background server for the client. After receiving a target virtual attack path and a target virtual component, the server 104 obtains a first material of the target virtual attack prop and a second material of the target virtual component, and performs a batch operation on the target virtual attack prop, the target virtual component, a first rendering component and a second rendering component to obtain a target virtual object and a target rendering component under the condition that the first material and the second material are the same material, wherein the first rendering component is used for rendering the target virtual attack prop, the second rendering component is used for rendering the target virtual component, the target virtual object is used for representing the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material; the server 104 sends the target virtual object and the target rendering component to the first terminal device 102 through the network, after the first terminal device 102 receives the target virtual object and the target rendering component, the first terminal device 102 renders the target virtual object in the target game application by using the target rendering component, so as to display the target virtual attack prop and the target virtual component in the target game application, and for the second terminal device 106, the server 104 and the first terminal device may interact through the network, for example, a game player corresponding to the first terminal device 102 and a game player corresponding to the second terminal device 106 interact through a competitive form in the same game, and the like. The above is merely an example, and the embodiments of the present application are not limited herein.

It should be noted that the server may be an independent physical server, may also be a server cluster or distributed system formed by a plurality of physical servers, and may also be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN, and a big data and artificial intelligence platform. The terminal may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.

Optionally, the method may be applied to various usage scenarios involving virtual attack-type game props, such as virtual shooting-type weapons, and the present embodiment is not limited in any way herein.

Optionally, in this embodiment, the terminal device may be a terminal device configured with a target client, and may include, but is not limited to, at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), notebook computers, tablet computers, palm computers, MID (Mobile Internet Devices), PAD, desktop computers, smart televisions, etc. The target client may be a video client, an instant messaging client, a browser client, an educational client, etc. Such networks may include, but are not limited to: a wired network, a wireless network, wherein the wired network comprises: a local area network, a metropolitan area network, and a wide area network, the wireless network comprising: bluetooth, WIFI, and other networks that enable wireless communication. The server may be a single server, a server cluster composed of a plurality of servers, or a cloud server. The above is only an example, and the present embodiment is not limited to this.

Optionally, in this embodiment, as an optional implementation manner, the method may be executed by a server, or may be executed by a terminal device, or may be executed by both the server and the terminal device, and in this embodiment, the description is given by taking an example that the method is executed by a terminal device (for example, the first terminal device 102). As shown in fig. 2, the flow of the control method for the virtual item may include the steps of:

step S202, a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop are obtained in a target game application.

Alternatively, for the target game application, which may be a virtual shooting game, the user may play the game using a client running on the terminal. In the process of playing the virtual shooting game, a target virtual attack prop to be rendered and a target virtual component used for assembling the target virtual attack prop need to be acquired, the target virtual component may be one or more virtual components, and the number of the virtual components is not limited herein.

Step S204, a first material of the target virtual attack prop and a second material of the target virtual component are obtained.

Optionally, after the target virtual attack prop and the target virtual component are obtained, a first material of the target virtual attack prop and a second material of the target virtual component need to be obtained.

Step S206, when the first material and the second material are the same, performing a batching operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and performing a batching operation on a first rendering component and a second rendering component to obtain a target rendering component, where the first rendering component is configured to render the target virtual attack prop, the second rendering component is configured to render the target virtual component, the target virtual object is configured to represent the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material.

Optionally, whether the first material and the second material are the same material is judged, under the condition that the first material and the second material are the same material, a target virtual object is obtained by performing a batch operation on the target virtual attack prop and the target virtual component, and a target rendering component is obtained by performing a batch operation on a first rendering component and a second rendering component, wherein the first rendering component is used for rendering the target virtual attack prop, the second rendering component is used for rendering the target virtual component, the target virtual object is used for representing the target virtual attack prop and the target virtual component, and the material of the target virtual object and the material of the target virtual attack prop are the same and are both the first material.

The batch operation, i.e., dynamic batch, may be understood as performing dynamic and batch processing on objects using the same material.

Step S208, rendering the target virtual object in the target game application by using the target rendering component, so as to display the target virtual attack item and the target virtual component in the target game application.

Optionally, after obtaining the target virtual object and the target rendering component, the target rendering component may be used in the target game application to render the target virtual object, and the target virtual attack prop and the target virtual component may be displayed in the target game application.

With the present embodiment, in the target game application, first, the target virtual attack prop to be rendered and the target virtual component on the target virtual attack prop are acquired, and obtaining a first material of the target virtual attack prop and a second material of the target virtual component, if the first material and the second material are the same material, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, carrying out batch operation on the first rendering component and the second rendering component to obtain a target rendering component, wherein the target virtual object is used for representing the target virtual attack prop and the target virtual component, the material of the target virtual object is a first material, and finally, the target virtual object is rendered in the target game application using the target rendering component, and the target virtual attack prop and the target virtual part are displayed in the target game application. By the batch operation mode, the target rendering component and the target virtual object are obtained, the target rendering component can be used for rendering the target virtual object (the target virtual attack prop and the target virtual component), the situation that a plurality of components are used for rendering the target virtual attack prop and the target virtual component is avoided, the performance consumption is reduced, and the smoothness of game operation is improved.

Optionally, in this embodiment, the batching the target virtual attack prop and the target virtual component to obtain a target virtual object, and the batching the first rendering component and the second rendering component to obtain a target rendering component includes: synthesizing the target virtual attack prop and the target virtual component to obtain the target virtual object; generating the target rendering component for the target virtual object, wherein the target rendering component is used for rendering the target virtual object; and deleting the first rendering assembly and the second rendering assembly.

Optionally, the batching operation may be implemented in the following manner to obtain the target virtual object and the target rendering component, and the specific process is as follows:

and synthesizing the target virtual attack prop and the target virtual component to obtain a target virtual object, then generating a target rendering component for the target virtual object, and deleting the first rendering component and the second rendering component. Alternatively, the first rendering component and the second rendering component may be deleted first, and then the target rendering component may be generated for the target virtual object.

It should be noted that the generated target rendering components (for example, the number of the target rendering components is 1) may simultaneously render the target object representing the target virtual attack prop and the target virtual component, so that the number of the rendering components may be reduced, and the performance consumption may be reduced.

Through the embodiment, the target rendering component can be generated in the above manner, and the generated target rendering component can simultaneously render the target object for representing the target virtual attack prop and the target virtual component, so that the number of the rendering components is reduced, the performance consumption is reduced, and the game performance is improved.

Optionally, in this embodiment, the synthesizing the target virtual attack prop and the target virtual component to obtain the target virtual object includes: and splicing the target virtual attack prop and the target virtual component to obtain the spliced target virtual object.

Optionally, the spliced target virtual object may be obtained by splicing the target virtual attack prop and the target virtual component, which is understood that the foregoing is merely an example, and the embodiment is not limited in this respect.

Optionally, in this embodiment, the obtaining, in the target game application, a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop includes: under the condition that the target virtual attack prop and the target virtual component are not loaded in a memory of a target terminal, acquiring the target virtual attack prop and the target virtual component from a database of the target terminal; or under the condition that the target virtual attack prop and the target virtual component are loaded in the memory of the target terminal once, acquiring the target virtual attack prop and the target virtual component from the memory of the target terminal.

Optionally, if the target virtual attack prop and the target virtual component are never loaded in the memory of the target terminal, the target virtual attack prop and the target virtual component may be obtained from a database of the target terminal or a server corresponding to the target terminal, and the target virtual attack prop and the target virtual component may be loaded in the target terminal. Or

If the target virtual attack prop and the target virtual component are loaded in the memory of the target terminal once, the target virtual attack prop and the target virtual component can be directly obtained from the memory of the target terminal, and the loading time is saved.

Through the embodiment, the target virtual attack prop and the target virtual component can be loaded in different modes, and the flexibility of the loading mode is improved.

Optionally, in this embodiment, when the target virtual attack prop and the target virtual component are not loaded in the memory of the target terminal, acquiring the target virtual attack prop and the target virtual component from the database of the target terminal includes: acquiring the target virtual attack prop from a database of the target terminal; and under the condition that the target virtual attack prop is obtained, obtaining the target virtual component from the database of the target terminal.

Alternatively, since the loading process of loading a new virtual attack prop (weapon) is time consuming, the weapon may be loaded first, followed by the components.

For example, if the target virtual attack prop and the target virtual component are not loaded in the memory of the target terminal, the target virtual attack prop may be obtained from the database of the target terminal and loaded preferentially, and if the target virtual attack prop is obtained, the target virtual component may be obtained from the database of the target terminal and then loaded.

Through the embodiment, the target virtual attack prop and the target virtual component can be loaded in sequence, and the loading speed is improved.

Optionally, in this embodiment, in a case that the target virtual attack prop and the target virtual component are not loaded in a memory of the target terminal, the method further includes: and loading a pre-configured script, wherein the pre-configured script is used for configuring the target virtual attack prop and the target virtual component.

Optionally, when the target virtual attack prop and the target virtual component are not loaded in the memory of the target terminal, a pre-configured script needs to be loaded, where the pre-configured script is used to configure the target virtual attack prop and the target virtual component.

That is, when loading a weapon, not only is a model of a target virtual attack prop (weapon) loaded, but also scripts need to be loaded dynamically, and as to which script is loaded is determined by configuration, any weapon and its associated script components can be modified conveniently.

Through the embodiment, the target virtual attack prop and the target virtual component can be flexibly configured by loading the script, so that the flexibility of game configuration is improved.

Optionally, in this embodiment, the batching the target virtual attack prop and the target virtual component to obtain a target virtual object, and the batching the first rendering component and the second rendering component to obtain a target rendering component includes: and under the condition that the target virtual attack prop and the target virtual component are determined to meet the preset condition for carrying out the batching operation, carrying out batching operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and carrying out batching operation on the first rendering assembly and the second rendering assembly to obtain the target rendering assembly, wherein the preset condition is used for determining whether the information contained in the target virtual attack prop and the target virtual component is within the range set by the preset condition.

Optionally, the target virtual attack prop and the target virtual component are batched to obtain the target virtual object, and when the first rendering component and the second rendering component are subjected to the batching operation to obtain the target rendering component, it is also necessary to determine whether the target virtual attack prop and the target virtual component meet preset conditions for performing the batching operation, if the condition is met, the target virtual attack prop and the target virtual component can be batched to obtain the target virtual object, performing the batching operation on the first rendering component and the second rendering component to obtain the target rendering component, the preset conditions are used for determining whether the information contained in the target virtual attack prop and the target virtual component is within a range set by the preset conditions.

It is understood that the above is only an example, and the present embodiment is not limited thereto.

Through the embodiment, due to the fact that dynamic target virtual attack props and target virtual components are dynamically batched, certain expenses can be generated, the batching operation can be limited through setting preset conditions, the batching operation is more reasonable, and the reasonability of the batching operation is improved.

Optionally, in this embodiment, the obtaining the target virtual object by performing a batching operation on the target virtual attack prop and the target virtual component and obtaining the target rendering component by performing the batching operation on the first rendering component and the second rendering component when it is determined that the target virtual attack prop and the target virtual component satisfy a preset condition for performing the batching operation includes: under the condition that the sum of the number of first vertexes contained in the target virtual attack prop and the number of second vertexes contained in the target virtual component does not exceed a first preset threshold value, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and carrying out batch operation on the first rendering component and the second rendering component to obtain the target rendering component; and/or, under the condition that the sum of the number of third vertices of the first mesh and the number of fourth vertices of the second mesh of the target virtual component, which are included in the target virtual attack prop, is determined not to exceed a second preset threshold, performing a batching operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and performing the batching operation on the first rendering component and the second rendering component to obtain the target rendering component; wherein each of the first mesh and the second mesh includes a plurality of triangular faces, and each of the first vertex, the second vertex, the third vertex, and the fourth vertex is a vertex of the plurality of triangular faces.

Alternatively, the mesh may be a mesh composed of a plurality of triangular surfaces, wherein the triangular surfaces are displayed on a single surface and are invisible from the back surface, and the vertices of the surface displayed on the triangular surfaces are the first vertex, the second vertex, the third vertex, and the fourth vertex.

Optionally, if the sum of the number of first vertices included in the target virtual attack prop and the number of second vertices included in the target virtual component does not exceed a first preset threshold (for example, does not exceed 900 vertices), a batching operation may be performed on the target virtual attack prop and the target virtual component to obtain the target virtual object, and the batching operation may be performed on the first rendering component and the second rendering component to obtain the target rendering component; and/or the presence of a gas in the gas,

if the sum of the number of third vertices of the first mesh and the number of fourth vertices of the second mesh of the target virtual component included in the target virtual attack prop does not exceed a second preset threshold (e.g., does not exceed 300 vertices), the target virtual attack prop and the target virtual component may be batched to obtain the target virtual object, and the first rendering component and the second rendering component may be batched to obtain the target rendering component.

It should be noted that unity3D is a comprehensive game development tool developed by unity Technologies to create multiple platforms of types of interactive content such as three-dimensional video games, building visualizations, real-time three-dimensional animations, etc., is a fully integrated professional game engine, and is a three-dimensional animation rendering and production software. In unity3D, there are static and dynamic lots, and static lots are formed by combining static (non-moving) GameObjects into a large grid and then drawing. Static batching is relatively simple to use, Static batching is started in PlayerSettings, and then Static that needs Static batching objects is hooked, unity3D will automatically merge objects marked as Static if they share the same material and do not move, and objects marked as Static cannot move, rotate or zoom in the game. But static batching requires additional memory to store the merged geometry. If multiple GameObjects share the same geometry prior to static batching, a copy of the geometry may be created for each GameObject at editor or runtime, which may increase memory overhead. For example, marking trees as static at a dense forest level may produce a severe memory impact. At this point, the trade-off must be made, and for less memory usage, it may be necessary to avoid some static batching of GameObjects, although this may necessitate sacrificing some rendering performance.

But instead. Weapons and components are both mobile and selectable, most importantly, are both dynamically generated and dynamically combined, and thus cannot be handled in a static batch manner. Then only dynamic pooling can be used, where unity is a function of self-contained dynamic pooling, but dynamic pooling has some overhead for each vertex of dynamic GameObjects, and thus dynamic pooling is only applied to meshes containing no more than 900 vertices and no more than 300 vertices. Thus, dynamic batching of weapons can only be handled by way of write logic.

As shown in fig. 3, the weapon (such as the target virtual attack prop) and the components of the weapon (such as the target virtual components) are not dynamically batched.

As shown in FIG. 4, the components owned under the weapon are to the left, the grid processor components on which the components are hung are to the right, and the grid processor components are also on the weapon.

As shown in fig. 5, the material of the component held by the weapon is the same, and the material of the component held by the weapon is the same as the material of the weapon.

As shown in FIG. 6, the weapon and parts may be batched, and when batched, all of the grid processors hanging on the parts and weapons are removed.

As shown in FIG. 7, a new common assembly of weapons and components may be created through the batching operation described above. By the method, grid processors of all parts under each weapon can be deleted, rendering is reduced, and the purpose of optimization is achieved.

It should be noted that if some dynamically combined objects are not subjected to batching, such as weapons and parts, because how many parts are to be loaded on each weapon are dynamically generated and combined in real time according to a configuration file, the weapons and the accessories to which the weapons belong are not initially made into a model, but the weapons and the accessories to which the weapons belong are made of the same material, so that a plurality of same material components are operated. The performance loss of the game is increased.

In order to solve the above problem, the following describes a flow of a display method of a virtual attack prop with reference to an optional example. As shown in fig. 8, the specific steps are as follows:

at step 801, the game begins and determines whether the player has acquired a new weapon.

Each time a player obtains a new weapon, the player reloads, step 802, and if the acquisition is a weapon that has been previously loaded, the reloading is not required. If the weapon is a new weapon, the resource is loaded, the weapon is loaded first, then the components are loaded, and the next step is started after the resources are loaded.

As shown in fig. 9, the previously loaded weapon will be stored in the memory pool and will not be destroyed. In this way, previously loaded weapons and components can be quickly displayed at the next use.

If a new weapon is used, the resource is loaded, the weapon is loaded first, then the components are loaded, the next step is started after the resources are loaded, the weapon loading is a very time-consuming process, the model of the weapon is loaded only during the loading, the scripts are required to be loaded dynamically at the same time, and the loading of any script is determined by the configuration, so that any weapon and the related script components thereof can be modified conveniently. As shown in fig. 10, a script component is loaded.

Step 803, when the loading of the weapon and the component is finished, whether the weapon and the component need to be batched is judged, and the batching is determined by the configuration and is not required, because the batching generates certain loss, and the batching cannot be carried out if the loss is too large.

Step 804, if the current weapon needs to be batched, judging whether all materials of the parts of the current weapon are the same as those used by the weapon, if so, starting to perform a batching operation, deleting the same materials and components, and generating a batched component and material, wherein the generated object is a new object, and as shown in fig. 11, hanging point information of all weapons and parts is available on the new object.

As shown in fig. 12, the new object stores the position of each component, and each component can be obtained by subscript. There are a total of four elements above, representing a weapon and 3 parts, and a subscript corresponding to a weapon or part, by which each element can be manipulated.

According to the embodiment, all the components belonging to the same weapon share one material component by batch processing, so that the performance loss is reduced, and the running performance of the game is improved.

It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.

According to another aspect of the embodiment of the present invention, there is also provided a display device of a virtual attack prop, as shown in fig. 13, the device includes:

a first obtaining unit 1302, configured to obtain, in a target game application, a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop;

a second obtaining unit 1304, configured to obtain a first material of the target virtual attack prop and a second material of the target virtual component;

a first processing unit 1306, configured to, when the first material and the second material are the same, perform batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and perform batch operation on a first rendering component and a second rendering component to obtain a target rendering component, where the first rendering component is configured to render the target virtual attack prop, the second rendering component is configured to render the target virtual component, the target virtual object is configured to represent the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material;

a second processing unit 1308, configured to render, in the target game application, the target virtual object using the target rendering component, so as to display the target virtual attack prop and the target virtual component in the target game application.

With the present embodiment, in the target game application, first, the target virtual attack prop to be rendered and the target virtual component on the target virtual attack prop are acquired, and obtaining a first material of the target virtual attack prop and a second material of the target virtual component, if the first material and the second material are the same material, carrying out batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, carrying out batch operation on the first rendering component and the second rendering component to obtain a target rendering component, wherein the target virtual object is used for representing the target virtual attack prop and the target virtual component, the material of the target virtual object is a first material, and finally, the target virtual object is rendered in the target game application using the target rendering component, and the target virtual attack prop and the target virtual part are displayed in the target game application. By the batch operation mode, the target rendering component and the target virtual object are obtained, the target rendering component can be used for rendering the target virtual object (the target virtual attack prop and the target virtual component), the situation that a plurality of components are used for rendering the target virtual attack prop and the target virtual component is avoided, the performance consumption is reduced, and the smoothness of game operation is improved.

As an optional technical solution, the first processing unit includes:

the synthesis module is used for synthesizing the target virtual attack prop and the target virtual component to obtain the target virtual object;

a generating module, configured to generate the target rendering component for the target virtual object, where the target rendering component is configured to render the target virtual object;

and the deleting module is used for deleting the first rendering assembly and the second rendering assembly.

As an optional technical solution, the synthesis module is further configured to splice the target virtual attack prop and the target virtual component to obtain a spliced target virtual object.

As an optional technical solution, the first obtaining unit includes:

a first obtaining module, configured to obtain the target virtual attack prop and the target virtual component from a database of a target terminal when the target virtual attack prop and the target virtual component are not loaded in a memory of the target terminal; or

A second obtaining module, configured to obtain the target virtual attack prop and the target virtual component from the memory of the target terminal when the target virtual attack prop and the target virtual component are loaded in the memory of the target terminal once.

As an optional technical solution, the first obtaining module is further configured to obtain the target virtual attack prop from a database of the target terminal; and under the condition that the target virtual attack prop is obtained, obtaining the target virtual component from the database of the target terminal.

As an optional technical solution, the apparatus further includes:

and the loading module is used for loading a pre-configured script, wherein the pre-configured script is used for configuring the target virtual attack prop and the target virtual component.

As an optional technical solution, the first processing unit is further configured to, when it is determined that the target virtual attack prop and the target virtual component meet a preset condition for performing the batching operation, perform batching operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and perform the batching operation on the first rendering component and the second rendering component to obtain the target rendering component, where the preset condition is used to determine whether information included in the target virtual attack prop and the target virtual component is within a range set by the preset condition.

As an optional technical solution, the first processing module is configured to, when it is determined that a sum of a number of first vertices included in the target virtual attack prop and a number of second vertices included in the target virtual component does not exceed a first preset threshold, perform a batching operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and perform the batching operation on the first rendering component and the second rendering component to obtain the target rendering component; and/or

A second processing module, configured to, when it is determined that a sum of a number of third vertices of a first mesh included in the target virtual attack prop and a number of fourth vertices of a second mesh of the target virtual component does not exceed a second preset threshold, perform a batching operation on the target virtual attack prop and the target virtual component to obtain the target virtual object, and perform the batching operation on the first rendering component and the second rendering component to obtain the target rendering component;

wherein each of the first mesh and the second mesh includes a plurality of triangular faces, and each of the first vertex, the second vertex, the third vertex, and the fourth vertex is a vertex of the plurality of triangular faces.

According to a further aspect of embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.

Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:

s1, obtaining a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application;

s2, obtaining a first material of the target virtual attack prop and a second material of the target virtual component;

s3, when the first material and the second material are the same, performing a batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and performing a batch operation on a first rendering component and a second rendering component to obtain a target rendering component, where the first rendering component is configured to render the target virtual attack prop, the second rendering component is configured to render the target virtual component, the target virtual object is configured to represent the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material;

s4, rendering the target virtual object in the target game application by using the target rendering component, so as to display the target virtual attack prop and the target virtual component in the target game application.

Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by instructing hardware related to the terminal device through a program, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, ROM (Read-Only Memory), RAM (Random Access Memory), magnetic or optical disks, and the like.

According to another aspect of the embodiment of the present invention, there is further provided an electronic device for implementing the display method of the virtual attack prop, where the electronic device may be a terminal device or a server shown in fig. 1. The present embodiment takes the electronic device as a terminal device as an example for explanation. As shown in fig. 14, the electronic device comprises a memory 1402 and a processor 1404, the memory 1402 having stored therein a computer program, the processor 1404 being arranged to execute the steps of any of the method embodiments described above by means of the computer program.

Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:

s1, obtaining a target virtual attack prop to be rendered and a target virtual component on the target virtual attack prop in a target game application;

s2, obtaining a first material of the target virtual attack prop and a second material of the target virtual component;

s3, when the first material and the second material are the same, performing a batch operation on the target virtual attack prop and the target virtual component to obtain a target virtual object, and performing a batch operation on a first rendering component and a second rendering component to obtain a target rendering component, where the first rendering component is configured to render the target virtual attack prop, the second rendering component is configured to render the target virtual component, the target virtual object is configured to represent the target virtual attack prop and the target virtual component, and the target virtual object is made of the first material;

s4, rendering the target virtual object in the target game application by using the target rendering component, so as to display the target virtual attack prop and the target virtual component in the target game application.

Alternatively, it is understood by those skilled in the art that the structure shown in fig. 14 is only an illustration and is not a limitation to the structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 14, or have a different configuration than shown in FIG. 14.

The memory 1402 may be configured to store software programs and modules, such as program commands/modules corresponding to the method and apparatus for displaying virtual attack props in the embodiment of the present invention, and the processor 1404 executes various functional applications and displays the virtual attack props by running the software programs and modules stored in the memory 1402, that is, the method for displaying the virtual attack props is implemented. Memory 1402 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1402 may further include memory located remotely from the processor 1404, which may be connected to a terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. As an example, as shown in fig. 14, the memory 1402 may include, but is not limited to, a first obtaining unit 1302, a second obtaining unit 1304, a first processing unit 1306, and a second processing unit 1308 of a display device including the virtual attack prop. In addition, the virtual attack prop may further include, but is not limited to, other module units in the display device of the virtual attack prop, which is not described in detail in this example.

Optionally, the transmitting device 1406 is used for receiving or sending data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1406 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmitting device 1406 is a Radio Frequency (RF) module, which is used to communicate with the internet by wireless means.

In addition, the electronic device further includes: display 1408, configured to display the target virtual attack prop and the target virtual component; and a connection bus 1410 for connecting the respective module parts in the above-described electronic apparatus.

In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting a plurality of nodes through a network communication. Nodes can form a Peer-To-Peer (P2P, Peer To Peer) network, and any type of computing device, such as a server, a terminal, and other electronic devices, can become a node in the blockchain system by joining the Peer-To-Peer network.

Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by instructing hardware related to the terminal device through a program, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.

The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.

The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of commands for enabling one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the above methods according to the embodiments of the present invention.

In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

24页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:信息处理方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类