CN110990100A - Method and device for processing node object in game scene - Google Patents

Method and device for processing node object in game scene Download PDF

Info

Publication number
CN110990100A
CN110990100A CN201911205413.2A CN201911205413A CN110990100A CN 110990100 A CN110990100 A CN 110990100A CN 201911205413 A CN201911205413 A CN 201911205413A CN 110990100 A CN110990100 A CN 110990100A
Authority
CN
China
Prior art keywords
node
node object
game scene
static
dynamic
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
CN201911205413.2A
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.)
Beijing Kingsoft Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software 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 Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201911205413.2A priority Critical patent/CN110990100A/en
Publication of CN110990100A publication Critical patent/CN110990100A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • 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/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • 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/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images

Abstract

The application discloses a method and a device for processing node objects in a game scene, wherein the method for processing the node objects in the game scene comprises the following steps: creating a dynamic node object and a static node object in a game scene, acquiring rendering data corresponding to the static node object, performing static batch processing on the rendering data to display the static node object in the game scene, acquiring a configuration file corresponding to the dynamic node object, operating the configuration file, and performing logical operation on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene, or stopping displaying the dynamic node object. By adopting the technical scheme, the node objects in the game scene can be effectively managed, and the running performance of the game is improved.

Description

Method and device for processing node object in game scene
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for processing a node object in a game scene.
Background
With the rapid development of games, pictures displayed in game scenes are more and more three-dimensional and fine, so that players can more vividly feel the game world, and the experience of the players is enriched.
However, in the mini game in the market, the number of node objects in the game scene is very large and complex, and there is no good way to manage the node objects, so that it is very cumbersome to process the node objects during game development and the game performance is affected.
Disclosure of Invention
The embodiment of the invention provides a method and a device for processing a node object in a game scene, which can improve the running performance of a game.
In a first aspect, an embodiment of the present invention provides a method for processing a node object in a game scene, including:
creating a dynamic node object and a static node object in a game scene;
acquiring rendering data corresponding to the static node object;
performing static batch processing on the rendering data to display the static node objects in the game scene;
acquiring a configuration file corresponding to the dynamic node object, wherein the configuration file comprises logic operation data associated with the dynamic node object;
and running the configuration file, and carrying out logic operation on the dynamic node object according to the logic operation data so as to display the dynamic node object in the game scene, or stopping displaying the dynamic node object.
In one possible implementation, the creating dynamic node objects and static node objects in the game scene includes:
creating a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scene, the at least one first child node indicating at least one second dynamic node object in the game scene, a first child node indicating a second dynamic node object;
creating a second parent node and at least one second child node associated with the second parent node, the second parent node indicating a first static node object in the game scene, the at least one second child node indicating at least one second static node object in the game scene, one second child node indicating one second static node object.
In one possible implementation, the method further includes:
configuring a first script file for the first parent node, the first script file including logical operation data associated with the first dynamic node object;
configuring at least one second script file for at least one first child node, wherein one first child node is configured with one second script file, and the second script file comprises logic operation data related to a second dynamic node object indicated by the first child node;
and generating the configuration file according to the first script file and the at least one second script file.
In an embodiment of a possible implementation, the running the configuration file and performing a logical operation on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene or stop displaying the dynamic node object includes:
if the dynamic node object needs to be started to be displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, wherein the dynamic node object is in an undisplayed state before the current moment; alternatively, the first and second electrodes may be,
and if the dynamic node object needs to be stopped from being displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to stop displaying the dynamic node object in the game scene, wherein the dynamic node object is in a display state before the current moment.
In an embodiment of one possible implementation, after the performing a logical operation on the dynamic node object according to the logical operation data to stop displaying the dynamic node object in the game scene, the method further includes:
and deleting the configuration file corresponding to the dynamic node object.
In an embodiment of possible implementation, the obtaining rendering data corresponding to the static node object includes:
acquiring first rendering data corresponding to the second parent node, wherein the first rendering data comprises rendering data of the first static node object;
and acquiring at least one second rendering data corresponding to the at least one second child node, wherein the second rendering data comprises the rendering data of a second static node object indicated by the second child node.
In one possible implementation, the static batch processing the rendering data to render and display the static node object in the game scene includes:
generating target rendering data from the first rendering data and the at least one second rendering data;
invoking the target rendering data through a first drawing command to render and display the first static node object and the at least one second static node object in the game scene.
In a second aspect, an embodiment of the present invention provides a device for processing a node object in a game scene, including:
the creating module is used for creating a dynamic node object and a static node object in a game scene;
a first obtaining module, configured to obtain rendering data corresponding to the static node object;
the first display module is used for carrying out static batch processing on the rendering data so as to display the static node objects in the game scene;
a second obtaining module, configured to obtain a configuration file corresponding to the dynamic node object, where the configuration file includes logical operation data associated with the dynamic node object;
and the second display module is used for operating the configuration file and carrying out logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene or stop displaying the dynamic node object.
In one possible implementation, the creating module includes:
a first creating unit configured to create a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scene, the at least one first child node indicating at least one second dynamic node object in the game scene, one first child node indicating one second dynamic node object;
a second creating unit, configured to create a second parent node and at least one second child node associated with the second parent node, where the second parent node indicates a first static node object in the game scene, the at least one second child node indicates at least one second static node object in the game scene, and one second child node indicates one second static node object.
In another possible implementation, the apparatus further includes:
a first configuration module, configured to configure a first script file for the first parent node, where the first script file includes logical operation data associated with the first dynamic node object;
a second configuration module, configured to configure at least one second script file for the at least one first child node, where one second script file is configured for one first child node, and the second script file includes logical operation data associated with a second dynamic node object indicated by the first child node;
and the generating module is used for generating the configuration file according to the first script file and the at least one second script file.
In an embodiment of possible implementation, the second display module is specifically configured to:
if the dynamic node object needs to be started to be displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, wherein the dynamic node object is in an undisplayed state before the current moment; alternatively, the first and second electrodes may be,
and if the dynamic node object needs to be stopped from being displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to stop displaying the dynamic node object in the game scene, wherein the dynamic node object is in a display state before the current moment.
In another possible implementation, the apparatus further includes:
and the deleting module is used for deleting the configuration file corresponding to the dynamic node object.
In one possible implementation, the first obtaining module includes:
a first obtaining unit, configured to obtain first rendering data corresponding to the second parent node, where the first rendering data includes rendering data of the first static node object;
a second obtaining unit, configured to obtain at least one second rendering data corresponding to the at least one second child node, where the second rendering data includes rendering data of a second static node object indicated by the second child node.
In one possible implementation, the first display module includes:
a generating unit configured to generate target rendering data from the first rendering data and the at least one second rendering data;
and the display unit is used for calling the target rendering data through a first drawing command so as to render and display the first static node object and the at least one second static node object in the game scene.
In a third aspect, an embodiment of the present invention provides a device for processing a node object in a game scenario, including a processor, a memory, and a communication interface, where the processor, the memory, and the communication interface are connected to each other, where the communication interface is used to receive and send data, the memory is used to store program codes, and the processor is used to call the program codes to execute the method according to the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer storage medium storing a computer program comprising program instructions that, when executed by a processor, perform the method of the first aspect.
In the embodiment of the present invention, a dynamic node object and a static node object in a game scene are created, rendering data corresponding to the static node object is obtained, static batch processing is performed on the rendering data to display the static node object in the game scene, a configuration file corresponding to the dynamic node object is obtained, the configuration file is run, and a logical operation is performed on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene, or the display of the dynamic node object is stopped. By adopting the technical scheme of the application, different processing modes are respectively adopted for the static node object and the dynamic node object, the rendering data of the static node object is subjected to static batch processing, logical operation is not needed, only the dynamic node object is subjected to logical operation, and the running performance of the game is improved.
Drawings
In order to illustrate embodiments of the present invention or technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of a method for processing a node object in a game scene according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for generating a configuration file according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a device for processing a node object in a game scene according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a processing apparatus for processing node objects in another game scenario according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a device for processing a node object in a game scene according to another embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
The following describes in detail a processing method for a node object in a game scene according to an embodiment of the present invention with reference to fig. 1 to fig. 2.
Please refer to fig. 1, which is a flowchart illustrating a processing method of a node object in a game scene according to an embodiment of the present invention. As shown in fig. 1, the method for processing node objects in a game scene according to an embodiment of the present invention may include the following steps S101 to S105.
S101, creating a dynamic node object and a static node object in a game scene;
in the embodiment of the invention, the game scene refers to a picture for restoring available node objects such as buildings, trees, sky, roads and the like in the game according to the game design requirement. In 3D games, a game scene provides a space containing various node objects, which is determined by the width, depth and height of the desired design game scene picture. The node objects in the game scene may be characters, buildings, machines, props, mountain stones, trees, and the like included in the game scene. Such as trees, stones, characters, etc. in the game scene, the trees, stones, characters, etc. may be node objects in the game scene.
Wherein the first dynamic node object may be indicated by creating a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scenario, the at least one first child node indicating at least one second dynamic node object in the game scenario, and a first child node indicating a second dynamic node object. A second parent node is created that indicates a first static node object in the game scene and at least one second child node associated with the second parent node that indicates at least one second static node object in the game scene and one second child node that indicates one second static node object. The method comprises the steps of creating a first father node and a second father node, and creating at least one first child node and at least one second child node according to the first father node and the second father node, so that nodes in a game scene are subjected to dynamic and static division, and dynamic node objects and static node objects in the game scene are created.
Alternatively, a first parent node and a second parent node may be created by using the game development tool Unity3D, and then at least one first child node and at least one second child node are created according to a game scene picture to be created, where the first parent node indicates a first dynamic node object in the game scene, the at least one first child node indicates at least one second dynamic node object in the game scene, and the dynamic node object refers to an object moving in the game scene, such as a walking character or a sledge moving up and down, and the like. The second father node indicates a first static node object in the game scene, at least one second son node indicates at least one second static node object in the game scene, and the static node objects refer to static objects in the game scene, such as stones, trees and the like which are relatively static at two sides of a road.
S102, obtaining rendering data corresponding to the static node object;
s103, performing static batch processing on the rendering data to display the static node objects in the game scene;
in the embodiment of the present invention, rendering data of a static node object is obtained, where the static node object in the embodiment of the present invention includes a second parent node and at least one second child node, first rendering data corresponding to the second parent node is obtained, the first rendering data includes rendering data of the first static node object, at least one second rendering data corresponding to the at least one second child node is obtained, and the second rendering data includes rendering data of a second static node object indicated by the second child node. And generating target rendering data according to the first rendering data and the at least one second rendering data, and calling the target rendering data through a first drawing command so as to render and display the first static node object and the at least one second static node object in the game scene.
The rendering data corresponding to a large number of static node objects which do not need to change positions can be subjected to static batch processing, all static node objects which do not change positions in the Unity3D game scene are selected with static options, and the engine can judge whether the static node objects in the game scene share the same rendering material according to the rendering data of the static node objects, such as wood sharing the same rendering material. If the same rendering material is shared, static node objects that share the same rendering material are treated as objects that can be batched. During rendering, at least one mesh corresponding to at least one static node object sharing one rendering material is synthesized into a larger mesh to generate target rendering data, a first drawing command is submitted by a CPU according to the target rendering data and stored in a command buffer, and the GPU extracts the first drawing command in the command buffer to perform rendering operation. This first drawing command is referred to as a Draw Call, and in Unity, the process of preparing data and notifying the GPU each time the engine is called a Draw Call. The CPU and the GPU realize parallel work through a command buffer area, the command buffer area stores the command of the CPU, and the GPU takes out the command from the command buffer area to execute; the more the DrawCall, the more CPU commits, just as files are read, the more times the CPU commits, resulting in a large amount of time spent by the CPU to commit, causing CPU overload. The game running process is a process of calling the GPU in real time, if the GPU is frequently interrupted in the calling process due to CPU overload and then is operated again, the performance is greatly influenced, therefore, the rendering data of the static node objects in the game scene is subjected to static batch processing, the number of Draw calls is reduced, the number of times of interruption when the GPU is called in rendering is reduced, and the running performance of the game is improved.
For example, if there are 4 objects A, B, C, D in a game scene, and if all static options are selected, the engine will determine whether these four objects share the same rendering material during static batch processing. If the same rendering material is shared, the four objects are regarded as objects which can be processed in batch, the engine synthesizes A, B, C, D the 4 mesh corresponding to the four objects into a larger mesh, and generates a drawing command Draw Call which is stored in the command buffer, and the GPU is called by the drawing command Draw Call to Draw the four objects. If static batch processing is not performed, A, B, C, D the four objects generate four drawing commands Draw calls, and when the number of static nodes in the game scene is larger, more drawing commands Draw calls are generated, which causes the GPU to be frequently interrupted during the calling process, so that static batch processing is performed on the rendering data of the static node objects in the game scene, the number of Draw calls is reduced, the number of times that the GPU is interrupted during the rendering and calling is reduced, and the running performance of the game is improved.
S104, acquiring a configuration file corresponding to the dynamic node object, wherein the configuration file comprises logic operation data associated with the dynamic node object;
and S105, operating the configuration file, and performing logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, or stopping displaying the dynamic node object.
Referring to fig. 2, a flowchart of a method for generating a configuration file according to an embodiment of the present invention is shown in fig. 2, where the method for generating a configuration file according to an embodiment of the present invention includes the following steps S21-S23:
s21, configuring a first script file for the first parent node, where the first script file includes logical operation data associated with the first dynamic node object;
s22, configuring at least one second script file for the at least one first child node, and configuring one second script file for one first child node, where the second script file includes logical operation data associated with a second dynamic node object indicated by the first child node;
s23, generating the configuration file according to the first script file and the at least one second script file.
In this embodiment, a first script file may be configured for the first parent node, where the first script file includes logical operation data associated with a first dynamic node object, at least one second script file is configured for at least one first child node, and one first child node configures one second script file, where the second script file includes logical operation data associated with a second dynamic node object indicated by the first child node. After the script file is configured for all the dynamic node objects in the game scene, the time sequence data required by each dynamic node when running in the game scene is recorded. And generating the configuration file according to the first script file and the at least one second script file, wherein the configuration file can be a JSON file, namely the logic operation data in the script file of the exported dynamic node object is the JSON file. And the static node object is static in the game scene and does not need to move, so the static node object does not bind any logic operation data and does not operate any data. Therefore, after the node objects in the game scene are divided into dynamic and static nodes, only the script file needs to be configured for the moving dynamic node objects, and the static node objects do not need to be configured with the script file, so that the memory of the terminal is optimized.
And in the game running process, after the configuration file corresponding to the dynamic node object is obtained, the JSON file is obtained, the configuration file is run, and the logic operation is carried out on the dynamic node object according to the logic operation data so as to display the dynamic node object in the game scene, or the display of the dynamic node object is stopped.
If it is determined that the dynamic node object needs to be started to be displayed at the current moment, running the configuration file, and performing logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, wherein the dynamic node object is in an undisplayed state before the current moment; or, if it is determined that the dynamic node object needs to be stopped from being displayed at the current time, running the configuration file, and performing logical operation on the dynamic node object according to the logical operation data to stop displaying the dynamic node object in the game scene, wherein the dynamic node object is in a display state before the current time.
For example, in a scrolling sky 2 mini game, when a player clicks the start of the game, a 3D scene game of the game is loaded according to rendering data of all dynamic node objects and rendering data of static node objects. And performing static batch processing on the rendering data of all static node objects and then displaying the rendering data in the game scene. And when the dynamic node object determines that the display needs to be started at a certain moment, the configuration file is operated, the logic operation data in the corresponding script file is obtained, and the logic operation data is displayed in a game scene according to the logic operation data in the corresponding script file. While static node objects have already been launched for display and do not participate in any logical operations. And after the 3D game scene is loaded, determining that a player character is started at the current moment, wherein the player character is a virtual character controlled by a user in the game scene, operating logic operation data in a script file corresponding to the player character, displaying the player character in the game scene according to the rendering data of the player character and the logic operation data in the script file, and moving under the operation of the user. When a player character moves to a certain position at a certain moment, if it is determined that the dynamic node objects around the player character need to be started and displayed at the current moment, the dynamic node objects around the player character acquire the logic operation data in the corresponding script file and perform logic operation according to the logic operation data so as to be displayed in a game scene, wherein the dynamic node objects are not displayed before the current moment. If the dynamic node object which is separated from the player character by a certain distance needs to be stopped from being displayed, the dynamic node object separated by the certain distance can acquire the logic operation data in the corresponding script file, and perform logic operation according to the logic operation data so as to stop displaying in the game scene. And before the current moment, the dynamic node objects at a certain distance are in a display state. The dynamic node object, which is separated from the player character by a certain distance and is in an un-activated display state, is activated to display according to the movement of the player character.
Optionally, after the dynamic node object that is separated from the player character by a certain distance and in the display state stops displaying in the game scene, the configuration file corresponding to the dynamic node object is deleted, so as to optimize the memory of the terminal.
In the embodiment of the present invention, a dynamic node object and a static node object in a game scene are created, rendering data corresponding to the static node object is obtained, static batch processing is performed on the rendering data to display the static node object in the game scene, a configuration file corresponding to the dynamic node object is obtained, the configuration file is run, and a logical operation is performed on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene, or the display of the dynamic node object is stopped. Because the dynamic nodes need to be closely related to game logic, after the node objects in the game scene are subjected to dynamic and static division, the dynamic node objects and the static node objects are separately processed, only attention needs to be paid to the dynamic nodes, and rendering data of the static node objects are subjected to static batch processing, so that the number of Draw calls is reduced, the number of times of interruption when a GPU is used for rendering a strip is reduced, configuration files in the dynamic node objects needing to be deleted are deleted in time, and a memory is optimized. By adopting the technical scheme of the application, different processing modes are respectively adopted for the static node object and the dynamic node object, the rendering data of the static node object is subjected to static batch processing, logical operation is not needed, only the dynamic node object is subjected to logical operation, and the running performance of the game is improved.
Referring to fig. 3, a schematic structural diagram of a processing apparatus for node objects in a game scene is provided in an embodiment of the present invention. As shown in fig. 3, the apparatus for processing a node object in a game scene according to an embodiment of the present invention may include:
s11, a creating module for creating dynamic node objects and static node objects in the game scene;
the creating module comprises a first creating unit and a second creating unit;
a first creating unit configured to create a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scene, the at least one first child node indicating at least one second dynamic node object in the game scene, one first child node indicating one second dynamic node object;
a second creating unit, configured to create a second parent node and at least one second child node associated with the second parent node, where the second parent node indicates a first static node object in the game scene, the at least one second child node indicates at least one second static node object in the game scene, and one second child node indicates one second static node object.
In the embodiment of the invention, the game scene refers to a picture for restoring available node objects such as buildings, trees, sky, roads and the like in the game according to the game design requirement. In 3D games, a game scene provides a space containing various node objects, which is determined by the width, depth and height of the desired design game scene picture. The node objects in the game scene may be characters, buildings, machines, props, mountain stones, trees, and the like included in the game scene. Such as trees, stones, characters, etc. in the game scene, the trees, stones, characters, etc. may be node objects in the game scene.
Wherein the first dynamic node object may be indicated by creating a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scenario, the at least one first child node indicating at least one second dynamic node object in the game scenario, and a first child node indicating a second dynamic node object. A second parent node is created that indicates a first static node object in the game scene and at least one second child node associated with the second parent node that indicates at least one second static node object in the game scene and one second child node that indicates one second static node object. The method comprises the steps of creating a first father node and a second father node, and creating at least one first child node and at least one second child node according to the first father node and the second father node, so that nodes in a game scene are subjected to dynamic and static division, and dynamic node objects and static node objects in the game scene are created.
Alternatively, a first parent node and a second parent node may be created by using the game development tool Unity3D, and then at least one first child node and at least one second child node are created according to a game scene picture to be created, where the first parent node indicates a first dynamic node object in the game scene, the at least one first child node indicates at least one second dynamic node object in the game scene, and the dynamic node object refers to an object moving in the game scene, such as a walking character or a sledge moving up and down, and the like. The second father node indicates a first static node object in the game scene, at least one second son node indicates at least one second static node object in the game scene, and the static node objects refer to static objects in the game scene, such as stones, trees and the like which are relatively static at two sides of a road.
S12, a first obtaining module, configured to obtain rendering data corresponding to the static node object;
the first acquisition module comprises a first acquisition unit and a second acquisition unit;
a first obtaining unit, configured to obtain first rendering data corresponding to the second parent node, where the first rendering data includes rendering data of the first static node object;
a second obtaining unit, configured to obtain at least one second rendering data corresponding to the at least one second child node, where the second rendering data includes rendering data of a second static node object indicated by the second child node.
S13, a first display module, configured to perform static batch processing on the rendering data to display the static node object in the game scene;
the first display module comprises a generating unit and a display unit;
a generating unit configured to generate target rendering data from the first rendering data and the at least one second rendering data;
and the display unit is used for calling the target rendering data through a first drawing command so as to render and display the first static node object and the at least one second static node object in the game scene.
In the embodiment of the present invention, rendering data of a static node object is obtained, where the static node object in the embodiment of the present invention includes a second parent node and at least one second child node, first rendering data corresponding to the second parent node is obtained, the first rendering data includes rendering data of the first static node object, at least one second rendering data corresponding to the at least one second child node is obtained, and the second rendering data includes rendering data of a second static node object indicated by the second child node. And generating target rendering data according to the first rendering data and the at least one second rendering data, and calling the target rendering data through a first drawing command so as to render and display the first static node object and the at least one second static node object in the game scene.
The rendering data corresponding to a large number of static node objects which do not need to change positions can be subjected to static batch processing, all static node objects which do not change positions in the Unity3D game scene are selected with static options, and the engine can judge whether the static node objects in the game scene share the same rendering material according to the rendering data of the static node objects, such as wood sharing the same rendering material. If the same rendering material is shared, static node objects that share the same rendering material are treated as objects that can be batched. During rendering, at least one mesh corresponding to at least one static node object sharing one rendering material is synthesized into a larger mesh to generate target rendering data, a first drawing command is submitted by a CPU according to the target rendering data and stored in a command buffer, and the GPU extracts the first drawing command in the command buffer to perform rendering operation. This first drawing command is referred to as a Draw Call, and in Unity, the process of preparing data and notifying the GPU each time the engine is called a Draw Call. The CPU and the GPU realize parallel work through a command buffer area, the command buffer area stores the command of the CPU, and the GPU takes out the command from the command buffer area to execute; the more the DrawCall, the more CPU commits, just as files are read, the more times the CPU commits, resulting in a large amount of time spent by the CPU to commit, causing CPU overload. The game running process is a process of calling the GPU in real time, if the GPU is frequently interrupted in the calling process due to CPU overload and then is operated again, the performance is greatly influenced, therefore, the rendering data of the static node objects in the game scene is subjected to static batch processing, the number of Draw calls is reduced, the number of times of interruption when the GPU is called in rendering is reduced, and the running performance of the game is improved.
For example, if there are 4 objects A, B, C, D in a game scene, and if all static options are selected, the engine will determine whether these four objects share the same rendering material during static batch processing. If the same rendering material is shared, the four objects are regarded as objects which can be processed in batch, the engine synthesizes A, B, C, D the 4 mesh corresponding to the four objects into a larger mesh, and generates a drawing command Draw Call which is stored in the command buffer, and the GPU is called by the drawing command Draw Call to Draw the four objects. If static batch processing is not performed, A, B, C, D the four objects generate four drawing commands Draw calls, and when the number of static nodes in the game scene is larger, more drawing commands Draw calls are generated, which causes the GPU to be frequently interrupted during the calling process, so that static batch processing is performed on the rendering data of the static node objects in the game scene, the number of Draw calls is reduced, the number of times that the GPU is interrupted during the rendering and calling is reduced, and the running performance of the game is improved.
S14, a second obtaining module, configured to obtain a configuration file corresponding to the dynamic node object, where the configuration file includes logical operation data associated with the dynamic node object;
and S15, a second display module, configured to run the configuration file, and perform a logical operation on the dynamic node object according to the logical operation data, so as to display the dynamic node object in the game scene, or stop displaying the dynamic node object.
And in the game running process, after the configuration file corresponding to the dynamic node object is obtained, the JSON file is obtained, the configuration file is run, and the logic operation is carried out on the dynamic node object according to the logic operation data so as to display the dynamic node object in the game scene, or the display of the dynamic node object is stopped.
If it is determined that the dynamic node object needs to be started to be displayed at the current moment, running the configuration file, and performing logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, wherein the dynamic node object is in an undisplayed state before the current moment; or, if it is determined that the dynamic node object needs to be stopped from being displayed at the current time, running the configuration file, and performing logical operation on the dynamic node object according to the logical operation data to stop displaying the dynamic node object in the game scene, wherein the dynamic node object is in a display state before the current time.
For example, in a scrolling sky 2 mini game, when a player clicks the start of the game, a 3D scene game of the game is loaded according to rendering data of all dynamic node objects and rendering data of static node objects. And performing static batch processing on the rendering data of all static node objects and then displaying the rendering data in the game scene. And when the dynamic node object determines that the display needs to be started at a certain moment, the configuration file is operated, the logic operation data in the corresponding script file is obtained, and the logic operation data is displayed in a game scene according to the logic operation data in the corresponding script file. While static node objects have already been launched for display and do not participate in any logical operations. And after the 3D game scene is loaded, determining that a player character is started at the current moment, wherein the player character is a virtual character controlled by a user in the game scene, operating logic operation data in a script file corresponding to the player character, displaying the player character in the game scene according to the rendering data of the player character and the logic operation data in the script file, and moving under the operation of the user. When a player character moves to a certain position at a certain moment, if it is determined that the dynamic node objects around the player character need to be started and displayed at the current moment, the dynamic node objects around the player character acquire the logic operation data in the corresponding script file and perform logic operation according to the logic operation data so as to be displayed in a game scene, wherein the dynamic node objects are not displayed before the current moment. If the dynamic node object which is separated from the player character by a certain distance needs to be stopped from being displayed, the dynamic node object separated by the certain distance can acquire the logic operation data in the corresponding script file, and perform logic operation according to the logic operation data so as to stop displaying in the game scene. And before the current moment, the dynamic node objects at a certain distance are in a display state. The dynamic node object, which is separated from the player character by a certain distance and is in an un-activated display state, is activated to display according to the movement of the player character.
Optionally, after the dynamic node object which is at a certain distance from the player character and in the display state of not being started stops displaying in the game scene, the configuration file corresponding to the dynamic node object is deleted, so as to optimize the memory of the terminal.
In the embodiment of the present invention, a dynamic node object and a static node object in a game scene are created, rendering data corresponding to the static node object is obtained, static batch processing is performed on the rendering data to display the static node object in the game scene, a configuration file corresponding to the dynamic node object is obtained, the configuration file is run, and a logical operation is performed on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene, or the display of the dynamic node object is stopped. Because the dynamic nodes need to be closely related to game logic, after the node objects in the game scene are subjected to dynamic and static division, the dynamic node objects and the static node objects are separately processed, only the dynamic nodes need to be concerned, and the rendering data of the static node objects are subjected to static batch processing, so that the number of Draw calls is reduced, and the number of times of interruption when the GPU renders the bars is reduced. By adopting the technical scheme of the application, different processing modes are respectively adopted for the static node object and the dynamic node object, the rendering data of the static node object is subjected to static batch processing, logical operation is not needed, only the dynamic node object is subjected to logical operation, and the running performance of the game is improved.
As shown in fig. 4, which is a schematic structural diagram of another processing apparatus for a node object in a game scene provided in an embodiment of the present invention, as shown in the drawing, the processing apparatus for a node object in a game scene provided in an embodiment of the present invention includes: a creating module 21, a first configuration module 22, a second configuration module 23, a generating module 24, a first obtaining module 25, a first display module 26, a second obtaining module 27, a second display module 28, and a deleting module 29; for the creation module 21, the first obtaining module 25, the first display module 26, the second obtaining module 27, and the second display module, please refer to the description of the embodiment in fig. 3, which is not repeated herein.
A first configuration module 22, configured to configure a first script file for the first parent node, where the first script file includes logical operation data associated with the first dynamic node object;
a second configuration module 23, configured to configure at least one second script file for the at least one first child node, where one second script file is configured for one first child node, and the second script file includes logical operation data associated with a second dynamic node object indicated by the first child node;
a generating module 24, configured to generate the configuration file according to the first script file and the at least one second script file;
in this embodiment, a first script file may be configured for the first parent node, where the first script file includes logical operation data associated with a first dynamic node object, at least one second script file is configured for at least one first child node, and one first child node configures one second script file, where the second script file includes logical operation data associated with a second dynamic node object indicated by the first child node. After the script file is configured for all the dynamic node objects in the game scene, the time sequence data required by each dynamic node when running in the game scene is recorded. And generating the configuration file according to the first script file and the at least one second script file, wherein the configuration file can be a JSON file, namely the logic operation data in the script file of the exported dynamic node object is the JSON file. And the static node object is static in the game scene and does not need to move, so the static node object does not bind any logic operation data and does not operate any data. Therefore, after the node objects in the game scene are divided into dynamic and static nodes, only the script file needs to be configured for the moving dynamic node objects, and the static node objects do not need to be configured with the script file, so that the memory of the terminal is optimized.
And the deleting module 29 is configured to delete the configuration file corresponding to the dynamic node object.
Optionally, after the dynamic node object that is separated from the player character by a certain distance and in the display state stops displaying in the game scene, the configuration file corresponding to the dynamic node object is deleted, so as to optimize the memory of the terminal.
In the embodiment of the present invention, a dynamic node object and a static node object in a game scene are created, rendering data corresponding to the static node object is obtained, static batch processing is performed on the rendering data to display the static node object in the game scene, a configuration file corresponding to the dynamic node object is obtained, the configuration file is run, and a logical operation is performed on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene, or the display of the dynamic node object is stopped. Because the dynamic nodes need to be closely related to game logic, after the node objects in the game scene are subjected to dynamic and static division, the dynamic node objects and the static node objects are separately processed, only attention needs to be paid to the dynamic nodes, and rendering data of the static node objects are subjected to static batch processing, so that the number of Draw calls is reduced, the number of times of interruption when a GPU is used for rendering a strip is reduced, configuration files in the dynamic node objects needing to be deleted are deleted in time, and a memory is optimized. By adopting the technical scheme of the application, different processing modes are respectively adopted for the static node object and the dynamic node object, the rendering data of the static node object is subjected to static batch processing, logical operation is not needed, only the dynamic node object is subjected to logical operation, and the running performance of the game is improved.
Referring to fig. 5, which is a schematic structural diagram of a processing apparatus for node objects in a game scene according to another embodiment of the present invention, as shown in fig. 5, the processing apparatus 1000 for node objects in a game scene may include: at least one processor 1001, such as a CPU, at least one communication interface 1003, memory 1004, at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The communication interface 1003 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1004 may be a high-speed RAM memory or a non-volatile memory (e.g., at least one disk memory). The memory 1004 may optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 5, memory 1004, which is a type of computer storage medium, may include an operating system, a network communication module, and program instructions.
In the processing apparatus 1000 of a node object in a game scene shown in fig. 5, the processor 1001 may be configured to load program instructions stored in the memory 1004 and specifically perform the following operations:
creating a dynamic node object and a static node object in a game scene;
acquiring rendering data corresponding to the static node object;
performing static batch processing on the rendering data to display the static node objects in the game scene;
acquiring a configuration file corresponding to the dynamic node object, wherein the configuration file comprises logic operation data associated with the dynamic node object;
and running the configuration file, and carrying out logic operation on the dynamic node object according to the logic operation data so as to display the dynamic node object in the game scene, or stopping displaying the dynamic node object.
In one possible implementation, the creating dynamic node objects and static node objects in the game scene includes:
creating a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scene, the at least one first child node indicating at least one second dynamic node object in the game scene, a first child node indicating a second dynamic node object;
creating a second parent node and at least one second child node associated with the second parent node, the second parent node indicating a first static node object in the game scene, the at least one second child node indicating at least one second static node object in the game scene, one second child node indicating one second static node object.
In one possible implementation, the method further includes:
configuring a first script file for the first parent node, the first script file including logical operation data associated with the first dynamic node object;
configuring at least one second script file for at least one first child node, wherein one first child node is configured with one second script file, and the second script file comprises logic operation data related to a second dynamic node object indicated by the first child node;
and generating the configuration file according to the first script file and the at least one second script file.
In an embodiment of a possible implementation, the running the configuration file and performing a logical operation on the dynamic node object according to the logical operation data to display the dynamic node object in the game scene or stop displaying the dynamic node object includes:
if the dynamic node object needs to be started to be displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, wherein the dynamic node object is in an undisplayed state before the current moment; alternatively, the first and second electrodes may be,
and if the dynamic node object needs to be stopped from being displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to stop displaying the dynamic node object in the game scene, wherein the dynamic node object is in a display state before the current moment.
In an embodiment of one possible implementation, after the performing a logical operation on the dynamic node object according to the logical operation data to stop displaying the dynamic node object in the game scene, the method further includes:
and deleting the configuration file corresponding to the dynamic node object.
In an embodiment of possible implementation, the obtaining rendering data corresponding to the static node object includes:
acquiring first rendering data corresponding to the second parent node, wherein the first rendering data comprises rendering data of the first static node object;
and acquiring at least one second rendering data corresponding to the at least one second child node, wherein the second rendering data comprises the rendering data of a second static node object indicated by the second child node.
In one possible implementation, the static batch processing the rendering data to render and display the static node object in the game scene includes:
generating target rendering data from the first rendering data and the at least one second rendering data;
invoking the target rendering data through a first drawing command to render and display the first static node object and the at least one second static node object in the game scene.
It should be noted that, for a specific implementation process, reference may be made to specific descriptions of the method embodiment shown in fig. 1, which are not described herein again.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are suitable for being loaded by a processor and executing the method steps in the embodiment shown in fig. 1, and a specific execution process may refer to a specific description of the embodiment shown in fig. 1, which is not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and includes processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.

