CN113262469A - Resource template generation method and device and scene element rendering method and device in game - Google Patents

Resource template generation method and device and scene element rendering method and device in game Download PDF

Info

Publication number
CN113262469A
CN113262469A CN202110636797.4A CN202110636797A CN113262469A CN 113262469 A CN113262469 A CN 113262469A CN 202110636797 A CN202110636797 A CN 202110636797A CN 113262469 A CN113262469 A CN 113262469A
Authority
CN
China
Prior art keywords
resource
node
nodes
determining
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110636797.4A
Other languages
Chinese (zh)
Inventor
张杨华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110636797.4A priority Critical patent/CN113262469A/en
Publication of CN113262469A publication Critical patent/CN113262469A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/50Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers
    • A63F2300/53Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing
    • A63F2300/538Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing for performing operations on behalf of the game client, e.g. rendering

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application provides a method and a device for generating a resource template and rendering scene elements in a game, wherein the method for generating the resource template comprises the following steps: determining a plurality of resource nodes of a target resource according to the resource type of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween; determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes; and generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark. The embodiment of the application reduces the data volume, reduces the occupied memory space, is more flexible in iteration, and can be multiplexed in other scenes.

Description

Resource template generation method and device and scene element rendering method and device in game
Technical Field
The present application relates to the field of information technology, and in particular, to a method and an apparatus for generating a resource template and rendering scene elements in a game.
Background
Currently, the scheme for generating urban layouts within a game is generally: a city layout file is first created in third party software (houdini, etc.) and then imported into the game engine, thereby generating a city layout within the game.
The applicant finds in research that in the traditional scheme, on one hand, a city layout file imported into a game engine comprises world space information of a plurality of different city elements in a world coordinate system, and the information is fixed and invariable and cannot be reused in other game scenes; on the other hand, the city layout file imported into the game engine also comprises resources corresponding to a plurality of different city elements, and the game engine has the disadvantages of large data volume, large occupied memory space and low iteration speed.
Disclosure of Invention
In view of this, an object of the present application is to provide a method and an apparatus for generating a resource template and rendering scene elements in a game, so as to reduce data size, reduce occupied memory space, make iteration more flexible, and enable multiplexing in other scenes.
In a first aspect, an embodiment of the present application provides a method for generating a resource template, where the method includes:
determining a plurality of resource nodes of a target resource according to the resource type of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween;
determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes;
and generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark.
With reference to the first aspect, an embodiment of the present application provides a first possible implementation manner of the first aspect, where the plurality of resource nodes include: a root node, a backbone node and a decoration node; the backbone nodes are child nodes of the root node, and the decoration nodes are child nodes of the backbone nodes; the backbone node is determined according to the resource type of the target resource; and the decoration node is determined according to the backbone node to which the decoration node belongs and the resource type to which the target resource belongs.
With reference to the first aspect, an embodiment of the present application provides a second possible implementation manner of the first aspect, where determining, according to a hierarchical relationship between the plurality of resource nodes, relative spatial transformation information between the plurality of resource nodes includes:
for each resource node, if the resource node includes a child node, determining relative spatial transformation information between the resource node and the first-level child node.
With reference to the first aspect, an embodiment of the present application provides a third possible implementation manner of the first aspect, where determining, according to a hierarchical relationship among the plurality of resource nodes, resource labels respectively corresponding to the plurality of resource nodes includes:
for each resource node, if the resource node is not a root node, determining a resource and a resource storage path corresponding to the resource node;
and determining the resource mark corresponding to the resource node based on the resource storage path corresponding to the resource node.
With reference to the third possible implementation manner of the first aspect, an embodiment of the present application provides a fourth possible implementation manner of the first aspect, where determining, based on the resource storage path corresponding to the resource node, a resource identifier corresponding to the resource node includes:
pre-establishing a mapping relation between a resource storage path set and a resource path identification set;
and determining the resource path identifier corresponding to the resource node as the resource mark corresponding to the resource node according to the mapping relation.
With reference to the third possible implementation manner of the first aspect, an embodiment of the present application provides a fifth possible implementation manner of the first aspect, where determining, based on the resource storage path corresponding to the resource node, a resource identifier corresponding to the resource node includes:
and determining the resource storage path corresponding to the resource node as the resource mark corresponding to the resource node.
With reference to any one of the foregoing possible implementation manners of the first aspect, an embodiment of the present application provides a sixth possible implementation manner of the first aspect, where the relative spatial transformation information includes at least one of:
relative position information, relative rotation information, and relative scaling information.
In a second aspect, an embodiment of the present application further provides a rendering method for scene elements in a game, where the rendering method includes:
responding to the touch operation of a user, and determining a copy in the game; wherein the copy comprises a target resource;
calling a resource template of a target resource, and searching for the resource according to a resource mark in the resource template; the resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes;
and rendering the target resources in the game according to the relative space transformation information in the resource template and the searched resources.
With reference to the second aspect, an embodiment of the present application provides a first possible implementation manner of the second aspect, where rendering a target resource in a game according to relative spatial transformation information in the resource template and a found resource includes:
for any resource node, if the resource node is not a root node, determining world space information of the resource node in a world coordinate system based on the world space information of a father node of the resource node in the world coordinate system and relative space transformation information between the resource node and the father node of the resource node;
and rendering the target resource in the game based on the world space information of the resource node in the world coordinate system and the searched resource corresponding to the resource node.
With reference to the first possible implementation manner of the second aspect, this embodiment provides a second possible implementation manner of the second aspect, where determining world space information of the resource node in a world coordinate system based on the world space information of the parent node of the resource node in the world coordinate system and relative spatial transformation information between the resource node and the parent node of the resource node includes:
determining a first matrix based on world space information of a father node of the resource node under a world coordinate system;
determining a second matrix based on relative spatial transformation information between the resource node and a parent node of the resource node;
and multiplying the second matrix by the first matrix to obtain a third matrix for representing the world space information of the resource node under the world coordinate system.
With reference to the second aspect, an embodiment of the present application provides a third possible implementation manner of the second aspect, where searching for a resource according to a resource tag in the resource template includes:
for each resource node, if the resource node is not a root node, determining a resource storage path corresponding to the resource node based on a resource mark corresponding to the resource node;
and searching the resource corresponding to the resource node from the resource storage path.
With reference to the third possible implementation manner of the second aspect, this application embodiment provides a fourth possible implementation manner of the second aspect, where determining, based on the resource label corresponding to the resource node, a resource storage path corresponding to the resource node includes:
determining a resource path identifier corresponding to the resource node based on the resource mark corresponding to the resource node;
and determining the resource storage path corresponding to the resource path identifier as the resource storage path corresponding to the resource node based on the mapping relation between the pre-established resource storage path set and the resource path identifier set.
With reference to the third possible implementation manner of the second aspect, an embodiment of the present application provides a fifth possible implementation manner of the second aspect, where determining, based on the resource label corresponding to the resource node, a resource storage path corresponding to the resource node includes:
and determining the resource mark corresponding to the resource node as a resource storage path corresponding to the resource node.
In a third aspect, an embodiment of the present application further provides a device for generating a resource template, where the device includes:
the node determining module is used for determining a plurality of resource nodes of the target resource according to the resource type of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween;
the information determining module is used for determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes;
and the template generating module is used for generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark.
In a fourth aspect, an embodiment of the present application further provides an apparatus for rendering scene elements in a game, where the apparatus for rendering includes:
the copy determining module is used for responding to the touch operation of the user and determining the copy in the game; wherein the copy comprises a target resource;
the resource searching module is used for calling a resource template of a target resource and searching the resource according to a resource mark in the resource template; the resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes;
and the resource rendering module is used for rendering the target resources in the game according to the relative space transformation information in the resource template and the searched resources.
In a fifth aspect, an embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, the processor and the memory communicate via the bus when the electronic device is running, and the machine-readable instructions, when executed by the processor, perform the steps of the first aspect, the second aspect, or any possible implementation of the first aspect or the second aspect.
In a sixth aspect, this application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to perform the steps in the first aspect, the second aspect, or any possible implementation manner of the first aspect and the second aspect.
According to the method for generating the resource template, firstly, a plurality of resource nodes of a target resource are determined according to the resource type of the target resource, and the resource nodes have a hierarchical relationship; then determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes; and finally, generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark. On one hand, because the resource template comprises relative space transformation information among a plurality of resource nodes, the world space information of the resource nodes under the world coordinate system under different scenes can be calculated according to the world space information of the actual reference nodes under the world coordinate system under different scenes and the relative space transformation information among the resource nodes, so that the resource template can be multiplexed into other scenes. On the other hand, the resource template of the application also comprises resource marks corresponding to the plurality of resource nodes respectively, and the resources corresponding to the plurality of resource nodes respectively are not stored, so that the data volume can be reduced, the occupied memory space is reduced, and the iteration is more flexible.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a flowchart illustrating a method for generating a resource template according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a tree structure provided by an embodiment of the present application;
FIG. 3 is a flowchart illustrating a rendering method of scene elements in a game according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram illustrating a resource template generation apparatus according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram illustrating an apparatus for rendering scene elements in a game according to an embodiment of the present disclosure;
fig. 6 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for illustrative and descriptive purposes only and are not used to limit the scope of protection of the present application. Additionally, it should be understood that the schematic drawings are not necessarily drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and steps without logical context may be performed in reverse order or simultaneously. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.
In addition, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
In consideration of the traditional scheme, on one hand, the city layout file imported into the game engine comprises world space information of a plurality of different city elements under a world coordinate system, and the information is fixed and invariable and cannot be reused in other game scenes; on the other hand, the city layout file imported into the game engine also comprises resources corresponding to a plurality of different city elements, and the game engine has the disadvantages of large data volume, large occupied memory space and low iteration speed. Based on this, the embodiments of the present application provide a method and an apparatus for generating a resource template and rendering a scene element in a game, which are described below by embodiments.
To facilitate understanding of the present embodiment, a detailed description is first given of a method for generating a resource template disclosed in the embodiments of the present application.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for generating a resource template according to an embodiment of the present disclosure. As shown in fig. 1, the generating method may include the steps of:
s101, determining a plurality of resource nodes of a target resource according to the resource type of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween;
s102, determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes;
s103, generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark.
In step S101, the target resource may refer to a resource of a target scene, such as an art resource required by a city in a game scene. The resource type may refer to a resource type of a target resource, such as a city in a game scene.
The plurality of resource nodes of the target resource have a hierarchical relationship therebetween. Specifically, as shown in fig. 2, the plurality of resource nodes include: the system comprises a root node, backbone nodes and decoration nodes, wherein the backbone nodes are child nodes of the root node, and the decoration nodes are child nodes of the backbone nodes. The backbone node is determined according to the resource type of the target resource, and the decoration node is determined according to the backbone node and the resource type of the target resource.
Taking a city in a game scene as an example for explanation, if the resource type of the target resource is the city in the game scene, determining the backbone node as a building node for constructing a city backbone according to the city in the game scene; and determining the decoration node as a decoration node for decorating the affiliated building node according to the city and the affiliated building node in the game scene. The plurality of resource nodes determined according to cities in the game scene include: a root node, a plurality of building nodes and a plurality of decoration nodes. Wherein one root node corresponds to a plurality of building nodes and child nodes of the root node are building nodes. Each building node corresponds to a plurality of decorative nodes, and the children of the building node are decorative nodes.
In step S102, the relative spatial transformation information may include at least one of: relative position information, relative rotation information, relative zoom information, and the like. Here, the relative spatial transformation may refer to: and converting the data of the current node in the world coordinate system in a relative space by taking the world space information of the reference node in the world coordinate system as a reference. The relative position information may refer to: and performing relative space transformation on the world position information of the current node in the world coordinate system to obtain relative position information. The relative rotation information may refer to: and performing relative space transformation on the world rotation information of the current node under the world coordinate system to obtain relative rotation information. The relative scaling information may refer to: and carrying out relative space transformation on the world scaling information of the current node under the world coordinate system to obtain relative scaling information.
In this embodiment, in the step S102, determining the relative space transformation information between the resource nodes according to the hierarchical relationship between the resource nodes may include: for each resource node, if the resource node includes a child node, determining relative spatial transformation information between the resource node and the first-level child node.
Taking the tree structure shown in fig. 2 as an example, the first-level child node of the root node is the backbone node, the root node is the reference node, the backbone node is the current node, and the relative spatial transformation information of the backbone node with respect to the root node is determined. And determining the relative spatial transformation information of the decoration node relative to the backbone node by taking the first-level child node of the backbone node as a decoration node, taking the backbone node as a reference node and taking the decoration node as a current node.
In step S102, the resource mark is used to mark a resource storage path corresponding to the resource node. Here, the resource mark may be a resource storage path corresponding to the resource node, or may be a path identifier of the resource storage path corresponding to the resource node. As for the resource marking, there are the following two embodiments:
firstly, a mapping relation between a resource storage path set and a resource path identification set is established in advance; and determining the resource path identifier corresponding to the resource node as the resource mark corresponding to the resource node according to the mapping relation. In this embodiment, the resource label refers to a resource path identifier corresponding to the resource node. Because the mapping relation between the resource storage path set and the resource path identification set is established in advance, the mapping relation can be stored in a mapping table or a database mode, and the corresponding resource storage path can be searched through the resource path identification.
And secondly, determining the resource storage path corresponding to the resource node as the resource mark corresponding to the resource node. In this embodiment, the resource label refers to a resource storage path corresponding to the resource node.
In this embodiment, in the step S102, determining the resource labels corresponding to the resource nodes respectively according to the hierarchical relationship among the resource nodes includes: for each resource node, if the resource node is not a root node, determining a resource and a resource storage path corresponding to the resource node; and determining the resource mark corresponding to the resource node based on the resource storage path corresponding to the resource node. Note that the root node is only a reference point of the world coordinate system, and does not correspond to a certain resource and a resource storage path.
Taking the tree structure shown in fig. 2 as an example, the resource nodes other than the root node include a backbone node and a decorative node. Determining resources and resource storage paths corresponding to the backbone nodes aiming at each backbone node; and determining the resource mark corresponding to the backbone node based on the resource storage path corresponding to the backbone node. Determining resources and resource storage paths corresponding to the decoration nodes aiming at each decoration node; and determining the resource mark corresponding to the decoration node based on the resource storage path corresponding to the decoration node.
In step S103, the resource template of the target resource includes relative spatial transformation information between the plurality of resource nodes and resource labels respectively corresponding to the plurality of resource nodes. Since the relative spatial transformation information is only used to characterize the relative spatial transformation information between resource nodes, it belongs to relative data that can be multiplexed into other scenarios. Therefore, the world space information of the resource nodes under the world coordinate system under different scenes can be calculated according to the world space information of the actual reference nodes under the world coordinate system under different scenes and the relative space transformation information between the resource nodes, so that the world space information can be multiplexed into other scenes. And compared with the resource file, the data volume of the resource mark is very small, the occupied memory space is also small, and the iteration is more flexible when the resource template is used for rendering.
According to the method for generating the resource template, firstly, a plurality of resource nodes of a target resource are determined according to the resource type of the target resource, and the resource nodes have a hierarchical relationship; then determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes; and finally, generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark. On one hand, because the resource template comprises relative space transformation information among a plurality of resource nodes, the world space information of the resource nodes under the world coordinate system under different scenes can be calculated according to the world space information of the actual reference nodes under the world coordinate system under different scenes and the relative space transformation information among the resource nodes, so that the resource template can be multiplexed into other scenes. On the other hand, the resource template of the application also comprises resource marks corresponding to the plurality of resource nodes respectively, and the resources corresponding to the plurality of resource nodes respectively are not stored, so that the data volume can be reduced, the occupied memory space is reduced, and the iteration is more flexible.
The method for rendering scene elements in a game disclosed in the embodiments of the present application will be described in detail below.
Referring to fig. 3, fig. 3 is a flowchart illustrating a rendering method of scene elements in a game according to an embodiment of the present disclosure. As shown in fig. 3, the rendering method may include the steps of:
s301, responding to touch operation of a user, and determining a copy in a game; wherein the copy comprises a target resource;
s302, calling a resource template of a target resource, and searching for the resource according to a resource mark in the resource template; the resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes;
s303, rendering the target resource in the game according to the relative space transformation information in the resource template and the searched resource.
In step S301, the copy in the game includes a target resource, where the target resource refers to an art resource required by a scene element in the game. Here, the scene element may be a building, a decoration, or the like in a city. And locking the copy in the game through the touch operation of the user so as to determine the target resource.
In step S302, the resource template of the target resource may refer to a template structure for restoring the target resource. The resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively. Wherein the relative spatial transformation information may include at least one of: relative position information, relative rotation information, relative zoom information, and the like. The resource mark is used for marking a resource storage path corresponding to the resource node. Here, the resource mark may be a resource storage path corresponding to the resource node, or may be a path identifier of the resource storage path corresponding to the resource node.
The plurality of resource nodes are determined according to the resource type of the target resource, and the plurality of resource nodes have a hierarchical relationship. Where the resource type may refer to a resource type of a target resource, such as a city in a game scenario. Taking a city in a game scene as an example for explanation, as shown in fig. 2, if the resource type to which the target resource belongs is a city in a game scene, the plurality of resource nodes include a root node, a backbone node, and a decoration node, and the root node, the backbone node, and the decoration node have a hierarchical relationship, that is, the backbone node is a child node of the root node, and the decoration node is a child node of the backbone node. The backbone nodes are building nodes for constructing the city backbone, and the decoration nodes are decoration nodes for decorating the building nodes.
The relative spatial transformation information is determined according to a hierarchical relationship between the plurality of resource nodes. In this embodiment, the relative spatial transformation information in the resource template is the relative spatial transformation information between the resource node and the first-level child node. Taking the tree structure shown in fig. 2 as an example, the first-level sub-node of the root node is a backbone node, the first-level sub-node of the backbone node is a decoration node, and the relative spatial transformation information in the resource template includes relative spatial transformation information between the root node and the backbone node and relative spatial transformation information between the backbone node and the decoration node.
The resource indicia is determined from a hierarchical relationship between the plurality of resource nodes. In this embodiment, for each resource node, if the resource node is not a root node, the resource label is determined based on the resource storage path corresponding to the resource node. Note that the root node is only a reference point of the world coordinate system, and does not correspond to a certain resource and a resource storage path. Taking the tree structure shown in fig. 2 as an example, the resource nodes other than the root node include a backbone node and a decorative node. For each backbone node, the resource label is determined based on the resource storage path corresponding to the backbone node. For each decoration node, the resource mark is determined based on the resource storage path corresponding to the decoration node.
In this embodiment, a resource template of the target resource is called, and the relative spatial transformation information and the resource tag in the resource template are read. And aiming at each resource node, if the resource node is not a root node, determining a resource storage path corresponding to the resource node based on a resource mark corresponding to the resource node, and searching for the resource corresponding to the resource node from the resource storage path.
Regarding determining the resource storage path corresponding to the resource node, there are the following two embodiments:
firstly, determining a resource path identifier corresponding to the resource node based on a resource mark corresponding to the resource node; and determining the resource storage path corresponding to the resource path identifier as the resource storage path corresponding to the resource node based on the mapping relation between the pre-established resource storage path set and the resource path identifier set. In this embodiment, the resource label refers to a resource path identifier corresponding to the resource node. Because the mapping relation between the resource storage path set and the resource path identification set is established in advance, the mapping relation can be stored in a mapping table or a database mode, and the corresponding resource storage path can be searched through the resource path identification.
And secondly, determining the resource mark corresponding to the resource node as a resource storage path corresponding to the resource node. In this embodiment, the resource label refers to a resource storage path corresponding to the resource node.
In step S303, the world space information includes at least one of: world position information, world rotation information, world zoom information, and the like.
In this step, for any resource node, if the resource node is not a root node, determining world space information of the resource node in a world coordinate system based on the world space information of a parent node of the resource node in the world coordinate system and relative space transformation information between the resource node and the parent node of the resource node; and rendering the target resource in the game based on the world space information of the resource node in the world coordinate system and the searched resource corresponding to the resource node.
Taking the tree structure shown in fig. 2 as an example, the backbone nodes are specified from the world space information of the root node in the world coordinate system and the relative space transformation information between the backbone nodes and the root node. And rendering the resources in the game based on the world space information of the backbone nodes in the world coordinate system and the searched resources corresponding to the backbone nodes. And for the decoration nodes, determining the world space information of the decoration nodes in the world coordinate system based on the world space information of the backbone nodes in the world coordinate system and the relative space transformation information between the decoration nodes and the backbone nodes. And rendering the resources in the game based on the world space information of the decoration nodes in the world coordinate system and the resources corresponding to the searched decoration nodes.
In this embodiment, the determining the world space information of the resource node in the world coordinate system based on the world space information of the parent node of the resource node in the world coordinate system and the relative space transformation information between the resource node and the parent node of the resource node may include: determining a first matrix based on world space information of a father node of the resource node under a world coordinate system; determining a second matrix based on relative spatial transformation information between the resource node and a parent node of the resource node; and multiplying the second matrix by the first matrix to obtain a third matrix for representing the world space information of the resource node under the world coordinate system. That is, the second matrix for representing the relative spatial transformation information between the resource node and the parent node of the resource node is multiplied by the first matrix for representing the world space information of the parent node of the resource node in the world coordinate system, so as to obtain the third matrix for representing the world space information of the resource node in the world coordinate system.
Taking the tree structure shown in fig. 2 as an example, for the backbone nodes, a second matrix for representing relative spatial transformation information between the backbone nodes and the root nodes is multiplied by a first matrix for representing world space information of the root nodes in a world coordinate system, so as to obtain a third matrix for representing the world space information of the backbone nodes in the world coordinate system. And for the decoration nodes, multiplying a second matrix used for representing relative space transformation information between the decoration nodes and the backbone nodes by a first matrix used for representing world space information of the backbone nodes in a world coordinate system to obtain a third matrix used for representing the world space information of the decoration nodes in the world coordinate system.
According to the rendering method of the scene elements in the game, provided by the embodiment of the application, the copy in the game is locked through the touch operation of a user, so that the target resource is determined; then calling a resource template of the target resource, reading relative space transformation information among a plurality of resource nodes in the resource template and resource marks corresponding to the resource nodes respectively, and searching for the resource according to the resource marks; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes; and finally, rendering the target resources in the game according to the relative space transformation information and the searched resources. On one hand, because the resource template comprises relative space transformation information among a plurality of resource nodes, the world space information of the resource nodes under the world coordinate system under different scenes can be calculated according to the world space information of the actual reference nodes under the world coordinate system under different scenes and the relative space transformation information among the resource nodes, so that the resource template can be multiplexed into other scenes for rendering. On the other hand, the resource template of the application also comprises resource marks corresponding to the plurality of resource nodes respectively, and the resources corresponding to the plurality of resource nodes respectively are not stored, so that the data volume can be reduced, the occupied memory space is reduced, and the iteration is more flexible.
Based on the same technical concept, embodiments of the present application further provide a resource template generation apparatus, a rendering apparatus for scene elements in a game, an electronic device, and a computer storage medium, and the like, which may be referred to in the following embodiments.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a device for generating a resource template according to an embodiment of the present application. As shown in fig. 4, the generating means may include:
a node determining module 401, configured to determine, according to a resource type to which a target resource belongs, a plurality of resource nodes of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween;
an information determining module 402, configured to determine, according to a hierarchical relationship among the resource nodes, relative space transformation information among the resource nodes and resource labels respectively corresponding to the resource nodes;
a template generating module 403, configured to generate a resource template of the target resource according to the relative space transformation information between the resource nodes and the resource tag.
In one possible embodiment, the plurality of resource nodes includes: a root node, a backbone node and a decoration node; the backbone nodes are child nodes of the root node, and the decoration nodes are child nodes of the backbone nodes; the backbone node is determined according to the resource type of the target resource; and the decoration node is determined according to the backbone node to which the decoration node belongs and the resource type to which the target resource belongs.
In one possible implementation, the information determining module 402 may include:
and the transformation information determining unit is used for determining the relative space transformation information between each resource node and the first-level child node if the resource node comprises the child node.
In one possible implementation, the information determining module 402 may further include:
a storage path determining unit, configured to determine, for each resource node, a resource and a resource storage path corresponding to the resource node if the resource node is not a root node;
and the resource mark determining unit is used for determining the resource mark corresponding to the resource node based on the resource storage path corresponding to the resource node.
In a possible implementation manner, the resource identifier determining unit is specifically configured to:
pre-establishing a mapping relation between a resource storage path set and a resource path identification set;
and determining the resource path identifier corresponding to the resource node as the resource mark corresponding to the resource node according to the mapping relation.
In a possible implementation manner, the resource identifier determining unit is specifically configured to:
and determining the resource storage path corresponding to the resource node as the resource mark corresponding to the resource node.
In one possible embodiment, the relative spatial transformation information includes at least one of:
relative position information, relative rotation information, and relative scaling information.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a rendering apparatus for scene elements in a game according to an embodiment of the present disclosure. As shown in fig. 5, the rendering apparatus may include:
a copy determining module 501, configured to determine a copy in a game in response to a touch operation of a user; wherein the copy comprises a target resource;
a resource searching module 502, configured to invoke a resource template of a target resource, and search for a resource according to a resource tag in the resource template; the resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes;
and a resource rendering module 503, configured to render the target resource in the game according to the relative space transformation information in the resource template and the found resource.
In one possible implementation, the resource rendering module 503 may include:
an information determining unit, configured to determine, for any resource node, world space information of the resource node in a world coordinate system based on the world space information of a parent node of the resource node in the world coordinate system and relative space transformation information between the resource node and the parent node of the resource node if the resource node is not a root node;
and the resource rendering unit is used for rendering the target resource in the game based on the world space information of the resource node in the world coordinate system and the searched resource corresponding to the resource node.
In a possible implementation, the information determining unit is specifically configured to:
determining a first matrix based on world space information of a father node of the resource node under a world coordinate system;
determining a second matrix based on relative spatial transformation information between the resource node and a parent node of the resource node;
and multiplying the second matrix by the first matrix to obtain a third matrix for representing the world space information of the resource node under the world coordinate system.
In one possible implementation, the resource lookup module 502 may include:
a path determining unit, configured to determine, for each resource node, a resource storage path corresponding to the resource node based on a resource label corresponding to the resource node if the resource node is not a root node;
and the resource searching unit is used for searching the resource corresponding to the resource node from the resource storage path.
In a possible implementation, the path determining unit is specifically configured to:
determining a resource path identifier corresponding to the resource node based on the resource mark corresponding to the resource node;
and determining the resource storage path corresponding to the resource path identifier as the resource storage path corresponding to the resource node based on the mapping relation between the pre-established resource storage path set and the resource path identifier set.
In a possible implementation, the path determining unit is specifically configured to:
and determining the resource mark corresponding to the resource node as a resource storage path corresponding to the resource node.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 6, includes: the processor 601, the memory 602, and the bus 603, where the memory 602 stores machine-readable instructions executable by the processor 601, when the electronic device runs, the processor 601 communicates with the memory 602 through the bus 603, and the processor 601 executes the machine-readable instructions to perform the method described in the foregoing method embodiment.
The computer program product for generating a resource template and rendering a scene element in a game provided in the embodiments of the present application includes a computer-readable storage medium storing a non-volatile program code executable by a processor, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and details are not repeated here.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and 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 of devices or units through some communication interfaces, and may be in an electrical, mechanical 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 application 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 functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the exemplary embodiments of the present application, and are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (17)