Claims (10)

1. A method for processing node objects in a game scene is characterized by comprising the following steps:
creating a dynamic node object and a static node object in a game scene;
acquiring rendering data corresponding to the static node object;
performing static batch processing on the rendering data to display the static node objects in the game scene;
acquiring a configuration file corresponding to the dynamic node object, wherein the configuration file comprises logic operation data associated with the dynamic node object;
and running the configuration file, and carrying out logic operation on the dynamic node object according to the logic operation data so as to display the dynamic node object in the game scene, or stopping displaying the dynamic node object.
2. The method of claim 1, wherein creating dynamic node objects and static node objects in a game scene comprises:
creating a first parent node and at least one first child node associated with the first parent node, the first parent node indicating a first dynamic node object in the game scene, the at least one first child node indicating at least one second dynamic node object in the game scene, a first child node indicating a second dynamic node object;
creating a second parent node and at least one second child node associated with the second parent node, the second parent node indicating a first static node object in the game scene, the at least one second child node indicating at least one second static node object in the game scene, one second child node indicating one second static node object.
3. The method of claim 2, wherein the method further comprises:
configuring a first script file for the first parent node, the first script file including logical operation data associated with the first dynamic node object;
configuring at least one second script file for at least one first child node, wherein one first child node is configured with one second script file, and the second script file comprises logic operation data related to a second dynamic node object indicated by the first child node;
and generating the configuration file according to the first script file and the at least one second script file.
4. The method of claim 1, wherein the running the configuration file and logically operating the dynamic node object according to the logical operation data to display the dynamic node object in the game scene or to stop displaying the dynamic node object comprises:
if the dynamic node object needs to be started to be displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene, wherein the dynamic node object is in an undisplayed state before the current moment; alternatively, the first and second electrodes may be,
and if the dynamic node object needs to be stopped from being displayed at the current moment, operating the configuration file, and carrying out logical operation on the dynamic node object according to the logical operation data so as to stop displaying the dynamic node object in the game scene, wherein the dynamic node object is in a display state before the current moment.
5. The method of claim 4, wherein said logically operating said dynamic node object according to said logical operation data to stop displaying said dynamic node object in said game scene further comprises:
and deleting the configuration file corresponding to the dynamic node object.
6. The method of claim 2, wherein said obtaining rendering data corresponding to the static node object comprises:
acquiring first rendering data corresponding to the second parent node, wherein the first rendering data comprises rendering data of the first static node object;
and acquiring at least one second rendering data corresponding to the at least one second child node, wherein the second rendering data comprises the rendering data of a second static node object indicated by the second child node.
7. The method of claim 6, wherein the static batching of the rendering data to render and display the static node objects in the game scene comprises:
generating target rendering data from the first rendering data and the at least one second rendering data;
invoking the target rendering data through a first drawing command to render and display the first static node object and the at least one second static node object in the game scene.
8. An apparatus for processing node objects in a game scene, comprising:
the creating module is used for creating a dynamic node object and a static node object in a game scene;
a first obtaining module, configured to obtain rendering data corresponding to the static node object;
the first display module is used for carrying out static batch processing on the rendering data so as to display the static node objects in the game scene;
acquiring a configuration file corresponding to the dynamic node object, wherein the configuration file comprises logic operation data associated with the dynamic node object;
and the second display module is used for operating the configuration file and carrying out logical operation on the dynamic node object according to the logical operation data so as to display the dynamic node object in the game scene or stop displaying the dynamic node object.
9. A device for processing node objects in a game scene, comprising a processor, a memory and a communication interface, wherein the processor, the memory and the communication interface are connected with each other, the communication interface is used for receiving and sending data, the memory is used for storing program codes, and the processor is used for calling the program codes and executing the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executed by a processor to implement the method of any one of claims 1 to 7.
CN201911205413.2A 2019-11-29 2019-11-29 Method and device for processing node object in game scene Pending CN110990100A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911205413.2A CN110990100A (en) 2019-11-29 2019-11-29 Method and device for processing node object in game scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911205413.2A CN110990100A (en) 2019-11-29 2019-11-29 Method and device for processing node object in game scene

Publications (1)

Publication Number Publication Date
CN110990100A true CN110990100A (en) 2020-04-10

Family

ID=70088641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911205413.2A Pending CN110990100A (en) 2019-11-29 2019-11-29 Method and device for processing node object in game scene

Country Status (1)

Country Link
CN (1) CN110990100A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112057868A (en) * 2020-09-17 2020-12-11 网易(杭州)网络有限公司 Game model batch processing method and device and electronic equipment
CN112190942A (en) * 2020-10-23 2021-01-08 网易(杭州)网络有限公司 Red dot system and data processing method based on red dot system
CN113082705A (en) * 2021-05-08 2021-07-09 腾讯科技(上海)有限公司 Game scene switching method and device, computer equipment and storage medium
CN113096222A (en) * 2021-04-20 2021-07-09 竞技世界(北京)网络技术有限公司 Animation playing device, method and equipment
CN114415909A (en) * 2021-12-27 2022-04-29 宝宝巴士股份有限公司 Node interaction method and device based on cos2dx

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750450A (en) * 2012-06-21 2012-10-24 北京像素软件科技股份有限公司 Scene management method and device in network game
CN105184847A (en) * 2015-10-16 2015-12-23 上海恺英网络科技有限公司 3D game rendering engine rendering method
CN105654540A (en) * 2015-12-28 2016-06-08 Tcl集团股份有限公司 Method and apparatus for data display in 3D scene

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750450A (en) * 2012-06-21 2012-10-24 北京像素软件科技股份有限公司 Scene management method and device in network game
CN105184847A (en) * 2015-10-16 2015-12-23 上海恺英网络科技有限公司 3D game rendering engine rendering method
CN105654540A (en) * 2015-12-28 2016-06-08 Tcl集团股份有限公司 Method and apparatus for data display in 3D scene

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朔宇 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112057868A (en) * 2020-09-17 2020-12-11 网易(杭州)网络有限公司 Game model batch processing method and device and electronic equipment
CN112190942A (en) * 2020-10-23 2021-01-08 网易(杭州)网络有限公司 Red dot system and data processing method based on red dot system
CN113096222A (en) * 2021-04-20 2021-07-09 竞技世界(北京)网络技术有限公司 Animation playing device, method and equipment
CN113096222B (en) * 2021-04-20 2024-04-05 竞技世界(北京)网络技术有限公司 Animation playing device, method and equipment
CN113082705A (en) * 2021-05-08 2021-07-09 腾讯科技(上海)有限公司 Game scene switching method and device, computer equipment and storage medium
CN113082705B (en) * 2021-05-08 2023-09-15 腾讯科技(上海)有限公司 Game scene switching method, game scene switching device, computer equipment and storage medium
CN114415909A (en) * 2021-12-27 2022-04-29 宝宝巴士股份有限公司 Node interaction method and device based on cos2dx
CN114415909B (en) * 2021-12-27 2023-12-26 宝宝巴士股份有限公司 Node interaction method and device based on cocos2dx