1. A method for generating a resource template, the method comprising:
determining a plurality of resource nodes of a target resource according to the resource type of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween;
determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes;
and generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark.
2. The generation method according to claim 1, wherein the plurality of resource nodes include: a root node, a backbone node and a decoration node; the backbone nodes are child nodes of the root node, and the decoration nodes are child nodes of the backbone nodes; the backbone node is determined according to the resource type of the target resource; and the decoration node is determined according to the backbone node to which the decoration node belongs and the resource type to which the target resource belongs.
3. The generation method according to claim 1, wherein determining relative spatial transformation information between the plurality of resource nodes according to the hierarchical relationship between the plurality of resource nodes comprises:
for each resource node, if the resource node includes a child node, determining relative spatial transformation information between the resource node and the first-level child node.
4. The generation method according to claim 1, wherein determining the resource labels respectively corresponding to the plurality of resource nodes according to the hierarchical relationship among the plurality of resource nodes comprises:
for each resource node, if the resource node is not a root node, determining a resource and a resource storage path corresponding to the resource node;
and determining the resource mark corresponding to the resource node based on the resource storage path corresponding to the resource node.
5. The generation method according to claim 4, wherein determining the resource label corresponding to the resource node based on the resource storage path corresponding to the resource node comprises:
pre-establishing a mapping relation between a resource storage path set and a resource path identification set;
and determining the resource path identifier corresponding to the resource node as the resource mark corresponding to the resource node according to the mapping relation.
6. The generation method according to claim 4, wherein determining the resource label corresponding to the resource node based on the resource storage path corresponding to the resource node comprises:
and determining the resource storage path corresponding to the resource node as the resource mark corresponding to the resource node.
7. The method of any one of claims 1-6, wherein the relative spatial transformation information comprises at least one of:
relative position information, relative rotation information, and relative scaling information.
8. A rendering method of scene elements in a game, the rendering method comprising:
responding to the touch operation of a user, and determining a copy in the game; wherein the copy comprises a target resource;
calling a resource template of a target resource, and searching for the resource according to a resource mark in the resource template; the resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes;
and rendering the target resources in the game according to the relative space transformation information in the resource template and the searched resources.
9. The rendering method according to claim 8, wherein rendering the target resource in the game according to the relative space transformation information in the resource template and the searched resource comprises:
for any resource node, if the resource node is not a root node, determining world space information of the resource node in a world coordinate system based on the world space information of a father node of the resource node in the world coordinate system and relative space transformation information between the resource node and the father node of the resource node;
and rendering the target resource in the game based on the world space information of the resource node in the world coordinate system and the searched resource corresponding to the resource node.
10. The rendering method of claim 9, wherein determining the world space information of the resource node in the world coordinate system based on the world space information of the parent node of the resource node in the world coordinate system and the relative space transformation information between the resource node and the parent node of the resource node comprises:
determining a first matrix based on world space information of a father node of the resource node under a world coordinate system;
determining a second matrix based on relative spatial transformation information between the resource node and a parent node of the resource node;
and multiplying the second matrix by the first matrix to obtain a third matrix for representing the world space information of the resource node under the world coordinate system.
11. The rendering method of claim 8, wherein finding resources from the resource tags in the resource template comprises:
for each resource node, if the resource node is not a root node, determining a resource storage path corresponding to the resource node based on a resource mark corresponding to the resource node;
and searching the resource corresponding to the resource node from the resource storage path.
12. The rendering method according to claim 11, wherein determining the resource storage path corresponding to the resource node based on the resource identifier corresponding to the resource node comprises:
determining a resource path identifier corresponding to the resource node based on the resource mark corresponding to the resource node;
and determining the resource storage path corresponding to the resource path identifier as the resource storage path corresponding to the resource node based on the mapping relation between the pre-established resource storage path set and the resource path identifier set.
13. The rendering method according to claim 11, wherein determining the resource storage path corresponding to the resource node based on the resource identifier corresponding to the resource node comprises:
and determining the resource mark corresponding to the resource node as a resource storage path corresponding to the resource node.
14. An apparatus for generating a resource template, the apparatus comprising:
the node determining module is used for determining a plurality of resource nodes of the target resource according to the resource type of the target resource; wherein a plurality of the resource nodes have a hierarchical relationship therebetween;
the information determining module is used for determining relative space transformation information among the resource nodes and resource marks corresponding to the resource nodes respectively according to the hierarchical relation among the resource nodes;
and the template generating module is used for generating a resource template of the target resource according to the relative space transformation information among the plurality of resource nodes and the resource mark.
15. An apparatus for rendering a scene element in a game, the apparatus comprising:
the copy determining module is used for responding to the touch operation of the user and determining the copy in the game; wherein the copy comprises a target resource;
the resource searching module is used for calling a resource template of a target resource and searching the resource according to a resource mark in the resource template; the resource template comprises relative space transformation information among a plurality of resource nodes and resource marks corresponding to the resource nodes respectively; the plurality of resource nodes are determined according to the resource type of the target resource, and a hierarchical relationship exists among the plurality of resource nodes; the relative spatial transformation information and the resource indicia are determined from a hierarchical relationship between the plurality of resource nodes;
and the resource rendering module is used for rendering the target resources in the game according to the relative space transformation information in the resource template and the searched resources.
16. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the method according to any one of claims 1 to 13.
17. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, is adapted to carry out the steps of the method according to any one of claims 1 to 13.
CN202110636797.4A 2021-06-08 2021-06-08 Resource template generation method and device and scene element rendering method and device in game Pending CN113262469A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110636797.4A CN113262469A (en) 2021-06-08 2021-06-08 Resource template generation method and device and scene element rendering method and device in game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110636797.4A CN113262469A (en) 2021-06-08 2021-06-08 Resource template generation method and device and scene element rendering method and device in game