Similar Documents

Publication Publication Date Title
CN110990100A (en) Method and device for processing node object in game scene
CN105468353B (en) Method and device for realizing interface animation, mobile terminal and computer terminal
CN106658139B (en) Focus control method and device
CN107219969B (en) 3D display method and apparatus
US20230410433A1 (en) Navigation mesh update
CN112307403A (en) Page rendering method, device, storage medium and terminal
CN110930484B (en) Animation configuration method and device, storage medium and electronic device
JP5411385B1 (en) Server and method for providing game
CN112190943A (en) Game display method and device, processor and electronic equipment
CN111210486B (en) Method and device for realizing streamer effect
CN111617473A (en) Display method and device of virtual attack prop, storage medium and electronic equipment
CN117078848A (en) Model rendering method and device, electronic equipment and storage medium
JP7039294B2 (en) Programs, image processing methods, and image processing equipment
CN115671735A (en) Object selection method and device in game and electronic equipment
CN111773679B (en) Method and device for processing icons in game
CN114712853A (en) Game map loading and displaying method, device, equipment and storage medium
KR101904530B1 (en) Method for providing and displaying a game map
US20200250790A1 (en) Graphics processing method and related apparatus, and device
CN114429513A (en) Method and device for determining visible element, storage medium and electronic equipment
CN110709891A (en) Virtual reality scene model establishing method and device, electronic equipment and storage medium
CN114669052A (en) Game control method, device, equipment and storage medium
CN111243069B (en) Scene switching method and system of Unity3D engine
CN113244625A (en) Game terrain data editing method and device, storage medium and electronic device
CN112807695A (en) Game scene generation method and device, readable storage medium and electronic equipment
CN112346613A (en) Icon display effect control method, terminal and computer-readable storage medium

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