Publications (1)

Publication Number Publication Date
CN113262469A true CN113262469A (en) 2021-08-17

Family

ID=77234445

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110636797.4A Pending CN113262469A (en) 2021-06-08 2021-06-08 Resource template generation method and device and scene element rendering method and device in game

Country Status (1)

Country Link
CN (1) CN113262469A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140267239A1 (en) * 2013-03-15 2014-09-18 Dreamworks Animation Llc Generalized instancing for three-dimensional scene data
US20140304214A1 (en) * 2008-02-22 2014-10-09 Nathan Sakunkoo Navigable semantic network definition, modeling, and use
US20140313197A1 (en) * 2013-04-19 2014-10-23 Huawei Technologies Co., Ltd. Method for Displaying a 3D Scene Graph on a Screen
WO2017036309A1 (en) * 2015-08-31 2017-03-09 阿里巴巴集团控股有限公司 Page rendering method, device and apparatus
CN108734788A (en) * 2018-05-17 2018-11-02 成都明镜视觉科技有限公司 A kind of node method for organizing of 3D objects in virtual scene
CN112604283A (en) * 2020-12-29 2021-04-06 珠海金山网络游戏科技有限公司 Data rendering method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140304214A1 (en) * 2008-02-22 2014-10-09 Nathan Sakunkoo Navigable semantic network definition, modeling, and use
US20140267239A1 (en) * 2013-03-15 2014-09-18 Dreamworks Animation Llc Generalized instancing for three-dimensional scene data
US20140313197A1 (en) * 2013-04-19 2014-10-23 Huawei Technologies Co., Ltd. Method for Displaying a 3D Scene Graph on a Screen
WO2017036309A1 (en) * 2015-08-31 2017-03-09 阿里巴巴集团控股有限公司 Page rendering method, device and apparatus
CN108734788A (en) * 2018-05-17 2018-11-02 成都明镜视觉科技有限公司 A kind of node method for organizing of 3D objects in virtual scene
CN112604283A (en) * 2020-12-29 2021-04-06 珠海金山网络游戏科技有限公司 Data rendering method and device

Similar Documents

Publication Publication Date Title
CN107992304B (en) Method and device for generating display interface
CN109558479B (en) Rule matching method, device, equipment and storage medium
CN103678705B (en) A kind of VCT file is to the vector data Parallel transformation method of shapefile file
CN108205960B (en) Method and device for rendering characters, electronic map making system and navigation system
CN106250129B (en) Vector quantization symbol dynamic drawing method based on meta graph recognition model
CN111290931B (en) Method and device for visually displaying buried point data
CN112417569B (en) Revit primitive labeling method, device, equipment and storage medium
CN113282687A (en) Data display method and device, computer equipment and storage medium
JP4589159B2 (en) Raster map search device
CN111353002B (en) Training method and device for network representation learning model, electronic equipment and medium
CN113610963B (en) Three-dimensional network topology drawing method, device, computing equipment and storage medium
CN114741071A (en) Application construction method and device
CN113850643A (en) Product recommendation method and device, electronic equipment and readable storage medium
KR101205865B1 (en) Design QR code making method
CN113262469A (en) Resource template generation method and device and scene element rendering method and device in game
CN105354295B (en) Dynamic display device and method for three-dimensional dynamic plotting point labels
CN112118474B (en) Video barrage display method and system, computer equipment and readable storage medium
CN113160405A (en) Point cloud map generation method and device, computer equipment and storage medium
CN104156364A (en) Display method and device of map search result
CN109388398B (en) Interface generation method and device in virtualization system
WO2020250313A1 (en) Polygon lookup method
CN112100307A (en) Data processing method, path searching processing method and device and electronic equipment
CN114157909B (en) Learning video generation method and device, electronic equipment and storage medium
CN115617324B (en) Client webpage generation method
CN112836469A (en) Information rendering method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination